Commit graph

99 commits

Author SHA1 Message Date
Peter Kokot
d3901b8ca6
Sync PHP_FILEINFO_UNCOMPRESS #if/ifdef/defined (#14525)
This fixes few more -Wundef warnings in ext/fileinfo. The
PHP_FILEINFO_UNCOMPRESS seems to be present to be defined at some point
but is currently unused in all build systems. Leaving this intact for
now.

Follow up of GH-5526 (-Wundef)
2024-06-10 08:11:25 +02:00
Peter Kokot
1d0cdd1b41
Remove unused ext/fileinfo/libmagic/elfclass.h file (#14344)
Usage was removed via 919abf0cb1 due to
redundand code in php-src. This also updates the appended libmagic patch
file.
2024-05-28 21:43:38 +02:00
Niels Dossche
87abd500e3
Fix 32-bit fileinfo (#13404)
libmagic 5.45 has a regression on 32-bit that is fixed in current HEAD,
but that's not released yet. Pull in the upstream fix [1].

[1] 218fdf813f
2024-02-15 20:47:49 +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
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Anatol Belski
3c602fdf67 libmagic: Keep the WS limitation piece
Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 21:00:03 +02: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
78b6f0d255 fileinfo: libmagic: Update libmagic.patch
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 18:26:06 +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
Stanislav Malyshev
b2f692a9f8 Merge branch 'PHP-8.1' 2022-07-05 00:59:43 -06:00
Christoph M. Becker
ca6d511fa5 Fix #81723: Memory corruption in finfo_buffer()
We need to use the same memory allocator throughout.
2022-07-05 00:44:00 -06:00
George Peter Banyard
d08451b2ca
Replace php_stdint.h header with standard headers (#8613) 2022-05-29 11:20:56 +01:00
David Carlier
45e623da26
libmagic: use php_memnstr instead of memmem
Closes GH-8391.
2022-05-23 10:57:44 +02:00
Anatol Belski
7251f3900e fileinfo: Update the patch
Signed-off-by: Anatol Belski <ab@php.net>
2021-04-06 22:43:05 +02:00
Anatol Belski
4af6679d78
fileinfo: Update libmagic.patch
Signed-off-by: Anatol Belski <ab@php.net>
2021-04-05 22:41:00 +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
Christoph M. Becker
e589609b4c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #77961: finfo_open crafted magic parsing SIGABRT
2020-11-24 14:06:53 +01:00
Christoph M. Becker
39f95f5614 Fix #77961: finfo_open crafted magic parsing SIGABRT
libmagic may abort the running process, which is not desirable for PHP;
we raise a fatal error instead.

Closes GH-6437.
2020-11-24 14:01:15 +01:00
Anatol Belski
e64c386b62 libmagic: Update patch
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2020-09-02 21:25:24 +02:00
Anatol Belski
486866c1b9 libmagic: Update patch [ci skip]
Signed-off-by: Anatol Belski <ab@php.net>
2020-08-29 21:27:01 +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
David Carlier
f32653accc fileinfo build fix proposal for haiku.
Haiku already defines a unichar type and different than the fileinfo's anyway.

Closed GH-5983
2020-08-21 16:13:09 +02:00
George Peter Banyard
3f286fa89a Promote Notice to Warning in libmagic
The current behaviour makes little to no sense, having a notice which starts with 'Warning:' should just be a warning

Closes GH-5824
2020-07-10 14:43:43 +02:00
George Peter Banyard
f91f72607b Drop unnecessary stdint and inttypes header checks
These are always available as of C99.

Closes GH-5323

Co-authored-by: "Christoph M. Becker" <cmbecker69@gmx.de>
2020-04-22 20:18:19 +02:00
George Peter Banyard
457380cae7 Drop wchar header check as always defined since C95 2020-03-31 00:14:56 +02:00
Christoph M. Becker
7702b693b5 Fix #79283: Segfault in libmagic patch contains a buffer overflow
To solve this, we properly calculate the required string length upfront
instead of allocating an oversized string (`len * 4 + 4`).
2020-03-16 22:42:15 -07:00
Christoph M. Becker
aa88f33f7d Fix #79283: Segfault in libmagic patch contains a buffer overflow
To solve this, we properly calculate the required string length upfront
instead of allocating an oversized string (`len * 4 + 4`).
2020-03-16 22:40:48 -07:00
Christoph M. Becker
7fa6e2a25c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update libmagic.patch
2020-03-02 15:08:50 +01:00
Christoph M. Becker
f15ab32af8 Update libmagic.patch
Some commits missed to update the patch file, so we're catching up on
this.

To generally make this easier, we back-port generate_patch.sh from
PHP-7.4, where we now also generate magic.h from magic.h.in.
2020-03-02 15:03:45 +01: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
dacf9ecc46 Update libmagic.patch [ci skip] 2019-06-29 17:36:11 +02:00
Anatol Belski
2ba9177d4f [ci skip] Update libmagic.patch 2019-05-30 14:09:00 +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
ba40f505e5 Fix unused variable warnings in libmagic
These variables are only used in assertions.
2019-04-12 12:03:26 +02:00
Nikita Popov
b65cb7e2aa Fix libmagic warnings 2019-04-11 15:20:05 +02:00
Nikita Popov
f6521659ca Add script to generate libmagic.patch 2019-04-11 15:12:20 +02:00
Nikita Popov
275fa53564 Accept zend_string* instead of char* in php_pcre_match_impl() 2019-03-18 12:32:06 +01:00
Fabien Villepinte
b6f9ade9f2 Remove unused variables 2019-03-17 23:29:51 +01:00
Anatol Belski
3e92365fa2 Update libmagic.patch [skip ci] 2019-03-08 21:55:15 +01:00
Anatol Belski
ee50461e4b Update libmagic.patch [ci skip] 2018-11-10 22:02:44 +01:00
Anatol Belski
a957af6c06 Update libmagic.patch [ci skip] 2018-11-05 22:25:31 +01:00
Anatol Belski
3082600326 Update libmagic.patch [ci skip] 2018-08-06 14:28:32 +02:00
Anatol Belski
01b9975639 [ci skip] Update libmagic.patch 2018-06-03 14:06:11 +02:00
Anatol Belski
dbea6e154d Update libmagic.patch 2018-04-30 14:29:55 +02:00
Anatol Belski
e2182a1ba7 Port libmagic 5.33 2018-04-29 16:02:08 +02:00
Anatol Belski
259085f201 Update libmagic.patch, also reflecting PCRE2 changes 2017-12-21 15:47:07 +01:00
Anatol Belski
b4db9e9acc Update libmagic.patch 2017-10-23 19:18:25 +02:00
Anatol Belski
747f70ba82 Cleanup irrelevant info 2017-10-11 18:40:16 +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