[php-src] PR #17255: Fix GH-16013 and bug #80857: Big endian issues
| From: | nielsdos | Date: | Tue, 24 Dec 2024 14:28:36 +0000 |
| Subject: | [php-src] PR #17255: Fix GH-16013 and bug #80857: Big endian issues | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30104@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17255
Author: nielsdos
The FFI call return values follow widening rules.
We must widen to
ffi_arg in the case we're handling a return value for types
shorter than the machine width. From http://www.chiark.greenend.org.uk/doc/libffi-dev/html/The-Closure-API.html:
> In most cases, ret points to an object of exactly the size of the type specified when cif was
> constructed.
> However, integral types narrower than the system register size are widened.
> In these cases your program may assume that ret points to an ffi_arg object.
If we don't do this, we get wrong values when reading the return values.