Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/expr Detect properly overflow in expr(1) for 0 + INT
details: https://anonhg.NetBSD.org/src/rev/dc547b85e119
branches: trunk
changeset: 319838:dc547b85e119
user: kamil <kamil%NetBSD.org@localhost>
date: Wed Jun 13 17:35:15 2018 +0000
description:
Detect properly overflow in expr(1) for 0 + INT
diffstat:
bin/expr/expr.y | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (29 lines):
diff -r 032e7a1ce265 -r dc547b85e119 bin/expr/expr.y
--- a/bin/expr/expr.y Wed Jun 13 17:32:29 2018 +0000
+++ b/bin/expr/expr.y Wed Jun 13 17:35:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: expr.y,v 1.40 2018/06/12 18:12:18 kamil Exp $ */
+/* $NetBSD: expr.y,v 1.41 2018/06/13 17:35:15 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.40 2018/06/12 18:12:18 kamil Exp $");
+__RCSID("$NetBSD: expr.y,v 1.41 2018/06/13 17:35:15 kamil Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -309,8 +309,8 @@
/*
* Check for over-& underflow.
*/
- if ((l > 0 && r <= INT64_MAX - l) ||
- (l < 0 && r >= INT64_MIN - l)) {
+ if ((l >= 0 && r <= INT64_MAX - l) ||
+ (l <= 0 && r >= INT64_MIN - l)) {
res = l + r;
} else {
yyerror("integer overflow or underflow occurred for "
Home |
Main Index |
Thread Index |
Old Index