Commit Graph
348 Commits
Author SHA1 Message Date
Sergei Turchanov c62cd9a43a Fix #74170: locale information change after mime_content_type
Some functions in libmagic (distributed with fileinfo extension) perform this sequence of calls:
func() {
setlocale(LC_TYPE, "C")
.. do some work ..
setlocale(LC_TYPE, "")
}

It effectively resets LC_TYPE if it that was set before the function call.

To avoid manipulations with current locale at all, the problematic functions
were modified to use locale-independent functions.
2019-12-20 11:22:59 +01:00
Stanislav Malyshev 8c2b3b0568 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix libmagic buffer overflow issue (CVE-2019-18218)
  bump version
  set versions for release
2019-10-28 20:47:44 -07:00
Stanislav Malyshev 2bdb13a1f7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix libmagic buffer overflow issue (CVE-2019-18218)
  bump version
  set versions for release
2019-10-28 20:47:30 -07:00
Stanislav Malyshev 469820048d Fix libmagic buffer overflow issue (CVE-2019-18218)
Ported from https://github.com/file/file/commit/46a8443f76cec4b41ec736eca396984c74664f84
2019-10-27 16:30:38 -07:00
Fabien Villepinte d9a3cb0b36 Fix typo in libmagic version 2019-03-08 20:51:09 +01:00
Anatol Belski 65ffdc2adf Fixed bug #77576 pull the libmagic implementation of gmtime_r
PHP already has all the checks to handle the *_r function variants.
Thus, reusing it to get right symbols.
2019-03-08 20:32:15 +01:00
Anatol Belski 992e4fbc65 Fix regex 2018-11-10 12:13:03 +01:00
Anatol Belski 9d77bf0978 Fix regex 2018-11-10 12:11:02 +01:00
Anatol Belski 22f71a66ec Sync one more upstream libmagic piece 2018-11-10 00:19:42 +01:00
Anatol Belski 29dcf19f8b Declare function proto in header 2018-11-05 21:29:35 +01:00
Anatol Belski 0e33c2822c Declare function proto in header 2018-11-05 21:28:04 +01:00
Anatol Belski c621182c42 Backport 7f5f4601 for 7.2 2018-11-04 16:57:55 +01: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 e1af7a794a Fix possible stack buffer overflow 2018-08-04 16:56:08 +02:00
Anatol Belski 6f24d75b56 Remove unnecessary decls, php.h is included 2018-06-03 12:45:37 +02:00
Anatol Belski 4363588f2f Align the ported place with libmagic 2018-06-03 12:14:42 +02:00
Dmitry Stogov 5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Anatol Belski 94699d2ade Use suitable datatypes 2018-04-30 14:27:11 +02:00
Anatol Belski f603ab57fc Reuse the struct timespec based pieces in libmagic 2018-04-30 12:02:47 +02:00
Anatol Belski cf45479a19 Reuse strcasestr implementation from libmagic 2018-04-29 19:39:57 +02:00
Anatol Belski 09db1ae4b7 Fix C89 compat 2018-04-29 16:18:59 +02:00
Anatol Belski e2182a1ba7 Port libmagic 5.33 2018-04-29 16:02:08 +02:00
Gabriel Caruso 2238403892 Trailing whitespaces on ext/*
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-04 02:38:32 -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 aa978538ca Merge branch 'PHP-7.2'
* PHP-7.2:
  fileinfo: fix misleading indentation in libmagic
2017-12-21 15:42:16 +01:00
Riccardo Magliocchetti e313daa598 fileinfo: fix misleading indentation in libmagic 2017-12-21 15:39:00 +01:00
Anatol Belski 20d930d8f3 Fix remaining signedness warnings 2017-11-14 17:07:09 +01:00
Anatol Belski a5bc5aed71 Patch core for PCRE2 support
RFC https://wiki.php.net/rfc/pcre2-migration
2017-11-13 19:37:38 +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
Dmitry Stogov 71daef93bc preg_replace() optimization 2017-06-07 13:50:16 +03: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 b11383fbde revert year change on bundled lib files 2017-01-05 23:26:20 +01:00
Anatol Belski 8892783649 add missing condition 2017-01-05 23:16:09 +01:00
Sammy Kaye Powers 9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Anatol Belski 5f4699c0ca fix c/p mistake 2016-11-24 16:41:57 +01:00
Anatol Belski 0e9912dc6f maintain patch level 2016-11-24 14:56:30 +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 e6bb7eb3aa Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix borked mainstream patch
  5.5.35 now
2016-03-31 01:38:22 +02:00
Anatol Belski a00c2b1bf5 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  fix borked mainstream patch
  5.5.35 now
2016-03-31 01:36:47 +02:00
Anatol Belski 4b0b1cec00 fix borked mainstream patch 2016-03-31 01:33:38 +02:00
Anatol Belski 84990ab346 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed bug #71527 Buffer over-write in finfo_open with malformed magic file
2016-03-29 13:11:17 +02:00
Anatol Belski fe13566c93 Fixed bug #71527 Buffer over-write in finfo_open with malformed magic file
The actual fix is applying the upstream patch from
https://github.com/file/file/commit/6713ca45e7757297381f4b4cdb9cf5e624a9ad36
2016-03-29 13:10:39 +02:00
Anatol Belski e93c6910fc Fixed bug #71527 Buffer over-write in finfo_open with malformed magic file
The actual fix is applying the upstream patch from
https://github.com/file/file/commit/6713ca45e7757297381f4b4cdb9cf5e624a9ad36
2016-03-28 00:45:19 +02:00
Xinchen Hui 4cb47bd3bd Fixed compiler warnings 2016-01-25 11:45:14 +08:00
Xinchen Hui da7f42de38 Fixed bug #71434 (finfo throws notice for specific python file) 2016-01-25 11:40:08 +08:00
Xinchen Hui a458a4fdc1 Fixed bug #7143 (finfo throws notice for specific python file)
There seems be a bug while it was changed from regexec to
preg_match_impl:
https://github.com/php/php-src/commit/46906925#diff-56e765972d18c84894ea061cfe58076aR1757
2016-01-25 11:24:44 +08:00
Dmitry Stogov 4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Dmitry Stogov 753fa0c593 Partial revert of 1a7798c786 that introduced wrong memory access 2015-04-14 15:35:33 +03:00