security: Update PCRE 8.31 → 8.45 (CVE-2015-2325, CVE-2017-7186 + ~20 other CVEs) - #24
Merged
Conversation
… 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).
4 tasks
There was a problem hiding this comment.
🟡 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_JITdisabled). - Fix
RegExpNativeTestresource cleanup by ensuringfree()runs in afinallyblock.
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 | ||
|
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14
Summary
Drop-in replacement of vendored PCRE from 8.31 to 8.45, fixing ~20 CVEs in the 8.x branch:
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.45spa2/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_JITundefined)PARENS_NEST_LIMIT 250added (new in PCRE 8.41 — the CVE-2017-7186 fix)RegExpNativeTest.java: fixed an unterminatedtryblock (pre-existing bug on master blocking on-device tests)Validation
RegExpNativeTestwhich validates the native regex engine against real dictionary dataScope
Interpreter-only — no behavior change. JIT remains disabled. The
sljit/tree is compiled but inert (noSUPPORT_JIT).