You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
avoid LIMIT_HEAP integer multiplication wrap around
If a LIMIT_HEAP value once converted to bytes is larger than UINT_MAX
would result in a bogus valueg that could trigger a matching failure
as shown by the following:
PCRE2 version 10.42 2022-12-11
re> /(*LIMIT_HEAP=4194304)a/
data> a
Failed: error -63: heap limit exceeded
Remove the multiplication and instead keep track of the maximum heap
allowed in KB as was done originally.
Aditionally, add a check to avoid overflowing a PCRE2_SIZE while
doubling the heap used and that could result in a crash (only on
systems with a 32-bit PCRE2_SIZE and using non standard settings).
Unlike the original, this code avoids rounding the heapframes_size
to the frame_size at the allocation time, which simplifies the logic
and wasn't really needed.
Fixes: d90fb23 (Refactor match_data() to always use the heap instead
of having an initial frames vector on the stack..., 2022-07-27)
Closes: #183
0 commit comments