You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pcre2-test heap-8 red on linux-x86_64: find_limits frees the match data's heap frames, which C pcre2 keeps #2365
pcre2-test is red on linux-x86_64 (eric-5090, Ubuntu, glibc 2.43) at main c97a008, built from the pinned seed nightly-20261011-local-2-e4861e1d6997.
It is also red at PR #2361's head, so the failure predates that PR. Only one
test in the suite differs, heap-8:
Direct repro: out/pcre2_build/bin/pcre2test -q testinputheap out.txt, run in out/pcre2_reference/pcre2-10.47/testdata.
What gdb shows (watchpoint on malloclistptr; breakpoints on my_malloc and my_free)
The block is recorded. Pattern 2's \=memory match grows the heap
frames: my_malloc(40960) from match_ (pcre2_match.w:4646) returns 0x7ffff7f1e010. pcre2test records it (malloclistptr 1 -> 2). The old
20480 block is freed and removed (2 -> 1).
It is freed while tracking is off. Pattern 2's \=find_limits, with show_memory off, then runs the match repeatedly. During those retries, my_free(0x7ffff7f1e010) frees that recorded 40960 block. The list isn't
updated, because tracking is off, so its entry goes stale.
The later free misses. Pattern 3's \=memory,ovector=0 frees the
match data's current heap frames, which are no longer the recorded block: free unremembered block.
The expected output says that C pcre2 still holds the 40960 block at pattern 3,
so its find-limits retries do not free the match data's heap frames. heapframes handling in the migrated pcre2_match (around pcre2_match.w:893 and 1913 and match_ near 4646/4662) diverges from
the C: either the retries use the match data's vector where C would not, or the
vector is reallocated where C keeps it.
Next step
Build the reference pcre2test from out/pcre2_reference/pcre2-10.47 with the
host C compiler, run the same gdb script against it, and compare the first my_malloc/my_free that differs. That points to the C statement the
migration changed. Per D112 the corpus moves only by re-promotion, so the fix
belongs in the migrator.
Why the Mac battery may be green
Unknown. The diff depends on allocation order and sizes. Check whether pcre2-test passes on darwin-aarch64 at c97a008.
Root cause: this isn't a pcre2 or migrator bug. check_match_limit (pcre2test_inc.h:3070) frees the cached heap frames on each find_limits retry while show_memory is off, so pcre2test's malloc list keeps a stale entry. Whether a later free prints its size depends only on malloc returning the same address.
Evidence on eric-5090:
The C pcre2test built by gcc fails upstream's own testoutputheap-8 at pattern 2.
Under gdb, the C pcre2test and the migrated one make the same 146 my_malloc/my_free calls, with the same sizes, in the same order.
Our normalizer had rewritten the expected output to the Mac's address reuse.
Fixed in #2361 (cb9205a): the heap test now compares every free as free. Allocation sizes, frame sizes, heapframes sizes and the order and count of frees still compare. pcre2-test is green on eric-5090. Follow-up audit: #2373.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce; #2361 (cb9205a) fixed the comparison as the comment above explains. Today the With-built and C-built pcre2test give identical heap output on Linux x86_64:
Activity
#2365: the heap test compares what pcre2 does, not where malloc puts it
ehartford commentedon Oct 12, 2026
Root cause: this isn't a pcre2 or migrator bug.
check_match_limit(pcre2test_inc.h:3070) frees the cached heap frames on each find_limits retry whileshow_memoryis off, so pcre2test's malloc list keeps a stale entry. Whether a later free prints its size depends only on malloc returning the same address.Evidence on eric-5090:
Fixed in #2361 (cb9205a): the heap test now compares every free as
free. Allocation sizes, frame sizes, heapframes sizes and the order and count of frees still compare. pcre2-test is green on eric-5090. Follow-up audit: #2373.Link on any Linux layout: host libraries from the loader, runtime bes…
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce; #2361 (cb9205a) fixed the comparison as the comment above explains. Today the With-built and C-builtpcre2testgive identical heap output on Linux x86_64: