scuffed-code/icu4c/source/tools/escapesrc
Tobias Stoeckmann 7369eff4ed ICU-20362 segfault/leftover files with long lines
If a file with an input line larger than INT32_MAX (i.e. 2 GB) contains
an UTF8 character after that limit, escapesrc crashes on 64 bit systems
or does not remove incomplete files on 32 bit systems.

The issue is that an unchecked cast from size_t to int32_t can turn
negative, which results in negative offsets during array access.

This will eventually lead to an out of boundary read, which most likely
crashes the tool.

This patch sets a fixed limit on 1 GB to make sure that no side effects
occur if the line is exactly INT32_MAX or a few bytes less. It should
still be way more than anyone would really need.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-02-13 10:23:19 -08:00
..
cptbl.h ICU-12766 support escaping on ebcdic (z) 2017-03-16 21:49:19 +00:00
escapesrc.cpp ICU-20362 segfault/leftover files with long lines 2019-02-13 10:23:19 -08:00
expect-simple.cpp ICU-12766 fix to escaper for z/OS - all compiles now! 2017-03-25 05:16:48 +00:00
Makefile.in ICU-12766 support escaping on ebcdic (z) 2017-03-16 21:49:19 +00:00
tblgen.cpp ICU-12766 support escaping on ebcdic (z) 2017-03-16 21:49:19 +00:00
test-nochange.cpp ICU-12766 cleanup and add test case for escaper 2017-03-15 02:16:35 +00:00
test-simple.cpp ICU-12766 fix to escaper for z/OS - all compiles now! 2017-03-25 05:16:48 +00:00