PCRE2Project / pcre2

PCRE2 development is now based here.
Other
919 stars 191 forks source link

pcre2test: memory reports only compiled memory usage for code/data #418

Closed carenas closed 5 months ago

carenas commented 5 months ago

Since 05aafb2 (Implement pcre2_set_max_pattern_compiled_length() and set this limit in the fuzzer, 2024-04-24), the memory modifier has reported the full size of the allocated "code" returned by pcre2_compile.

Problem is that the size of the structure used to hold that in memory also depends on the platform ABI and even alignment by the compiler, and has been therefore fragile to compare.

Revert to reporting only the additional memory that pcre2_compile() will use for the compiled pattern (including any data tables) and make sure that the limit provided with pcre2_set_max_pattern_compiled_length() also avoid the internal struct overhead.

Fixes: #415

PhilipHazel commented 5 months ago

Thanks, Carlo, for sorting this out. I clearly didn't think things through enough when I added that new limit.