Skip to content

Fix FFI array types whose size overflows size_t - #25698

Open
marc-mabe wants to merge 1 commit into
php:PHP-8.5from
marc-mabe:fix/ffi-array-size-overflow
Open

marc-mabe wants to merge 1 commit into
php:PHP-8.5from
marc-mabe:fix/ffi-array-size-overflow

Conversation

@marc-mabe

Copy link
Copy Markdown
Contributor

The size of an array type was computed as length * element size without an overflow check, in FFI::arrayType() as well as for array declarators and nested declarators. A length that is valid on its own could wrap the size around to a few bytes, so FFI::new() allocated a tiny buffer while element access, which is only checked against the length, reached far beyond it.

The size of an array type was computed as length * element size without
an overflow check, in FFI::arrayType() as well as for array declarators
and nested declarators. A length that is valid on its own could wrap the
size around, leaving the array type with a size far smaller than its
length requires.
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.

1 participant