php-src/ext/ffi/tests
Christoph M. Becker 703cac33db
Fix GH-7867: FFI::cast() from pointer to array is broken
Casting from pointer to array is special, so we must not fall back to
the general FFI casting.  There is a particular issue regarding the
size comparison, namely that the pointer size is always 8 for 64bit
architectures, but the size of an array is determined by its
declaration, so as is casting a pointer to an array with more than 8
elements would fail, but casting to an array with less than 9 elements
succeeds, but the internal pointer would point to some arbitrary
memory.

We fix this by properly supporting the cast.  An alternative would be
to deny this kind of cast generally, since it is not necessarily safe.
However, FFI isn't necessarily safe anyway.

We also check pointer/array type compatibility when casting.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-7876.
2022-01-10 23:58:39 +01:00
..
001.phpt
002.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
003.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
004.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
005.phpt
006.phpt
007.phpt
008.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
009.phpt
010.phpt
011.phpt
012.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
013.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
014.phpt
015.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
016.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
017.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
018.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
019.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
020.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
021.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
022.phpt Merge branch 'PHP-7.4' 2020-03-12 11:45:05 +03:00
023.phpt Merge branch 'PHP-7.4' 2020-02-17 12:54:11 +03:00
024.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
025.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
026.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
027.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
028.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
029.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
030.phpt
031.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
032.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
033.phpt
034.phpt
035.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
036.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
037.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
038.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
039.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
040.phpt Fix #79472: ext/ffi/tests/040.phpt TC fails on Big endian arch 2020-04-14 20:31:31 +03:00
041.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
042.phpt Fix FFI test on Windows 2019-02-12 13:57:44 +01:00
043.phpt Review the usage of apostrophes in error messages 2020-07-10 21:05:28 +02:00
044.phpt Fix handling and extend ext/ffi/tests/044.phpt 2019-03-30 12:53:32 +01:00
045.phpt Replace EXPECTF when possible 2020-06-29 21:31:44 +02:00
100.phpt Run tidy 2020-09-18 14:28:32 +02:00
101.phpt Run tidy 2020-09-18 14:28:32 +02:00
200.phpt Run tidy 2020-09-18 14:28:32 +02:00
300-win32.h.in
300.h Convert CRLF line endings to LF 2019-05-07 04:40:01 +02:00
300.phpt Add --file-cache-prime/use options to run-tests 2020-05-20 15:29:32 +02:00
301-win32.phpt Trim trailing whitespaces and fix code style 2020-05-12 17:00:11 +02:00
301.phpt
302.phpt Allow loading FFI bindings through ffi.preload directive 2019-10-22 17:52:56 +03:00
303.phpt Added suppot for glob() wildcard matching in ffi.preload directive 2019-10-24 07:40:07 +02:00
bug77632.phpt Run tidy 2020-09-18 14:28:32 +02:00
bug77632b.phpt Run tidy 2020-09-18 14:28:32 +02:00
bug77706.phpt Run tidy 2020-09-18 14:28:32 +02:00
bug77768.phpt Run tidy 2020-09-18 14:28:32 +02:00
bug78270_1.phpt Improve FFI test suite for Windows 2020-03-18 16:53:06 +01:00
bug78270_2.phpt Improve FFI test suite for Windows 2020-03-18 16:53:06 +01:00
bug78543.phpt Fix #78543: is_callable() on FFI\CData throws Exception 2019-09-19 09:13:22 +02:00
bug78714.phpt Improve FFI test suite for Windows 2020-03-18 16:53:06 +01:00
bug78761_preload.h Fix #78761: Zend memory heap corruption with preload and casting 2019-10-30 19:49:39 +01:00
bug78761_preload.php Fix #78761: Zend memory heap corruption with preload and casting 2019-10-30 19:49:39 +01:00
bug78761.phpt Remove support for preloading on Windows 2020-01-06 22:41:55 +01:00
bug78762.phpt Fix #78762: Failing FFI::cast() may leak memory 2019-10-30 17:21:58 +01:00
bug79096.phpt Merge branch 'PHP-7.4' 2020-03-18 17:01:30 +01:00
bug79177.phpt Fix bug79177.phpt wrt. JIT 2020-10-30 15:47:18 +01:00
bug79532.phpt Fix #79532: sizeof off_t can be wrong 2020-04-29 10:40:59 +02:00
bug79571.phpt Skip test on big-endian architectures 2020-05-12 13:31:53 +02:00
bug79576.phpt Fixed error message 2021-09-15 15:00:49 +03:00
bug79749.phpt Fix #79749: Converting FFI instances to bool fails 2020-06-29 16:02:58 +02:00
bug80186.phpt Fixed bug #80186 2020-10-09 16:56:08 +02:00
bug80847.phpt XFAIL on WIN64 because of problem in libffi 2021-03-24 13:57:31 +01:00
callconv_x86.dll Fix #78716: Function name mangling is wrong for some parameter types 2019-10-22 11:38:58 +02:00
callconv.phpt Fix #78716: Function name mangling is wrong for some parameter types 2019-10-22 11:38:58 +02:00
gh7867.phpt Fix GH-7867: FFI::cast() from pointer to array is broken 2022-01-10 23:58:39 +01:00
list.phpt Add many missing closing PHP tags to tests 2020-08-09 22:03:36 +02:00
preload.inc Improve FFI test suite for Windows 2020-03-18 16:53:06 +01:00
skipif.inc
utils.inc Improve FFI test suite for Windows 2020-03-18 16:53:06 +01:00