Skip to content

Fix is_zend_ptr() huge block comparison - #16938

Closed
ndossche wants to merge 1 commit into
php:PHP-8.2from
ndossche:zendmm-is-zend-ptr-bug
Closed

ndossche wants to merge 1 commit into
php:PHP-8.2from
ndossche:zendmm-is-zend-ptr-bug

Conversation

@ndossche

@ndossche ndossche commented Nov 25, 2024 •

Copy link
Copy Markdown
Member

We should compare the block memory allocation range, not the block metadata pointer (See zend_mm_add_huge_block).
This caused random test failure for ext/ffi/tests/gh14626.phpt when the malloc() performed by the FFI code lies close to the block metadata, and the size of the block is large enough.

This random crash was reported by #16902 (comment)
It only reproduced on 32-bit in like 1/12 tries on average on my system, so a bit hard to reproduce. Did not test on 64-bit but probably even harder to reproduce.

We should compare the block memory, not the block metadata (See
zend_mm_add_huge_block).
This caused random test failure for ext/ffi/tests/gh14626.phpt when the
malloc() performed by the FFI code lies close to the block metadata, and
the size of the block is large enough.

This was reported by php#16902 (comment)

@dstogov dstogov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Right of curse. Thanks!

@ndossche ndossche closed this in 18674e3 Nov 26, 2024
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.

2 participants