Skip to content

Commit 8af1b25

Browse files
committed
ICU-20824 Fix - avoid potential out-of-bounds array access (undefined behaviour)
This is a backport of a fix from mapnik clone of this class: mapnik/mapnik#4096 Also suggested to icu as: https://unicode-org.atlassian.net/browse/ICU-20824 We encountered it in mapnik and fixed it in our own mapnik 3.0 fork. I think it worth backporting the fix to here as well.
1 parent 48597a4 commit 8af1b25

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

icu4c/source/extra/scrptrun/scrptrun.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ UBool ScriptRun::next()
155155
if ((pairIndex & 1) == 0) {
156156
parenStack[++parenSP].pairIndex = pairIndex;
157157
parenStack[parenSP].scriptCode = scriptCode;
158+
startSP = parenSP;
158159
} else if (parenSP >= 0) {
159160
int32_t pi = pairIndex & ~1;
160161

icu4c/source/extra/scrptrun/srtest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <stdio.h>
1717

1818
char16_t testChars[] = {
19+
'(', ')', '(', ')', '(', ')', 'x', '(', ')',
1920
0x0020, 0x0946, 0x0939, 0x093F, 0x0928, 0x094D, 0x0926, 0x0940, 0x0020,
2021
0x0627, 0x0644, 0x0639, 0x0631, 0x0628, 0x064A, 0x0629, 0x0020,
2122
0x0420, 0x0443, 0x0441, 0x0441, 0x043A, 0x0438, 0x0439, 0x0020,

0 commit comments

Comments
 (0)