Skip to content

Conversation

carenas
Copy link
Contributor

@carenas carenas commented Oct 22, 2023

Not a regression, as it seems to be included with the 10.40 release.

Resolves the following error when building with UBSAN in a recent compiler:

Test 17: JIT-specific features when JIT is available
src/pcre2_jit_match.c:124:25: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/pcre2_jit_match.c:124:25 in 
src/pcre2_jit_match.c:126:25: runtime error: applying zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/pcre2_jit_match.c:126:25 in 

Since 4ef0c51 (Interpret NULL pointer, zero length as an empty
string for subjects and replacements., 2021-11-30), a NULL pointer
with zero length has been internally replaced with an empty string
in all matching functions, but the test for jit was incorrectly
using the fastpath which intentionally skips all validation and
results in NULL pointer arithmetic operations.

Change the test to use the validating jit path instead.
Copy link
Collaborator

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zherczeg zherczeg merged commit d11400f into PCRE2Project:master Oct 22, 2023
@carenas carenas deleted the ubsan branch October 22, 2023 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants