1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 10:12:18 +01:00
Commit Graph

874 Commits

Author SHA1 Message Date
Ilija Tovilo
cee3687180 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix cve-2014-3538 test
2025-01-27 21:49:03 +01:00
Ilija Tovilo
7bda7ad31d Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix cve-2014-3538 test
2025-01-27 21:48:47 +01:00
Ilija Tovilo
d17d58a982 Fix cve-2014-3538 test
Make sure we have a unique test file to work with, and increase the time
for the nojit version to match the default version.

Closes GH-17600
2025-01-27 20:01:13 +01:00
David Carlier
ea83eba590 Merge branch 'PHP-8.2' into PHP-8.3 2024-09-05 01:41:55 +01:00
Daniel Scherzer
c5e0a6aaab Fix GH-15752: finfo_file() - parameter validation error messages
Show the correct parameter names and numbers - the errors are caused by the
second parameter being empty or having null bytes, not the first.

close GH-15755
2024-09-05 01:41:15 +01:00
Christoph M. Becker
a23775a30d Fix GH-14888: README.REDIST.BINS refers to non-existing LICENSE [ci skip]
The LICENSE file of libmagic had been inadvertently removed when the
lib had been upgraded to 5.43.  So we add the file `COPYING` from that
release[1], and rename it to `LICENSE`.

[1] <https://github.com/file/file/releases/tag/FILE5_43>

Closes GH-14917.
2024-07-11 16:39:22 +02:00
Michael Orlitzky
4ded247675 ext/fileinfo/tests/bug78987.phpt: increase a memory limit
This test performs a few checks to ensure that "not too much" memory
is used while fileinfo is detecting encodings. It is however platform
specific, and memory usage varies across hosts and as libmagic changes.

Recently a Gentoo user reported a failure in this test at,

  https://bugs.gentoo.org/927461

on a big-endian PPC64 machine with output,

  ---- EXPECTED OUTPUT
  131072   => ok
  262144   => ok
  524288   => ok
  1048576  => ok
  2097152  => ok
  4194304  => ok
  8388608  => ok
  16777216 => ok
  ---- ACTUAL OUTPUT
  131072   => 10092544
  262144   => 10092544
  524288   => 12189696
  1048576  => 12189696
  2097152  => 14352384
  4194304  => 18612224
  8388608  => 24903680
  16777216 => 37486592
  ---- FAILED

Those numbers are with 8.3.4 and therefore missing commit b7c5813c
which also raises the limits. Checking the "actual" numbers above
against the current values, we see that the limit for 524288 would
need to be bumped to 12189696 to allow this test to pass. Since that
seems reasonable, that's what this commit does.

Closes GH-13795
Closes GH-13940
2024-04-11 15:58:06 +02:00
Niels Dossche
e71b597f4d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
2024-02-13 21:15:37 +01:00
Niels Dossche
c2b671cb1b Fix GH-13344: finfo::buffer(): Failed identify data 0:(null)
Credits to ranvis for finding the upstream commit that fixes the issue.

This backports 029b82459e

Closes GH-13370.
2024-02-13 21:13:43 +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
4b22cb213a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fileinfo: Backport svg detection patch
2023-09-30 16:26:24 +02:00
usarise
1f5bea3452 fileinfo: Backport svg detection patch 2023-09-30 16:17:03 +02:00
Anatol Belski
292e10b14b fileinfo: Add test for xz type
Ref: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 18:37:53 +02:00
Anatol Belski
97f0d97d2a fileinfo: Backport xz detection patch
Upstream: 9b0459afab

Fixes: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 18:02:46 +02:00
Anatol Belski
86f79b299e fileinfo: Backport xz detection fix
Upstream: 9b0459afab

Fixes: #11298

Signed-off-by: Anatol Belski <ab@php.net>
2023-07-01 17:58:38 +02:00
Niels Dossche
b0ba368d53 Fix GH-11408: Unable to build PHP 8.3.0 alpha 1 / fileinfo extension
On some configurations, the COMPILE_DL_FILEINFO must come from the
config.h file. If the COMPILE_DL_FILEINFO macro is not set, the build
won't include the ZEND_GET_MODULE block necessary for building this
extension as a shared object.

Closes GH-11505.
2023-06-23 17:43:52 +02:00
Ilija Tovilo
9d5f2f1343 Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Máté Kocsis
7936c8085e Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +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
962c082a5b fileinfo: Fix expected values for test on s390x
The peak memory usage increased by the blanket 1mb on s390 only.
This is good to note but otherwise seems acceptable, so just
adjusting the test is fine.

Signed-off-by: Anatol Belski <ab@php.net>
2022-10-02 19:57:41 +02:00
Anatol Belski
bb6b41c3b1 Revert "fileinfo: tests: Disable times sensitive tests on debug build"
This reverts commit cab2f05f5a.
2022-10-02 18:39:54 +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
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
a4280d23dd fileinfo: tests: Sync more upstream tests and fix phpt
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
Anatol Belski
fbe73ff5b2 Merge branch 'PHP-8.2'
* PHP-8.2:
  fileinfo: tests: Disable times sensitive tests on debug build
2022-09-25 20:44:50 +02:00
Anatol Belski
50fc9970f3 Merge branch 'PHP-8.1' into PHP-8.2 2022-09-25 20:44:16 +02:00
Anatol Belski
cab2f05f5a fileinfo: tests: Disable times sensitive tests on debug build
Signed-off-by: Anatol Belski <ab@php.net>
2022-09-25 20:43:31 +02:00
Anatol Belski
3021da54be Merge branch 'PHP-8.2'
* PHP-8.2:
  fileinfo: magic: Backport mime type support for woff/woff2 fonts
2022-09-18 14:44:42 +02:00
Anatol Belski
796fdb4bcc Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fileinfo: magic: Backport mime type support for woff/woff2 fonts
2022-09-18 14:44:00 +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
Ilija Tovilo
12b9196042 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix cleaup of fileinfo test
2022-09-14 22:19:55 +02:00
Ilija Tovilo
52850a4c0f Fix cleaup of fileinfo test 2022-09-14 22:18:59 +02:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
b4ec3e9bc0 Do not generate CONST_CS when registering constants (#9439) 2022-08-28 08:27:19 +02:00
Michael Voříšek
60189aa96a Skip locale tests /w musl libc (#9141) 2022-07-25 23:56:14 +01:00
Máté Kocsis
e328c68305 Rename @cname to @cvalue in stubs (#9043)
@cname currently refers to the constant name in C. However, it is not always a (constant) name, but sometimes a function invocation, so naming it as @cvalue would be more appropriate.
2022-07-19 15:11:42 +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
Pierrick Charron
6fd2b39397 Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Máté Kocsis
debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Máté Kocsis
d457519b65 Declare ext/fileinfo constants in stubs (#8701) 2022-06-04 10:22:09 +02: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
George Peter Banyard
2ecd46f48f Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01:00