History log of /netbsd-src/bin/expr/expr.y (Results 1 – 25 of 45)
Revision Date Author Comments
# 784b5b67 11-Jun-2020 kamil <kamil@NetBSD.org>

Fix typo


# 2597218c 27-Jun-2018 kamil <kamil@NetBSD.org>

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


# 2b5da4d0 27-Jun-2018 kamil <kamil@NetBSD.org>

Improve the * operator handling in expr(1)

Fixes overflow detection in expressions INT * -UINT.

Detected with libFuzzer & UBSan.


# 3ae7054d 14-Jun-2018 christos <christos@NetBSD.org>

remove notreached


# 721572cd 14-Jun-2018 christos <christos@NetBSD.org>

return to caller instead of exit(2)


# 2537a420 13-Jun-2018 kamil <kamil@NetBSD.org>

Detect properly overflow in expr(1) for 0 + INT


# 7806b479 12-Jun-2018 kamil <kamil@NetBSD.org>

Rework perform_arith_op() in expr(1) to omit Undefined Behavior

The current implementation of operations - + * / % could cause Undefined
Behavior and in narrow cases (INT64_MIN / -1 and INT64_MIN %

Rework perform_arith_op() in expr(1) to omit Undefined Behavior

The current implementation of operations - + * / % could cause Undefined
Behavior and in narrow cases (INT64_MIN / -1 and INT64_MIN % -1) SIGFPE
and crash duping core.

Detected with MKSANITIZER enabled for the Undefined Behavior variation:
# eval expr '4611686018427387904 + 4611686018427387904'
/public/src.git/bin/expr/expr.y:315:12: runtime error: signed integer overflow: 4611686018427387904 + 4611686018427387904 cannot be represented in type 'long'

All bin/t_expr ATF tests pass now in a sanitized userland.

Sponsored by <The NetBSD Foundation>

show more ...


# 51fe790c 05-Sep-2016 sevan <sevan@NetBSD.org>

Drop main() prototype.


# 66dd2755 15-Mar-2012 joerg <joerg@NetBSD.org>

Add __printflike attribution to use vprintf and friends with an argument
as format string.


# 370cd318 25-Aug-2011 joerg <joerg@NetBSD.org>

Mark yyerror as dead.


# 57921160 20-Jan-2009 joerg <joerg@NetBSD.org>

Revert for now, pending discussion of how expr should behave in the case
of pre-POSIX expressions.


# 14d25567 20-Jan-2009 joerg <joerg@NetBSD.org>

SUS says that expr must support "--" to prevent interpretation of
negative numbers as options.


# 8eba9df2 30-Apr-2008 martin <martin@NetBSD.org>

Normalize TNF license, move to 2 clause.


# 2174dda2 17-Mar-2006 rumble <rumble@NetBSD.org>

Handle asprintf failing to allocate.


# 5760da63 01-Jun-2005 lukem <lukem@NetBSD.org>

appease gcc -Wuninitialized


# c92704dc 20-Apr-2004 jdolecek <jdolecek@NetBSD.org>

add support for 'length' keyword, for compatibility with GNU expr


# 217903ee 20-Mar-2004 jdolecek <jdolecek@NetBSD.org>

explicitly use REG_BASIC when calling regcomp(3), instead of 0


# a15c6f03 14-Feb-2003 grant <grant@NetBSD.org>

'NetBSD.org'


# 7a64806d 16-Sep-2001 wiz <wiz@NetBSD.org>

Use {g,s}etprogname, and some other KNF stuff. Patch by Petri Koistinen.


# 64e6a11a 06-May-2001 jmc <jmc@NetBSD.org>

Various cleanups/fixes.
Change the add/subtract overflow checks to use an unsigned to do the op
and then cast back into the signed var to check the signs.

Make multiply shortcut on either right or l

Various cleanups/fixes.
Change the add/subtract overflow checks to use an unsigned to do the op
and then cast back into the signed var to check the signs.

Make multiply shortcut on either right or left being 0.
Make multiply's overflow test not fail on simple cases like 1 * -1
Make the multiple overflow test pass all the regress tests.

show more ...


# a7755cce 05-May-2001 jmc <jmc@NetBSD.org>

Various changes to fix bugs in PR bin/12838.

Make sure all precendence is spelled out correctly (comparison does not
have the same level as the arithmetic operators..)
Break the arithemtic operators

Various changes to fix bugs in PR bin/12838.

Make sure all precendence is spelled out correctly (comparison does not
have the same level as the arithmetic operators..)
Break the arithemtic operators into 2 classes (+- are lower than */%)
Restructure the arithmetic code into a function either class above can call.
Finally, add a whole suite of regression tests (checked in separately) which
the previous code failed on 3 of them.

show more ...


# 6f6fe2f3 25-Apr-2001 simonb <simonb@NetBSD.org>

Spell occurred correctly.


# a66a2e0a 04-Feb-2001 christos <christos@NetBSD.org>

remove redundant declaration of yyparse


# 5888f4d2 30-Oct-2000 jdolecek <jdolecek@NetBSD.org>

add a hack to properly handle '--' as first argument -
it's ignored if it would cause syntax error, otherwise treated as common
string; this is so that both 'expr -- : .' and 'expr -- foo : .' works

add a hack to properly handle '--' as first argument -
it's ignored if it would cause syntax error, otherwise treated as common
string; this is so that both 'expr -- : .' and 'expr -- foo : .' works
This addresses standards/11230 by Ben Harris.

while here, make all global variables but main() static, use const more

show more ...


# 401ea1af 29-Oct-2000 thorpej <thorpej@NetBSD.org>

The "&" operator has a higer precedence than "|".


12