Fix various overflows and UB in src/
Checklist
-
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
src
Description of change
Fix various overflows and UB in src/
R= @bnoordhuis and/or @nodejs/collaborators
NOTE: This doesn't fix:
../src/string_search.h:231:68: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
SUMMARY: AddressSanitizer: undefined-behavior ../src/string_search.h:231:68 in
../src/string_search.h:186:34: runtime error: index 18446744073709451866 out of bounds for type 'int [251]'
SUMMARY: AddressSanitizer: undefined-behavior ../src/string_search.h:186:34 in
../src/string_search.h:194:25: runtime error: index 18446744073709451866 out of bounds for type 'int [251]'
SUMMARY: AddressSanitizer: undefined-behavior ../src/string_search.h:194:25 in
I'm open to suggestions how it could be approached, though.