[php-src] PR #25030: Fix GH-25029: fileinfo built-in magic database is not aligned
| From: | lazerg | Date: | Thu, 29 Oct 2026 09:47:44 +0000 |
| Subject: | [php-src] PR #25030: Fix GH-25029: fileinfo built-in magic database is not aligned | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40050@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25030
Author: lazerg
php_magic_database is a plain unsigned char array, so it only gets 1-byte
alignment, but apprentice_map() reads it as uint32_t and then as an array
of struct magic. On strict-alignment CPUs like ARMv5 the header check reads garbage,
the built-in database is rejected and every finfo call fails. Cross-compiling for armv5te with
-Os puts the array in a .rodata section with alignment 1 (at offset 3 in a
small test object). This declares it with ZEND_SET_ALIGNED(8, ...) in
create_data_file.php and in the generated data_file.c.
Fixes #25029