]> granicus.if.org Git - icu/commit
ICU-21492 Fix regex compile assertion failure.
authorAndy Heninger <andy.heninger@gmail.com>
Sat, 13 Feb 2021 21:28:10 +0000 (13:28 -0800)
committerFrank Yung-Fong Tang <ftang@google.com>
Thu, 18 Feb 2021 02:49:55 +0000 (18:49 -0800)
commitf062244cdbbab374c8559fbdb6fa1ff153732e0c
treeb4145973f8d8a4d897d6b06151f6710fd325af2f
parent352b4811465741f9094861301fd6933e3b9aed9b
ICU-21492 Fix regex compile assertion failure.

A regex pattern containing nested look-behind blocks could trigger an assertion
failure during pattern compilation. The problem was caused by an off-by-one
error in the code that computes an upper bound on the match length, needed
because look-behind expressions are constrained to not have unbounded match
length.

Nested look-behind blocks come into play because, when computing the maximum
match length of an outer block, any inner look-behind blocks are skipped over -
they do not directly contribute to the length matched by the outer block. The
problem was in the code that skips over these nested look-behind blocks.
icu4c/source/i18n/regexcmp.cpp
icu4c/source/test/testdata/regextst.txt