Fix "-(int64_t)0x8000000000000000" undef behavior

Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37191
This commit is contained in:
Nigel Tao committed 2021-08-15 12:39:01 +10:00
1 parent 8a4f61501b
commit a83b5cabaf
3 files changed
+28 -17

No files matched your search

+11 -6
View File
@@ -14273,13 +14273,18 @@ wuffs_base__parse_number_i64(wuffs_base__slice_u8 s, uint32_t options) {
ret.value = 0;
return ret;
} else if (negative) {
if (r.value > 0x8000000000000000) {
goto fail_out_of_bounds;
if (r.value < 0x8000000000000000) {
wuffs_base__result_i64 ret;
ret.status.repr = NULL;
ret.value = -(int64_t)(r.value);
return ret;
} else if (r.value == 0x8000000000000000) {
wuffs_base__result_i64 ret;
ret.status.repr = NULL;
ret.value = -0x8000000000000000;
return ret;
}
wuffs_base__result_i64 ret;
ret.status.repr = NULL;
ret.value = -(int64_t)(r.value);
return ret;
goto fail_out_of_bounds;
} else if (r.value > 0x7FFFFFFFFFFFFFFF) {
goto fail_out_of_bounds;
} else {