mirror of
https://github.com/Interlisp/maiko.git
synced 2026-05-04 07:19:21 +00:00
integer multiply overflow wasn't catching all cases (#100)
This commit is contained in:
@@ -61,7 +61,7 @@ dummy:
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
result = arg1 * arg2;
|
result = arg1 * arg2;
|
||||||
if ((arg2 != 0) && ((result / arg2) != arg1)) goto doufn2;
|
if ((arg2 != 0) && (((result % arg2) != 0) || ((result / arg2) != arg1))) goto doufn2;
|
||||||
N_ARITH_SWITCH(result);
|
N_ARITH_SWITCH(result);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -91,7 +91,7 @@ dummy:
|
|||||||
|
|
||||||
/* UB: signed integer overflow: 1073741824 * 32768 cannot be represented in type 'int' */
|
/* UB: signed integer overflow: 1073741824 * 32768 cannot be represented in type 'int' */
|
||||||
result = arg1 * arg2;
|
result = arg1 * arg2;
|
||||||
if ((arg2 != 0) && ((result / arg2) != arg1)) { goto doufn; }
|
if ((arg2 != 0) && (((result % arg2) != 0) || ((result / arg2) != arg1))) { goto doufn; }
|
||||||
N_ARITH_SWITCH(result);
|
N_ARITH_SWITCH(result);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user