Skip to content

security: Update PCRE 8.31 → 8.45 (CVE-2015-2325, CVE-2017-7186 + ~20 other CVEs) - #24

Merged
ap0ught merged 1 commit into
masterfrom
security/pcre-845
Sep 9, 2026
Merged

security: Update PCRE 8.31 → 8.45 (CVE-2015-2325, CVE-2017-7186 + ~20 other CVEs)#24
ap0ught merged 1 commit into
masterfrom
security/pcre-845

Conversation

@ap0ught

@ap0ught ap0ught commented Sep 9, 2026

Copy link
Copy Markdown
Member

Closes #14

Summary

Drop-in replacement of vendored PCRE from 8.31 to 8.45, fixing ~20 CVEs in the 8.x branch:

CVE Severity Affected in PCRE
CVE-2015-2325 Heap buffer overflow 8.31–8.37
CVE-2017-7186 Stack exhaustion 8.31–8.40
CVE-2017-7244 Heap buffer overflow 8.31–8.40
+ 17 others Various 8.31–8.41

All fixed as of PCRE 8.45 (2021-06-15).

What changed

  • spa2/src/main/cpp/pcre-mini/: all 8-bit source files swapped to pristine PCRE 8.45
  • spa2/src/main/cpp/pcre-mini/config.h: hand-authored for Android/bionic, matching our existing interpreter-only build (SUPPORT_PCRE8 + SUPPORT_UTF + SUPPORT_UCP, SUPPORT_JIT undefined)
  • PARENS_NEST_LIMIT 250 added (new in PCRE 8.41 — the CVE-2017-7186 fix)
  • RegExpNativeTest.java: fixed an unterminated try block (pre-existing bug on master blocking on-device tests)

Validation

  • assembleDebug: builds clean on all 4 ABIs (arm64-v8a, armeabi-v7a, x86, x86_64)
  • testDebugUnitTest (Tier 1+2): all 231 tests pass
  • connectedDebugAndroidTest (Tier 3) on Pixel 9 Pro XL (Android 15): all 5 on-device tests pass, including RegExpNativeTest which validates the native regex engine against real dictionary data

Scope

Interpreter-only — no behavior change. JIT remains disabled. The sljit/ tree is compiled but inert (no SUPPORT_JIT).

… other 8.x CVEs)

Drop-in swap of vendored PCRE in spa2/src/main/cpp/pcre-mini.
JIT is disabled (SUPPORT_JIT undef) — same interpreter-only config as before.

Also:
- Add PARENS_NEST_LIMIT to config.h (new in 8.41, needed for CVE-2017-7186)
- Fix unterminated try-block in RegExpNativeTest.switchDictionaryReplacesResults
- Add sifry-wt/ to .gitignore

Validated: assembleDebug (all 4 ABIs), testDebugUnitTest (all pass),
connectedDebugAndroidTest on Pixel 9 Pro XL (all 5 on-device tests pass).
Copilot AI lite review requested due to automatic review settings September 9, 2026 19:41
@ap0ught
ap0ught merged commit f69b7d5 into master Sep 9, 2026
3 checks passed
@ap0ught
ap0ught deleted the security/pcre-845 branch September 9, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The PR introduces at least one build/maintenance hazard in vendored native code (notably around sljit optional allocator inclusion) and a macro-define robustness issue that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the app’s vendored native PCRE (pcre-mini) from 8.31 to 8.45 to remediate multiple CVEs in the PCRE 8.x line, while keeping the build interpreter-only (no JIT behavior changes intended) and fixing an Android instrumentation test cleanup bug.

Changes:

  • Replace vendored PCRE1 sources with PCRE 8.45 and update headers/config to match the project’s Android/bionic build.
  • Update bundled sljit sources (still compiled, but intended to be inert with SUPPORT_JIT disabled).
  • Fix RegExpNativeTest resource cleanup by ensuring free() runs in a finally block.
File summaries
File Description
spa2/src/main/cpp/pcre-mini/ucp.h Updates Unicode property enums (incl. grapheme break props) to match newer Unicode data used by PCRE 8.45.
spa2/src/main/cpp/pcre-mini/sljit/sljitUtils.c Brings sljit utility/stack allocator code in line with newer sljit APIs and portability macros.
spa2/src/main/cpp/pcre-mini/sljit/sljitProtExecAllocator.c Removes the protected executable allocator implementation from the vendored sljit tree.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativeX86_64.c Updates x86_64 backend for new call/arg handling and instruction emission details.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativeX86_32.c Updates x86_32 backend for new call/arg handling and stack-probing behavior.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativeTILEGX_64.c Removes/adjusts unreachable or deprecated paths in TILEGX backend.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativeSPARC_32.c Adjusts SPARC backend flag-setting behavior and adds argument-move helpers.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativePPC_64.c Updates PPC64 backend instruction forms and flag semantics.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativePPC_32.c Updates PPC32 backend instruction forms and flag semantics.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativeMIPS_64.c Updates MIPS64 backend overflow/mul handling and adds call argument setup.
spa2/src/main/cpp/pcre-mini/sljit/sljitNativeMIPS_32.c Updates MIPS32 backend overflow/mul handling and adds call argument setup.
spa2/src/main/cpp/pcre-mini/sljit/sljitExecAllocator.c Updates executable allocator behavior (incl. MAP_JIT handling on Apple).
spa2/src/main/cpp/pcre-mini/sljit/sljitConfigInternal.h Updates internal sljit configuration/macros (incl. SLJIT_FUNC and cache flush).
spa2/src/main/cpp/pcre-mini/sljit/sljitConfig.h Updates sljit public config comments/behavior around calling convention attributes.
spa2/src/main/cpp/pcre-mini/README Updates PCRE README to PCRE 8.45 era (PCRE1 EOL, updated links/docs notes).
spa2/src/main/cpp/pcre-mini/pcre.h Updates public PCRE header for 8.45 (new options/info/config constants, 32-bit API symbols, etc.).
spa2/src/main/cpp/pcre-mini/pcre_xclass.c Updates extended class matching logic/types for 8.45 behavior and Unicode property handling.
spa2/src/main/cpp/pcre-mini/pcre_version.c Updates version API compilation branches for 8/16/32-bit builds.
spa2/src/main/cpp/pcre-mini/pcre_valid_utf8.c Updates UTF-8 validation (types, comments, unused handling) consistent with 8.45.
spa2/src/main/cpp/pcre-mini/pcre_string_utils.c Adds internal string utility helpers (notably for non-8-bit builds in upstream).
spa2/src/main/cpp/pcre-mini/pcre_refcount.c Updates refcount API compilation branches for 8/16/32-bit builds.
spa2/src/main/cpp/pcre-mini/pcre_ord2utf8.c Updates ord→UTF-8 conversion; adds an explicit COMPILE_PCRE8 define before including internals.
spa2/src/main/cpp/pcre-mini/pcre_newline.c Updates newline recognition to use named constants and expanded platform handling.
spa2/src/main/cpp/pcre-mini/pcre_maketables.c Updates locale/table generation behavior and comments (Perl VT handling change).
spa2/src/main/cpp/pcre-mini/pcre_globals.c Adds exported stack guard function pointers to globals.
spa2/src/main/cpp/pcre-mini/pcre_get.c Updates substring/named-substring helpers (incl. stringcount bounds checks and 32-bit variants).
spa2/src/main/cpp/pcre-mini/pcre_fullinfo.c Adds new fullinfo query codes (first/required char, limits, match-empty) and adjusts types.
spa2/src/main/cpp/pcre-mini/pcre_config.c Adds UTF-32 config handling and exposes parens-limit via PCRE_CONFIG_PARENS_LIMIT.
spa2/src/main/cpp/pcre-mini/pcre_chartables.c Updates default character tables (notably whitespace class bits).
spa2/src/main/cpp/pcre-mini/pcre_byte_order.c Adds byte-order swapping support for reloaded patterns (and 16/32-bit tables handling).
spa2/src/main/cpp/pcre-mini/LICENCE Updates license metadata text and attribution details for later PCRE releases.
spa2/src/main/cpp/pcre-mini/config.h Replaces configure-generated config with an Android/bionic hand-authored config, incl. PARENS_NEST_LIMIT.
spa2/src/main/cpp/pcre-mini/AUTHORS Updates authorship metadata consistent with PCRE 8.45 distribution.
spa2/src/androidTest/java/cz/absolutno/sifry/regexp/RegExpNativeTest.java Ensures native resources are freed via finally in the dictionary-switching test.
.gitignore Ignores the sifry-wt/ directory.
Review details
  • Files reviewed: 39/51 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 202 to 206
# define IS_CALL 0x010
# define IS_BIT26_COND 0x020
# define IS_BIT16_COND 0x040
# define IS_BIT23_COND 0x080

Comment on lines +48 to 49
#define COMPILE_PCRE8

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.

Security: remediate bundled PCRE 8.31 CVEs (deferred)

3 participants