Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/expr Add a missing check to handle correctly 0 * 0 in ex...



details:   https://anonhg.NetBSD.org/src/rev/f3ce49af868f
branches:  trunk
changeset: 323731:f3ce49af868f
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Jun 27 17:23:36 2018 +0000

description:
Add a missing check to handle correctly 0 * 0 in expr(1)

diffstat:

 bin/expr/expr.y |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 9ac604322005 -r f3ce49af868f bin/expr/expr.y
--- a/bin/expr/expr.y   Wed Jun 27 17:14:47 2018 +0000
+++ b/bin/expr/expr.y   Wed Jun 27 17:23:36 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expr.y,v 1.44 2018/06/27 17:12:49 kamil Exp $ */
+/* $NetBSD: expr.y,v 1.45 2018/06/27 17:23:36 kamil Exp $ */
 
 /*_
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 %{
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: expr.y,v 1.44 2018/06/27 17:12:49 kamil Exp $");
+__RCSID("$NetBSD: expr.y,v 1.45 2018/06/27 17:23:36 kamil Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -371,7 +371,7 @@
 
                if ((l < 0 && r < 0) ||
                    (r > 0 && l > INT64_MAX / r) ||
-                   (r <= 0 && r < INT64_MIN / l)) {
+                   (r <= 0 && l != 0 && r < INT64_MIN / l)) {
                        yyerror("integer overflow or underflow occurred for "
                            "operation '%s %s %s'", left, op, right);
                        /* NOTREACHED */



Home | Main Index | Thread Index | Old Index