-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters