mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-09 02:00:49 +00:00
Compare commits
399
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
621007164e | ||
|
|
da5321013c | ||
|
|
f1acac154a | ||
|
|
0a21b5d970 | ||
|
|
ee61c7175f | ||
|
|
51f9a00b47 | ||
|
|
dda81f0505 | ||
|
|
0e09009753 | ||
|
|
4d2278143a | ||
|
|
863bf294fe | ||
|
|
7381b6accc | ||
|
|
c7d3c027d5 | ||
|
|
c2e197e4ef | ||
|
|
7fc04937f5 | ||
|
|
8f1baa6e1c | ||
|
|
16023f3e3b | ||
|
|
7a4584d3f6 | ||
|
|
b7fa67742c | ||
|
|
e488690d95 | ||
|
|
c96d08b272 | ||
|
|
496f291f3d | ||
|
|
885edfef0a | ||
|
|
c8157619ef | ||
|
|
97aa752fee | ||
|
|
6dedeb40db | ||
|
|
bf58162ddf | ||
|
|
29533ae528 | ||
|
|
cd9c39d77c | ||
|
|
921544cad9 | ||
|
|
a621781fdb | ||
|
|
fdb580a5ad | ||
|
|
d263ecd864 | ||
|
|
dacea3f6fb | ||
|
|
cc7194dd10 | ||
|
|
5f67caad54 | ||
|
|
7f4e1a0eef | ||
|
|
f1ffb4b1ad | ||
|
|
9d168b863e | ||
|
|
eee8b6c33f | ||
|
|
539738c438 | ||
|
|
8036758491 | ||
|
|
f7d7befae8 | ||
|
|
531c306fe6 | ||
|
|
78d1228ef6 | ||
|
|
33a9f01d36 | ||
|
|
7ced40e24e | ||
|
|
4cc46b2a99 | ||
|
|
90a8ea9827 | ||
|
|
0765623d69 | ||
|
|
f38ca75a3c | ||
|
|
88aab478bf | ||
|
|
593c4b9b00 | ||
|
|
3ee3066bd0 | ||
|
|
f93d24aa67 | ||
|
|
4ceb7b46ad | ||
|
|
f473ea5464 | ||
|
|
2f83797a0c | ||
|
|
9c0813fd48 | ||
|
|
634aa0a2db | ||
|
|
ba1d9cc4b7 | ||
|
|
e2bbf0a2df | ||
|
|
c591f022f8 | ||
|
|
be9b2a95ad | ||
|
|
4605d536d2 | ||
|
|
c27f012b7a | ||
|
|
ac28329354 | ||
|
|
95fa727992 | ||
|
|
9c5c3ff022 | ||
|
|
23917b451b | ||
|
|
983f155e1c | ||
|
|
0d562a8f44 | ||
|
|
cee9722028 | ||
|
|
9af582bbe0 | ||
|
|
e10272c628 | ||
|
|
d3aeb8a204 | ||
|
|
ae46d1ce19 | ||
|
|
d734e75599 | ||
|
|
aa2eca2e48 | ||
|
|
f59b67ae50 | ||
|
|
ff70b40dc9 | ||
|
|
45facd15fb | ||
|
|
a643ccfb90 | ||
|
|
9bed19a1e0 | ||
|
|
d82d68742c | ||
|
|
1defbb25ed | ||
|
|
12d3bdee3d | ||
|
|
a894a8155f | ||
|
|
4435b9142f | ||
|
|
9faaee66fa | ||
|
|
0ea75af9be | ||
|
|
809610f5ea | ||
|
|
f938112c49 | ||
|
|
920a0afbf8 | ||
|
|
9a404df382 | ||
|
|
5ae20c6247 | ||
|
|
bd31cb7563 | ||
|
|
afbf725e73 | ||
|
|
caecd88237 | ||
|
|
75f40ae1f3 | ||
|
|
fe0ca2745f | ||
|
|
968fbc6acf | ||
|
|
fb83c76dee | ||
|
|
95b9c34f02 | ||
|
|
51856a76f8 | ||
|
|
4c3b73b6df | ||
|
|
ef8fc4b53d | ||
|
|
fb04dcf6db | ||
|
|
8b14d3052f | ||
|
|
646572d6d3 | ||
|
|
bfb669891e | ||
|
|
9ba4db5e5d | ||
|
|
1291d6bbee | ||
|
|
ef2db26c60 | ||
|
|
c8eaca013a | ||
|
|
0c136a2abd | ||
|
|
d5248f67b5 | ||
|
|
8584cc010a | ||
|
|
c17a17e44b | ||
|
|
c6a26cb39d | ||
|
|
24f8a68d0a | ||
|
|
bdfe457a2c | ||
|
|
7b18981830 | ||
|
|
82d347a477 | ||
|
|
8f9ab04d93 | ||
|
|
e08bef442c | ||
|
|
5b6269a253 | ||
|
|
a8722f5330 | ||
|
|
5e3f0f5671 | ||
|
|
f001c63073 | ||
|
|
7efbd70b03 | ||
|
|
94d6cb4a78 | ||
|
|
b30a6d6018 | ||
|
|
2cdbd3537f | ||
|
|
0f9c708229 | ||
|
|
61ad5e24ea | ||
|
|
b3b155ffe2 | ||
|
|
547f62ed2a | ||
|
|
ef4896d956 | ||
|
|
8825311ce1 | ||
|
|
e63f7b47e1 | ||
|
|
fc6aa939f5 | ||
|
|
0a76610459 | ||
|
|
e2fe8e164f | ||
|
|
2fc178cf44 | ||
|
|
ebb98e7aeb | ||
|
|
ede59c8feb | ||
|
|
919abf0cb1 | ||
|
|
b585a3aed7 | ||
|
|
f9ad308669 | ||
|
|
cd387b4575 | ||
|
|
8fe4cc6d28 | ||
|
|
53f129a44d | ||
|
|
b75867fff0 | ||
|
|
630f9c33c2 | ||
|
|
034e6decb3 | ||
|
|
97df260b27 | ||
|
|
0323f66fa2 | ||
|
|
13f1c276ab | ||
|
|
dd791cd717 | ||
|
|
0e985d3726 | ||
|
|
b28c3eb47e | ||
|
|
84be568366 | ||
|
|
301b7f990a | ||
|
|
7e870c596d | ||
|
|
2d9d10fbbf | ||
|
|
29f51e1ca9 | ||
|
|
7dbc5e5c69 | ||
|
|
96cde1841a | ||
|
|
9fb816f45a | ||
|
|
98b22864ff | ||
|
|
2323e95df9 | ||
|
|
db5ad4c51f | ||
|
|
9dfa843a38 | ||
|
|
0ddcf2a919 | ||
|
|
7740edae36 | ||
|
|
c351b47ce8 | ||
|
|
1a2ec3fc60 | ||
|
|
4d54c4bdf0 | ||
|
|
de4fff0fb3 | ||
|
|
1803228597 | ||
|
|
287c91c1f0 | ||
|
|
ab0939e5e5 | ||
|
|
56754a7f9e | ||
|
|
88412772d2 | ||
|
|
82b07b62c0 | ||
|
|
26ff3a4c1e | ||
|
|
4e7b31a0db | ||
|
|
fcbe20d357 | ||
|
|
2711948d14 | ||
|
|
16e2d954fc | ||
|
|
28ed0119ac | ||
|
|
408b172017 | ||
|
|
e64da8c20d | ||
|
|
00525b824a | ||
|
|
2775dc2b44 | ||
|
|
372844918a | ||
|
|
f86b2193a4 | ||
|
|
99f0760bfb | ||
|
|
d2e1a04b10 | ||
|
|
582f42b8d4 | ||
|
|
592df89027 | ||
|
|
5e95b61639 | ||
|
|
fe551c089a | ||
|
|
53fa6c5b6b | ||
|
|
30aceaf1a7 | ||
|
|
197095c29e | ||
|
|
e665a07ab9 | ||
|
|
b206b0e29d | ||
|
|
ee275e34c8 | ||
|
|
32be79dcfa | ||
|
|
52f35b984c | ||
|
|
bda1cc6946 | ||
|
|
cb41a7bad1 | ||
|
|
437612f656 | ||
|
|
54fbbded37 | ||
|
|
9185cfd539 | ||
|
|
20941b71aa | ||
|
|
276bead9c4 | ||
|
|
359bc0ee2f | ||
|
|
cbe1597b74 | ||
|
|
5a7039035c | ||
|
|
eb2360602e | ||
|
|
88c48a4b95 | ||
|
|
2fefae4771 | ||
|
|
2b10db8e10 | ||
|
|
706aefb781 | ||
|
|
529da0f74c | ||
|
|
1504f7d630 | ||
|
|
3f42f2f5d1 | ||
|
|
0407bdf252 | ||
|
|
7bfe9bf951 | ||
|
|
7ba1409a1a | ||
|
|
35f32637b0 | ||
|
|
eab42649ab | ||
|
|
b7cd099ae0 | ||
|
|
ad492ca932 | ||
|
|
481c4715d4 | ||
|
|
4e2c01617f | ||
|
|
c044164a96 | ||
|
|
aeb633543b | ||
|
|
7311087cf0 | ||
|
|
1355ea60cc | ||
|
|
5e338836ff | ||
|
|
32314f6b67 | ||
|
|
babeca356b | ||
|
|
1847cf10c1 | ||
|
|
f6896e4395 | ||
|
|
8c247af1fc | ||
|
|
daa1fb8ba6 | ||
|
|
39dd715382 | ||
|
|
84a4041ba4 | ||
|
|
1ff30fd88c | ||
|
|
6569db8808 | ||
|
|
7189039d65 | ||
|
|
7df4087b98 | ||
|
|
d72b943262 | ||
|
|
9444bc7997 | ||
|
|
547451796c | ||
|
|
65cf73c931 | ||
|
|
fd28010e20 | ||
|
|
e4ff7f2ee3 | ||
|
|
f59506cd27 | ||
|
|
d3b5ed0787 | ||
|
|
cf4753691d | ||
|
|
ae74549239 | ||
|
|
61ec9b5b0f | ||
|
|
eeaec70758 | ||
|
|
990ecc12fc | ||
|
|
0fe07a0e74 | ||
|
|
bff84d7c18 | ||
|
|
358aedc454 | ||
|
|
0a29e4731e | ||
|
|
12b2127b72 | ||
|
|
8b9719d8b9 | ||
|
|
b3466f862f | ||
|
|
da3add26cf | ||
|
|
ab6c1d21f9 | ||
|
|
65364fe7d0 | ||
|
|
00546bc9b7 | ||
|
|
3e167ba990 | ||
|
|
b4a4db467b | ||
|
|
d0a244f1f3 | ||
|
|
51c38a0997 | ||
|
|
61e0f8599d | ||
|
|
d491b2f916 | ||
|
|
71d3a69425 | ||
|
|
dc3a5d783f | ||
|
|
0678dc8d91 | ||
|
|
ad744263ca | ||
|
|
e946de29d2 | ||
|
|
1ffb7fddc2 | ||
|
|
c74efe1b2e | ||
|
|
b5051ff939 | ||
|
|
e2ba5c7987 | ||
|
|
8e9777a1f1 | ||
|
|
e644aad3f9 | ||
|
|
8ab4e2e90d | ||
|
|
b512adf78d | ||
|
|
2fe5bcbeb5 | ||
|
|
892def5f12 | ||
|
|
8d1d038509 | ||
|
|
6bd5a06894 | ||
|
|
ec002bd837 | ||
|
|
52de149ebc | ||
|
|
2326401fc1 | ||
|
|
7f527897fe | ||
|
|
d4b67896ec | ||
|
|
84605098bc | ||
|
|
ee1ab62763 | ||
|
|
d77ea459bd | ||
|
|
44be7b7f27 | ||
|
|
0335d2ef3e | ||
|
|
a0bb3fd679 | ||
|
|
eca037a51d | ||
|
|
f3230e3522 | ||
|
|
c5ccaf1d04 | ||
|
|
35b077f53e | ||
|
|
8044d0680b | ||
|
|
a8e0a623ec | ||
|
|
2dff153b23 | ||
|
|
f0a1e410a3 | ||
|
|
b3c6089111 | ||
|
|
ce2ad0df18 | ||
|
|
04821a1ee6 | ||
|
|
f25ff02b54 | ||
|
|
4fc0d46ae7 | ||
|
|
0baaf9fade | ||
|
|
ae313b6037 | ||
|
|
9f5cf7d41a | ||
|
|
02b661ecfc | ||
|
|
1f90dd3359 | ||
|
|
e7f36ba693 | ||
|
|
01a1c3067c | ||
|
|
1f46bec9ce | ||
|
|
e3df0c5f60 | ||
|
|
e2b0d97950 | ||
|
|
a34288fa1a | ||
|
|
b93ea59665 | ||
|
|
64e4261c9b | ||
|
|
0bf50a8302 | ||
|
|
d472434ea0 | ||
|
|
03214a2aef | ||
|
|
494034901e | ||
|
|
f8acf826c3 | ||
|
|
604de67b7d | ||
|
|
a7d1cad4c3 | ||
|
|
897b7b68cc | ||
|
|
6c8a570a96 | ||
|
|
716d2a3937 | ||
|
|
c5fec9e09d | ||
|
|
18989420b6 | ||
|
|
37a13d2df7 | ||
|
|
3cc6bd10ac | ||
|
|
5efda71e54 | ||
|
|
34e686c556 | ||
|
|
899fe3d8af | ||
|
|
6081dd781a | ||
|
|
af5f997a5d | ||
|
|
48df4464ea | ||
|
|
9c8b42960d | ||
|
|
a7d1656b96 | ||
|
|
cc22f021fe | ||
|
|
334758794d | ||
|
|
bf328b1681 | ||
|
|
a0ecb3794f | ||
|
|
2db96fea2d | ||
|
|
b23460063f | ||
|
|
ad9ed232e7 | ||
|
|
9d1d25e625 | ||
|
|
3488cf6fd8 | ||
|
|
08e7252abf | ||
|
|
c42d5cf5de | ||
|
|
680ddabac1 | ||
|
|
4106d48d1c | ||
|
|
945938d33c | ||
|
|
6f3bcb0d6e | ||
|
|
2d576c2a99 | ||
|
|
e667d23178 | ||
|
|
0a3979e08b | ||
|
|
4053dbe29f | ||
|
|
6c9c44905e | ||
|
|
a84a2d4ace | ||
|
|
d9432d6a50 | ||
|
|
85d3ac5763 | ||
|
|
ca29063da5 | ||
|
|
b053c4f4f6 | ||
|
|
3c328f0984 | ||
|
|
d780c2a673 | ||
|
|
d400b74296 | ||
|
|
08334293f8 | ||
|
|
ce70b920e4 | ||
|
|
b51f82f260 | ||
|
|
fe67674809 | ||
|
|
1b9cbab9a7 | ||
|
|
5f2a30e111 | ||
|
|
4f73394fdd | ||
|
|
317bcb96d0 | ||
|
|
979eed5c6b | ||
|
|
aee6344e24 |
No files matched your search
@@ -22,6 +22,10 @@ sapi/nsapi/nsapi.c ident
|
||||
sapi/continuity/capi.c ident
|
||||
Zend/RFCs/002.txt ident
|
||||
Zend/RFCs/003.txt ident
|
||||
ext/exif/exif.c ident
|
||||
ext/ldap/ldap.c ident
|
||||
ext/pdo_pgsql/pdo_pgsql.c ident
|
||||
ext/tidy/tidy.c ident
|
||||
NEWS merge=NEWS
|
||||
/ext/bz2/tests/with_strings.phpt -crlf
|
||||
/ext/dom/tests/bug40836.phpt -crlf
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*.tgz
|
||||
*.tar.gz
|
||||
*.tar.bz2
|
||||
*.tar.gz.asc
|
||||
*.tar.bz2.asc
|
||||
.FBCIndex
|
||||
.FBCLockFolder
|
||||
.deps
|
||||
|
||||
@@ -385,6 +385,12 @@ MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 4.0.4
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: hash
|
||||
PRIMARY MAINTAINER: Sara Golemon <pollita@php.net>, Mike Wallner <mike@php.net>, Anatol Belski <ab@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
STATUS: Working
|
||||
SINCE: 5.1.2
|
||||
-------------------------------------------------------------------------------
|
||||
EXTENSION: iconv
|
||||
PRIMARY MAINTAINER: Moriyoshi Koizumi <moriyoshi@php.net>
|
||||
MAINTENANCE: Maintained
|
||||
|
||||
@@ -1,5 +1,393 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
06 Aug 2015 PHP 5.4.44
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69793 (Remotely triggerable stack exhaustion via recursive
|
||||
method calls). (Stas)
|
||||
. Fixed bug #69892 (Different arrays compare indentical due to integer key
|
||||
truncation). (Nikita)
|
||||
. Fixed bug #70121 (unserialize() could lead to unexpected methods execution
|
||||
/ NULL pointer deref). (Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
|
||||
- Phar:
|
||||
. Improved fix for bug #69441. (Anatol Belski)
|
||||
. Fixed bug #70019 (Files extracted from archive may be placed outside of
|
||||
destination directory). (Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
|
||||
multiple type confusions). (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
|
||||
items). (sean.heelan)
|
||||
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
|
||||
SPLArrayObject). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
|
||||
09 Jul 2015 PHP 5.4.43
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69768 (escapeshell*() doesn't cater to !). (cmb)
|
||||
. Fixed bug #69874 (Can't set empty additional_headers for mail()), regression
|
||||
from fix to bug #68776. (Yasuo)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #69669 (mysqlnd is vulnerable to BACKRONYM) (CVE-2015-3152).
|
||||
(Andrey)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69958 (Segfault in Phar::convertToData on invalid file). (Stas)
|
||||
. Fixed bug #69923 (Buffer overflow and stack smashing error in
|
||||
phar_fix_filepath). (Stas)
|
||||
|
||||
11 Jun 2015 PHP 5.4.42
|
||||
|
||||
- Core:
|
||||
. Imroved fix for bug #69545 (Integer overflow in ftp_genlist() resulting in
|
||||
heap overflow). (CVE-2015-4643) (Max Spelsberg)
|
||||
. Fixed bug #69646 (OS command injection vulnerability in escapeshellarg).
|
||||
(CVE-2015-4642) (Anatol Belski)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (Stas)
|
||||
|
||||
- Litespeed SAPI:
|
||||
. Fixed bug #68812 (Unchecked return value). (George Wang)
|
||||
|
||||
- Mail:
|
||||
. Fixed bug #68776 (mail() does not have mail header injection prevention for
|
||||
additional headers). (Yasuo)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #69667 (segfault in php_pgsql_meta_data). (CVE-2015-4644) (Remi)
|
||||
|
||||
- Sqlite3:
|
||||
. Upgrade bundled sqlite to 3.8.10.2. (CVE-2015-3414, CVE-2015-3415,
|
||||
CVE-2015-3416) (Kaplan)
|
||||
|
||||
14 May 2015 PHP 5.4.41
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69364 (PHP Multipart/form-data remote dos Vulnerability).
|
||||
(CVE-2015-4024) (Stas)
|
||||
. Fixed bug #69403 (str_repeat() sign mismatch based memory corruption).
|
||||
(Stas)
|
||||
. Fixed bug #69418 (CVE-2006-7243 fix regressions in 5.4+). (CVE-2015-4025)
|
||||
(Stas)
|
||||
. Fixed bug #69522 (heap buffer overflow in unpack()). (Stas)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #69545 (Integer overflow in ftp_genlist() resulting in heap
|
||||
overflow). (CVE-2015-4022) (Stas)
|
||||
|
||||
- PCNTL:
|
||||
. Fixed bug #68598 (pcntl_exec() should not allow null char). (CVE-2015-4026)
|
||||
(Stas)
|
||||
|
||||
- PCRE
|
||||
. Upgraded pcrelib to 8.37. (CVE-2015-2325, CVE-2015-2326)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69453 (Memory Corruption in phar_parse_tarfile when entry
|
||||
filename starts with null). (CVE-2015-4021) (Stas)
|
||||
|
||||
16 Apr 2015 PHP 5.4.40
|
||||
|
||||
- Apache2handler:
|
||||
. Fixed bug #69218 (potential remote code execution with apache 2.4
|
||||
apache2handler). (CVE-2015-3330) (Gerrit Venema)
|
||||
|
||||
- Core:
|
||||
. Additional fix for bug #69152 (Type confusion vulnerability in
|
||||
exception::getTraceAsString). (Stas)
|
||||
. Fixed bug #69337 (php_stream_url_wrap_http_ex() type-confusion
|
||||
vulnerability). (Stas)
|
||||
. Fixed bug #69353 (Missing null byte checks for paths in various PHP
|
||||
extensions). (Stas)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #69316 (Use-after-free in php_curl related to
|
||||
CURLOPT_FILE/_INFILE/_WRITEHEADER). (Laruence)
|
||||
|
||||
- Ereg:
|
||||
. Fixed bug #68740 (NULL Pointer Dereference). (Laruence)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #68819 (Fileinfo on specific file causes spurious OOM and/or
|
||||
segfault). (Anatol Belski)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (CVE-2014-9709)
|
||||
(Remi)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #68901 (use after free). (CVE-2015-2301) (bugreports at internot
|
||||
dot info)
|
||||
. Fixed bug #69324 (Buffer Over-read in unserialize when parsing Phar).
|
||||
(CVE-2015-2783) (Stas)
|
||||
. Fixed bug #69441 (Buffer Overflow when parsing tar/zip/phar in
|
||||
phar_set_inode). (CVE-2015-3329) (Stas)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #68741 (Null pointer deference) (CVE-2015-1352). (Xinchen Hui)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69152 (Type Confusion Infoleak Vulnerability in unserialize()
|
||||
with SoapFault). (Dmitry)
|
||||
|
||||
- Sqlite3:
|
||||
. Fixed bug #66550 (SQLite prepared statement use-after-free). (Sean Heelan)
|
||||
|
||||
19 Mar 2015 PHP 5.4.39
|
||||
|
||||
- Core:
|
||||
. Fixed bug #68976 (Use After Free Vulnerability in unserialize())
|
||||
(CVE-2015-2787). (Stas)
|
||||
. Fixed bug #69134 (Per Directory Values overrides PHP_INI_SYSTEM
|
||||
configuration options). (Anatol Belski)
|
||||
. Fixed bug #69207 (move_uploaded_file allows nulls in path). (CVE-2015-2348)
|
||||
(Stas)
|
||||
|
||||
- Ereg:
|
||||
. Fixed bug #69248 (heap overflow vulnerability in regcomp.c) (CVE-2015-2305).
|
||||
(Stas)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #69085 (SoapClient's __call() type confusion through
|
||||
unserialize()). (Dmitry)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #69253 (ZIP Integer Overflow leads to writing past heap
|
||||
boundary) (CVE-2015-2331). (Stas)
|
||||
|
||||
19 Feb 2015 PHP 5.4.38
|
||||
|
||||
- Core:
|
||||
. Removed support for multi-line headers, as the are deprecated by RFC 7230.
|
||||
(Stas)
|
||||
. Added NULL byte protection to exec, system and passthru. (Yasuo)
|
||||
. Fixed bug #68925 (Mitigation for CVE-2015-0235 – GHOST: glibc gethostbyname
|
||||
buffer overflow). (Stas)
|
||||
. Fixed bug #67827 (broken detection of system crypt sha256/sha512 support).
|
||||
(ncopa at alpinelinux dot org)
|
||||
. Fixed bug #68942 (Use after free vulnerability in unserialize() with
|
||||
DateTimeZone). (CVE-2015-0273) (Stas)
|
||||
|
||||
- Enchant:
|
||||
. Fixed bug #68552 (heap buffer overflow in enchant_broker_request_dict()).
|
||||
(Antony)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #67427 (SoapServer cannot handle large messages)
|
||||
(brandt at docoloc dot de)
|
||||
|
||||
22 Jan 2015 PHP 5.4.37
|
||||
- Core:
|
||||
. Fixed bug #68710 (Use After Free Vulnerability in PHP's unserialize()).
|
||||
(CVE-2015-0231) (Stefan Esser)
|
||||
|
||||
- CGI:
|
||||
. Fixed bug #68618 (out of bounds read crashes php-cgi). (CVE-2014-9427)
|
||||
(Stas)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68799: Free called on unitialized pointer. (CVE-2015-0232)
|
||||
(Stas)
|
||||
|
||||
- Fileinfo:
|
||||
. Removed readelf.c and related code from libmagic sources
|
||||
(Remi, Anatol)
|
||||
. Fixed bug #68735 (fileinfo out-of-bounds memory access).
|
||||
(Anatol)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #55618 (use case-insensitive cert name matching).
|
||||
(Daniel Lowrey)
|
||||
|
||||
18 Dec 2014 PHP 5.4.36
|
||||
|
||||
- Core:
|
||||
. Upgraded crypt_blowfish to version 1.3. (Leigh)
|
||||
. Fixed bug #68545 (NULL pointer dereference in unserialize.c). (Anatol)
|
||||
. Fixed bug #68594 (Use after free vulnerability in unserialize()).
|
||||
(CVE-2014-8142) (Stefan Esser)
|
||||
|
||||
- Mcrypt:
|
||||
. Fixed possible read after end of buffer and use after free. (Dmitry)
|
||||
|
||||
13 Nov 2014 PHP 5.4.35
|
||||
|
||||
- Core:
|
||||
. Fixed bug #68365 (zend_mm_heap corrupted after memory overflow in
|
||||
zend_hash_copy). (Dmitry)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #68283 (fileinfo: out-of-bounds read in elf note headers).
|
||||
(CVE-2014-3710) (Remi)
|
||||
|
||||
- GMP:
|
||||
. Fixed bug #63595 (GMP memory management conflicts with other libraries
|
||||
using GMP). (Remi)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #66584 (Segmentation fault on statement deallocation) (Matteo)
|
||||
|
||||
16 Oct 2014, PHP 5.4.34
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #67985 (Incorrect last used array index copied to new array after
|
||||
unset). (Tjerk)
|
||||
. Fixed bug #68044 (Integer overflow in unserialize() (32-bits only)).
|
||||
(CVE-2014-3669) (Stas)
|
||||
|
||||
- cURL:
|
||||
. Fixed bug #68089 (NULL byte injection - cURL lib). (Stas)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #68113 (Heap corruption in exif_thumbnail()). (CVE-2014-3670)
|
||||
(Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Reverted fixes for bug #41631, due to regressions. (Stas)
|
||||
|
||||
- XMLRPC:
|
||||
. Fixed bug #68027 (Global buffer overflow in mkgmtime() function).
|
||||
(CVE-2014-3668) (Stas)
|
||||
|
||||
18 Sep 2014, PHP 5.4.33
|
||||
|
||||
- Core:
|
||||
. Fixed bug #47358 (glob returns error, should be empty array()). (Pierre)
|
||||
. Fixed bug #65463 (SIGSEGV during zend_shutdown()). (Keyur Govande)
|
||||
. Fixed bug #66036 (Crash on SIGTERM in apache process). (Keyur Govande)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #41631 (socket timeouts not honored in blocking SSL reads).
|
||||
(Daniel Lowrey)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66091 (memory leaks in DateTime constructor). (Tjerk)
|
||||
|
||||
- FPM:
|
||||
. Fixed #67606 (FPM with mod_fastcgi/apache2.4 is broken). (David Zuelke)
|
||||
|
||||
- GD:
|
||||
. Made fontFetch's path parser thread-safe. (Sara)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #67873 (Segfaults in php_wddx_serialize_var). (Anatol, Remi)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug #67724 (chained zlib filters silently fail with large amounts of
|
||||
data). (Mike)
|
||||
. Fixed bug #67865 (internal corruption phar error). (Mike)
|
||||
|
||||
21 Aug 2014, PHP 5.4.32
|
||||
|
||||
- COM:
|
||||
. Fixed missing type checks in com_event_sink. (Yussuf Khalil, Stas)
|
||||
. Fixed bug #41577 (DOTNET is successful once per server run).
|
||||
(Aidas Kasparas)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #67705 (extensive backtracking in rule regular expression).
|
||||
(CVE-2014-3538) (Remi)
|
||||
. Fixed bug #67716 (Segfault in cdf.c). (CVE-2014-3587) (Remi)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #66901 (php-gd 'c_color' NULL pointer dereference).
|
||||
(CVE-2014-2497). (Remi)
|
||||
. Fixed bug #67730 (Null byte injection possible with imagexxx functions).
|
||||
(CVE-2014-5120) (Ryan Mauger)
|
||||
|
||||
- LiteSpeed:
|
||||
. Updated LiteSpeed SAPI code from V5.5 to V6.6 (George Wang)
|
||||
|
||||
- Network:
|
||||
. Fixed bug #67717 (segfault in dns_get_record). (CVE-2014-3597) (Remi)
|
||||
|
||||
- Milter:
|
||||
. Fixed bug #67715 (php-milter does not build and crashes randomly). (Mike)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed missing type checks in OpenSSL options (Yussuf Khalil, Stas).
|
||||
|
||||
- Readline:
|
||||
. Fixed bug #55496 (Interactive mode doesn't force a newline before the
|
||||
prompt). (Bob, Johannes)
|
||||
. Fixed bug #67496 (Save command history when exiting interactive shell
|
||||
with control-c). (Dmitry Saprykin, Johannes)
|
||||
|
||||
- Sessions:
|
||||
. Fixed missing type checks in php_session_create_id. (Yussuf Khalil, Stas).
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #67539 (ArrayIterator use-after-free due to object change during
|
||||
sorting). (CVE-2014-4698) (research at insighti dot org, Laruence)
|
||||
. Fixed bug #67538 (SPL Iterators use-after-free). (CVE-2014-4670) (Laruence)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #67693 (incorrect push to the empty array) (Tjerk)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #60616 (odbc_fetch_into returns junk data at end of multi-byte
|
||||
char fields). (Keyur)
|
||||
|
||||
- MySQLi:
|
||||
. Fixed bug #67839 (mysqli does not handle 4-byte floats correctly). (Keyur)
|
||||
|
||||
24 Jul 2014, PHP 5.4.31
|
||||
|
||||
- Core:
|
||||
. Fixed bug #67428 (header('Location: foo') will override a 308-399 response
|
||||
code). (Adam)
|
||||
. Fixed bug #67436 (Autoloader isn't called if two method definitions don't
|
||||
match). (Bob)
|
||||
. Fixed bug #67091 (make install fails to install libphp5.so on FreeBSD 10.0).
|
||||
(Ferenc)
|
||||
. Fixed bug #67151 (strtr with empty array crashes). (Nikita)
|
||||
. Fixed bug #67407 (Windows 8.1/Server 2012 R2 reported as Windows 8/Server
|
||||
2012). (Christian Wenz)
|
||||
. Implemented FR #34407 (ucwords and Title Case). (Tjerk)
|
||||
|
||||
- CLI server:
|
||||
. Implemented FR #67429 (CLI server is missing some new HTTP response codes).
|
||||
(Adam)
|
||||
. Fixed bug #66830 (Empty header causes PHP built-in web server to hang).
|
||||
(Adam)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #67530 (error_log=syslog ignored). (Remi)
|
||||
. Fixed bug #67531 (syslog cannot be set in pool configuration). (Remi)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting).
|
||||
(Stas)
|
||||
|
||||
- pgsql:
|
||||
. Fixed bug #67550 (Error in code "form" instead of "from", pgsql.c, line 756),
|
||||
which affected builds against libpq < 7.3. (Adam)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #67587 (Redirection loop on nginx with FPM). (Christian Weiske)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #67430 (http:// wrapper doesn't follow 308 redirects). (Adam)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #66827 (Session raises E_NOTICE when session name variable is array).
|
||||
(Yasuo)
|
||||
|
||||
26 Jun 2014, PHP 5.4.30
|
||||
|
||||
- Core:
|
||||
@@ -7,7 +395,7 @@ PHP NEWS
|
||||
. Fixed bug #66622 (Closures do not correctly capture the late bound class
|
||||
(static::) in some cases). (Levi Morrison)
|
||||
. Fixed bug #67390 (insecure temporary file use in the configure script).
|
||||
(CVE-2014-3981) (Remi)
|
||||
(Remi) (CVE-2014-3981)
|
||||
. Fixed bug #67399 (putenv with empty variable may lead to crash). (Stas)
|
||||
. Fixed bug #67498 (phpinfo() Type Confusion Information Leak Vulnerability).
|
||||
(Stefan Esser)
|
||||
|
||||
+12
-8
@@ -12,7 +12,7 @@ Collaboration is a Good Thing(tm), and Git lets us do this. Thus, following
|
||||
some basic rules with regards to Git usage will::
|
||||
|
||||
a. Make everybody happier, especially those responsible for maintaining
|
||||
Git itself.
|
||||
PHP itself.
|
||||
|
||||
b. Keep the changes consistently well documented and easily trackable.
|
||||
|
||||
@@ -45,15 +45,16 @@ Currently we have the following branches in use::
|
||||
|
||||
master The active development branch.
|
||||
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is a current
|
||||
PHP-5.6 Is used to release the PHP 5.6.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is a current
|
||||
stable version and is open for bugfixes only.
|
||||
PHP-5.5 Is used to release the PHP 5.5.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
|
||||
PHP-5.3 Is used to release the PHP 5.3.x series. This is currently
|
||||
in extended support and open forsecurity fixes only. Triaged
|
||||
via security@php.net
|
||||
PHP-5.4 Is used to release the PHP 5.4.x series. This is an old
|
||||
stable version and is open for security fixes only.
|
||||
|
||||
PHP-5.3 This branch is closed.
|
||||
|
||||
PHP-5.2 This branch is closed.
|
||||
|
||||
@@ -61,9 +62,12 @@ Currently we have the following branches in use::
|
||||
|
||||
PHP-4.4 This branch is closed.
|
||||
|
||||
PHP-X.Y.Z These branches are used for the release managers for tagging
|
||||
the releases, hence they are closed to the general public.
|
||||
|
||||
The next few rules are more of a technical nature::
|
||||
|
||||
1. All changes should first go to the lowest branch (i.e. 5.3) and then
|
||||
1. All changes should first go to the lowest branch (i.e. 5.6) and then
|
||||
get merged up to all other branches. If a change is not needed for
|
||||
later branches (i.e. fixes for features which where dropped from later
|
||||
branches) an empty merge should be done.
|
||||
|
||||
+21
-10
@@ -183,11 +183,11 @@ last commit id to web/php.git, then, mirrors will now sync
|
||||
Getting the stable release announced
|
||||
------------------------------------
|
||||
|
||||
1. Run the bumpRelease script for phpweb on your local checkout
|
||||
1. Update phpweb/include/releases.inc with the old release info
|
||||
(updates the download archives)
|
||||
|
||||
a. ``php bin/bumpRelease 5`` to create the release file (releases/x_y_z.php)
|
||||
The release announcement file should list in detail security fixes and
|
||||
changes in behavior (whether due to a bug fix or not).
|
||||
a. You can run ``php bin/bumpRelease 5`` if you are making a release for the
|
||||
highest branch, otherwise you have to do this manually, see point 1.b
|
||||
|
||||
b. In case multiple PHP minor versions are in active development you have
|
||||
to manually copy the old information to include/releases.inc
|
||||
@@ -200,15 +200,18 @@ Getting the stable release announced
|
||||
|
||||
c. ``$PHP_X_MD5`` array and update all the md5 sums
|
||||
|
||||
d. set ``$PHP_X_RC`` to false!
|
||||
d. ``$PHP_X_SHA256`` array and update all the SHA256 sums
|
||||
|
||||
e. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
e. set ``$PHP_X_RC`` to false!
|
||||
|
||||
f. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
|
||||
|
||||
f. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
g. if the windows builds aren't ready yet prefix the "windows" key with a dot (".windows")
|
||||
|
||||
3. Update phpweb/include/releases.php with the old release info
|
||||
(updates the download archives)
|
||||
3. Create the release file (releases/x_y_z.php)
|
||||
Usually we use the same content as for point 6, but included in php template
|
||||
instead of the release xml.
|
||||
|
||||
4. Update php-qa/include/release-qa.php and add the next version as an QARELEASE
|
||||
(prepare for next RC)
|
||||
@@ -253,6 +256,9 @@ to upgrade.
|
||||
9. Wait an hour or two, then send a mail to php-announce@lists.php.net,
|
||||
php-general@lists.php.net and internals@lists.php.net with a text similar to
|
||||
http://news.php.net/php.internals/17222.
|
||||
Please make sure that the mail to php-announce@ is its own completely seperate email.
|
||||
This is to make sure that repiles to the announcement on php-general@ or internals@
|
||||
will not accidentally hit the php-announce@ mailinglist.
|
||||
|
||||
Re-releasing the same version (or -pl)
|
||||
--------------------------------------
|
||||
@@ -269,7 +275,9 @@ Re-releasing the same version (or -pl)
|
||||
|
||||
d. ``$PHP_X_MD5`` array and update all the md5 sums
|
||||
|
||||
e. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
e. ``$PHP_X_SHA256`` array and update all the SHA256 sums
|
||||
|
||||
f. Make sure there are no outdated "notes" or edited "date" keys in the
|
||||
``$RELEASES[X][$PHP_X_VERSION]["source"]`` array
|
||||
|
||||
3. Add a short notice to phpweb stating that there is a new release, and
|
||||
@@ -286,3 +294,6 @@ to upgrade.
|
||||
5. Wait an hour or two, then send a mail to php-announce@lists.php.net,
|
||||
php-general@lists.php.net and internals@lists.php.net with a text similar to
|
||||
the news entry.
|
||||
Please make sure that the mail to php-announce@ is its own completely seperate email.
|
||||
This is to make sure that repiles to the announcement on php-general@ or internals@
|
||||
will not accidentally hit the php-announce@ mailinglist.
|
||||
@@ -10,6 +10,7 @@ PHP 5.4 UPGRADE NOTES
|
||||
2. Changes to reserved words and classes
|
||||
3. Changes to engine behavior
|
||||
4. Changes to existing functions
|
||||
a. unserialize() change
|
||||
5. Changes to existing classes
|
||||
6. Changes to existing methods
|
||||
7. Deprecated Functionality
|
||||
@@ -311,7 +312,7 @@ PHP 5.4 UPGRADE NOTES
|
||||
to limit the amount of stack frames returned.
|
||||
|
||||
- Fixed crypt_blowfish handling of 8-bit characters. crypt() in Blowfish mode
|
||||
now supports hashes marked $2a$, $2x$, $2y$ and $2z$.
|
||||
now supports hashes marked $2a$, $2x$ and $2y$.
|
||||
|
||||
- mbstring now supports following encodings: Shift_JIS/UTF-8 Emoji,
|
||||
JIS X0213:2004 (Shift_JIS-2004, EUC-JP-2004, ISO-2022-JP-2004),
|
||||
@@ -350,8 +351,46 @@ PHP 5.4 UPGRADE NOTES
|
||||
- Since 5.4.7, ctor is always called when new user stream wrapper object is created.
|
||||
Before, it was called only when stream_open was called.
|
||||
|
||||
- Manipulated serialization strings for objects implementing Serializable by
|
||||
replacing "C:" with "O:" at the start will now produce an error.
|
||||
4a. unserialize() change
|
||||
------------------------
|
||||
|
||||
- Starting PHP 5.4.29, the bug fix for bug #67072 introduces a change to
|
||||
unserialize() function, detailed below:
|
||||
|
||||
If the string looking like 'O:..:"ClassName":...' is unserialized, and
|
||||
the class named is an internal class that declares custom unserializer
|
||||
function, or extends such class, unserialize would fail.
|
||||
|
||||
Using O: for user classes not extending internal classes (including
|
||||
those implementing Serializable) is still supported in 5.4, though
|
||||
it is deprecated and may not be supported in 5.6 for classes that do not
|
||||
originally serialize to O:. Same for using O: for internal classes
|
||||
implementing Serializable (like ArrayObject) and classes that extend
|
||||
them.
|
||||
|
||||
The reason for that is that O: format is meant to be used with classes
|
||||
that do not define custom handlers, and was never intended for the use
|
||||
with classes that do. When used with the class that relies on custom
|
||||
unserializer, it can leave the object of such internal class in an
|
||||
inconsistent state which has been observed to result in crashes and may
|
||||
also lead to memory corruption and ultimately even arbitrary code
|
||||
execution. This was never the intended use of unserializer, and mere
|
||||
possibility of doing this constitutes a bug, since the data passed to
|
||||
unserialize() is not a valid serialization of any object. Since there
|
||||
are many applications applying unserialize() to untrusted data, this
|
||||
presents a potential security vulnerability. Thus, keeping such bug in
|
||||
the code base was considered too dangerous.
|
||||
|
||||
We are aware that some applications use O: format as a way to
|
||||
instantiate classes. This was never the intended usage of serializer,
|
||||
and ReflectionClass methods such as newInstance or
|
||||
newInstanceWithoutConstructor can be used for that. We're working on
|
||||
providing more comprehensive solution for such use cases in PHP 5.6 and
|
||||
welcome the ideas in this area.
|
||||
|
||||
We note also that using unserialize() on any data that is not the result
|
||||
of serialize() call continues to be an unsupported scenario and should
|
||||
not be relied on to produce any specific result.
|
||||
|
||||
==============================
|
||||
5. Changes to existing classes
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
class a {
|
||||
public function test($arg = c::TESTCONSTANT) {
|
||||
echo __METHOD__ . "($arg)\n";
|
||||
}
|
||||
|
||||
static public function staticTest() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
class b extends a {
|
||||
public function test() {
|
||||
echo __METHOD__ . "()\n";
|
||||
parent::test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
bug67436: Autoloader isn't called if user defined error handler is present
|
||||
|
||||
--INI--
|
||||
error_reporting=
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($classname) {
|
||||
if (in_array($classname, array('a','b','c'))) {
|
||||
require_once ($classname . '.php');
|
||||
}
|
||||
});
|
||||
|
||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
||||
}, error_reporting());
|
||||
|
||||
a::staticTest();
|
||||
|
||||
$b = new b();
|
||||
$b->test();
|
||||
|
||||
--EXPECT--
|
||||
b::test()
|
||||
a::test(c::TESTCONSTANT)
|
||||
@@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
bug67436: E_STRICT instead of custom error handler
|
||||
|
||||
--INI--
|
||||
error_reporting=-1
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($classname) {
|
||||
if (in_array($classname, array('a','b','c'))) {
|
||||
require_once ($classname . '.php');
|
||||
}
|
||||
});
|
||||
|
||||
a::staticTest();
|
||||
|
||||
$b = new b();
|
||||
$b->test();
|
||||
|
||||
--EXPECTF--
|
||||
Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s/bug67436/b.php on line %d
|
||||
b::test()
|
||||
a::test(c::TESTCONSTANT)
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class c {
|
||||
const TESTCONSTANT = "c::TESTCONSTANT";
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #67985 - Last used array index not copied to new array at assignment
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = ['zero', 'one', 'two'];
|
||||
unset($a[2]);
|
||||
$b = $a;
|
||||
$a[] = 'three';
|
||||
$b[] = 'three';
|
||||
|
||||
var_dump($a === $b);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Bug #69892: Different arrays compare indentical due to integer key truncation
|
||||
--SKIPIF--
|
||||
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump([0 => 0] === [0x100000000 => 0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
|
||||
--FILE--
|
||||
<?php
|
||||
unserialize('O:12:"DateInterval":1:{s:4:"days";O:9:"Exception":7:{s:10:"'."\0".'*'."\0".'message";s:1:"x";s:17:"'."\0".'Exception'."\0".'string";s:1:"A";s:7:"'."\0".'*'."\0".'code";i:0;s:7:"'."\0".'*'."\0".'file";s:1:"a";s:7:"'."\0".'*'."\0".'line";i:1337;s:16:"'."\0".'Exception'."\0".'trace";a:0:{}s:19:"'."\0".'Exception'."\0".'previous";O:8:"stdClass":0:{}}}');
|
||||
?>
|
||||
OK
|
||||
--EXPECT--
|
||||
OK
|
||||
+14
@@ -813,6 +813,20 @@ void zend_shutdown(TSRMLS_D) /* {{{ */
|
||||
zend_shutdown_timeout_thread();
|
||||
#endif
|
||||
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
|
||||
|
||||
if (EG(active))
|
||||
{
|
||||
/*
|
||||
* The order of destruction is important here.
|
||||
* See bugs #65463 and 66036.
|
||||
*/
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
|
||||
zend_cleanup_internal_classes(TSRMLS_C);
|
||||
zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
|
||||
}
|
||||
|
||||
zend_destroy_modules();
|
||||
|
||||
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
|
||||
|
||||
+11
-11
@@ -980,7 +980,7 @@ static void zend_mm_random(unsigned char *buf, size_t size) /* {{{ */
|
||||
int has_context = 0;
|
||||
|
||||
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
|
||||
/* Could mean that the key container does not exist, let try
|
||||
/* Could mean that the key container does not exist, let try
|
||||
again by asking for a new one */
|
||||
if (GetLastError() == NTE_BAD_KEYSET) {
|
||||
if (CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
|
||||
@@ -1344,7 +1344,7 @@ static int zend_mm_check_ptr(zend_mm_heap *heap, void *ptr, int silent ZEND_FILE
|
||||
}
|
||||
if (!silent) {
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL TSRMLS_CC);
|
||||
zend_debug_alloc_output("---------------------------------------\n");
|
||||
zend_debug_alloc_output("%s(%d) : Block "PTR_FMT" status:\n" ZEND_FILE_LINE_RELAY_CC, ptr);
|
||||
@@ -2171,7 +2171,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
#if ZEND_MM_CACHE
|
||||
if (ZEND_MM_SMALL_SIZE(true_size)) {
|
||||
size_t index = ZEND_MM_BUCKET_INDEX(true_size);
|
||||
|
||||
|
||||
if (heap->cache[index] != NULL) {
|
||||
zend_mm_free_block *best_fit;
|
||||
zend_mm_free_block **cache;
|
||||
@@ -2184,7 +2184,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
|
||||
heap->cache[index] = best_fit->prev_free_block;
|
||||
ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
|
||||
ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
|
||||
|
||||
|
||||
ptr = ZEND_MM_DATA_OF(best_fit);
|
||||
|
||||
#if ZEND_DEBUG || ZEND_MM_HEAP_PROTECTION
|
||||
@@ -2466,7 +2466,7 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
|
||||
: "%0"(res),
|
||||
"rm"(size),
|
||||
"rm"(offset));
|
||||
|
||||
|
||||
if (UNEXPECTED(overflow)) {
|
||||
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
|
||||
return 0;
|
||||
@@ -2575,7 +2575,7 @@ ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LI
|
||||
|
||||
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
{
|
||||
int length;
|
||||
size_t length;
|
||||
char *p;
|
||||
#ifdef ZEND_SIGNALS
|
||||
TSRMLS_FETCH();
|
||||
@@ -2583,13 +2583,13 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
length = strlen(s)+1;
|
||||
p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
length = strlen(s);
|
||||
p = (char *) _emalloc(safe_address(length, 1, 1) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
memcpy(p, s, length);
|
||||
memcpy(p, s, length+1);
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
}
|
||||
@@ -2603,7 +2603,7 @@ ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
p = (char *) _emalloc(safe_address(length, 1, 1) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
@@ -2624,7 +2624,7 @@ ZEND_API char *zend_strndup(const char *s, uint length)
|
||||
|
||||
HANDLE_BLOCK_INTERRUPTIONS();
|
||||
|
||||
p = (char *) malloc(length+1);
|
||||
p = (char *) malloc(safe_address(length, 1, 1));
|
||||
if (UNEXPECTED(p == NULL)) {
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
return p;
|
||||
|
||||
+6
-3
@@ -3150,8 +3150,11 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
|
||||
*zv = *precv->op2.zv;
|
||||
zval_copy_ctor(zv);
|
||||
INIT_PZVAL(zv);
|
||||
zval_update_constant_ex(&zv, (void*)1, fptr->common.scope TSRMLS_CC);
|
||||
if (Z_TYPE_P(zv) == IS_BOOL) {
|
||||
if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
|
||||
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv));
|
||||
memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
|
||||
offset += Z_STRLEN_P(zv);
|
||||
} else if (Z_TYPE_P(zv) == IS_BOOL) {
|
||||
if (Z_LVAL_P(zv)) {
|
||||
memcpy(offset, "true", 4);
|
||||
offset += 4;
|
||||
@@ -3173,7 +3176,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
|
||||
*(offset++) = '.';
|
||||
}
|
||||
*(offset++) = '\'';
|
||||
} else if (Z_TYPE_P(zv) == IS_ARRAY) {
|
||||
} else if (Z_TYPE_P(zv) == IS_ARRAY || (Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_ARRAY) {
|
||||
memcpy(offset, "Array", 5);
|
||||
offset += 5;
|
||||
} else {
|
||||
|
||||
@@ -639,6 +639,8 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zend_function *function);
|
||||
|
||||
+42
-9
@@ -41,7 +41,7 @@ void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)
|
||||
if (exception == add_previous || !add_previous || !exception) {
|
||||
return;
|
||||
}
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
if (Z_TYPE_P(add_previous) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {
|
||||
zend_error(E_ERROR, "Cannot set non exception as previous exception");
|
||||
return;
|
||||
}
|
||||
@@ -218,6 +218,33 @@ ZEND_METHOD(exception, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto Exception::__wakeup()
|
||||
Exception unserialize checks */
|
||||
#define CHECK_EXC_TYPE(name, type) \
|
||||
value = zend_read_property(default_exception_ce, object, name, sizeof(name)-1, 0 TSRMLS_CC); \
|
||||
if(value && Z_TYPE_P(value) != type) { \
|
||||
zval *tmp; \
|
||||
MAKE_STD_ZVAL(tmp); \
|
||||
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
|
||||
Z_OBJ_HANDLER_P(object, unset_property)(object, tmp, 0 TSRMLS_CC); \
|
||||
zval_ptr_dtor(&tmp); \
|
||||
}
|
||||
|
||||
ZEND_METHOD(exception, __wakeup)
|
||||
{
|
||||
zval *value;
|
||||
zval *object = getThis();
|
||||
HashTable *intern_ht = zend_std_get_properties(getThis() TSRMLS_CC);
|
||||
CHECK_EXC_TYPE("message", IS_STRING);
|
||||
CHECK_EXC_TYPE("string", IS_STRING);
|
||||
CHECK_EXC_TYPE("code", IS_LONG);
|
||||
CHECK_EXC_TYPE("file", IS_STRING);
|
||||
CHECK_EXC_TYPE("line", IS_LONG);
|
||||
CHECK_EXC_TYPE("trace", IS_ARRAY);
|
||||
CHECK_EXC_TYPE("previous", IS_OBJECT);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto ErrorException::__construct(string message, int code, int severity [, string filename [, int lineno [, Exception previous]]])
|
||||
ErrorException constructor */
|
||||
ZEND_METHOD(error_exception, __construct)
|
||||
@@ -586,11 +613,15 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
int res_len = 0, *len = &res_len, num = 0;
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
if(Z_TYPE_P(trace) != IS_ARRAY) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
res = estrdup("");
|
||||
str = &res;
|
||||
|
||||
trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
|
||||
zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
|
||||
|
||||
s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
|
||||
@@ -598,8 +629,8 @@ ZEND_METHOD(exception, getTraceAsString)
|
||||
TRACE_APPEND_STRL(s_tmp, strlen(s_tmp));
|
||||
efree(s_tmp);
|
||||
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
res[res_len] = '\0';
|
||||
RETURN_STRINGL(res, res_len, 0);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -636,15 +667,15 @@ ZEND_METHOD(exception, __toString)
|
||||
int len = 0;
|
||||
zend_fcall_info fci;
|
||||
zval fname;
|
||||
|
||||
|
||||
DEFAULT_0_PARAMS;
|
||||
|
||||
|
||||
str = estrndup("", 0);
|
||||
|
||||
exception = getThis();
|
||||
ZVAL_STRINGL(&fname, "gettraceasstring", sizeof("gettraceasstring")-1, 1);
|
||||
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT) {
|
||||
while (exception && Z_TYPE_P(exception) == IS_OBJECT && instanceof_function(Z_OBJCE_P(exception), default_exception_ce TSRMLS_CC)) {
|
||||
prev_str = str;
|
||||
_default_exception_get_entry(exception, "message", sizeof("message")-1, &message TSRMLS_CC);
|
||||
_default_exception_get_entry(exception, "file", sizeof("file")-1, &file TSRMLS_CC);
|
||||
@@ -654,6 +685,7 @@ ZEND_METHOD(exception, __toString)
|
||||
convert_to_string(&file);
|
||||
convert_to_long(&line);
|
||||
|
||||
trace = NULL;
|
||||
fci.size = sizeof(fci);
|
||||
fci.function_table = &Z_OBJCE_P(exception)->function_table;
|
||||
fci.function_name = &fname;
|
||||
@@ -666,7 +698,7 @@ ZEND_METHOD(exception, __toString)
|
||||
|
||||
zend_call_function(&fci, NULL TSRMLS_CC);
|
||||
|
||||
if (Z_TYPE_P(trace) != IS_STRING) {
|
||||
if (trace && Z_TYPE_P(trace) != IS_STRING) {
|
||||
zval_ptr_dtor(&trace);
|
||||
trace = NULL;
|
||||
}
|
||||
@@ -723,6 +755,7 @@ ZEND_END_ARG_INFO()
|
||||
const static zend_function_entry default_exception_functions[] = {
|
||||
ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
|
||||
ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
|
||||
|
||||
@@ -108,7 +108,7 @@ static int clean_non_persistent_function(zend_function *function TSRMLS_DC) /* {
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
ZEND_API int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
|
||||
}
|
||||
|
||||
+2
-3
@@ -1513,11 +1513,10 @@ ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t co
|
||||
}
|
||||
if (ordered) {
|
||||
if (p1->nKeyLength==0 && p2->nKeyLength==0) { /* numeric indices */
|
||||
result = p1->h - p2->h;
|
||||
if (result!=0) {
|
||||
if (p1->h != p2->h) {
|
||||
HASH_UNPROTECT_RECURSION(ht1);
|
||||
HASH_UNPROTECT_RECURSION(ht2);
|
||||
return result;
|
||||
return p1->h > p2->h ? 1 : -1;
|
||||
}
|
||||
} else { /* string indices */
|
||||
result = p1->nKeyLength - p2->nKeyLength;
|
||||
|
||||
@@ -1264,14 +1264,19 @@ ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
|
||||
Z_STRVAL_P(result) = erealloc(Z_STRVAL_P(result), res_len+1);
|
||||
Z_STRVAL_P(result) = safe_erealloc(Z_STRVAL_P(result), res_len, 1, 1);
|
||||
|
||||
memcpy(Z_STRVAL_P(result)+Z_STRLEN_P(result), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
Z_STRVAL_P(result)[res_len]=0;
|
||||
Z_STRLEN_P(result) = res_len;
|
||||
} else {
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
char *buf = (char *) emalloc(length + 1);
|
||||
char *buf;
|
||||
|
||||
if (Z_STRLEN_P(op1) < 0 || Z_STRLEN_P(op2) < 0 || (int) (Z_STRLEN_P(op1) + Z_STRLEN_P(op2)) < 0) {
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
buf = (char *) safe_emalloc(length, 1, 1);
|
||||
|
||||
memcpy(buf, Z_STRVAL_P(op1), Z_STRLEN_P(op1));
|
||||
memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
@@ -2067,7 +2072,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) /* {{{ */
|
||||
} else if (ret2!=IS_DOUBLE) {
|
||||
if (oflow1) {
|
||||
ZVAL_LONG(result, oflow1);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
dval2 = (double) lval2;
|
||||
} else if (dval1 == dval2 && !zend_finite(dval1)) {
|
||||
|
||||
@@ -135,8 +135,9 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC)
|
||||
}
|
||||
ALLOC_HASHTABLE_REL(tmp_ht);
|
||||
zend_hash_init(tmp_ht, zend_hash_num_elements(original_ht), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
zvalue->value.ht = tmp_ht;
|
||||
zend_hash_copy(tmp_ht, original_ht, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
|
||||
tmp_ht->nNextFreeElement = original_ht->nNextFreeElement;
|
||||
}
|
||||
break;
|
||||
case IS_OBJECT:
|
||||
|
||||
@@ -1210,7 +1210,7 @@ function gen_vm($def, $skel) {
|
||||
fputs($f,"#define $op $code\n");
|
||||
}
|
||||
|
||||
fputs($f, "\n#endif");
|
||||
fputs($f, "\n#endif\n");
|
||||
fclose($f);
|
||||
echo "zend_vm_opcodes.h generated successfully.\n";
|
||||
|
||||
|
||||
@@ -165,4 +165,4 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
|
||||
#define ZEND_QM_ASSIGN_VAR 157
|
||||
#define ZEND_JMP_SET_VAR 158
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+1
-1
@@ -2800,7 +2800,7 @@ AC_DEFUN([PHP_DETECT_ICC],
|
||||
|
||||
dnl PHP_DETECT_SUNCC
|
||||
dnl Detect if the systems default compiler is suncc.
|
||||
dnl We also set some usefull CFLAGS if the user didn't set any
|
||||
dnl We also set some useful CFLAGS if the user didn't set any
|
||||
AC_DEFUN([PHP_DETECT_SUNCC],[
|
||||
SUNCC="no"
|
||||
AC_MSG_CHECKING([for suncc])
|
||||
|
||||
Vendored
-8
@@ -1532,10 +1532,6 @@ dgux*)
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
freebsd1*)
|
||||
dynamic_linker=no
|
||||
;;
|
||||
|
||||
freebsd* | dragonfly*)
|
||||
# DragonFly does not have aout. When/if they implement a new
|
||||
# versioning mechanism, adjust this.
|
||||
@@ -5842,10 +5838,6 @@ _LT_EOF
|
||||
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
|
||||
;;
|
||||
|
||||
freebsd1*)
|
||||
_LT_AC_TAGVAR(ld_shlibs, $1)=no
|
||||
;;
|
||||
|
||||
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
|
||||
# support. Future versions do this automatically, but an explicit c++rt0.o
|
||||
# does not break anything, and helps significantly (at the cost of a little
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=4
|
||||
PHP_RELEASE_VERSION=30
|
||||
PHP_RELEASE_VERSION=44
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
@@ -698,9 +698,9 @@ PHP_FUNCTION(com_event_sink)
|
||||
/* 0 => typelibname, 1 => dispname */
|
||||
zval **tmp;
|
||||
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS)
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 0, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING)
|
||||
typelibname = Z_STRVAL_PP(tmp);
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS)
|
||||
if (zend_hash_index_find(Z_ARRVAL_P(sink), 1, (void**)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING)
|
||||
dispname = Z_STRVAL_PP(tmp);
|
||||
} else if (sink != NULL) {
|
||||
convert_to_string(sink);
|
||||
|
||||
@@ -198,7 +198,8 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
IUnknown *unk = NULL;
|
||||
|
||||
php_com_initialize(TSRMLS_C);
|
||||
if (COMG(dotnet_runtime_stuff) == NULL) {
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
if (stuff == NULL) {
|
||||
hr = dotnet_init(&where TSRMLS_CC);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
@@ -210,9 +211,35 @@ PHP_FUNCTION(com_dotnet_create_instance)
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
}
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
|
||||
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
|
||||
} else if (stuff->dotnet_domain == NULL) {
|
||||
where = "ICorRuntimeHost_GetDefaultDomain";
|
||||
hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
char *err = php_win32_error_to_msg(hr);
|
||||
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
|
||||
if (err)
|
||||
LocalFree(err);
|
||||
php_com_throw_exception(hr, buf TSRMLS_CC);
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
|
||||
where = "QI: System._AppDomain";
|
||||
hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain);
|
||||
if (FAILED(hr)) {
|
||||
char buf[1024];
|
||||
char *err = php_win32_error_to_msg(hr);
|
||||
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
|
||||
if (err)
|
||||
LocalFree(err);
|
||||
php_com_throw_exception(hr, buf TSRMLS_CC);
|
||||
ZVAL_NULL(object);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
obj = CDNO_FETCH(object);
|
||||
|
||||
|
||||
+11
-1
@@ -10,7 +10,7 @@
|
||||
| http://www.php.net/license/3_01.txt |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you 6 copy immediately. |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Author: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
@@ -170,6 +170,12 @@ static int php_curl_option_url(php_curl *ch, const char *url, const int len TSRM
|
||||
#if LIBCURL_VERSION_NUM < 0x071100
|
||||
char *copystr = NULL;
|
||||
#endif
|
||||
|
||||
if (strlen(url) != len) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Curl option contains invalid characters (\\0)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Disable file:// if open_basedir are used */
|
||||
if (PG(open_basedir) && *PG(open_basedir)) {
|
||||
#if LIBCURL_VERSION_NUM >= 0x071304
|
||||
@@ -1045,6 +1051,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_WRITEFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1118,6 +1125,7 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
|
||||
if (error == FAILURE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION");
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
@@ -1194,6 +1202,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
|
||||
length = CURL_READFUNC_ABORT;
|
||||
#endif
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) == IS_STRING) {
|
||||
length = MIN((int) (size * nmemb), Z_STRLEN_P(retval_ptr));
|
||||
memcpy(data, Z_STRVAL_P(retval_ptr), length);
|
||||
@@ -1268,6 +1277,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the CURLOPT_HEADERFUNCTION");
|
||||
length = -1;
|
||||
} else if (retval_ptr) {
|
||||
_php_curl_verify_handlers(ch, 1 TSRMLS_CC);
|
||||
if (Z_TYPE_P(retval_ptr) != IS_LONG) {
|
||||
convert_to_long_ex(&retval_ptr);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68089 (NULL byte injection - cURL lib)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'skipif.inc';
|
||||
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$url = "file:///etc/passwd\0http://google.com";
|
||||
$ch = curl_init();
|
||||
var_dump(curl_setopt($ch, CURLOPT_URL, $url));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
|
||||
bool(false)
|
||||
Done
|
||||
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
Bug #69316: Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEADER
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
function hdr_callback($ch, $data) {
|
||||
// close the stream, causing the FILE structure to be free()'d
|
||||
if($GLOBALS['f_file']) {
|
||||
fclose($GLOBALS['f_file']); $GLOBALS['f_file'] = 0;
|
||||
|
||||
// cause an allocation of approx the same size as a FILE structure, size varies a bit depending on platform/libc
|
||||
$FILE_size = (PHP_INT_SIZE == 4 ? 0x160 : 0x238);
|
||||
curl_setopt($ch, CURLOPT_COOKIE, str_repeat("a", $FILE_size - 1));
|
||||
}
|
||||
return strlen($data);
|
||||
}
|
||||
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
|
||||
|
||||
$temp_file = dirname(__FILE__) . '/body.tmp';
|
||||
$url = "{$host}/get.php?test=getpost";
|
||||
$ch = curl_init();
|
||||
$f_file = fopen($temp_file, "w") or die("failed to open file\n");
|
||||
curl_setopt($ch, CURLOPT_BUFFERSIZE, 10);
|
||||
curl_setopt($ch, CURLOPT_HEADERFUNCTION, "hdr_callback");
|
||||
curl_setopt($ch, CURLOPT_FILE, $f_file);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
unlink(dirname(__FILE__) . '/body.tmp');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: curl_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d
|
||||
===DONE===
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
|
||||
if(false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
|
||||
if (php_sapi_name() != "cli") {
|
||||
die("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
|
||||
}
|
||||
}
|
||||
+12507
-12509
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -966,8 +966,8 @@ mssqltime = hour12 ":" minutelz ":" secondlz [:.] [0-9]+ meridian;
|
||||
isoweekday = year4 "-"? "W" weekofyear "-"? [0-7];
|
||||
isoweek = year4 "-"? "W" weekofyear;
|
||||
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
|
||||
firstdayof = 'first day of'?;
|
||||
lastdayof = 'last day of'?;
|
||||
firstdayof = 'first day of';
|
||||
lastdayof = 'last day of';
|
||||
backof = 'back of ' hour24 space? meridian?;
|
||||
frontof = 'front of ' hour24 space? meridian?;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2013 The PHP Group |
|
||||
| Copyright (c) 1997-2014 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1565
-1504
File diff suppressed because it is too large.
Load diff
+97
-85
@@ -50,7 +50,11 @@ static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i;
|
||||
int st = snprintf(s, len, "%lld", i); \
|
||||
s[st] = '\0'; \
|
||||
} while (0);
|
||||
#ifdef HAVE_ATOLL
|
||||
# define DATE_A64I(i, s) i = atoll(s)
|
||||
#else
|
||||
# define DATE_A64I(i, s) i = strtoll(s, NULL, 10)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* {{{ arginfo */
|
||||
@@ -544,7 +548,7 @@ static zend_object_handlers date_object_handlers_period;
|
||||
#define DATE_SET_CONTEXT \
|
||||
zval *object; \
|
||||
object = getThis(); \
|
||||
|
||||
|
||||
#define DATE_FETCH_OBJECT \
|
||||
php_date_obj *obj; \
|
||||
DATE_SET_CONTEXT; \
|
||||
@@ -711,7 +715,7 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* RFC2822, Section 3.3: http://www.ietf.org/rfc/rfc2822.txt
|
||||
* FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
|
||||
* CFWS = *([FWS] comment) (([FWS] comment) / FWS)
|
||||
*
|
||||
*
|
||||
* date-time = [ day-of-week "," ] date FWS time [CFWS]
|
||||
* day-of-week = ([FWS] day-name)
|
||||
* day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"
|
||||
@@ -733,19 +737,19 @@ PHP_RSHUTDOWN_FUNCTION(date)
|
||||
* date-fullyear = 4DIGIT
|
||||
* date-month = 2DIGIT ; 01-12
|
||||
* date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
|
||||
*
|
||||
*
|
||||
* time-hour = 2DIGIT ; 00-23
|
||||
* time-minute = 2DIGIT ; 00-59
|
||||
* time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
|
||||
*
|
||||
*
|
||||
* time-secfrac = "." 1*DIGIT
|
||||
* time-numoffset = ("+" / "-") time-hour ":" time-minute
|
||||
* time-offset = "Z" / time-numoffset
|
||||
*
|
||||
*
|
||||
* partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
|
||||
* full-date = date-fullyear "-" date-month "-" date-mday
|
||||
* full-time = partial-time time-offset
|
||||
*
|
||||
*
|
||||
* date-time = full-date "T" full-time
|
||||
*/
|
||||
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
|
||||
@@ -835,7 +839,7 @@ PHP_MSHUTDOWN_FUNCTION(date)
|
||||
PHP_MINFO_FUNCTION(date)
|
||||
{
|
||||
const timelib_tzdb *tzdb = DATE_TIMEZONEDB;
|
||||
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "date/time support", "enabled");
|
||||
php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version);
|
||||
@@ -987,8 +991,8 @@ char *php_date_full_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
return day_full_names[day_of_week];
|
||||
}
|
||||
|
||||
char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
@@ -996,8 +1000,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
|
||||
timelib_sll day_of_week = timelib_day_of_week(y, m, d);
|
||||
if (day_of_week < 0) {
|
||||
return "Unknown";
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
return day_short_names[day_of_week];
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1029,7 +1033,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = 0;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
localtime ? abs(offset->offset / 3600) : 0,
|
||||
localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1075,7 +1079,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break;
|
||||
case 'A': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "PM" : "AM"); break;
|
||||
case 'B': {
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
int retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1175,7 +1179,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
|
||||
}
|
||||
|
||||
string = php_format_date(format, format_len, ts, localtime TSRMLS_CC);
|
||||
|
||||
|
||||
RETVAL_STRING(string, 0);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1199,7 +1203,7 @@ PHPAPI char *php_format_date(char *format, int format_len, time_t ts, int localt
|
||||
}
|
||||
|
||||
string = date_format(format, format_len, t, localtime);
|
||||
|
||||
|
||||
timelib_time_dtor(t);
|
||||
return string;
|
||||
}
|
||||
@@ -1240,7 +1244,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
offset->leap_secs = 0;
|
||||
offset->is_dst = t->dst;
|
||||
offset->abbr = malloc(9); /* GMT�xxxx\0 */
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
snprintf(offset->abbr, 9, "GMT%c%02d%02d",
|
||||
!localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
|
||||
!localtime ? abs(offset->offset / 3600) : 0,
|
||||
!localtime ? abs((offset->offset % 3600) / 60) : 0 );
|
||||
@@ -1272,7 +1276,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
|
||||
/* Swatch Beat a.k.a. Internet Time */
|
||||
case 'B':
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
retval = (((((long)t->sse)-(((long)t->sse) - ((((long)t->sse) % 86400) + 3600))) * 10) / 864);
|
||||
while (retval < 0) {
|
||||
retval += 1000;
|
||||
}
|
||||
@@ -1324,7 +1328,7 @@ PHP_FUNCTION(idate)
|
||||
char *format;
|
||||
int format_len;
|
||||
long ts = 0;
|
||||
int ret;
|
||||
int ret;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &format, &format_len, &ts) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
@@ -1352,7 +1356,7 @@ PHP_FUNCTION(idate)
|
||||
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
|
||||
{
|
||||
const timelib_tzdb *builtin = timelib_builtin_db();
|
||||
|
||||
|
||||
if (php_version_compare(tzdb->version, builtin->version) > 0) {
|
||||
php_date_global_timezone_db = tzdb;
|
||||
php_date_global_timezone_db_enabled = 1;
|
||||
@@ -1424,7 +1428,7 @@ PHP_FUNCTION(strtotime)
|
||||
}
|
||||
|
||||
if (!time_len) {
|
||||
timelib_time_dtor(now);
|
||||
timelib_time_dtor(now);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1865,7 +1869,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data
|
||||
if (it_time->tz_info) {
|
||||
newdateobj->time->tz_info = it_time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
*data = &iterator->current;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2033,13 +2037,13 @@ static inline zend_object_value date_object_new_date_ex(zend_class_entry *class_
|
||||
if (ptr) {
|
||||
*ptr = intern;
|
||||
}
|
||||
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_date;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2053,12 +2057,12 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
php_date_obj *new_obj = NULL;
|
||||
php_date_obj *old_obj = (php_date_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_date_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->time) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
/* this should probably moved to a new `timelib_time *timelime_time_clone(timelib_time *)` */
|
||||
new_obj->time = timelib_time_ctor();
|
||||
*new_obj->time = *old_obj->time;
|
||||
@@ -2068,7 +2072,7 @@ static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC)
|
||||
if (old_obj->time->tz_info) {
|
||||
new_obj->time->tz_info = old_obj->time->tz_info;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2090,10 +2094,10 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
|
||||
if (!o2->time->sse_uptodate) {
|
||||
timelib_update_ts(o2->time, o2->time->tz_info);
|
||||
}
|
||||
|
||||
|
||||
return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2170,10 +2174,10 @@ static inline zend_object_value date_object_new_timezone_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_timezone;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2187,12 +2191,12 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
php_timezone_obj *new_obj = NULL;
|
||||
php_timezone_obj *old_obj = (php_timezone_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_timezone_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
if (!old_obj->initialized) {
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
|
||||
new_obj->type = old_obj->type;
|
||||
new_obj->initialized = 1;
|
||||
switch (new_obj->type) {
|
||||
@@ -2208,7 +2212,7 @@ static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC)
|
||||
new_obj->tzi.z.abbr = old_obj->tzi.z.abbr;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return new_ov;
|
||||
}
|
||||
|
||||
@@ -2225,10 +2229,10 @@ static inline zend_object_value date_object_new_interval_ex(zend_class_entry *cl
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_interval, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_interval;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2242,7 +2246,7 @@ static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC)
|
||||
php_interval_obj *new_obj = NULL;
|
||||
php_interval_obj *old_obj = (php_interval_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_interval_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2314,10 +2318,10 @@ static inline zend_object_value date_object_new_period_ex(zend_class_entry *clas
|
||||
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
object_properties_init(&intern->std, class_type);
|
||||
|
||||
|
||||
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_period, NULL TSRMLS_CC);
|
||||
retval.handlers = &date_object_handlers_period;
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -2331,7 +2335,7 @@ static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC)
|
||||
php_period_obj *new_obj = NULL;
|
||||
php_period_obj *old_obj = (php_period_obj *) zend_object_store_get_object(this_ptr TSRMLS_CC);
|
||||
zend_object_value new_ov = date_object_new_period_ex(old_obj->std.ce, &new_obj TSRMLS_CC);
|
||||
|
||||
|
||||
zend_objects_clone_members(&new_obj->std, new_ov, &old_obj->std, Z_OBJ_HANDLE_P(this_ptr) TSRMLS_CC);
|
||||
|
||||
/** FIX ME ADD CLONE STUFF **/
|
||||
@@ -2394,11 +2398,7 @@ static void date_object_free_storage_period(void *object TSRMLS_DC)
|
||||
/* Advanced Interface */
|
||||
PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
|
||||
{
|
||||
Z_TYPE_P(object) = IS_OBJECT;
|
||||
object_init_ex(object, pce);
|
||||
Z_SET_REFCOUNT_P(object, 1);
|
||||
Z_UNSET_ISREF_P(object);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -2421,7 +2421,7 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
|
||||
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
|
||||
char *new_abbr = NULL;
|
||||
timelib_sll new_offset;
|
||||
|
||||
|
||||
if (dateobj->time) {
|
||||
timelib_time_dtor(dateobj->time);
|
||||
}
|
||||
@@ -2506,14 +2506,19 @@ PHP_FUNCTION(date_create)
|
||||
zval *timezone_object = NULL;
|
||||
char *time_str = NULL;
|
||||
int time_str_len = 0;
|
||||
zval datetime_object;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sO!", &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
|
||||
php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
|
||||
zval_dtor(&datetime_object);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
zval *datetime_object_ptr = &datetime_object;
|
||||
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2526,14 +2531,19 @@ PHP_FUNCTION(date_create_from_format)
|
||||
zval *timezone_object = NULL;
|
||||
char *time_str = NULL, *format_str = NULL;
|
||||
int time_str_len = 0, format_str_len = 0;
|
||||
zval datetime_object;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &format_str, &format_str_len, &time_str, &time_str_len, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(return_value TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
|
||||
php_date_instantiate(date_ce_date, &datetime_object TSRMLS_CC);
|
||||
if (!php_date_initialize(zend_object_store_get_object(&datetime_object TSRMLS_CC), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
|
||||
zval_dtor(&datetime_object);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
zval *datetime_object_ptr = &datetime_object;
|
||||
RETVAL_ZVAL(datetime_object_ptr, 0, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -2556,7 +2566,7 @@ PHP_METHOD(DateTime, __construct)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
|
||||
static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht TSRMLS_DC)
|
||||
{
|
||||
zval **z_date = NULL;
|
||||
zval **z_timezone = NULL;
|
||||
@@ -2565,12 +2575,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
|
||||
timelib_tzinfo *tzi;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
if (zend_hash_find(myht, "date", 5, (void**) &z_date) == SUCCESS) {
|
||||
convert_to_string(*z_date);
|
||||
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
|
||||
convert_to_long(*z_timezone_type);
|
||||
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
|
||||
convert_to_string(*z_timezone);
|
||||
if (zend_hash_find(myht, "date", 5, (void**) &z_date) == SUCCESS && Z_TYPE_PP(z_date) == IS_STRING) {
|
||||
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS && Z_TYPE_PP(z_timezone_type) == IS_LONG) {
|
||||
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS && Z_TYPE_PP(z_timezone) == IS_STRING) {
|
||||
|
||||
switch (Z_LVAL_PP(z_timezone_type)) {
|
||||
case TIMELIB_ZONETYPE_OFFSET:
|
||||
@@ -2585,7 +2592,6 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
|
||||
|
||||
case TIMELIB_ZONETYPE_ID: {
|
||||
int ret;
|
||||
convert_to_string(*z_timezone);
|
||||
|
||||
tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
|
||||
|
||||
@@ -2626,7 +2632,7 @@ PHP_METHOD(DateTime, __set_state)
|
||||
|
||||
php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
|
||||
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
|
||||
php_error(E_ERROR, "Invalid serialization data for DateTime object");
|
||||
}
|
||||
}
|
||||
@@ -2644,7 +2650,7 @@ PHP_METHOD(DateTime, __wakeup)
|
||||
|
||||
myht = Z_OBJPROP_P(object);
|
||||
|
||||
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
|
||||
if (!php_date_initialize_from_hash(&dateobj, myht TSRMLS_CC)) {
|
||||
php_error(E_ERROR, "Invalid serialization data for DateTime object");
|
||||
}
|
||||
}
|
||||
@@ -2704,7 +2710,7 @@ void php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAMETERS, timelib_time *
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
|
||||
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
|
||||
|
||||
|
||||
if (parsed_time->f == -99999) {
|
||||
add_assoc_bool(return_value, "fraction", 0);
|
||||
} else {
|
||||
@@ -2771,7 +2777,7 @@ PHP_FUNCTION(date_parse)
|
||||
int date_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2790,7 +2796,7 @@ PHP_FUNCTION(date_parse_from_format)
|
||||
int date_len, format_len;
|
||||
struct timelib_error_container *error;
|
||||
timelib_time *parsed_time;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &format, &format_len, &date, &date_len) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3117,7 +3123,7 @@ PHP_FUNCTION(date_isodate_set)
|
||||
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
|
||||
dateobj->time->relative.d = timelib_daynr_from_weeknr(y, w, d);
|
||||
dateobj->time->have_relative = 1;
|
||||
|
||||
|
||||
timelib_update_ts(dateobj->time, NULL);
|
||||
|
||||
RETURN_ZVAL(object, 1, 0);
|
||||
@@ -3204,15 +3210,15 @@ PHP_FUNCTION(date_diff)
|
||||
static int timezone_initialize(timelib_tzinfo **tzi, /*const*/ char *tz TSRMLS_DC)
|
||||
{
|
||||
char *tzid;
|
||||
|
||||
|
||||
*tzi = NULL;
|
||||
|
||||
|
||||
if ((tzid = timelib_timezone_id_from_abbr(tz, -1, 0))) {
|
||||
*tzi = php_date_parse_tzfile(tzid, DATE_TIMEZONEDB TSRMLS_CC);
|
||||
} else {
|
||||
*tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
if (*tzi) {
|
||||
return SUCCESS;
|
||||
} else {
|
||||
@@ -3254,7 +3260,7 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
php_timezone_obj *tzobj;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
@@ -3481,7 +3487,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -3640,7 +3646,7 @@ PHP_METHOD(DateInterval, __construct)
|
||||
php_interval_obj *diobj;
|
||||
timelib_rel_time *reltime;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &interval_string, &interval_string_length) == SUCCESS) {
|
||||
if (date_interval_initialize(&reltime, interval_string, interval_string_length TSRMLS_CC) == SUCCESS) {
|
||||
@@ -3663,8 +3669,7 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
#define PHP_DATE_INTERVAL_READ_PROPERTY(element, member, itype, def) \
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_long(*z_arg); \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS && Z_TYPE_PP(z_arg) == IS_LONG) { \
|
||||
(*intobj)->diff->member = (itype)Z_LVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = (itype)def; \
|
||||
@@ -3675,8 +3680,15 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
|
||||
do { \
|
||||
zval **z_arg = NULL; \
|
||||
if (zend_hash_find(myht, element, strlen(element) + 1, (void**) &z_arg) == SUCCESS) { \
|
||||
convert_to_string(*z_arg); \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
if (Z_TYPE_PP(z_arg) == IS_STRING) { \
|
||||
DATE_A64I((*intobj)->diff->member, Z_STRVAL_PP(z_arg)); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_LONG || Z_TYPE_PP(z_arg) == IS_BOOL) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_LVAL_PP(z_arg); \
|
||||
} else if (Z_TYPE_PP(z_arg) == IS_DOUBLE) { \
|
||||
(*intobj)->diff->member = (timelib_sll)Z_DVAL_PP(z_arg); \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
} else { \
|
||||
(*intobj)->diff->member = -1LL; \
|
||||
} \
|
||||
@@ -3854,7 +3866,7 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
|
||||
struct timelib_error_container *errors;
|
||||
|
||||
timelib_strtointerval(format, format_length, &b, &e, &p, &r, &errors);
|
||||
|
||||
|
||||
if (errors->error_count > 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown or bad format (%s)", format);
|
||||
retval = FAILURE;
|
||||
@@ -3883,7 +3895,7 @@ PHP_METHOD(DatePeriod, __construct)
|
||||
int isostr_len = 0;
|
||||
timelib_time *clone;
|
||||
zend_error_handling error_handling;
|
||||
|
||||
|
||||
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_date, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
|
||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_date, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) {
|
||||
@@ -3996,7 +4008,7 @@ PHP_FUNCTION(timezone_identifiers_list)
|
||||
tzdb = DATE_TIMEZONEDB;
|
||||
item_count = tzdb->index_size;
|
||||
table = tzdb->index;
|
||||
|
||||
|
||||
array_init(return_value);
|
||||
|
||||
for (i = 0; i < item_count; ++i) {
|
||||
@@ -4030,7 +4042,7 @@ PHP_FUNCTION(timezone_abbreviations_list)
|
||||
{
|
||||
const timelib_tz_lookup_table *table, *entry;
|
||||
zval *element, **abbr_array_pp, *abbr_array;
|
||||
|
||||
|
||||
table = timelib_timezone_abbreviations_list();
|
||||
array_init(return_value);
|
||||
entry = table;
|
||||
@@ -4106,11 +4118,11 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_time *t;
|
||||
timelib_tzinfo *tzi;
|
||||
char *retstr;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ldddd", &time, &retformat, &latitude, &longitude, &zenith, &gmt_offset) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
retformat = SUNFUNCS_RET_STRING;
|
||||
@@ -4154,7 +4166,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
|
||||
timelib_unixtime2local(t, time);
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, 1, &h_rise, &h_set, &rise, &set, &transit);
|
||||
timelib_time_dtor(t);
|
||||
|
||||
|
||||
if (rs != 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4208,7 +4220,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
timelib_sll rise, set, transit;
|
||||
int dummy;
|
||||
double ddummy;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ldd", &time, &latitude, &longitude) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -4222,7 +4234,7 @@ PHP_FUNCTION(date_sun_info)
|
||||
/* Setup */
|
||||
t2 = timelib_time_ctor();
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
/* Get sun up/down and transit */
|
||||
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
|
||||
switch (rs) {
|
||||
@@ -4366,7 +4378,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
|
||||
ZVAL_NULL(zv);
|
||||
}
|
||||
zend_hash_update(props, "interval", sizeof("interval"), &zv, sizeof(zv), NULL);
|
||||
|
||||
|
||||
/* converted to larger type (int->long); must check when unserializing */
|
||||
MAKE_STD_ZVAL(zv);
|
||||
ZVAL_LONG(zv, (long) period_obj->recurrences);
|
||||
@@ -4448,7 +4460,7 @@ static int php_date_period_initialize_from_hash(php_period_obj *period_obj, Hash
|
||||
}
|
||||
|
||||
period_obj->initialized = 1;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -4465,7 +4477,7 @@ PHP_METHOD(DatePeriod, __set_state)
|
||||
}
|
||||
|
||||
myht = Z_ARRVAL_P(array);
|
||||
|
||||
|
||||
object_init_ex(return_value, date_ce_period);
|
||||
period_obj = zend_object_store_get_object(return_value TSRMLS_CC);
|
||||
if (!php_date_period_initialize_from_hash(period_obj, myht TSRMLS_CC)) {
|
||||
|
||||
@@ -95,18 +95,18 @@ result = Monday 2037-10-05 00:00:00 NZDT
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Australia/Adelaide
|
||||
ts = Friday 1971-01-01 17:17:17 CST
|
||||
result = Monday 1971-01-04 00:00:00 CST
|
||||
ts = Friday 1971-01-01 17:17:17 ACST
|
||||
result = Monday 1971-01-04 00:00:00 ACST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Australia/Darwin
|
||||
ts = Monday 1971-03-29 17:17:17 CST
|
||||
result = Monday 1971-04-05 00:00:00 CST
|
||||
ts = Monday 1971-03-29 17:17:17 ACST
|
||||
result = Monday 1971-04-05 00:00:00 ACST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
Australia/Perth
|
||||
ts = Friday 1971-01-01 17:17:17 WST
|
||||
result = Monday 1971-01-04 00:00:00 WST
|
||||
ts = Friday 1971-01-01 17:17:17 AWST
|
||||
result = Monday 1971-01-04 00:00:00 AWST
|
||||
wanted = Monday 00:00:00
|
||||
|
||||
America/Aruba
|
||||
|
||||
@@ -233,8 +233,8 @@ result=Saturday 1970-01-03 00:00:00 CAT 0
|
||||
wanted=Saturday 00:00:00
|
||||
|
||||
TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes
|
||||
tStamp=Thursday 1980-04-24 17:17:17 KAST 0
|
||||
result=Thursday 1980-05-01 03:00:00 CST 0
|
||||
tStamp=Thursday 1980-04-24 17:17:17 XJT 0
|
||||
result=Thursday 1980-05-01 00:00:00 XJT 0
|
||||
wanted=Thursday 03:00:00
|
||||
|
||||
TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does
|
||||
|
||||
@@ -39,5 +39,5 @@ datestr 10:00:00 AM July 1 2005 UTC
|
||||
|
||||
Setting TZ
|
||||
input 10:00:00 AM July 1 2005
|
||||
strftime 10:00:00 AM July 1 2005 EST +1000
|
||||
datestr 10:00:00 AM July 1 2005 EST
|
||||
strftime 10:00:00 AM July 1 2005 AEST +1000
|
||||
datestr 10:00:00 AM July 1 2005 AEST
|
||||
@@ -44,7 +44,7 @@ array(4) {
|
||||
|
||||
string(6) "Y-m-d+"
|
||||
string(19) "2001-11-29 13:20:01"
|
||||
object(DateTime)#2 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
@@ -70,7 +70,7 @@ array(4) {
|
||||
|
||||
string(7) "Y-m-d +"
|
||||
string(19) "2001-11-29 13:20:01"
|
||||
object(DateTime)#3 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
@@ -96,7 +96,7 @@ array(4) {
|
||||
|
||||
string(6) "Y-m-d+"
|
||||
string(10) "2001-11-29"
|
||||
object(DateTime)#2 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
@@ -139,7 +139,7 @@ array(4) {
|
||||
|
||||
string(7) "Y-m-d +"
|
||||
string(11) "2001-11-29 "
|
||||
object(DateTime)#2 (3) {
|
||||
object(DateTime)#%d (3) {
|
||||
["date"]=>
|
||||
string(26) "2001-11-29 %d:%d:%d.%d"
|
||||
["timezone_type"]=>
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(2)
|
||||
int(-1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(6)
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(8)
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
@@ -14,17 +14,17 @@ var_dump($di);
|
||||
--EXPECTF--
|
||||
object(DateInterval)#%d (15) {
|
||||
["y"]=>
|
||||
int(2)
|
||||
int(-1)
|
||||
["m"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["d"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["h"]=>
|
||||
int(6)
|
||||
int(-1)
|
||||
["i"]=>
|
||||
int(8)
|
||||
int(-1)
|
||||
["s"]=>
|
||||
int(0)
|
||||
int(-1)
|
||||
["weekday"]=>
|
||||
int(10)
|
||||
["weekday_behavior"]=>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
--TEST--
|
||||
Bug #68942 (Use after free vulnerability in unserialize() with DateTime).
|
||||
--FILE--
|
||||
<?php
|
||||
$data = unserialize('a:2:{i:0;O:8:"DateTime":3:{s:4:"date";s:26:"2000-01-01 00:00:00.000000";s:13:"timezone_type";a:2:{i:0;i:1;i:1;i:2;}s:8:"timezone";s:1:"A";}i:1;R:5;}');
|
||||
var_dump($data);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Invalid serialization data for DateTime object in %s/bug68942_2.php on line %d
|
||||
+74
-58
@@ -187,10 +187,10 @@ ZEND_END_ARG_INFO();
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
* class DOMDocument extends DOMNode
|
||||
* class DOMDocument extends DOMNode
|
||||
*
|
||||
* URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-i-Document
|
||||
* Since:
|
||||
* Since:
|
||||
*/
|
||||
|
||||
const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
|
||||
@@ -235,10 +235,10 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
/* {{{ docType DOMDocumentType
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-B63ED1A31
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -266,15 +266,15 @@ int dom_document_doctype_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
/* {{{ implementation DOMImplementation
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1B793EBA
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -285,10 +285,10 @@ int dom_document_implementation_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
/* {{{ documentElement DOMElement
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-87CD092
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
int dom_document_document_element_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
{
|
||||
@@ -391,8 +391,8 @@ int dom_document_encoding_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
/* {{{ standalone boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-standalone
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -455,7 +455,7 @@ int dom_document_standalone_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ version string
|
||||
/* {{{ version string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-version
|
||||
Since: DOM Level 3
|
||||
@@ -520,8 +520,8 @@ int dom_document_version_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
/* {{{ strictErrorChecking boolean
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-strictErrorChecking
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -565,7 +565,7 @@ int dom_document_strict_error_checking_write(dom_object *obj, zval *newval TSRML
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ formatOutput boolean
|
||||
/* {{{ formatOutput boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_format_output_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -607,7 +607,7 @@ int dom_document_format_output_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ validateOnParse boolean
|
||||
/* {{{ validateOnParse boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_validate_on_parse_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -649,7 +649,7 @@ int dom_document_validate_on_parse_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ resolveExternals boolean
|
||||
/* {{{ resolveExternals boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_resolve_externals_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -691,7 +691,7 @@ int dom_document_resolve_externals_write(dom_object *obj, zval *newval TSRMLS_DC
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
/* {{{ preserveWhiteSpace boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_preserve_whitespace_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -733,7 +733,7 @@ int dom_document_preserve_whitespace_write(dom_object *obj, zval *newval TSRMLS_
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ recover boolean
|
||||
/* {{{ recover boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_recover_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -775,7 +775,7 @@ int dom_document_recover_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ substituteEntities boolean
|
||||
/* {{{ substituteEntities boolean
|
||||
readonly=no
|
||||
*/
|
||||
int dom_document_substitue_entities_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
@@ -817,8 +817,8 @@ int dom_document_substitue_entities_write(dom_object *obj, zval *newval TSRMLS_D
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
/* {{{ documentURI string
|
||||
readonly=no
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-documentURI
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -881,8 +881,8 @@ int dom_document_document_uri_write(dom_object *obj, zval *newval TSRMLS_DC)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
/* {{{ config DOMConfiguration
|
||||
readonly=yes
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-config
|
||||
Since: DOM Level 3
|
||||
*/
|
||||
@@ -897,7 +897,7 @@ int dom_document_config_read(dom_object *obj, zval **retval TSRMLS_DC)
|
||||
|
||||
/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_element)
|
||||
{
|
||||
@@ -930,7 +930,7 @@ PHP_FUNCTION(dom_document_create_element)
|
||||
|
||||
/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment();
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_document_fragment)
|
||||
{
|
||||
@@ -957,7 +957,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
|
||||
|
||||
/* {{{ proto DOMText dom_document_create_text_node(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_text_node)
|
||||
{
|
||||
@@ -985,7 +985,7 @@ PHP_FUNCTION(dom_document_create_text_node)
|
||||
|
||||
/* {{{ proto DOMComment dom_document_create_comment(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_comment)
|
||||
{
|
||||
@@ -1013,7 +1013,7 @@ PHP_FUNCTION(dom_document_create_comment)
|
||||
|
||||
/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_cdatasection)
|
||||
{
|
||||
@@ -1041,7 +1041,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
|
||||
|
||||
/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_processing_instruction)
|
||||
{
|
||||
@@ -1076,7 +1076,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
|
||||
|
||||
/* {{{ proto DOMAttr dom_document_create_attribute(string name);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_attribute)
|
||||
{
|
||||
@@ -1110,7 +1110,7 @@ PHP_FUNCTION(dom_document_create_attribute)
|
||||
|
||||
/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_create_entity_reference)
|
||||
{
|
||||
@@ -1143,7 +1143,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
|
||||
|
||||
/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname);
|
||||
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
|
||||
Since:
|
||||
Since:
|
||||
*/
|
||||
PHP_FUNCTION(dom_document_get_elements_by_tag_name)
|
||||
{
|
||||
@@ -1177,7 +1177,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
xmlDocPtr docp;
|
||||
xmlNodePtr nodep, retnodep;
|
||||
dom_object *intern, *nodeobj;
|
||||
int ret;
|
||||
int ret;
|
||||
long recursive = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO|l", &id, dom_document_class_entry, &node, dom_node_class_entry, &recursive) == FAILURE) {
|
||||
@@ -1188,7 +1188,7 @@ PHP_FUNCTION(dom_document_import_node)
|
||||
|
||||
DOM_GET_OBJ(nodep, node, xmlNodePtr, nodeobj);
|
||||
|
||||
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|
||||
if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE
|
||||
|| nodep->type == XML_DOCUMENT_TYPE_NODE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot import: Node Type Not Supported");
|
||||
RETURN_FALSE;
|
||||
@@ -1278,7 +1278,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nodep->ns = nsptr;
|
||||
|
||||
DOM_RET_OBJ(nodep, &ret, intern);
|
||||
@@ -1580,11 +1580,15 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, int sourc
|
||||
xmlInitParser();
|
||||
|
||||
if (mode == DOM_LOAD_FILE) {
|
||||
char *file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
char *file_dest;
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
return NULL;
|
||||
}
|
||||
file_dest = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (file_dest) {
|
||||
ctxt = xmlCreateFileParserCtxt(file_dest);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
ctxt = xmlCreateMemoryParserCtxt(source, source_len);
|
||||
}
|
||||
@@ -1757,7 +1761,7 @@ PHP_FUNCTION(dom_document_save)
|
||||
char *file;
|
||||
long options = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &file, &file_len, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1906,7 +1910,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
zval *id;
|
||||
xmlDoc *docp;
|
||||
xmlNodePtr root;
|
||||
long flags = 0;
|
||||
long flags = 0;
|
||||
int err;
|
||||
dom_object *intern;
|
||||
|
||||
@@ -1919,7 +1923,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
err = xmlXIncludeProcessFlags(docp, flags);
|
||||
|
||||
/* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these
|
||||
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
|
||||
are added via xmlXIncludeProcess to mark beginning and ending of xincluded document
|
||||
but are not wanted in resulting document - must be done even if err as it could fail after
|
||||
having processed some xincludes */
|
||||
root = (xmlNodePtr) docp->children;
|
||||
@@ -1935,7 +1939,7 @@ PHP_FUNCTION(dom_document_xinclude)
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1956,19 +1960,19 @@ PHP_FUNCTION(dom_document_validate)
|
||||
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
|
||||
|
||||
cvp = xmlNewValidCtxt();
|
||||
|
||||
|
||||
cvp->userData = NULL;
|
||||
cvp->error = (xmlValidityErrorFunc) php_libxml_error_handler;
|
||||
cvp->warning = (xmlValidityErrorFunc) php_libxml_error_handler;
|
||||
|
||||
|
||||
if (xmlValidateDocument(cvp, docp)) {
|
||||
RETVAL_TRUE;
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
xmlFreeValidCtxt(cvp);
|
||||
|
||||
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1986,7 +1990,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
int is_valid;
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1999,6 +2003,10 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
|
||||
switch (type) {
|
||||
case DOM_LOAD_FILE:
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (!valid_file) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source");
|
||||
@@ -2008,7 +2016,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
|
||||
break;
|
||||
case DOM_LOAD_STRING:
|
||||
parser = xmlSchemaNewMemParserCtxt(source, source_len);
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
but it is not apparent how to do that for schema's */
|
||||
break;
|
||||
default:
|
||||
@@ -2075,7 +2083,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
int is_valid;
|
||||
char resolved_path[MAXPATHLEN + 1];
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2088,6 +2096,10 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
|
||||
switch (type) {
|
||||
case DOM_LOAD_FILE:
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
valid_file = _dom_get_valid_file_path(source, resolved_path, MAXPATHLEN TSRMLS_CC);
|
||||
if (!valid_file) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source");
|
||||
@@ -2097,7 +2109,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
|
||||
break;
|
||||
case DOM_LOAD_STRING:
|
||||
parser = xmlRelaxNGNewMemParserCtxt(source, source_len);
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
/* If loading from memory, we need to set the base directory for the document
|
||||
but it is not apparent how to do that for schema's */
|
||||
break;
|
||||
default:
|
||||
@@ -2165,7 +2177,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
int source_len, refcount, ret;
|
||||
long options = 0;
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
|
||||
id = getThis();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &source, &source_len, &options) == FAILURE) {
|
||||
@@ -2178,6 +2190,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
}
|
||||
|
||||
if (mode == DOM_LOAD_FILE) {
|
||||
if (CHECK_NULL_PATH(source, source_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid file source");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ctxt = htmlCreateFileParserCtxt(source, NULL);
|
||||
} else {
|
||||
source_len = xmlStrlen(source);
|
||||
@@ -2201,7 +2217,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
|
||||
htmlParseDocument(ctxt);
|
||||
newdoc = ctxt->myDoc;
|
||||
htmlFreeParserCtxt(ctxt);
|
||||
|
||||
|
||||
if (!newdoc)
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -2266,7 +2282,7 @@ PHP_FUNCTION(dom_document_save_html_file)
|
||||
char *file;
|
||||
const char *encoding;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2323,13 +2339,13 @@ PHP_FUNCTION(dom_document_save_html)
|
||||
php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
buf = xmlBufferCreate();
|
||||
if (!buf) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (node->type == XML_DOCUMENT_FRAG_NODE) {
|
||||
int one_size;
|
||||
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC
|
||||
value = null_value;
|
||||
} else if (Z_TYPE_P(value) == IS_OBJECT) {
|
||||
/* these are zvalues create on demand, with refcount and is_ref
|
||||
* status left in an uninitalized stated */
|
||||
* status left in an uninitialized stated */
|
||||
zval_dtor(value);
|
||||
efree(value);
|
||||
|
||||
|
||||
@@ -13,6 +13,11 @@ assert.bail=true
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("");
|
||||
assert('$result === false');
|
||||
$doc = new DOMDocument();
|
||||
$result = $doc->loadHTMLFile("text.html\0something");
|
||||
assert('$result === false');
|
||||
?>
|
||||
--EXPECTF--
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Empty string supplied as input %s
|
||||
|
||||
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): Invalid file source %s
|
||||
@@ -550,13 +550,12 @@ PHP_FUNCTION(enchant_broker_request_dict)
|
||||
|
||||
d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag);
|
||||
if (d) {
|
||||
pos = pbroker->dictcnt++;
|
||||
if (pbroker->dictcnt) {
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
pos = pbroker->dictcnt++;
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
|
||||
@@ -607,14 +606,14 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict)
|
||||
|
||||
d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl);
|
||||
if (d) {
|
||||
pos = pbroker->dictcnt++;
|
||||
if (pbroker->dictcnt) {
|
||||
pos = pbroker->dictcnt++;
|
||||
pbroker->dict = (enchant_dict **)erealloc(pbroker->dict, sizeof(enchant_dict *) * pbroker->dictcnt);
|
||||
} else {
|
||||
pbroker->dict = (enchant_dict **)emalloc(sizeof(enchant_dict *));
|
||||
pos = 0;
|
||||
pbroker->dictcnt++;
|
||||
}
|
||||
|
||||
dict = pbroker->dict[pos] = (enchant_dict *)emalloc(sizeof(enchant_dict));
|
||||
dict->id = pos;
|
||||
dict->pbroker = pbroker;
|
||||
|
||||
@@ -117,7 +117,15 @@ int cflags;
|
||||
(NC-1)*sizeof(cat_t));
|
||||
if (g == NULL)
|
||||
return(REG_ESPACE);
|
||||
p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
|
||||
{
|
||||
/* Patched for CERT Vulnerability Note VU#695940, Feb 2015. */
|
||||
size_t new_ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
|
||||
if (new_ssize < len || new_ssize > LONG_MAX / sizeof(sop)) {
|
||||
free((char *) g);
|
||||
return REG_INVARG;
|
||||
}
|
||||
p->ssize = new_ssize;
|
||||
}
|
||||
p->strip = (sop *)malloc(p->ssize * sizeof(sop));
|
||||
p->slen = 0;
|
||||
if (p->strip == NULL) {
|
||||
@@ -1276,6 +1284,10 @@ int c;
|
||||
register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
|
||||
register unsigned uc = (unsigned char)c;
|
||||
|
||||
if (!g->setbits) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
|
||||
if (col[uc] != 0)
|
||||
return(1);
|
||||
|
||||
@@ -9,7 +9,7 @@ Test eregi() function : basic functionality - confirm case insensitivity
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic funtionality of eregi()
|
||||
* Test basic functionality of eregi()
|
||||
*/
|
||||
|
||||
echo "*** Testing eregi() : basic functionality ***\n";
|
||||
|
||||
+3
-3
@@ -2426,11 +2426,11 @@ static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel
|
||||
data_ptr += 8;
|
||||
break;
|
||||
case TAG_FMT_SINGLE:
|
||||
memmove(data_ptr, &info_data->value.f, byte_count);
|
||||
memmove(data_ptr, &info_value->f, 4);
|
||||
data_ptr += 4;
|
||||
break;
|
||||
case TAG_FMT_DOUBLE:
|
||||
memmove(data_ptr, &info_data->value.d, byte_count);
|
||||
memmove(data_ptr, &info_value->d, 8);
|
||||
data_ptr += 8;
|
||||
break;
|
||||
}
|
||||
@@ -2702,7 +2702,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
|
||||
{
|
||||
xp_field->tag = tag;
|
||||
|
||||
xp_field->value = NULL;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
(unsigned char**)&xp_field->value,
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 368 B |
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #68113 (Heap corruption in exif_thumbnail())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded("exif") or die("skip need exif");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
|
||||
|
||||
Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
|
||||
bool(false)
|
||||
Done
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 735 B |
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
Bug #68799 (Free called on unitialized pointer)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
/*
|
||||
* Pollute the heap. Helps trigger bug. Sometimes not needed.
|
||||
*/
|
||||
class A {
|
||||
function __construct() {
|
||||
$a = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa';
|
||||
$this->a = $a . $a . $a . $a . $a . $a;
|
||||
}
|
||||
};
|
||||
|
||||
function doStuff ($limit) {
|
||||
|
||||
$a = new A;
|
||||
|
||||
$b = array();
|
||||
for ($i = 0; $i < $limit; $i++) {
|
||||
$b[$i] = clone $a;
|
||||
}
|
||||
|
||||
unset($a);
|
||||
|
||||
gc_collect_cycles();
|
||||
}
|
||||
|
||||
$iterations = 3;
|
||||
|
||||
doStuff($iterations);
|
||||
doStuff($iterations);
|
||||
|
||||
gc_collect_cycles();
|
||||
|
||||
print_r(exif_read_data(__DIR__.'/bug68799.jpg'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[FileName] => bug68799.jpg
|
||||
[FileDateTime] => %d
|
||||
[FileSize] => 735
|
||||
[FileType] => 2
|
||||
[MimeType] => image/jpeg
|
||||
[SectionsFound] => ANY_TAG, IFD0, WINXP
|
||||
[COMPUTED] => Array
|
||||
(
|
||||
[html] => width="1" height="1"
|
||||
[Height] => 1
|
||||
[Width] => 1
|
||||
[IsColor] => 1
|
||||
[ByteOrderMotorola] => 1
|
||||
)
|
||||
|
||||
[XResolution] => 96/1
|
||||
[YResolution] => 96/1
|
||||
[ResolutionUnit] => 2
|
||||
[Author] =>
|
||||
)
|
||||
@@ -11,7 +11,7 @@ if test "$PHP_FILEINFO" != "no"; then
|
||||
libmagic/cdf.c libmagic/cdf_time.c libmagic/compress.c \
|
||||
libmagic/encoding.c libmagic/fsmagic.c libmagic/funcs.c \
|
||||
libmagic/is_tar.c libmagic/magic.c libmagic/print.c \
|
||||
libmagic/readcdf.c libmagic/readelf.c libmagic/softmagic.c"
|
||||
libmagic/readcdf.c libmagic/softmagic.c"
|
||||
|
||||
PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic)
|
||||
PHP_ADD_BUILD_DIR($ext_builddir/libmagic)
|
||||
|
||||
@@ -8,7 +8,7 @@ if (PHP_FILEINFO != 'no') {
|
||||
cdf.c cdf_time.c compress.c \
|
||||
encoding.c fsmagic.c funcs.c \
|
||||
is_tar.c magic.c print.c \
|
||||
readcdf.c readelf.c softmagic.c";
|
||||
readcdf.c softmagic.c";
|
||||
|
||||
if (VCVERS < 1500) {
|
||||
ADD_FLAG('CFLAGS', '/Zm1000');
|
||||
|
||||
@@ -115198,7 +115198,7 @@ const unsigned char php_magic_database[2606480] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x40, 0x00, 0x3D, 0x1B, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5E, 0x5C, 0x73, 0x7B, 0x30, 0x2C, 0x31, 0x30, 0x30, 0x7D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x5C,
|
||||
0x73, 0x7B, 0x30, 0x2C, 0x31, 0x30, 0x30, 0x7D, 0x5B, 0x7B, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
@@ -506,6 +506,11 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
|
||||
RETVAL_FALSE;
|
||||
goto clean;
|
||||
}
|
||||
if (CHECK_NULL_PATH(buffer, buffer_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETVAL_FALSE;
|
||||
goto clean;
|
||||
}
|
||||
|
||||
wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
|
||||
|
||||
|
||||
+235
-325
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/apprentice.c Fri Apr 11 12:36:52 2014
|
||||
+++ libmagic/apprentice.c Sun Jan 4 17:02:29 2015
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -479,6 +479,15 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return NULL;
|
||||
}
|
||||
return map;
|
||||
@@ -1233,7 +1269,7 @@
|
||||
* the sign extension must have happened.
|
||||
*/
|
||||
case FILE_BYTE:
|
||||
- v = (char) v;
|
||||
+ v = (signed char) v;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
@@ -1500,7 +1536,7 @@
|
||||
if (me->cont_count == me->max_count) {
|
||||
struct magic *nm;
|
||||
@@ -833,7 +842,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/ascmagic.c Mon Mar 10 16:40:55 2014
|
||||
+++ libmagic/ascmagic.c Sun Jan 4 17:02:29 2015
|
||||
@@ -139,7 +139,7 @@
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
@@ -872,7 +881,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/cdf.c Tue May 27 22:22:35 2014
|
||||
+++ libmagic/cdf.c Sun Jan 4 17:02:29 2015
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -891,7 +900,25 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
@@ -296,7 +306,10 @@
|
||||
@@ -267,13 +277,15 @@
|
||||
{
|
||||
const char *b = (const char *)sst->sst_tab;
|
||||
const char *e = ((const char *)p) + tail;
|
||||
+ size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
|
||||
+ CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
|
||||
(void)&line;
|
||||
- if (e >= b && (size_t)(e - b) <= CDF_SEC_SIZE(h) * sst->sst_len)
|
||||
+ if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
|
||||
return 0;
|
||||
DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
|
||||
" > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
|
||||
SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
|
||||
- CDF_SEC_SIZE(h) * sst->sst_len, CDF_SEC_SIZE(h), sst->sst_len));
|
||||
+ ss * sst->sst_len, ss, sst->sst_len));
|
||||
errno = EFTYPE;
|
||||
return -1;
|
||||
}
|
||||
@@ -296,7 +308,10 @@
|
||||
if (info->i_fd == -1)
|
||||
return -1;
|
||||
|
||||
@@ -903,7 +930,59 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
return -1;
|
||||
|
||||
return (ssize_t)len;
|
||||
@@ -810,6 +823,10 @@
|
||||
@@ -352,10 +367,10 @@
|
||||
size_t ss = CDF_SHORT_SEC_SIZE(h);
|
||||
size_t pos = CDF_SHORT_SEC_POS(h, id);
|
||||
assert(ss == len);
|
||||
- if (pos > CDF_SEC_SIZE(h) * sst->sst_len) {
|
||||
+ if (pos + len > CDF_SEC_SIZE(h) * sst->sst_len) {
|
||||
DPRINTF(("Out of bounds read %" SIZE_T_FORMAT "u > %"
|
||||
SIZE_T_FORMAT "u\n",
|
||||
- pos, CDF_SEC_SIZE(h) * sst->sst_len));
|
||||
+ pos + len, CDF_SEC_SIZE(h) * sst->sst_len));
|
||||
return -1;
|
||||
}
|
||||
(void)memcpy(((char *)buf) + offs,
|
||||
@@ -455,7 +470,8 @@
|
||||
cdf_count_chain(const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
|
||||
{
|
||||
size_t i, j;
|
||||
- cdf_secid_t maxsector = (cdf_secid_t)(sat->sat_len * size);
|
||||
+ cdf_secid_t maxsector = (cdf_secid_t)((sat->sat_len * size)
|
||||
+ / sizeof(maxsector));
|
||||
|
||||
DPRINTF(("Chain:"));
|
||||
for (j = i = 0; sid >= 0; i++, j++) {
|
||||
@@ -465,8 +481,8 @@
|
||||
errno = EFTYPE;
|
||||
return (size_t)-1;
|
||||
}
|
||||
- if (sid > maxsector) {
|
||||
- DPRINTF(("Sector %d > %d\n", sid, maxsector));
|
||||
+ if (sid >= maxsector) {
|
||||
+ DPRINTF(("Sector %d >= %d\n", sid, maxsector));
|
||||
errno = EFTYPE;
|
||||
return (size_t)-1;
|
||||
}
|
||||
@@ -796,11 +812,15 @@
|
||||
if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
|
||||
goto out;
|
||||
for (i = 0; i < sh.sh_properties; i++) {
|
||||
- size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
|
||||
+ size_t ofs, tail = (i << 1) + 1;
|
||||
+ if (cdf_check_stream_offset(sst, h, p, tail * sizeof(uint32_t),
|
||||
+ __LINE__) == -1)
|
||||
+ goto out;
|
||||
+ ofs = CDF_GETUINT32(p, tail);
|
||||
q = (const uint8_t *)(const void *)
|
||||
((const char *)(const void *)p + ofs
|
||||
- 2 * sizeof(uint32_t));
|
||||
- if (q > e) {
|
||||
+ if (q < p || q > e) {
|
||||
DPRINTF(("Ran of the end %p > %p\n", q, e));
|
||||
goto out;
|
||||
}
|
||||
@@ -810,6 +830,10 @@
|
||||
i, inp[i].pi_id, inp[i].pi_type, q - p, offs));
|
||||
if (inp[i].pi_type & CDF_VECTOR) {
|
||||
nelements = CDF_GETUINT32(q, 1);
|
||||
@@ -914,7 +993,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
o = 2;
|
||||
} else {
|
||||
nelements = 1;
|
||||
@@ -884,7 +901,9 @@
|
||||
@@ -884,7 +908,9 @@
|
||||
}
|
||||
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
|
||||
nelements));
|
||||
@@ -925,7 +1004,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
uint32_t l = CDF_GETUINT32(q, o);
|
||||
inp[i].pi_str.s_len = l;
|
||||
inp[i].pi_str.s_buf = (const char *)
|
||||
@@ -929,7 +948,7 @@
|
||||
@@ -929,7 +955,7 @@
|
||||
cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
|
||||
{
|
||||
@@ -934,7 +1013,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
const cdf_summary_info_header_t *si =
|
||||
CAST(const cdf_summary_info_header_t *, sst->sst_tab);
|
||||
const cdf_section_declaration_t *sd =
|
||||
@@ -944,21 +963,13 @@
|
||||
@@ -944,21 +970,13 @@
|
||||
ssi->si_os = CDF_TOLE2(si->si_os);
|
||||
ssi->si_class = si->si_class;
|
||||
cdf_swap_class(&ssi->si_class);
|
||||
@@ -959,7 +1038,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1132,7 +1143,7 @@
|
||||
@@ -1132,7 +1150,7 @@
|
||||
cdf_directory_t *d;
|
||||
char name[__arraycount(d->d_name)];
|
||||
cdf_stream_t scn;
|
||||
@@ -968,7 +1047,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
|
||||
static const char *types[] = { "empty", "user storage",
|
||||
"user stream", "lockbytes", "property", "root storage" };
|
||||
@@ -1185,7 +1196,7 @@
|
||||
@@ -1185,7 +1203,7 @@
|
||||
cdf_dump_property_info(const cdf_property_info_t *info, size_t count)
|
||||
{
|
||||
cdf_timestamp_t tp;
|
||||
@@ -977,7 +1056,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
char buf[64];
|
||||
size_t i, j;
|
||||
|
||||
@@ -1229,7 +1240,11 @@
|
||||
@@ -1229,7 +1247,11 @@
|
||||
break;
|
||||
case CDF_FILETIME:
|
||||
tp = info[i].pi_tp;
|
||||
@@ -991,7 +1070,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
} else {
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf.h Mon Dec 2 15:25:29 2013
|
||||
+++ libmagic/cdf.h Sun Jan 4 17:02:29 2015
|
||||
@@ -35,10 +35,12 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -1034,7 +1113,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
void cdf_unpack_header(cdf_header_t *, char *);
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/cdf_time.c Mon Dec 2 15:25:29 2013
|
||||
+++ libmagic/cdf_time.c Sun Nov 9 19:16:18 2014
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
@@ -1094,7 +1173,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
static const char *ref = "Sat Apr 23 01:30:00 1977";
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c Sun Jan 6 21:35:43 2013
|
||||
+++ libmagic/compress.c Mon Dec 2 15:25:29 2013
|
||||
+++ libmagic/compress.c Sun Jan 4 17:02:29 2015
|
||||
@@ -32,6 +32,7 @@
|
||||
* uncompress(method, old, n, newch) - uncompress old into new,
|
||||
* using method, return sizeof new
|
||||
@@ -1257,7 +1336,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h Mon Feb 18 16:40:59 2013
|
||||
+++ libmagic/file.h Mon Mar 10 16:40:55 2014
|
||||
+++ libmagic/file.h Sun Jan 4 17:02:29 2015
|
||||
@@ -33,11 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1344,7 +1423,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
void *map; /* internal resources used by entry */
|
||||
struct mlist *next, *prev;
|
||||
};
|
||||
@@ -411,21 +413,18 @@
|
||||
@@ -411,21 +413,16 @@
|
||||
protected const char *file_fmttime(uint64_t, int, char *);
|
||||
protected struct magic_set *file_ms_alloc(int);
|
||||
protected void file_ms_free(struct magic_set *);
|
||||
@@ -1361,8 +1440,8 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
- __attribute__((__format__(__printf__, 2, 3)));
|
||||
+protected int file_printf(struct magic_set *, const char *, ...);
|
||||
protected int file_reset(struct magic_set *);
|
||||
protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
-protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
- size_t);
|
||||
protected int file_trycdf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
-#if HAVE_FORK
|
||||
@@ -1370,7 +1449,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
protected int file_zmagic(struct magic_set *, int, const char *,
|
||||
const unsigned char *, size_t);
|
||||
#endif
|
||||
@@ -438,21 +437,18 @@
|
||||
@@ -438,21 +435,18 @@
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
@@ -1397,7 +1476,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
protected void file_showstr(FILE *, const char *, size_t);
|
||||
protected size_t file_mbswidth(const char *);
|
||||
protected const char *file_getbuffer(struct magic_set *);
|
||||
@@ -462,16 +458,14 @@
|
||||
@@ -462,16 +456,14 @@
|
||||
size_t *);
|
||||
protected size_t file_pstring_length_size(const struct magic *);
|
||||
protected size_t file_pstring_get_length(const struct magic *, const char *);
|
||||
@@ -1415,7 +1494,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
@@ -484,32 +478,16 @@
|
||||
@@ -484,32 +476,16 @@
|
||||
#define strtoul(a, b, c) strtol(a, b, c)
|
||||
#endif
|
||||
|
||||
@@ -1450,7 +1529,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
|
||||
#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) && !defined(QUICK)
|
||||
#define QUICK
|
||||
@@ -531,6 +509,14 @@
|
||||
@@ -531,6 +507,14 @@
|
||||
#endif
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
@@ -1467,7 +1546,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
#endif /* __file_h__ */
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/fsmagic.c Mon Dec 2 15:25:29 2013
|
||||
+++ libmagic/fsmagic.c Sun Jan 4 17:02:29 2015
|
||||
@@ -59,27 +59,21 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -1834,7 +1913,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
}
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/funcs.c Mon Mar 10 16:40:55 2014
|
||||
+++ libmagic/funcs.c Sun Jan 4 17:02:29 2015
|
||||
@@ -41,52 +41,42 @@
|
||||
#if defined(HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
@@ -2128,7 +2207,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
+
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c Fri Jan 11 17:43:09 2013
|
||||
+++ libmagic/magic.c Mon Dec 2 15:29:02 2013
|
||||
+++ libmagic/magic.c Sun Jan 4 17:02:29 2015
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -2472,7 +2551,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h Thu Mar 21 18:52:42 2013
|
||||
+++ libmagic/magic.h Mon Dec 2 15:25:29 2013
|
||||
+++ libmagic/magic.h Sun Jan 4 17:02:29 2015
|
||||
@@ -87,6 +87,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -2491,14 +2570,14 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/print.c Mon Dec 2 15:29:02 2013
|
||||
@@ -28,13 +28,17 @@
|
||||
/*
|
||||
+++ libmagic/print.c Sun Jan 4 17:02:29 2015
|
||||
@@ -29,12 +29,17 @@
|
||||
* print.c - debugging printout routines
|
||||
*/
|
||||
|
||||
+#define _GNU_SOURCE
|
||||
+#include "php.h"
|
||||
|
||||
+
|
||||
#include "file.h"
|
||||
+#include "cdf.h"
|
||||
|
||||
@@ -2510,7 +2589,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
@@ -43,188 +47,28 @@
|
||||
@@ -43,188 +48,28 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
@@ -2711,7 +2790,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
}
|
||||
|
||||
protected const char *
|
||||
@@ -235,7 +79,7 @@
|
||||
@@ -235,7 +80,7 @@
|
||||
struct tm *tm;
|
||||
|
||||
if (flags & FILE_T_WINDOWS) {
|
||||
@@ -2722,7 +2801,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
}
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c Wed Oct 31 18:03:01 2012
|
||||
+++ libmagic/readcdf.c Thu Apr 24 19:54:40 2014
|
||||
+++ libmagic/readcdf.c Sun Jan 4 17:02:29 2015
|
||||
@@ -30,7 +30,11 @@
|
||||
#endif
|
||||
|
||||
@@ -2796,282 +2875,9 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
} else {
|
||||
if (file_printf(ms, "application/CDFV2-corrupt") == -1)
|
||||
return -1;
|
||||
diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
--- libmagic.orig/readelf.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.c Mon Dec 2 15:25:29 2013
|
||||
@@ -48,8 +48,8 @@
|
||||
private int dophn_exec(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
off_t, int *, int);
|
||||
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
- off_t, int *, int, int);
|
||||
-private size_t donote(struct magic_set *, void *, size_t, size_t, int,
|
||||
+ off_t, int *, int);
|
||||
+private size_t donote(struct magic_set *, unsigned char *, size_t, size_t, int,
|
||||
int, size_t, int *);
|
||||
|
||||
#define ELF_ALIGN(a) ((((a) + align - 1) / align) * align)
|
||||
@@ -127,11 +127,17 @@
|
||||
|
||||
#define elf_getu16(swap, value) getu16(swap, value)
|
||||
#define elf_getu32(swap, value) getu32(swap, value)
|
||||
-#define elf_getu64(swap, value) getu64(swap, value)
|
||||
+#ifdef USE_ARRAY_FOR_64BIT_TYPES
|
||||
+# define elf_getu64(swap, array) \
|
||||
+ ((swap ? ((uint64_t)elf_getu32(swap, array[0])) << 32 : elf_getu32(swap, array[0])) + \
|
||||
+ (swap ? elf_getu32(swap, array[1]) : ((uint64_t)elf_getu32(swap, array[1]) << 32)))
|
||||
+#else
|
||||
+# define elf_getu64(swap, value) getu64(swap, value)
|
||||
+#endif
|
||||
|
||||
#define xsh_addr (clazz == ELFCLASS32 \
|
||||
- ? (void *)&sh32 \
|
||||
- : (void *)&sh64)
|
||||
+ ? (void *) &sh32 \
|
||||
+ : (void *) &sh64)
|
||||
#define xsh_sizeof (clazz == ELFCLASS32 \
|
||||
? sizeof(sh32) \
|
||||
: sizeof(sh64))
|
||||
@@ -168,8 +174,8 @@
|
||||
? elf_getu32(swap, ph32.p_filesz) \
|
||||
: elf_getu64(swap, ph64.p_filesz)))
|
||||
#define xnh_addr (clazz == ELFCLASS32 \
|
||||
- ? (void *)&nh32 \
|
||||
- : (void *)&nh64)
|
||||
+ ? (void *) &nh32 \
|
||||
+ : (void *) &nh64)
|
||||
#define xph_memsz (size_t)((clazz == ELFCLASS32 \
|
||||
? elf_getu32(swap, ph32.p_memsz) \
|
||||
: elf_getu64(swap, ph64.p_memsz)))
|
||||
@@ -189,8 +195,8 @@
|
||||
? prpsoffsets32[i] \
|
||||
: prpsoffsets64[i])
|
||||
#define xcap_addr (clazz == ELFCLASS32 \
|
||||
- ? (void *)&cap32 \
|
||||
- : (void *)&cap64)
|
||||
+ ? (void *) &cap32 \
|
||||
+ : (void *) &cap64)
|
||||
#define xcap_sizeof (clazz == ELFCLASS32 \
|
||||
? sizeof cap32 \
|
||||
: sizeof cap64)
|
||||
@@ -292,7 +298,7 @@
|
||||
{
|
||||
Elf32_Phdr ph32;
|
||||
Elf64_Phdr ph64;
|
||||
- size_t offset, len;
|
||||
+ size_t offset;
|
||||
unsigned char nbuf[BUFSIZ];
|
||||
ssize_t bufsize;
|
||||
|
||||
@@ -306,7 +312,11 @@
|
||||
* Loop through all the program headers.
|
||||
*/
|
||||
for ( ; num; num--) {
|
||||
- if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
|
||||
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (FINFO_READ_FUNC(fd, xph_addr, xph_sizeof) == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -324,8 +334,13 @@
|
||||
* This is a PT_NOTE section; loop through all the notes
|
||||
* in the section.
|
||||
*/
|
||||
- len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf);
|
||||
- if ((bufsize = pread(fd, nbuf, len, xph_offset)) == -1) {
|
||||
+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ bufsize = FINFO_READ_FUNC(fd, nbuf,
|
||||
+ ((xph_filesz < sizeof(nbuf)) ? xph_filesz : sizeof(nbuf)));
|
||||
+ if (bufsize == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -852,24 +867,12 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- /* Read offset of name section to be able to read section names later */
|
||||
- if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) == -1) {
|
||||
- file_badread(ms);
|
||||
- return -1;
|
||||
- }
|
||||
- name_off = xsh_offset;
|
||||
-
|
||||
for ( ; num; num--) {
|
||||
- /* Read the name of this section. */
|
||||
- if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) {
|
||||
- file_badread(ms);
|
||||
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
return -1;
|
||||
}
|
||||
- name[sizeof(name) - 1] = '\0';
|
||||
- if (strcmp(name, ".debug_info") == 0)
|
||||
- stripped = 0;
|
||||
-
|
||||
- if (pread(fd, xsh_addr, xsh_sizeof, off) == -1) {
|
||||
+ if (FINFO_READ_FUNC(fd, xsh_addr, xsh_sizeof) == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -894,14 +897,17 @@
|
||||
/* Things we can determine when we seek */
|
||||
switch (xsh_type) {
|
||||
case SHT_NOTE:
|
||||
- if ((nbuf = malloc(xsh_size)) == NULL) {
|
||||
- file_error(ms, errno, "Cannot allocate memory"
|
||||
- " for note");
|
||||
+ nbuf = emalloc((size_t)xsh_size);
|
||||
+ if ((noff = FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET)) ==
|
||||
+ (off_t)-1) {
|
||||
+ file_badread(ms);
|
||||
+ efree(nbuf);
|
||||
return -1;
|
||||
}
|
||||
- if (pread(fd, nbuf, xsh_size, xsh_offset) == -1) {
|
||||
+ if (FINFO_READ_FUNC(fd, nbuf, (size_t)xsh_size) !=
|
||||
+ (ssize_t)xsh_size) {
|
||||
+ efree(nbuf);
|
||||
file_badread(ms);
|
||||
- free(nbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -910,25 +916,16 @@
|
||||
if (noff >= (off_t)xsh_size)
|
||||
break;
|
||||
noff = donote(ms, nbuf, (size_t)noff,
|
||||
- xsh_size, clazz, swap, 4, flags);
|
||||
+ (size_t)xsh_size, clazz, swap, 4,
|
||||
+ flags);
|
||||
if (noff == 0)
|
||||
break;
|
||||
}
|
||||
- free(nbuf);
|
||||
+ efree(nbuf);
|
||||
break;
|
||||
case SHT_SUNW_cap:
|
||||
- switch (mach) {
|
||||
- case EM_SPARC:
|
||||
- case EM_SPARCV9:
|
||||
- case EM_IA_64:
|
||||
- case EM_386:
|
||||
- case EM_AMD64:
|
||||
- break;
|
||||
- default:
|
||||
- goto skip;
|
||||
- }
|
||||
-
|
||||
- if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) {
|
||||
+ if (FINFO_LSEEK_FUNC(fd, (off_t)xsh_offset, SEEK_SET) ==
|
||||
+ (off_t)-1) {
|
||||
file_badseek(ms);
|
||||
return -1;
|
||||
}
|
||||
@@ -940,7 +937,7 @@
|
||||
MAX(sizeof cap32, sizeof cap64)];
|
||||
if ((coff += xcap_sizeof) > (off_t)xsh_size)
|
||||
break;
|
||||
- if (read(fd, cbuf, (size_t)xcap_sizeof) !=
|
||||
+ if (FINFO_READ_FUNC(fd, cbuf, (size_t)xcap_sizeof) !=
|
||||
(ssize_t)xcap_sizeof) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
@@ -966,13 +963,12 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
- /*FALLTHROUGH*/
|
||||
- skip:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
-
|
||||
if (file_printf(ms, ", %sstripped", stripped ? "" : "not ") == -1)
|
||||
return -1;
|
||||
if (cap_hw1) {
|
||||
@@ -1051,7 +1047,7 @@
|
||||
const char *shared_libraries = "";
|
||||
unsigned char nbuf[BUFSIZ];
|
||||
ssize_t bufsize;
|
||||
- size_t offset, align, len;
|
||||
+ size_t offset, align;
|
||||
|
||||
if (size != xph_sizeof) {
|
||||
if (file_printf(ms, ", corrupted program header size") == -1)
|
||||
@@ -1060,8 +1056,13 @@
|
||||
}
|
||||
|
||||
for ( ; num; num--) {
|
||||
- if (pread(fd, xph_addr, xph_sizeof, off) == -1) {
|
||||
- file_badread(ms);
|
||||
+ if (FINFO_LSEEK_FUNC(fd, off, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (FINFO_READ_FUNC(fd, xph_addr, xph_sizeof) == -1) {
|
||||
+ file_badread(ms);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1099,9 +1100,12 @@
|
||||
* This is a PT_NOTE section; loop through all the notes
|
||||
* in the section.
|
||||
*/
|
||||
- len = xph_filesz < sizeof(nbuf) ? xph_filesz
|
||||
- : sizeof(nbuf);
|
||||
- bufsize = pread(fd, nbuf, len, xph_offset);
|
||||
+ if (FINFO_LSEEK_FUNC(fd, xph_offset, SEEK_SET) == (off_t)-1) {
|
||||
+ file_badseek(ms);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ bufsize = FINFO_READ_FUNC(fd, nbuf, ((xph_filesz < sizeof(nbuf)) ?
|
||||
+ xph_filesz : sizeof(nbuf)));
|
||||
if (bufsize == -1) {
|
||||
file_badread(ms);
|
||||
return -1;
|
||||
@@ -1162,7 +1166,7 @@
|
||||
/*
|
||||
* If we cannot seek, it must be a pipe, socket or fifo.
|
||||
*/
|
||||
- if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
|
||||
+ if((FINFO_LSEEK_FUNC(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
|
||||
fd = file_pipe2file(ms, fd, buf, nbytes);
|
||||
|
||||
if (fstat(fd, &st) == -1) {
|
||||
diff -u libmagic.orig/readelf.h libmagic/readelf.h
|
||||
--- libmagic.orig/readelf.h Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/readelf.h Mon Dec 2 15:25:29 2013
|
||||
@@ -44,9 +44,17 @@
|
||||
typedef uint32_t Elf32_Word;
|
||||
typedef uint8_t Elf32_Char;
|
||||
|
||||
+#if SIZEOF_LONG_LONG != 8
|
||||
+#define USE_ARRAY_FOR_64BIT_TYPES
|
||||
+typedef uint32_t Elf64_Addr[2];
|
||||
+typedef uint32_t Elf64_Off[2];
|
||||
+typedef uint32_t Elf64_Xword[2];
|
||||
+#else
|
||||
+#undef USE_ARRAY_FOR_64BIT_TYPES
|
||||
typedef uint64_t Elf64_Addr;
|
||||
typedef uint64_t Elf64_Off;
|
||||
typedef uint64_t Elf64_Xword;
|
||||
+#endif
|
||||
typedef uint16_t Elf64_Half;
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef uint8_t Elf64_Char;
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c Thu Mar 21 18:45:14 2013
|
||||
+++ libmagic/softmagic.c Mon Mar 10 16:40:55 2014
|
||||
+++ libmagic/softmagic.c Sun Jan 4 17:02:29 2015
|
||||
@@ -41,6 +41,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@@ -3084,6 +2890,15 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
|
||||
private int match(struct magic_set *, struct magic *, uint32_t,
|
||||
const unsigned char *, size_t, size_t, int, int, int, int, int *, int *,
|
||||
@@ -53,7 +58,7 @@
|
||||
private int32_t moffset(struct magic_set *, struct magic *);
|
||||
private void mdebug(uint32_t, const char *, size_t);
|
||||
private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
|
||||
- const unsigned char *, uint32_t, size_t, size_t);
|
||||
+ const unsigned char *, uint32_t, size_t, struct magic *);
|
||||
private int mconvert(struct magic_set *, struct magic *, int);
|
||||
private int print_sep(struct magic_set *, int);
|
||||
private int handle_annotation(struct magic_set *, struct magic *);
|
||||
@@ -62,6 +67,8 @@
|
||||
private void cvt_32(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
@@ -3221,9 +3036,97 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
break; \
|
||||
} \
|
||||
|
||||
@@ -1145,9 +1130,6 @@
|
||||
"nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
|
||||
nbytes, count);
|
||||
@@ -896,10 +881,21 @@
|
||||
return 1;
|
||||
}
|
||||
case FILE_PSTRING: {
|
||||
- char *ptr1 = p->s, *ptr2 = ptr1 + file_pstring_length_size(m);
|
||||
+ size_t sz = file_pstring_length_size(m);
|
||||
+ char *ptr1 = p->s, *ptr2 = ptr1 + sz;
|
||||
size_t len = file_pstring_get_length(m, ptr1);
|
||||
- if (len >= sizeof(p->s))
|
||||
- len = sizeof(p->s) - 1;
|
||||
+ sz = sizeof(p->s) - sz; /* maximum length of string */
|
||||
+ if (len >= sz) {
|
||||
+ /*
|
||||
+ * The size of the pascal string length (sz)
|
||||
+ * is 1, 2, or 4. We need at least 1 byte for NUL
|
||||
+ * termination, but we've already truncated the
|
||||
+ * string by p->s, so we need to deduct sz.
|
||||
+ * Because we can use one of the bytes of the length
|
||||
+ * after we shifted as NUL termination.
|
||||
+ */
|
||||
+ len = sz;
|
||||
+ }
|
||||
while (len--)
|
||||
*ptr1++ = *ptr2++;
|
||||
*ptr1 = '\0';
|
||||
@@ -1010,7 +1006,7 @@
|
||||
|
||||
private int
|
||||
mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
- const unsigned char *s, uint32_t offset, size_t nbytes, size_t linecnt)
|
||||
+ const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
|
||||
{
|
||||
/*
|
||||
* Note: FILE_SEARCH and FILE_REGEX do not actually copy
|
||||
@@ -1030,15 +1026,24 @@
|
||||
const char *last; /* end of search region */
|
||||
const char *buf; /* start of search region */
|
||||
const char *end;
|
||||
- size_t lines;
|
||||
+ size_t lines, linecnt, bytecnt;
|
||||
+
|
||||
+ linecnt = m->str_range;
|
||||
+ bytecnt = linecnt * 80;
|
||||
|
||||
+ if (bytecnt == 0) {
|
||||
+ bytecnt = 8192;
|
||||
+ }
|
||||
+ if (bytecnt > nbytes) {
|
||||
+ bytecnt = nbytes;
|
||||
+ }
|
||||
if (s == NULL) {
|
||||
ms->search.s_len = 0;
|
||||
ms->search.s = NULL;
|
||||
return 0;
|
||||
}
|
||||
buf = RCAST(const char *, s) + offset;
|
||||
- end = last = RCAST(const char *, s) + nbytes;
|
||||
+ end = last = RCAST(const char *, s) + bytecnt;
|
||||
/* mget() guarantees buf <= last */
|
||||
for (lines = linecnt, b = buf; lines && b < end &&
|
||||
((b = CAST(const char *,
|
||||
@@ -1051,7 +1056,7 @@
|
||||
b++;
|
||||
}
|
||||
if (lines)
|
||||
- last = RCAST(const char *, s) + nbytes;
|
||||
+ last = RCAST(const char *, s) + bytecnt;
|
||||
|
||||
ms->search.s = buf;
|
||||
ms->search.s_len = last - buf;
|
||||
@@ -1125,7 +1130,6 @@
|
||||
int *need_separator, int *returnval)
|
||||
{
|
||||
uint32_t soffset, offset = ms->offset;
|
||||
- uint32_t count = m->str_range;
|
||||
int rv, oneed_separator;
|
||||
char *sbuf, *rbuf;
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
@@ -1137,17 +1141,13 @@
|
||||
}
|
||||
|
||||
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
|
||||
- (uint32_t)nbytes, count) == -1)
|
||||
+ (uint32_t)nbytes, m) == -1)
|
||||
return -1;
|
||||
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, "
|
||||
- "nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
|
||||
- nbytes, count);
|
||||
+ "nbytes=%zu)\n", m->type, m->flag, offset, o, nbytes);
|
||||
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
|
||||
-#ifndef COMPILE_ONLY
|
||||
- file_mdump(m);
|
||||
@@ -3231,7 +3134,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
}
|
||||
|
||||
if (m->flag & INDIR) {
|
||||
@@ -1191,7 +1173,7 @@
|
||||
@@ -1191,7 +1191,7 @@
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
@@ -3240,7 +3143,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1226,7 +1208,7 @@
|
||||
@@ -1226,7 +1226,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
@@ -3249,7 +3152,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1278,7 +1260,7 @@
|
||||
@@ -1278,7 +1278,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
@@ -3258,7 +3161,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1330,7 +1312,7 @@
|
||||
@@ -1330,7 +1330,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
@@ -3267,7 +3170,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1367,7 +1349,7 @@
|
||||
@@ -1367,7 +1367,7 @@
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
@@ -3276,7 +3179,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1438,7 +1420,7 @@
|
||||
@@ -1438,7 +1438,7 @@
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
@@ -3285,7 +3188,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1508,7 +1490,7 @@
|
||||
@@ -1508,7 +1508,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
@@ -3294,7 +3197,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1578,7 +1560,7 @@
|
||||
@@ -1578,7 +1578,7 @@
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
@@ -3303,7 +3206,15 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1644,23 +1626,20 @@
|
||||
@@ -1637,30 +1637,27 @@
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect +offs=%u\n", offset);
|
||||
}
|
||||
- if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1)
|
||||
+ if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
|
||||
return -1;
|
||||
ms->offset = offset;
|
||||
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
mdebug(offset, (char *)(void *)p,
|
||||
sizeof(union VALUETYPE));
|
||||
@@ -3329,7 +3240,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1679,38 +1658,40 @@
|
||||
@@ -1679,38 +1676,40 @@
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
@@ -3376,7 +3287,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
rbuf = ms->o.buf;
|
||||
@@ -1718,16 +1699,26 @@
|
||||
@@ -1718,16 +1717,26 @@
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
@@ -3407,7 +3318,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
@@ -1837,6 +1828,42 @@
|
||||
@@ -1837,6 +1846,42 @@
|
||||
return file_strncmp(a, b, len, flags);
|
||||
}
|
||||
|
||||
@@ -3450,7 +3361,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
private int
|
||||
magiccheck(struct magic_set *ms, struct magic *m)
|
||||
{
|
||||
@@ -1996,69 +2023,157 @@
|
||||
@@ -1996,69 +2041,157 @@
|
||||
break;
|
||||
}
|
||||
case FILE_REGEX: {
|
||||
@@ -3521,7 +3432,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
+ zval *retval;
|
||||
+ zval *subpats;
|
||||
+ char *haystack;
|
||||
+
|
||||
+
|
||||
+ MAKE_STD_ZVAL(retval);
|
||||
+ ALLOC_INIT_ZVAL(subpats);
|
||||
+
|
||||
@@ -3663,4 +3574,3 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
default:
|
||||
file_magerror(ms, "invalid type %d in magiccheck()", m->type);
|
||||
return -1;
|
||||
|
||||
@@ -1269,7 +1269,7 @@ file_signextend(struct magic_set *ms, struct magic *m, uint64_t v)
|
||||
* the sign extension must have happened.
|
||||
*/
|
||||
case FILE_BYTE:
|
||||
v = (char) v;
|
||||
v = (signed char) v;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
|
||||
@@ -820,7 +820,7 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
||||
q = (const uint8_t *)(const void *)
|
||||
((const char *)(const void *)p + ofs
|
||||
- 2 * sizeof(uint32_t));
|
||||
if (q > e) {
|
||||
if (q < p || q > e) {
|
||||
DPRINTF(("Ran of the end %p > %p\n", q, e));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -420,8 +420,6 @@ protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
|
||||
protected int file_replace(struct magic_set *, const char *, const char *);
|
||||
protected int file_printf(struct magic_set *, const char *, ...);
|
||||
protected int file_reset(struct magic_set *);
|
||||
protected int file_tryelf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
protected int file_trycdf(struct magic_set *, int, const unsigned char *,
|
||||
size_t);
|
||||
#ifdef PHP_FILEINFO_UNCOMPRESS
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,333 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Christos Zoulas 2003.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice immediately at the beginning of the file, without modification,
|
||||
* this list of conditions, and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* @(#)Id: readelf.h,v 1.9 2002/05/16 18:45:56 christos Exp
|
||||
*
|
||||
* Provide elf data structures for non-elf machines, allowing file
|
||||
* non-elf hosts to determine if an elf binary is stripped.
|
||||
* Note: cobbled from the linux header file, with modifications
|
||||
*/
|
||||
#ifndef __fake_elf_h__
|
||||
#define __fake_elf_h__
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef uint32_t Elf32_Addr;
|
||||
typedef uint32_t Elf32_Off;
|
||||
typedef uint16_t Elf32_Half;
|
||||
typedef uint32_t Elf32_Word;
|
||||
typedef uint8_t Elf32_Char;
|
||||
|
||||
#if SIZEOF_LONG_LONG != 8
|
||||
#define USE_ARRAY_FOR_64BIT_TYPES
|
||||
typedef uint32_t Elf64_Addr[2];
|
||||
typedef uint32_t Elf64_Off[2];
|
||||
typedef uint32_t Elf64_Xword[2];
|
||||
#else
|
||||
#undef USE_ARRAY_FOR_64BIT_TYPES
|
||||
typedef uint64_t Elf64_Addr;
|
||||
typedef uint64_t Elf64_Off;
|
||||
typedef uint64_t Elf64_Xword;
|
||||
#endif
|
||||
typedef uint16_t Elf64_Half;
|
||||
typedef uint32_t Elf64_Word;
|
||||
typedef uint8_t Elf64_Char;
|
||||
|
||||
#define EI_NIDENT 16
|
||||
|
||||
typedef struct {
|
||||
Elf32_Char e_ident[EI_NIDENT];
|
||||
Elf32_Half e_type;
|
||||
Elf32_Half e_machine;
|
||||
Elf32_Word e_version;
|
||||
Elf32_Addr e_entry; /* Entry point */
|
||||
Elf32_Off e_phoff;
|
||||
Elf32_Off e_shoff;
|
||||
Elf32_Word e_flags;
|
||||
Elf32_Half e_ehsize;
|
||||
Elf32_Half e_phentsize;
|
||||
Elf32_Half e_phnum;
|
||||
Elf32_Half e_shentsize;
|
||||
Elf32_Half e_shnum;
|
||||
Elf32_Half e_shstrndx;
|
||||
} Elf32_Ehdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Char e_ident[EI_NIDENT];
|
||||
Elf64_Half e_type;
|
||||
Elf64_Half e_machine;
|
||||
Elf64_Word e_version;
|
||||
Elf64_Addr e_entry; /* Entry point */
|
||||
Elf64_Off e_phoff;
|
||||
Elf64_Off e_shoff;
|
||||
Elf64_Word e_flags;
|
||||
Elf64_Half e_ehsize;
|
||||
Elf64_Half e_phentsize;
|
||||
Elf64_Half e_phnum;
|
||||
Elf64_Half e_shentsize;
|
||||
Elf64_Half e_shnum;
|
||||
Elf64_Half e_shstrndx;
|
||||
} Elf64_Ehdr;
|
||||
|
||||
/* e_type */
|
||||
#define ET_REL 1
|
||||
#define ET_EXEC 2
|
||||
#define ET_DYN 3
|
||||
#define ET_CORE 4
|
||||
|
||||
/* e_machine (used only for SunOS 5.x hardware capabilities) */
|
||||
#define EM_SPARC 2
|
||||
#define EM_386 3
|
||||
#define EM_SPARC32PLUS 18
|
||||
#define EM_SPARCV9 43
|
||||
#define EM_IA_64 50
|
||||
#define EM_AMD64 62
|
||||
|
||||
/* sh_type */
|
||||
#define SHT_SYMTAB 2
|
||||
#define SHT_NOTE 7
|
||||
#define SHT_DYNSYM 11
|
||||
#define SHT_SUNW_cap 0x6ffffff5 /* SunOS 5.x hw/sw capabilites */
|
||||
|
||||
/* elf type */
|
||||
#define ELFDATANONE 0 /* e_ident[EI_DATA] */
|
||||
#define ELFDATA2LSB 1
|
||||
#define ELFDATA2MSB 2
|
||||
|
||||
/* elf class */
|
||||
#define ELFCLASSNONE 0
|
||||
#define ELFCLASS32 1
|
||||
#define ELFCLASS64 2
|
||||
|
||||
/* magic number */
|
||||
#define EI_MAG0 0 /* e_ident[] indexes */
|
||||
#define EI_MAG1 1
|
||||
#define EI_MAG2 2
|
||||
#define EI_MAG3 3
|
||||
#define EI_CLASS 4
|
||||
#define EI_DATA 5
|
||||
#define EI_VERSION 6
|
||||
#define EI_PAD 7
|
||||
|
||||
#define ELFMAG0 0x7f /* EI_MAG */
|
||||
#define ELFMAG1 'E'
|
||||
#define ELFMAG2 'L'
|
||||
#define ELFMAG3 'F'
|
||||
#define ELFMAG "\177ELF"
|
||||
|
||||
#define OLFMAG1 'O'
|
||||
#define OLFMAG "\177OLF"
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word p_type;
|
||||
Elf32_Off p_offset;
|
||||
Elf32_Addr p_vaddr;
|
||||
Elf32_Addr p_paddr;
|
||||
Elf32_Word p_filesz;
|
||||
Elf32_Word p_memsz;
|
||||
Elf32_Word p_flags;
|
||||
Elf32_Word p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word p_type;
|
||||
Elf64_Word p_flags;
|
||||
Elf64_Off p_offset;
|
||||
Elf64_Addr p_vaddr;
|
||||
Elf64_Addr p_paddr;
|
||||
Elf64_Xword p_filesz;
|
||||
Elf64_Xword p_memsz;
|
||||
Elf64_Xword p_align;
|
||||
} Elf64_Phdr;
|
||||
|
||||
#define PT_NULL 0 /* p_type */
|
||||
#define PT_LOAD 1
|
||||
#define PT_DYNAMIC 2
|
||||
#define PT_INTERP 3
|
||||
#define PT_NOTE 4
|
||||
#define PT_SHLIB 5
|
||||
#define PT_PHDR 6
|
||||
#define PT_NUM 7
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word sh_name;
|
||||
Elf32_Word sh_type;
|
||||
Elf32_Word sh_flags;
|
||||
Elf32_Addr sh_addr;
|
||||
Elf32_Off sh_offset;
|
||||
Elf32_Word sh_size;
|
||||
Elf32_Word sh_link;
|
||||
Elf32_Word sh_info;
|
||||
Elf32_Word sh_addralign;
|
||||
Elf32_Word sh_entsize;
|
||||
} Elf32_Shdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word sh_name;
|
||||
Elf64_Word sh_type;
|
||||
Elf64_Off sh_flags;
|
||||
Elf64_Addr sh_addr;
|
||||
Elf64_Off sh_offset;
|
||||
Elf64_Off sh_size;
|
||||
Elf64_Word sh_link;
|
||||
Elf64_Word sh_info;
|
||||
Elf64_Off sh_addralign;
|
||||
Elf64_Off sh_entsize;
|
||||
} Elf64_Shdr;
|
||||
|
||||
#define NT_NETBSD_CORE_PROCINFO 1
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
typedef struct elf_note {
|
||||
Elf32_Word n_namesz; /* Name size */
|
||||
Elf32_Word n_descsz; /* Content size */
|
||||
Elf32_Word n_type; /* Content type */
|
||||
} Elf32_Nhdr;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word n_namesz;
|
||||
Elf64_Word n_descsz;
|
||||
Elf64_Word n_type;
|
||||
} Elf64_Nhdr;
|
||||
|
||||
/* Notes used in ET_CORE */
|
||||
#define NT_PRSTATUS 1
|
||||
#define NT_PRFPREG 2
|
||||
#define NT_PRPSINFO 3
|
||||
#define NT_PRXREG 4
|
||||
#define NT_TASKSTRUCT 4
|
||||
#define NT_PLATFORM 5
|
||||
#define NT_AUXV 6
|
||||
|
||||
/* Note types used in executables */
|
||||
/* NetBSD executables (name = "NetBSD") */
|
||||
#define NT_NETBSD_VERSION 1
|
||||
#define NT_NETBSD_EMULATION 2
|
||||
#define NT_FREEBSD_VERSION 1
|
||||
#define NT_OPENBSD_VERSION 1
|
||||
#define NT_DRAGONFLY_VERSION 1
|
||||
/*
|
||||
* GNU executables (name = "GNU")
|
||||
* word[0]: GNU OS tags
|
||||
* word[1]: major version
|
||||
* word[2]: minor version
|
||||
* word[3]: tiny version
|
||||
*/
|
||||
#define NT_GNU_VERSION 1
|
||||
|
||||
/* GNU OS tags */
|
||||
#define GNU_OS_LINUX 0
|
||||
#define GNU_OS_HURD 1
|
||||
#define GNU_OS_SOLARIS 2
|
||||
#define GNU_OS_KFREEBSD 3
|
||||
#define GNU_OS_KNETBSD 4
|
||||
|
||||
/*
|
||||
* GNU Hardware capability information
|
||||
* word[0]: Number of entries
|
||||
* word[1]: Bitmask of enabled entries
|
||||
* Followed by a byte id, and a NUL terminated string per entry
|
||||
*/
|
||||
#define NT_GNU_HWCAP 2
|
||||
|
||||
/*
|
||||
* GNU Build ID generated by ld
|
||||
* 160 bit SHA1 [default]
|
||||
* 128 bit md5 or uuid
|
||||
*/
|
||||
#define NT_GNU_BUILD_ID 3
|
||||
|
||||
/* SunOS 5.x hardware/software capabilities */
|
||||
typedef struct {
|
||||
Elf32_Word c_tag;
|
||||
union {
|
||||
Elf32_Word c_val;
|
||||
Elf32_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf32_Cap;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Xword c_tag;
|
||||
union {
|
||||
Elf64_Xword c_val;
|
||||
Elf64_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf64_Cap;
|
||||
|
||||
/* SunOS 5.x hardware/software capability tags */
|
||||
#define CA_SUNW_NULL 0
|
||||
#define CA_SUNW_HW_1 1
|
||||
#define CA_SUNW_SF_1 2
|
||||
|
||||
/* SunOS 5.x software capabilities */
|
||||
#define SF1_SUNW_FPKNWN 0x01
|
||||
#define SF1_SUNW_FPUSED 0x02
|
||||
#define SF1_SUNW_MASK 0x03
|
||||
|
||||
/* SunOS 5.x hardware capabilities: sparc */
|
||||
#define AV_SPARC_MUL32 0x0001
|
||||
#define AV_SPARC_DIV32 0x0002
|
||||
#define AV_SPARC_FSMULD 0x0004
|
||||
#define AV_SPARC_V8PLUS 0x0008
|
||||
#define AV_SPARC_POPC 0x0010
|
||||
#define AV_SPARC_VIS 0x0020
|
||||
#define AV_SPARC_VIS2 0x0040
|
||||
#define AV_SPARC_ASI_BLK_INIT 0x0080
|
||||
#define AV_SPARC_FMAF 0x0100
|
||||
#define AV_SPARC_FJFMAU 0x4000
|
||||
#define AV_SPARC_IMA 0x8000
|
||||
|
||||
/* SunOS 5.x hardware capabilities: 386 */
|
||||
#define AV_386_FPU 0x00000001
|
||||
#define AV_386_TSC 0x00000002
|
||||
#define AV_386_CX8 0x00000004
|
||||
#define AV_386_SEP 0x00000008
|
||||
#define AV_386_AMD_SYSC 0x00000010
|
||||
#define AV_386_CMOV 0x00000020
|
||||
#define AV_386_MMX 0x00000040
|
||||
#define AV_386_AMD_MMX 0x00000080
|
||||
#define AV_386_AMD_3DNow 0x00000100
|
||||
#define AV_386_AMD_3DNowx 0x00000200
|
||||
#define AV_386_FXSR 0x00000400
|
||||
#define AV_386_SSE 0x00000800
|
||||
#define AV_386_SSE2 0x00001000
|
||||
#define AV_386_PAUSE 0x00002000
|
||||
#define AV_386_SSE3 0x00004000
|
||||
#define AV_386_MON 0x00008000
|
||||
#define AV_386_CX16 0x00010000
|
||||
#define AV_386_AHF 0x00020000
|
||||
#define AV_386_TSCP 0x00040000
|
||||
#define AV_386_AMD_SSE4A 0x00080000
|
||||
#define AV_386_POPCNT 0x00100000
|
||||
#define AV_386_AMD_LZCNT 0x00200000
|
||||
#define AV_386_SSSE3 0x00400000
|
||||
#define AV_386_SSE4_1 0x00800000
|
||||
#define AV_386_SSE4_2 0x01000000
|
||||
|
||||
#endif
|
||||
@@ -58,7 +58,7 @@ private int32_t mprint(struct magic_set *, struct magic *);
|
||||
private int32_t moffset(struct magic_set *, struct magic *);
|
||||
private void mdebug(uint32_t, const char *, size_t);
|
||||
private int mcopy(struct magic_set *, union VALUETYPE *, int, int,
|
||||
const unsigned char *, uint32_t, size_t, size_t);
|
||||
const unsigned char *, uint32_t, size_t, struct magic *);
|
||||
private int mconvert(struct magic_set *, struct magic *, int);
|
||||
private int print_sep(struct magic_set *, int);
|
||||
private int handle_annotation(struct magic_set *, struct magic *);
|
||||
@@ -884,14 +884,17 @@ mconvert(struct magic_set *ms, struct magic *m, int flip)
|
||||
size_t sz = file_pstring_length_size(m);
|
||||
char *ptr1 = p->s, *ptr2 = ptr1 + sz;
|
||||
size_t len = file_pstring_get_length(m, ptr1);
|
||||
if (len >= sizeof(p->s)) {
|
||||
sz = sizeof(p->s) - sz; /* maximum length of string */
|
||||
if (len >= sz) {
|
||||
/*
|
||||
* The size of the pascal string length (sz)
|
||||
* is 1, 2, or 4. We need at least 1 byte for NUL
|
||||
* termination, but we've already truncated the
|
||||
* string by p->s, so we need to deduct sz.
|
||||
* Because we can use one of the bytes of the length
|
||||
* after we shifted as NUL termination.
|
||||
*/
|
||||
len = sizeof(p->s) - sz;
|
||||
len = sz;
|
||||
}
|
||||
while (len--)
|
||||
*ptr1++ = *ptr2++;
|
||||
@@ -1003,7 +1006,7 @@ mdebug(uint32_t offset, const char *str, size_t len)
|
||||
|
||||
private int
|
||||
mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
const unsigned char *s, uint32_t offset, size_t nbytes, size_t linecnt)
|
||||
const unsigned char *s, uint32_t offset, size_t nbytes, struct magic *m)
|
||||
{
|
||||
/*
|
||||
* Note: FILE_SEARCH and FILE_REGEX do not actually copy
|
||||
@@ -1023,15 +1026,27 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
const char *last; /* end of search region */
|
||||
const char *buf; /* start of search region */
|
||||
const char *end;
|
||||
size_t lines;
|
||||
size_t lines, linecnt, bytecnt;
|
||||
|
||||
linecnt = m->str_range;
|
||||
bytecnt = linecnt * 80;
|
||||
|
||||
if (bytecnt == 0) {
|
||||
bytecnt = 8192;
|
||||
}
|
||||
if (bytecnt > nbytes) {
|
||||
bytecnt = nbytes;
|
||||
}
|
||||
if (offset > bytecnt) {
|
||||
offset = bytecnt;
|
||||
}
|
||||
if (s == NULL) {
|
||||
ms->search.s_len = 0;
|
||||
ms->search.s = NULL;
|
||||
return 0;
|
||||
}
|
||||
buf = RCAST(const char *, s) + offset;
|
||||
end = last = RCAST(const char *, s) + nbytes;
|
||||
end = last = RCAST(const char *, s) + bytecnt;
|
||||
/* mget() guarantees buf <= last */
|
||||
for (lines = linecnt, b = buf; lines && b < end &&
|
||||
((b = CAST(const char *,
|
||||
@@ -1044,7 +1059,7 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir,
|
||||
b++;
|
||||
}
|
||||
if (lines)
|
||||
last = RCAST(const char *, s) + nbytes;
|
||||
last = RCAST(const char *, s) + bytecnt;
|
||||
|
||||
ms->search.s = buf;
|
||||
ms->search.s_len = last - buf;
|
||||
@@ -1118,7 +1133,6 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
int *need_separator, int *returnval)
|
||||
{
|
||||
uint32_t soffset, offset = ms->offset;
|
||||
uint32_t count = m->str_range;
|
||||
int rv, oneed_separator;
|
||||
char *sbuf, *rbuf;
|
||||
union VALUETYPE *p = &ms->ms_value;
|
||||
@@ -1130,13 +1144,12 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
}
|
||||
|
||||
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
|
||||
(uint32_t)nbytes, count) == -1)
|
||||
(uint32_t)nbytes, m) == -1)
|
||||
return -1;
|
||||
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0) {
|
||||
fprintf(stderr, "mget(type=%d, flag=%x, offset=%u, o=%zu, "
|
||||
"nbytes=%zu, count=%u)\n", m->type, m->flag, offset, o,
|
||||
nbytes, count);
|
||||
"nbytes=%zu)\n", m->type, m->flag, offset, o, nbytes);
|
||||
mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
|
||||
}
|
||||
|
||||
@@ -1627,7 +1640,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect +offs=%u\n", offset);
|
||||
}
|
||||
if (mcopy(ms, p, m->type, 0, s, offset, nbytes, count) == -1)
|
||||
if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1)
|
||||
return -1;
|
||||
ms->offset = offset;
|
||||
|
||||
@@ -2057,7 +2070,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
|
||||
zval *retval;
|
||||
zval *subpats;
|
||||
char *haystack;
|
||||
|
||||
|
||||
MAKE_STD_ZVAL(retval);
|
||||
ALLOC_INIT_ZVAL(subpats);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Patches applied to file sources tree before generating magic.mgc
|
||||
Patches applied to file 5.14 sources tree before generating magic.mgc
|
||||
and before running create_data_file.php to create data_file.c.
|
||||
|
||||
|
||||
@@ -17,14 +17,6 @@ diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index 67c3eee..4a7d8dd 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
-# $File: commands,v 1.44 2013/02/05 15:20:47 christos Exp $
|
||||
+# $File: commands,v 1.45 2013/02/06 14:18:52 christos Exp $
|
||||
# commands: file(1) magic for various shells and interpreters
|
||||
#
|
||||
#0 string/w : shell archive or script for antique kernel text
|
||||
@@ -49,7 +49,7 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
@@ -36,4 +28,56 @@ index 67c3eee..4a7d8dd 100644
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
1.8.5.5
|
||||
From 0b478f445b6b7540b58af5d1fe583fa9e48fd745 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Wed, 28 May 2014 19:52:36 +0000
|
||||
Subject: [PATCH] further optimize awk by not looking for the BEGIN regex until
|
||||
we found the BEGIN (Jan Kaluza)
|
||||
|
||||
---
|
||||
magic/Magdir/commands | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index bfffdef..26b2869 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -49,7 +49,8 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
!:mime text/x-awk
|
||||
-0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
+0 search/16384 BEGIN
|
||||
+>0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
|
||||
# AT&T Bell Labs' Plan 9 shell
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
2.0.3
|
||||
|
||||
From 71a8b6c0d758acb0f73e2e51421a711b5e9d6668 Mon Sep 17 00:00:00 2001
|
||||
From: Christos Zoulas <christos@zoulas.com>
|
||||
Date: Fri, 30 May 2014 16:48:44 +0000
|
||||
Subject: [PATCH] Limit regex search for BEGIN to the first 4K of the file.
|
||||
|
||||
---
|
||||
magic/Magdir/commands | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/magic/Magdir/commands b/magic/Magdir/commands
|
||||
index 26b2869..bcd0f43 100644
|
||||
--- a/magic/Magdir/commands
|
||||
+++ b/magic/Magdir/commands
|
||||
@@ -49,8 +49,7 @@
|
||||
!:mime text/x-awk
|
||||
0 string/wt #!\ /usr/bin/awk awk script text executable
|
||||
!:mime text/x-awk
|
||||
-0 search/16384 BEGIN
|
||||
->0 regex =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
+0 regex/4096 =^\\s{0,100}BEGIN\\s{0,100}[{] awk script text
|
||||
|
||||
# AT&T Bell Labs' Plan 9 shell
|
||||
0 string/wt #!\ /bin/rc Plan 9 rc shell script text executable
|
||||
--
|
||||
2.0.3
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 B |
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #68735 fileinfo out-of-bounds memory access
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$test_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug68735.jpg";
|
||||
$f = new finfo;
|
||||
|
||||
var_dump($f->file($test_file));
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
string(%d) "JPEG image data, JFIF standard 1.01, comment: "%S""
|
||||
===DONE===
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 1
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$string = <<<HERE
|
||||
----a-----'''---------a---------------a--------a-----a-----a---------a-----as-------a----a--a-------------a--as-----s---------------a---------a---a--s-a-----a-----------asy---------a-----a-----------a----s--------a-------------a-------a--------a----s------------a-----a----------------a----s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a-----------------------a----a----s-------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a----s----s--------a----------a----------------------a----a----s-------------a----------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n------a-------a-a-------a-----a----a---a-----a-----------------------a----a---a-----a------------------s-------a----a---a-----a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s------\r\n-------------------a-------a-a-------a-----a----a---a-------a------------------------a----a---a-----''--a-------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-------s-----a---a-------------------------a----a-------------a---a-------------------s-------a----a-------------a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a--------------------------------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a-----------------------a----a--------------------a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a-----------s--------a----------a----------------------a----a--------------------a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a-----------------------a----a---a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a---a----------a----------------------a----a---a------------------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-a-----------a-------a-a-------a-----a----a----a---s-----a-----------------------a----a----a---------a-----------------s-------a----a----a---------a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-------------------a-------a-a-------a-----a----a--------a----a-----------------------a----a----------a----a------------------s-------a----a---a------as---s-a--------------s-----a------a-y--a-------a-----a--a--------a----s--------a-------------a-------a--------a----s--------------a-----a----------a----------s--a----------s-----------------\r\n-----a-------------a-------a-a-------a-----a----a--------s-----a---a-------------------------a----a--------------a---a-------------------s-------------a---------------a----a---a---a-----as-a--------------a-----a--s----s---------y------------a-----a-s---a-------''----a---s--a-''------''----s------------a-y----------------s------a-----y--a-s--a-s------s--a-s----------''----------------------------a---s--a----a---------a-s---a-s--------s--------a---------s--a-y-------------as----a----a-------------a------a---s--a-s------a--------a----s----y--as--a----a-s---------------a-----a-----------Line truncated
|
||||
HERE;
|
||||
|
||||
$finfo = new finfo();
|
||||
$type = $finfo->buffer($string);
|
||||
|
||||
var_dump($type);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(60) "ASCII text, with very long lines, with CRLF line terminators"
|
||||
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Bug #68819 Fileinfo on specific file causes spurious OOM and/or segfault, var 2
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$string = '';
|
||||
|
||||
// These two in any order
|
||||
$string .= "\r\n";
|
||||
$string .= "''''";
|
||||
|
||||
// Total string length > 8192
|
||||
$string .= str_repeat(chr(rand(32, 127)), 8184);
|
||||
|
||||
// Ending in this string
|
||||
$string .= "say";
|
||||
|
||||
$finfo = new finfo();
|
||||
$type = $finfo->buffer($string);
|
||||
var_dump($type);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
string(60) "ASCII text, with very long lines, with CRLF line terminators"
|
||||
@@ -0,0 +1,35 @@
|
||||
--TEST--
|
||||
Bug #66731: file: extensive backtraking
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--FILE--
|
||||
<?php
|
||||
$fd = __DIR__.'/cve-2014-3538.data';
|
||||
|
||||
file_put_contents($fd,
|
||||
'try:' .
|
||||
str_repeat("\n", 1000000));
|
||||
|
||||
$fi = finfo_open(FILEINFO_NONE);
|
||||
$t = microtime(true);
|
||||
var_dump(finfo_file($fi, $fd));
|
||||
$t = microtime(true) - $t;
|
||||
finfo_close($fi);
|
||||
if ($t < 1) {
|
||||
echo "Ok\n";
|
||||
} else {
|
||||
printf("Failed, time=%.2f\n", $t);
|
||||
}
|
||||
|
||||
?>
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/cve-2014-3538.data');
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
Ok
|
||||
Done
|
||||
@@ -19,6 +19,7 @@ echo "*** Testing finfo_file() : basic functionality ***\n";
|
||||
var_dump( finfo_file( $finfo, __FILE__) );
|
||||
var_dump( finfo_file( $finfo, __FILE__, FILEINFO_CONTINUE ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
@@ -27,4 +28,7 @@ var_dump( finfo_file( $finfo, $magicFile ) );
|
||||
string(28) "text/x-php; charset=us-ascii"
|
||||
string(22) "PHP script, ASCII text"
|
||||
string(25) "text/plain; charset=utf-8"
|
||||
|
||||
Warning: finfo_file(): Invalid path in %s/finfo_file_basic.php on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Bug #67296 (filter_input doesn't validate variables)
|
||||
--XFAIL--
|
||||
See Bug #49184
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip needs filter ext"); ?>
|
||||
--ENV--
|
||||
return <<<END
|
||||
HTTP_X_FORWARDED_FOR=example.com
|
||||
END;
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_UNSAFE_RAW));
|
||||
var_dump($_SERVER["HTTP_X_FORWARDED_FOR"]);
|
||||
var_dump(getenv("HTTP_X_FORWARDED_FOR"));
|
||||
var_dump("done");
|
||||
?>
|
||||
--EXPECT--
|
||||
string(11) "example.com"
|
||||
string(11) "example.com"
|
||||
string(11) "example.com"
|
||||
string(4) "done"
|
||||
+41
-43
@@ -188,9 +188,9 @@ ftp_close(ftpbuf_t *ftp)
|
||||
SSL_shutdown(ftp->ssl_handle);
|
||||
SSL_free(ftp->ssl_handle);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
closesocket(ftp->fd);
|
||||
}
|
||||
}
|
||||
ftp_gc(ftp);
|
||||
efree(ftp);
|
||||
return NULL;
|
||||
@@ -262,7 +262,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
if (!ftp_getresp(ftp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (ftp->resp != 234) {
|
||||
if (!ftp_putcmd(ftp, "AUTH", "SSL")) {
|
||||
return 0;
|
||||
@@ -270,7 +270,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
if (!ftp_getresp(ftp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (ftp->resp != 334) {
|
||||
return 0;
|
||||
} else {
|
||||
@@ -278,7 +278,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
ftp->use_ssl_for_data = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ctx = SSL_CTX_new(SSLv23_client_method());
|
||||
if (ctx == NULL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL context");
|
||||
@@ -325,8 +325,8 @@ ftp_login(ftpbuf_t *ftp, const char *user, const char *pass TSRMLS_DC)
|
||||
if (!ftp_getresp(ftp)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
|
||||
|
||||
ftp->use_ssl_for_data = (ftp->resp >= 200 && ftp->resp <=299);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -360,7 +360,7 @@ ftp_reinit(ftpbuf_t *ftp)
|
||||
{
|
||||
if (ftp == NULL) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ftp_gc(ftp);
|
||||
|
||||
@@ -395,7 +395,7 @@ ftp_syst(ftpbuf_t *ftp)
|
||||
if (!ftp_putcmd(ftp, "SYST", NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 215) {
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 215) {
|
||||
return NULL;
|
||||
}
|
||||
syst = ftp->inbuf;
|
||||
@@ -431,14 +431,14 @@ ftp_pwd(ftpbuf_t *ftp)
|
||||
if (!ftp_putcmd(ftp, "PWD", NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 257) {
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 257) {
|
||||
return NULL;
|
||||
}
|
||||
/* copy out the pwd from response */
|
||||
if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
|
||||
if ((pwd = strchr(ftp->inbuf, '"')) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if ((end = strrchr(++pwd, '"')) == NULL) {
|
||||
if ((end = strrchr(++pwd, '"')) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ftp->pwd = estrndup(pwd, end - pwd);
|
||||
@@ -608,7 +608,7 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -625,7 +625,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%ld", size);
|
||||
|
||||
|
||||
if (!ftp_putcmd(ftp, "ALLO", buffer)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -642,7 +642,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -674,7 +674,7 @@ ftp_type(ftpbuf_t *ftp, ftptype_t type)
|
||||
if (ftp == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (type == ftp->type) {
|
||||
if (type == ftp->type) {
|
||||
return 1;
|
||||
}
|
||||
if (type == FTPTYPE_ASCII) {
|
||||
@@ -765,7 +765,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
|
||||
if (!ftp_putcmd(ftp, "PASV", NULL)) {
|
||||
return 0;
|
||||
}
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 227) {
|
||||
if (!ftp_getresp(ftp) || ftp->resp != 227) {
|
||||
return 0;
|
||||
}
|
||||
/* parse out the IP and port */
|
||||
@@ -808,7 +808,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
|
||||
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
||||
ftp->data = data;
|
||||
|
||||
if (resumepos > 0) {
|
||||
@@ -902,7 +902,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, l
|
||||
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
ftp->data = data;
|
||||
|
||||
if (startpos > 0) {
|
||||
snprintf(arg, sizeof(arg), "%ld", startpos);
|
||||
@@ -1103,7 +1103,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
|
||||
|
||||
if (strpbrk(cmd, "\r\n")) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* build the output buffer */
|
||||
if (args && args[0]) {
|
||||
/* "cmd args\r\n\0" */
|
||||
@@ -1252,7 +1252,7 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
|
||||
sent = SSL_write(ftp->ssl_handle, buf, size);
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
sent = SSL_write(ftp->data->ssl_handle, buf, size);
|
||||
} else {
|
||||
#endif
|
||||
@@ -1292,14 +1292,14 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) {
|
||||
nr_bytes = SSL_read(ftp->ssl_handle, buf, len);
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
} else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) {
|
||||
nr_bytes = SSL_read(ftp->data->ssl_handle, buf, len);
|
||||
} else {
|
||||
#endif
|
||||
nr_bytes = recv(s, buf, len, 0);
|
||||
#if HAVE_OPENSSL_EXT
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return (nr_bytes);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1516,7 +1516,7 @@ data_accept(databuf_t *data, ftpbuf_t *ftp TSRMLS_DC)
|
||||
|
||||
data_accepted:
|
||||
#if HAVE_OPENSSL_EXT
|
||||
|
||||
|
||||
/* now enable ssl if we need to */
|
||||
if (ftp->use_ssl && ftp->use_ssl_for_data) {
|
||||
ctx = SSL_CTX_new(SSLv23_client_method());
|
||||
@@ -1536,23 +1536,23 @@ data_accepted:
|
||||
SSL_CTX_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
SSL_set_fd(data->ssl_handle, data->fd);
|
||||
|
||||
if (ftp->old_ssl) {
|
||||
SSL_copy_session_id(data->ssl_handle, ftp->ssl_handle);
|
||||
}
|
||||
|
||||
|
||||
if (SSL_connect(data->ssl_handle) <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: SSL/TLS handshake failed");
|
||||
SSL_shutdown(data->ssl_handle);
|
||||
SSL_free(data->ssl_handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
data->ssl_active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1567,14 +1567,14 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
{
|
||||
#if HAVE_OPENSSL_EXT
|
||||
SSL_CTX *ctx;
|
||||
#endif
|
||||
#endif
|
||||
if (data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (data->listener != -1) {
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (data->ssl_active) {
|
||||
|
||||
|
||||
ctx = SSL_get_SSL_CTX(data->ssl_handle);
|
||||
SSL_CTX_free(ctx);
|
||||
|
||||
@@ -1582,9 +1582,9 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
SSL_free(data->ssl_handle);
|
||||
data->ssl_active = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
closesocket(data->listener);
|
||||
}
|
||||
}
|
||||
if (data->fd != -1) {
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (data->ssl_active) {
|
||||
@@ -1595,9 +1595,9 @@ data_close(ftpbuf_t *ftp, databuf_t *data)
|
||||
SSL_free(data->ssl_handle);
|
||||
data->ssl_active = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
closesocket(data->fd);
|
||||
}
|
||||
}
|
||||
if (ftp) {
|
||||
ftp->data = NULL;
|
||||
}
|
||||
@@ -1615,8 +1615,8 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
databuf_t *data = NULL;
|
||||
char *ptr;
|
||||
int ch, lastch;
|
||||
int size, rcvd;
|
||||
int lines;
|
||||
size_t size, rcvd;
|
||||
size_t lines;
|
||||
char **ret = NULL;
|
||||
char **entry;
|
||||
char *text;
|
||||
@@ -1634,7 +1634,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
if ((data = ftp_getdata(ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
ftp->data = data;
|
||||
|
||||
if (!ftp_putcmd(ftp, cmd, path)) {
|
||||
goto bail;
|
||||
@@ -1658,7 +1658,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
lines = 0;
|
||||
lastch = 0;
|
||||
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
|
||||
if (rcvd == -1) {
|
||||
if (rcvd == -1 || rcvd > ((size_t)(-1))-size) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -1668,8 +1668,6 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
|
||||
for (ptr = data->buf; rcvd; rcvd--, ptr++) {
|
||||
if (*ptr == '\n' && lastch == '\r') {
|
||||
lines++;
|
||||
} else {
|
||||
size++;
|
||||
}
|
||||
lastch = *ptr;
|
||||
}
|
||||
@@ -1863,7 +1861,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) {
|
||||
goto bail;
|
||||
}
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
if ((data = data_accept(data, ftp TSRMLS_CC)) == NULL) {
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data;
|
||||
@@ -1919,7 +1917,7 @@ ftp_nb_continue_write(ftpbuf_t *ftp TSRMLS_DC)
|
||||
goto bail;
|
||||
}
|
||||
ftp->data = data_close(ftp, ftp->data);
|
||||
|
||||
|
||||
if (!ftp_getresp(ftp) || (ftp->resp != 226 && ftp->resp != 250)) {
|
||||
goto bail;
|
||||
}
|
||||
|
||||
@@ -18,5 +18,5 @@ var_dump(ftp_login($ftp, 'user', 'pass'));
|
||||
ftp_close($ftp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: ftp_login(): bogus msg in %sbug37799.php on line 8
|
||||
Warning: ftp_login(): %rdummy|bogus msg%r in %sbug37799.php on line 8
|
||||
bool(false)
|
||||
+12
-12
@@ -1495,7 +1495,7 @@ PHP_FUNCTION(imageloadfont)
|
||||
gdFontPtr font;
|
||||
php_stream *stream;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_name) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_name) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1790,7 +1790,7 @@ PHP_FUNCTION(imagefilledarc)
|
||||
long cx, cy, w, h, ST, E, col, style;
|
||||
gdImagePtr im;
|
||||
int e, st;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -2033,7 +2033,7 @@ PHP_FUNCTION(imagegrabwindow)
|
||||
if ( handle == 0 ) {
|
||||
goto clean;
|
||||
}
|
||||
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
|
||||
pPrintWindow = (tPrintWindow) GetProcAddress(handle, "PrintWindow");
|
||||
|
||||
if ( pPrintWindow ) {
|
||||
pPrintWindow(window, memDC, (UINT) client_area);
|
||||
@@ -2438,7 +2438,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
long ignore_warning;
|
||||
#endif
|
||||
if (image_type == PHP_GDIMG_TYPE_GD2PART) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (width < 1 || height < 1) {
|
||||
@@ -2446,7 +2446,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3984,7 +3984,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
if (zend_hash_get_current_data_ex(HASH_OF(EXT), (void **) &item, &pos) == FAILURE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp("linespacing", key) == 0) {
|
||||
convert_to_double_ex(item);
|
||||
strex.flags |= gdFTEX_LINESPACE;
|
||||
@@ -4006,7 +4006,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
#endif
|
||||
|
||||
PHP_GD_CHECK_OPEN_BASEDIR(fontname, "Invalid font filename");
|
||||
|
||||
|
||||
#ifdef USE_GD_IMGSTRTTF
|
||||
# if HAVE_GD_STRINGFTEX
|
||||
if (extended) {
|
||||
@@ -4071,7 +4071,7 @@ PHP_FUNCTION(imagepsloadfont)
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &file, &file_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4178,7 +4178,7 @@ PHP_FUNCTION(imagepsencodefont)
|
||||
char *enc, **enc_vector;
|
||||
int enc_len, *f_ind;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &fnt, &enc, &enc_len) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &fnt, &enc, &enc_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4411,11 +4411,11 @@ PHP_FUNCTION(imagepsbbox)
|
||||
if (argc != 3 && argc != 6) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
}
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "srl|lld", &str, &str_len, &fnt, &sz, &sp, &wd, &angle) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 6) {
|
||||
space = sp;
|
||||
add_width = wd;
|
||||
@@ -4600,7 +4600,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
#ifdef HAVE_GD_JPG
|
||||
long ignore_warning;
|
||||
#endif
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,6 +124,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
|
||||
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
|
||||
if (stream == NULL) {
|
||||
RETURN_FALSE;
|
||||
|
||||
@@ -72,8 +72,10 @@ static struct {
|
||||
|
||||
#define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2)
|
||||
|
||||
#define CSD_BUF_SIZE 280
|
||||
|
||||
typedef struct {
|
||||
unsigned char buf[280];
|
||||
unsigned char buf[CSD_BUF_SIZE];
|
||||
int curbit, lastbit, done, last_byte;
|
||||
} CODE_STATIC_DATA;
|
||||
|
||||
@@ -398,9 +400,14 @@ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroD
|
||||
scd->lastbit = (2+count)*8 ;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
for (i = scd->curbit, j = 0; j < code_size; ++i, ++j)
|
||||
ret |= ((scd->buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
|
||||
if ((scd->curbit + code_size - 1) >= (CSD_BUF_SIZE * 8)) {
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = 0;
|
||||
for (i = scd->curbit, j = 0; j < code_size; ++i, ++j) {
|
||||
ret |= ((scd->buf[i / 8] & (1 << (i % 8))) != 0) << j;
|
||||
}
|
||||
}
|
||||
|
||||
scd->curbit += code_size;
|
||||
return ret;
|
||||
|
||||
+4
-2
@@ -370,9 +370,10 @@ static void *fontFetch (char **error, void *key)
|
||||
fontlist = gdEstrdup(a->fontlist);
|
||||
|
||||
/*
|
||||
* Must use gd_strtok_r else pointer corrupted by strtok in nested loop.
|
||||
* Must use gd_strtok_r becasuse strtok() isn't thread safe
|
||||
*/
|
||||
for (name = gd_strtok_r (fontlist, LISTSEPARATOR, &strtok_ptr); name; name = gd_strtok_r (0, LISTSEPARATOR, &strtok_ptr)) {
|
||||
char *strtok_ptr_path;
|
||||
/* make a fresh copy each time - strtok corrupts it. */
|
||||
path = gdEstrdup (fontsearchpath);
|
||||
|
||||
@@ -388,7 +389,8 @@ static void *fontFetch (char **error, void *key)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (dir = strtok (path, PATHSEPARATOR); dir; dir = strtok (0, PATHSEPARATOR)) {
|
||||
for (dir = gd_strtok_r (path, PATHSEPARATOR, &strtok_ptr_path); dir;
|
||||
dir = gd_strtok_r (0, PATHSEPARATOR, &strtok_ptr_path)) {
|
||||
if (!strcmp(dir, ".")) {
|
||||
TSRMLS_FETCH();
|
||||
#if HAVE_GETCWD
|
||||
|
||||
@@ -31,12 +31,17 @@ gdImagePtr gdImageCreateFromXpm (char *filename)
|
||||
if (ret != XpmSuccess) {
|
||||
return 0;
|
||||
}
|
||||
number = image.ncolors;
|
||||
for(i = 0; i < number; i++) {
|
||||
if (!image.colorTable[i].c_color) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(im = gdImageCreate(image.width, image.height))) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
number = image.ncolors;
|
||||
colors = (int *) safe_emalloc(number, sizeof(int), 0);
|
||||
for (i = 0; i < number; i++) {
|
||||
switch (strlen (image.colorTable[i].c_color)) {
|
||||
|
||||
@@ -20,6 +20,6 @@ echo '(' . $bbox[6] . ', ' . $bbox[7] . ")\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
(-1, 15)
|
||||
(156, 15)
|
||||
(156, -48)
|
||||
(15%d, 15)
|
||||
(15%d, -48)
|
||||
(-1, -48)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd2
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegd2 TEST\n";
|
||||
imagegd2($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegd2 TEST
|
||||
|
||||
Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegd
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegd TEST\n";
|
||||
imagegd($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegd TEST
|
||||
|
||||
Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagegif
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['GIF Create Support']) || $support['GIF Create Support'] === false) {
|
||||
print 'skip gif support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagegif TEST\n";
|
||||
imagegif($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagegif TEST
|
||||
|
||||
Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagejpeg
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
|
||||
print 'skip jpeg support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagejpeg TEST\n";
|
||||
imagejpeg($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagejpeg TEST
|
||||
|
||||
Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -3,7 +3,7 @@ Testing that imageloadfont() breaks on non-string first parameter
|
||||
--CREDITS--
|
||||
Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11
|
||||
--SKIPIF--
|
||||
<?php
|
||||
<?php
|
||||
if (!extension_loaded("gd")) die("skip GD not present");
|
||||
?>
|
||||
--FILE--
|
||||
@@ -11,5 +11,5 @@ Neveo Harrison <neveoo [at] gmail [dot] com> #testfest #tek11
|
||||
var_dump( imageloadfont(array()) );
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imageloadfont() expects parameter 1 to be string, array given in %s on line %d
|
||||
NULL
|
||||
Warning: imageloadfont() expects parameter 1 to be a valid path, array given in %s on line %d
|
||||
NULL
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagepng
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
|
||||
print 'skip png support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagepng TEST\n";
|
||||
imagepng($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagepng TEST
|
||||
|
||||
Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagewbmp
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
|
||||
print 'skip wbmp support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagewbmp TEST\n";
|
||||
imagewbmp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Testing null byte injection in imagewebp
|
||||
--CLEAN--
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
rmdir($tempdir);
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$support = gd_info();
|
||||
if (!isset($support['WEBP Support']) || $support['WEBP Support'] === false) {
|
||||
print 'skip webp support not available';
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate(1,1);// 1px image
|
||||
|
||||
|
||||
$tempdir = sys_get_temp_dir(). '/php-gdtest';
|
||||
if (!file_exists($tempdir) && !is_dir($tempdir)) {
|
||||
mkdir ($tempdir, 0777, true);
|
||||
}
|
||||
|
||||
$userinput = "1\0"; // from post or get data
|
||||
$temp = $tempdir. "/test" . $userinput .".tmp";
|
||||
|
||||
echo "\nimagewebp TEST\n";
|
||||
imagewebp($image, $temp);
|
||||
var_dump(file_exists($tempdir. "/test1"));
|
||||
var_dump(file_exists($tempdir. "/test1.tmp"));
|
||||
foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
|
||||
|
||||
--EXPECTF--
|
||||
imagewbmp TEST
|
||||
|
||||
Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
@@ -324,30 +324,6 @@ static void _php_gmpnum_free(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
# define MAX_BASE 36
|
||||
#endif
|
||||
|
||||
/* {{{ gmp_emalloc
|
||||
*/
|
||||
static void *gmp_emalloc(size_t size)
|
||||
{
|
||||
return emalloc(size);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ gmp_erealloc
|
||||
*/
|
||||
static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
|
||||
{
|
||||
return erealloc(ptr, new_size);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ gmp_efree
|
||||
*/
|
||||
static void gmp_efree(void *ptr, size_t size)
|
||||
{
|
||||
efree(ptr);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ ZEND_GINIT_FUNCTION
|
||||
*/
|
||||
static ZEND_GINIT_FUNCTION(gmp)
|
||||
@@ -369,8 +345,6 @@ ZEND_MODULE_STARTUP_D(gmp)
|
||||
#endif
|
||||
REGISTER_STRING_CONSTANT("GMP_VERSION", (char *)gmp_version, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
+6
-1
@@ -142,6 +142,7 @@ static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_
|
||||
}
|
||||
if (isfilename) {
|
||||
if (CHECK_NULL_PATH(data, data_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
|
||||
@@ -222,6 +223,10 @@ static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename,
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (isfilename) {
|
||||
if (CHECK_NULL_PATH(data, data_len)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, DEFAULT_CONTEXT);
|
||||
if (!stream) {
|
||||
/* Stream will report errors opening file */
|
||||
@@ -449,7 +454,7 @@ PHP_FUNCTION(hash_update_file)
|
||||
char *filename, buf[1024];
|
||||
int filename_len, n;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg);
|
||||
echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n";
|
||||
hash_hmac_file('foo', $file, $key, TRUE);
|
||||
|
||||
echo "\n-- Testing hash_hmac_file() function with bad path --\n";
|
||||
hash_hmac_file('crc32', $file.chr(0).$file, $key, TRUE);
|
||||
|
||||
?>
|
||||
===Done===
|
||||
--EXPECTF--
|
||||
@@ -51,4 +54,8 @@ Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
|
||||
-- Testing hash_hmac_file() function with invalid hash algorithm --
|
||||
|
||||
Warning: hash_hmac_file(): Unknown hashing algorithm: foo in %s on line %d
|
||||
|
||||
-- Testing hash_hmac_file() function with bad path --
|
||||
|
||||
Warning: hash_hmac_file(): Invalid path in %s on line %d
|
||||
===Done===
|
||||
@@ -73,7 +73,9 @@ PHP_FUNCTION( numfmt_parse )
|
||||
}
|
||||
|
||||
#if ICU_LOCALE_BUG && defined(LC_NUMERIC)
|
||||
oldlocale = setlocale(LC_NUMERIC, "C");
|
||||
/* need to copy here since setlocale may change it later */
|
||||
oldlocale = estrdup(setlocale(LC_NUMERIC, NULL));
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
#endif
|
||||
|
||||
switch(type) {
|
||||
@@ -100,6 +102,7 @@ PHP_FUNCTION( numfmt_parse )
|
||||
}
|
||||
#if ICU_LOCALE_BUG && defined(LC_NUMERIC)
|
||||
setlocale(LC_NUMERIC, oldlocale);
|
||||
efree(oldlocale);
|
||||
#endif
|
||||
if(zposition) {
|
||||
zval_dtor(zposition);
|
||||
|
||||
@@ -15,6 +15,7 @@ function ut_main()
|
||||
setlocale(LC_ALL, $de_locale);
|
||||
$fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
|
||||
$numeric = $fmt->parse("1234,56");
|
||||
setlocale(LC_ALL, "C"); // reset for printing
|
||||
$res_str .= "$numeric\n";
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting
|
||||
--SKIPIF--
|
||||
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function ut_main()
|
||||
{
|
||||
setlocale(LC_ALL, 'de_DE');
|
||||
|
||||
$fmt = new NumberFormatter( 'sl_SI.UTF-8', NumberFormatter::DECIMAL);
|
||||
$num = "1.234.567,891";
|
||||
$res_str = $fmt->parse($num)."\n";
|
||||
$res_str .= setlocale(LC_NUMERIC, 0);
|
||||
return $res_str;
|
||||
}
|
||||
|
||||
include_once( 'ut_common.inc' );
|
||||
ut_run();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
1234567,891
|
||||
de_DE
|
||||
+1
-1
@@ -368,7 +368,7 @@ static int json_utf8_to_utf16(unsigned short *utf16, char utf8[], int len) /* {{
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Only check if utf8 string is valid, and compute utf16 lenght */
|
||||
/* Only check if utf8 string is valid, and compute utf16 length */
|
||||
for (j=0 ; pos < len ; j++) {
|
||||
us = php_next_utf8_char((const unsigned char *)utf8, len, &pos, &status);
|
||||
if (status != SUCCESS) {
|
||||
|
||||
Loaded 100 of 387 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user