1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

48 Commits

Author SHA1 Message Date
Niels Dossche
3d51ba3479 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix ZEND_NONSTRING attribute for data_file.c
2025-05-28 19:50:06 +02:00
Niels Dossche
b8e734a24e Fix ZEND_NONSTRING attribute for data_file.c
This broke in CI but not on my local machine because of the different
compiler version. This is because there was an issue in GCC [1] that
caused the attribute to not properly work on multidimensional arrays.
This has since been fixed in GCC 15.
Therefore, we guard the attribute with a version check.

[1] https://gcc.gnu.org/cgit/gcc/commit/?id=afb46540d3921e96c4cd7ba8fa2c8b0901759455
2025-05-28 19:48:59 +02:00
Niels Dossche
cbe0cf6315 Merge branch 'PHP-8.4'
* PHP-8.4:
  Temporarily drop attribute for fileinfo
2025-05-27 21:08:11 +02:00
Niels Dossche
877663178c Temporarily drop attribute for fileinfo
The error in CI doesn't reproduce on my system with GCC 15.1.1...
2025-05-27 21:07:15 +02:00
Niels Dossche
c2749e0a80 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix compile error for attribute
2025-05-27 21:01:39 +02:00
Niels Dossche
e4d2cd47c2 Fix compile error for attribute 2025-05-27 21:00:41 +02:00
Niels Dossche
d5515577d5 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Backport fix for GH-17687
2025-05-27 20:42:12 +02:00
Niels Dossche
fab0a6d75c Backport fix for GH-17687
Introducing a new attribute macro in lower branches is an ABI break and
not allowed. However, we still need to fix the warnings such that
-Werror builds don't break. So we copy the macro from the master branch
to the C files in the appropriate places.
2025-05-27 20:40:35 +02:00
Niels Dossche
ea69276fd5 Fix GH-17687: initializer-string for array of ... warnings
Starting with gcc 15 the warning `-Wunterminated-string-initialization`
is enabled by default. We make now use of the `nonstring` attribute to
silence the warning for the cases where this is intended.

Closes GH-18603.
2025-05-27 20:28:29 +02:00
Niels Dossche
a570ce8f40 Remove custom patches that are no longer in upstream
These were introduced in 6747068c, but they don't seem to be in upstream
(anymore). For the entry in rpm it may have even been a mixup with the
two sections in the rpm file: there's a "10 string" entry but only in
the delta part.
2025-02-15 12:53:07 +01:00
Niels Dossche
37dbad8fcd Upgrade to file 5.46 2025-02-15 12:53:07 +01:00
Niels Dossche
f1b24da6b5 Fix GH-17039: PHP 8.4: Incorrect MIME content type
Backports file/file@ad925d3

Closes GH-17044.
2024-12-08 22:47:03 +01:00
Guillaume Outters
bcd3eec44a Fix bug #65106: PHP fails to compile ext/fileinfo
Make data_file.c's generator output its array initialization
"by list of strings", instead of "by list of chars": that makes the compiler
happier.

Use strtr() with a precomputed map, instead of a loop over ord(),
to generate in 1/100th the time.

Avoids ambiguous 0x tokens (as specified in C standards), by using octal.

Closes GH-10422.
2024-03-22 15:00:15 +01:00
Niels Dossche
b7c5813c98 Update libmagic to 5.45 (#13369)
* Update libmagic to 5.45

This also cleans up magicdata.patch: changes that are already in upstream file
were removed from that patch file.

There are five (expected) test output changes.
All these were also checked with the file command.

  - bug77961.phpt changes because there's now an early error-return in the
    `if (ts == FILE_BADSIZE) {` branch.
  - cve-2014-1943.phpt and cve-2014-1943-mb.phpt change because now the crafted
    data is recognised as a simh file.
  - bug71434.phpt now properly recognises it as a Python file.
  - ext/fileinfo/tests/finfo_file_basic.phpt more specific mime type.

* Adjust memory requirement for s390x fileinfo run

The larger database causes a higher memory usage.
Similar to 962c082a5b.

* [ci skip] NEWS
2024-02-13 21:11:57 +01:00
Anatol Belski
bd24c56207 fileinfo: Backport svg detection patch
This patch is a port of 1f5bea34 and adds a port for 5.43 based
branches. The related test is unchanged.

Signed-off-by: Anatol Belski <ab@php.net>
2023-09-30 18:22:14 +02:00
Anatol Belski
6219d7fbc6 fileinfo: libmagic: Check in unpatched 5.43
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:46 +02:00
Anatol Belski
34fa65a6c2 fileinfo: magic: Backport mime type support for woff/woff2 fonts
Upstream patch: 7a821aedc1

Fixes GH-8805.

Signed-off-by: Anatol Belski <ab@php.net>
(cherry picked from commit 8a2ebe069148909a00739c83e9bcc031734bf826)
2022-09-18 14:39:12 +02:00
Anatol Belski
3b9173dc8f fileinfo: Port libmagic 5.40
Signed-off-by: Anatol Belski <ab@php.net>
2021-04-05 20:19:07 +02:00
Anatol Belski
bf93f1d824 fileinfo: Followup fixes
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 19:03:41 +02:00
Anatol Belski
c3eeab01ba fileinfo: Upgrade to libmagic 5.39
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 02:05:56 +02:00
Christoph M. Becker
6747068ce7 Fix #79681: mime_content_type/finfo returning incorrect mimetype
We backport the respective fix for MP3s[1].

[1] <5a55569a35>
2020-06-10 16:36:40 +02:00
Anatol Belski
02fc2fe8c9 Fix magic data 2019-06-29 16:51:41 +02:00
Anatol Belski
622b10f06e Ported limagic 5.37 2019-05-30 02:22:40 +02:00
Anatol Belski
d874d4a15c Fixed bug #77346 webm files incorrectly detected as application/octet-stream
HEADSUP data from file 5.34 is used from now on
2018-12-28 13:25:40 +01:00
Anatol Belski
2a062f3c02 Rework magic data once more
The change reduces the input size on patterns using posix character
classes. It is still better than reverting to the patterns from the
older version, as the upstream data uses posix classes also in the later
versions. The input reduction speeds up the pattern matching in some
cases.

This patch is functionally almost same as upstream, but might show some diff
when the input is very long. While the magic data in the newer versions is
functionally an improvement, with jit=0 it might show a performance regression.
The slowdown is negligible in the normal usage and is still acceptable for the
malicious input. If some functional regressions show up, this patch should be
reverted and the tests timing should be adapted instead.
2018-11-14 22:23:24 +01:00
Anatol Belski
0e38909170 Rework magic data
Still upstream contains some slower patterns. Those might need to
be patched, if regressions arise.
2018-11-10 18:22:44 +01:00
Anatol Belski
e2182a1ba7 Port libmagic 5.33 2018-04-29 16:02:08 +02:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Anatol Belski
08d8623dec Upgrade bundled libmagic to 5.31 2017-10-11 18:18:55 +02:00
Anatol Belski
31a3956053 apply the current Fedora's data patches 2016-11-24 17:43:16 +01:00
Anatol Belski
411e97c72d Upgraded libmagic to 5.29
yet unfinished port to libmagic 5.28

catch with missing libmagic port pieces

regenerate data file with magic from 5.28

test magic files from 5.28

missing files

fix path

pure c99 is still not supported

move right to 5.29, yet some bugs present

more sync with orig lib

more ZMM usage

use unpatched data for now

partial revert according to bug #67705

Revert "more ZMM usage"

This reverts commit 5e3c9b851034b455942b219b18bdc49c8315c3ee.

several fixes, so it's now closer to the clean port
2016-11-24 13:44:04 +01:00
Anatol Belski
bae44417a8 after merge fix 2015-03-08 19:56:31 +01:00
Anatol Belski
eeb74b0ab8 regenerated data file 2015-03-08 19:47:53 +01:00
Anatol Belski
1b77e51ad7 started to patch for libmagic.next
everything is broken yet
2015-03-08 19:47:38 +01:00
Anatol Belski
969ce2e877 regenerated data file 2015-03-08 19:47:21 +01:00
Anatol Belski
2181ed2e2a started to patch for libmagic.next
everything is broken yet
2015-03-08 19:47:06 +01:00
Anatol Belski
c9d0894ec5 Fixed bug #67647 Bundled libmagic 5.17 does not detect quicktime files correctly 2015-01-22 11:48:11 +01:00
Anatol Belski
41a2f7074d Fixed bug #68398 msooxml matches too many archives 2014-12-06 20:51:00 +01:00
Andrey Hristov
3dc9bef819 Merge branch 'PHP-5.5' into PHP-5.6
Conflicts:
	ext/fileinfo/data_file.c
	ext/fileinfo/libmagic/softmagic.c
	ext/fileinfo/magicdata.patch
2014-08-06 16:25:12 +03:00
Stanislav Malyshev
eeaec70758 Fix bug #67705 (extensive backtracking in rule regular expression) 2014-08-04 00:05:40 -07:00
Remi Collet
4374a52e9d Fixed bug #66946 extensive backtracking in awk rule regular expression
CVE-2013-7345

Applied upstream patch:
ef2329cf71

Add the magicdata.patch to track patches applied to upstream data file.
2014-03-25 11:00:33 +01:00
Anatol Belski
967a6771d3 updated to libmagic-5.17 2014-02-19 10:02:36 +01:00
Anatol Belski
10367fa7c6 upgraded libmagic to 5.14 2013-04-07 22:15:56 +02:00
Pierre Joye
12cf930a40 Fix bug #61504, potential vuln. in fileinfo. update to 5.11 2012-03-27 13:34:46 +02:00
Scott MacVicar
c48241a569 MFH Update libmagic data file to 5.02 2009-05-04 20:56:13 +00:00
Scott MacVicar
7a29c8f386 MFH Update fileinfo to libmagic 5.00 and remove dependency on dirent.h on Windows 2009-03-15 23:04:19 +00:00
Scott MacVicar
3e543f2464 MFH: Sync libmagic with 4.26 and add support for the new v6 magic file format 2008-11-02 16:13:49 +00:00
SVN Migration
14ce4a1d0a This commit was manufactured by cvs2svn to create branch 'PHP_5_3'. 2008-07-25 02:44:58 +00:00