Commit graph

100 commits

Author SHA1 Message Date
Niels Dossche
399cb4ca85
Fix misplaced endif in apprentice_sort() (#18686) 2025-05-29 12:04:07 +02:00
Niels Dossche
37dbad8fcd Upgrade to file 5.46 2025-02-15 12:53:07 +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
1b39d4c6d2 libmagic: Further simplify diff
Avoid displaced lines where not necessary, use include guard and don't
change called function names.

Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 20:48:35 +02:00
Anatol Belski
5c9cb24aa0 libmagic: Follow up fixes for 5.43
Fixes possible build and runtime issues on Windows.`

Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 16:11:50 +02:00
Anatol Belski
25bb817804 fileinfo: libmagic: Simplify libmagic patch
For the time being, the new args passing pre-compiled regex are cut out.
On the PHP side, PCRE patterns are cached and thus a duplicated
mechanism isn't necessary.

There might be still advantages to carry pre-compiled patterns for
libmagic separately, but reusing this mechanism needs a better
consideration, as it might require to retain from the PHP internal pattern
caching mechanism.

Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:47 +02:00
Anatol Belski
a3dd514d4d fileinfo: Introduce php_libmagic.* to simplify patch
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:47 +02:00
Anatol Belski
a24727a5ca fileinfo: libmagic: Apply libmagic.patch
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 03:02:46 +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
George Peter Banyard
2ecd46f48f
Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01: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
c676e8f356 libmagic: Fix VS compat 2020-08-29 19:58:26 +02:00
Anatol Belski
f8f288145b libmagic: Remove unneeded includes
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 19:41:53 +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
George Peter Banyard
1b2ec73c1d Drop various unused macros/APIs
Also convert_libmagic_pattern() to return a zend_string*

Closes GH-6029
2020-08-26 12:59:43 +02:00
Peter Kokot
f002761e08 Update libmagic patch
This simplifies the libmagic patch:
- in upstream the HAVE_STRERROR check has been removed
- in upstream library the HAVE_SIGNAL_H has been removed
- indentations syncs with the upstream library
- some irrelevant changes removed from the patch (log comment), upstream
  has this correctly logged already so no need to patch the comment.

Closes GH-4298
2019-07-08 12:38:47 +02:00
Anatol Belski
57c23df142 Fix datatype 2019-05-30 02:34:35 +02:00
Anatol Belski
622b10f06e Ported limagic 5.37 2019-05-30 02:22:40 +02:00
Nikita Popov
908660c1d7 Avoid maybe uninit warning in libmagic
GCC 5 false positive, gone in newer versions.
2019-04-15 10:59:45 +02:00
Nikita Popov
b65cb7e2aa Fix libmagic warnings 2019-04-11 15:20:05 +02:00
Anatol Belski
7f5f46013b Rework places in libmagic regarding previous CVE-2014-3538 fixes
CVE-2014-3538 was fixed upstream, but the old patch was still kept in
the PHP port. This patch causes performance regressions when PCRE JIT is
not enabled. This is fixed by applying the relevant original code from
the newer libmagic, which makes the old patch obsolete as the
CVE-2014-3538 tests still pass.
2018-11-04 13:11:28 +01:00
Anatol Belski
6f24d75b56 Remove unnecessary decls, php.h is included 2018-06-03 12:45:37 +02: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
Riccardo Magliocchetti
e313daa598 fileinfo: fix misleading indentation in libmagic 2017-12-21 15:39:00 +01:00
Anatol Belski
fb0be397d0 Fix mismatching alloc 2017-10-23 18:49:17 +02:00
Anatol Belski
08d8623dec Upgrade bundled libmagic to 5.31 2017-10-11 18:18:55 +02:00
Xinchen Hui
2d21404e25 Merge branch 'PHP-7.1'
* PHP-7.1:
  Update NEWS
  Fixed bug #74379 (syntax error compile error in libmagic/apprentice.c)
  Missed NEWS

Conflicts:
	ext/fileinfo/libmagic.patch
2017-04-10 11:47:38 +08:00
Xinchen Hui
341ff7119f Fixed bug #74379 (syntax error compile error in libmagic/apprentice.c) 2017-04-10 11:44:41 +08: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
Xinchen Hui
4cb47bd3bd Fixed compiler warnings 2016-01-25 11:45:14 +08:00
Kalle Sommer Nielsen
88b9d485d6 Drop old VC support for ext/fileinfo.
@Anatol, I generated the updated patch file against file 5.22, since you are the one that usually updates it, can you please confirm it works?
2015-03-29 07:48:48 +02:00
Anatol Belski
bae44417a8 after merge fix 2015-03-08 19:56:31 +01:00
Anatol Belski
3e8a5485e2 catching up 2015-03-08 19:47:59 +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
5892ec175a catching up 2015-03-08 19:47:30 +01:00
Anatol Belski
ca98547801 catching up 2015-03-08 19:47:28 +01:00
Anatol Belski
ec84d36c9f portable off_t 2015-03-08 19:47:24 +01:00
Anatol Belski
0d410fc2d2 more after patch fixes 2015-03-08 19:47:20 +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
f9d672f7d4 Merge branch 'PHP-5.6'
* PHP-5.6:
  simplify error handling for dirs as magic
2015-01-22 10:17:45 +01:00
Anatol Belski
60c2621b2a Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  simplify error handling for dirs as magic
2015-01-22 10:17:14 +01:00
Anatol Belski
43652d386a simplify error handling for dirs as magic 2015-01-22 10:16:13 +01:00
Anatol Belski
4e3e95dfc0 Merge branch 'PHP-5.6'
* PHP-5.6:
  updated NEWS
  Fixed bug #68827 Double free with disabled ZMM
2015-01-22 10:02:05 +01:00
Anatol Belski
d0e75bdc59 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed bug #68827 Double free with disabled ZMM
  Fixed segfault while running with moodle
2015-01-22 10:00:10 +01:00
Joshua Rogers
91aa340180 Fixed bug #68827 Double free with disabled ZMM 2015-01-22 09:59:13 +01:00
Stanislav Malyshev
b7a7b1a624 trailing whitespace removal 2015-01-10 15:07:38 -08:00
Anatol Belski
ef89ab2f99 Merge branch 'PHP-5.6'
* PHP-5.6:
  updated NEWs
  Fixed bug #68665 (Invalid free)
2014-12-28 14:02:25 +01:00
Anatol Belski
a72cd07f29 Fixed bug #68665 (Invalid free) 2014-12-28 13:58:01 +01:00