• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ptondereau / ext-php-rs
66%
master: 66%

Build:
Build:
LAST BUILD BRANCH: fix/string-prop-getter-zend-string-leak
DEFAULT BRANCH: master
Repo Added 01 Apr 2026 02:57PM UTC
Token Y7FoKFtsn51OXQH6dAAozlw5G2JFddXKH regen
Build 18 Last
Files 96
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH fix/729-binary-interned-heap-corruption
branch: fix/729-binary-interned-heap-corruption
CHANGE BRANCH
x
Reset
Sync Branches
  • fix/729-binary-interned-heap-corruption
  • feat/cache-slot-property-lookup
  • feat/module-globals
  • feat/sapi-trait-and-zts
  • feat/static-property-descriptors
  • fix/clippy-1-95-0
  • fix/null-pointer-sapi-trampolines
  • fix/string-prop-getter-zend-string-leak

22 Apr 2026 05:19PM UTC coverage: 66.241%. First build
24792373762

push

github

ptondereau
fix: heap corruption when returning Binary of 0/1 packed bytes

Returning a Binary from a #[php_function] crashed PHP with "zend_mm_heap corrupted" when the packed byte length was 0 or 1. This was a regression introduced in 0.15.8 by PR #701, which short-circuits ext_php_rs_zend_string_init to return PHP's interned permanent statics (zend_empty_string, zend_one_char_string[c]) for length 0 and 1. Zval::set_zend_string was updated in that PR to detect these statics via GC_IMMUTABLE and flag the zval as InternedStringEx, but Zval::set_binary was missed and always flagged the zval as refcounted. On drop PHP tried to free a process-global static, leading to heap corruption.

Zval::set_binary now wraps the raw pointer from Pack::pack_into in ZBox<ZendStr> and delegates to set_zend_string, so every path that assigns a zend_string to a zval shares one flag-selection site, matching PHP's own ZVAL_STR macro in Zend/zend_types.h.

Also tightened the NULL guard in wrapper.c so the fast path is safe when only one of the two weak symbols resolves at link time, and fixed an adjacent correctness issue where Zval::binary::<T>() and Zval::binary_slice::<T>() silently truncated trailing bytes when the byte length was not a multiple of size_of::<T>(). Both functions now return None in that case rather than dropping data.

Fixes #729

67 of 73 new or added lines in 1 file covered. (91.78%)

8653 of 13063 relevant lines covered (66.24%)

33.15 hits per line

Relevant lines Covered
Build:
Build:
13063 RELEVANT LINES 8653 COVERED LINES
33.15 HITS PER LINE
Source Files on fix/729-binary-interned-heap-corruption
  • Tree
  • List 96
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
24792373762 fix/729-binary-interned-heap-corruption fix: heap corruption when returning Binary of 0/1 packed bytes Returning a Binary from a #[php_function] crashed PHP with "zend_mm_heap corrupted" when the packed byte length was 0 or 1. This was a regression introduced in 0.15.8 by PR #701, whic... push 22 Apr 2026 05:24PM UTC ptondereau github
66.24
See All Builds (18)

Badge your Repo: ext-php-rs

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

Refresh
  • Settings
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc