forked from PCRE2Project/pcre2
-
Notifications
You must be signed in to change notification settings - Fork 0
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 truncation because of multiplication integer overflow
If a LIMIT_HEAP value once converted to bytes is larger than UINT_MAX would result in a bogus setting 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 (mostly on systems with a 32-bit PCRE2_SIZE with non standard settings). Fixes: d90fb23 (Refactor match_data() to always use the heap instead of having an initial frames vector on the stack..., 2022-07-27) Closes: PCRE2Project#183
- Loading branch information
Showing
2 changed files
with
27 additions
and
11 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