commit 3471b9ef4286f725937ca14fb373a21166edc3df Author: Ivan Sorokin Date: Tue Dec 29 02:25:39 2015 +0300 fix signed integer overflow on 189.eval diff --git a/src/builtin.c b/src/builtin.c index b3700c3..01bc826 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -1152,7 +1152,7 @@ m4_incr (struct obstack *obs, int argc, token_data **argv) if (!numeric_arg (argv[0], ARG (1), &value)) return; - shipout_int (obs, value + 1); + shipout_int (obs, (uint32_t)value + 1); } static void diff --git a/src/eval.c b/src/eval.c index 8b4b05a..b04d6d9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -177,7 +177,7 @@ eval_lex (int32_t *val) else if (digit >= base) break; else - *val = *val * base + digit; + *val = (uint32_t)*val * (uint32_t)base + (uint32_t)digit; } return NUMBER; }