Module Name: src
Committed By: kamil
Date: Wed Jun 27 17:23:36 UTC 2018
Modified Files:
src/bin/expr: expr.y
Log Message:
Add a missing check to handle correctly 0 * 0 in expr(1)
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/bin/expr/expr.y
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/expr/expr.y
diff -u src/bin/expr/expr.y:1.44 src/bin/expr/expr.y:1.45
--- src/bin/expr/expr.y:1.44 Wed Jun 27 17:12:49 2018
+++ src/bin/expr/expr.y Wed Jun 27 17:23:36 2018
@@ -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 @@ perform_arith_op(const char *left, const
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 */