Skip to content

pcre2: Backport a fix causing duplicate symbol definitions#108685

Closed
simpkins wants to merge 1 commit intogodotengine:masterfrom
simpkins:pcre_bug
Closed

pcre2: Backport a fix causing duplicate symbol definitions#108685
simpkins wants to merge 1 commit intogodotengine:masterfrom
simpkins:pcre_bug

Conversation

@simpkins
Copy link
Contributor

modules/regex/SCsub compiles the pcre2 sources twice: once for 16-bit and once for 32-bit code unit width. Most of the pcre2 code uses a PCRE2_SUFFIX() macro to append the code unit width suffix to the function name to avoid conflicting function names when compiling this way. However, this was missed for the internal chd_smul function, resulting in both the 16-bit and 32-bit versions defining a function with the same name. The duplicate symbol definition was only triggering a warning at link time and was not causing the build to fail, but this means that either the 16-bit or 32-bit code will end up calling a function that operates on the incorrect data type.

This backports the fix already applied upstream. (Buried in one line of PCRE2Project/pcre2@9a868b060) pcre2 does not yet have any new releases that include this fix.

modules/regex/SCsub compiles the pcre2 sources twice: once for 16-bit
and once for 32-bit code unit width.  Most of the pcre2 code uses a
`PCRE2_SUFFIX()` macro to append the code unit width suffix to the
function name to avoid conflicting function names when compiling this
way.  However, this was missed for the internal `chd_smul` function,
resulting in both the 16-bit and 32-bit versions defining a function
with the same name. The duplicate symbol definition was only triggering
a warning at link time and was not causing the build to fail, but this
means that either the 16-bit or 32-bit code will end up calling a
function that operates on the incorrect data type.

This backports the fix already applied upstream.  (Buried in one line of
PCRE2Project/pcre2@9a868b060)
pcre2 does not yet have any new releases that include this fix.
@simpkins simpkins requested a review from a team as a code owner July 16, 2025 21:33
@Calinou Calinou added bug topic:thirdparty cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels Jul 17, 2025
@Calinou Calinou added this to the 4.5 milestone Jul 17, 2025
@Repiteo Repiteo added the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Sep 18, 2025
@Repiteo Repiteo modified the milestones: 4.5, 4.x Sep 18, 2025
@akien-mga akien-mga changed the title pcre2: backport a fix causing duplicate symbol definitions pcre2: Backport a fix causing duplicate symbol definitions Jan 8, 2026
@akien-mga
Copy link
Member

Apologies for missing this PR until now.

This was superseded in master by #113967 which upgraded to 10.47.

The change is still relevant for 4.5 and 4.4, and I noticed that pcre2 10.46 was a security update, so I made #114766 to update the stable branches to 10.46 and include this fix at the same time.

Thanks for the contribution!

@akien-mga akien-mga closed this Jan 8, 2026
@akien-mga akien-mga removed cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release labels Jan 8, 2026
@akien-mga akien-mga removed this from the 4.x milestone Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants