mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 19:20:50 +00:00
Compare commits
324
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e37064dae4 | ||
|
|
4eb3ecbccf | ||
|
|
64e4b276bd | ||
|
|
f01446dacf | ||
|
|
c35e4cb20c | ||
|
|
dc223e524d | ||
|
|
444314a291 | ||
|
|
6ba48cff6c | ||
|
|
69236ea979 | ||
|
|
f973877a2f | ||
|
|
791a98eb1c | ||
|
|
1f6078e4a5 | ||
|
|
229782c0ad | ||
|
|
4d76676101 | ||
|
|
32a629ef2c | ||
|
|
82b95bb758 | ||
|
|
7d5ca3b28d | ||
|
|
75c0dbdd02 | ||
|
|
27fe2b42fc | ||
|
|
db38282f42 | ||
|
|
b25f44098f | ||
|
|
b9ab6e14ff | ||
|
|
61156f0d68 | ||
|
|
c1cfd6a9fe | ||
|
|
869c547681 | ||
|
|
9c291f0fa0 | ||
|
|
58043201f8 | ||
|
|
9caabe953a | ||
|
|
cf1f579fcd | ||
|
|
327f538e91 | ||
|
|
9667ee4f72 | ||
|
|
f15c155363 | ||
|
|
d5796fb298 | ||
|
|
67c2b0a9e8 | ||
|
|
fad3f936ac | ||
|
|
f5622f5c87 | ||
|
|
e95625f47e | ||
|
|
40b3a031b2 | ||
|
|
90c6cbd09b | ||
|
|
c9d3ff0c6e | ||
|
|
14d674442e | ||
|
|
99613431b4 | ||
|
|
e87ac688d5 | ||
|
|
1d32b80903 | ||
|
|
f67ccd4a7b | ||
|
|
5c458c9b02 | ||
|
|
7ab39e2fae | ||
|
|
ced2a80e6f | ||
|
|
c301adbbd1 | ||
|
|
6e886f07a8 | ||
|
|
ee6900c3de | ||
|
|
56cdaecb28 | ||
|
|
d276e6a838 | ||
|
|
0ae8c337a3 | ||
|
|
30a5ed3a79 | ||
|
|
ed16f2fed5 | ||
|
|
315c0536c2 | ||
|
|
cc125f277b | ||
|
|
cce457c68c | ||
|
|
074b86d845 | ||
|
|
4c2e1a13be | ||
|
|
24d8f6ed7c | ||
|
|
64e3e932fc | ||
|
|
0c34d515f1 | ||
|
|
3f842655db | ||
|
|
72ac8cf5ad | ||
|
|
305bddb0ed | ||
|
|
d28f1dae9d | ||
|
|
9cd23ff84f | ||
|
|
04b42b1e05 | ||
|
|
80fee637f4 | ||
|
|
88838dd282 | ||
|
|
9fbd0c1ff1 | ||
|
|
2c16b9cf62 | ||
|
|
65abdb556d | ||
|
|
4fc1bfa93b | ||
|
|
6b116932b2 | ||
|
|
fb4a6dc0f1 | ||
|
|
f2c2a4be9e | ||
|
|
f813f43855 | ||
|
|
8b191921c3 | ||
|
|
c9f21e8319 | ||
|
|
b57a38f584 | ||
|
|
9ebc96116b | ||
|
|
18ba78e988 | ||
|
|
17a53f9e60 | ||
|
|
8ebdb1f5fd | ||
|
|
e8b768dd92 | ||
|
|
9cc0a5a9a9 | ||
|
|
206d45bc17 | ||
|
|
828f911efd | ||
|
|
bd1919504b | ||
|
|
b25009fc2c | ||
|
|
1d69028d2f | ||
|
|
834f7a39be | ||
|
|
48e76abadd | ||
|
|
894df05fe8 | ||
|
|
7521149193 | ||
|
|
df09515089 | ||
|
|
f69362d212 | ||
|
|
47d6ea6332 | ||
|
|
4d0565b5ba | ||
|
|
1a88692692 | ||
|
|
f0a17b3a86 | ||
|
|
9bb5f64871 | ||
|
|
8dc5ffa479 | ||
|
|
928aecc002 | ||
|
|
7b1572b177 | ||
|
|
b61bd1243a | ||
|
|
33c1a55b40 | ||
|
|
2fbce5f51f | ||
|
|
511f07b747 | ||
|
|
0fbcff1b35 | ||
|
|
08ac37bd2a | ||
|
|
1364742be9 | ||
|
|
41131cd41d | ||
|
|
f3feddb5b4 | ||
|
|
e6c48213c2 | ||
|
|
3c3980caa1 | ||
|
|
6cb75fb1e8 | ||
|
|
d1a491acf3 | ||
|
|
eebcbd5de3 | ||
|
|
171c759d79 | ||
|
|
3666cfab97 | ||
|
|
a4aa4f9772 | ||
|
|
1c84b55ade | ||
|
|
d0c98366d0 | ||
|
|
fe1d6feb3d | ||
|
|
8bb3bd04a9 | ||
|
|
3cc4265527 | ||
|
|
eb190b4e91 | ||
|
|
3798eb6fd5 | ||
|
|
aa82e99ed8 | ||
|
|
81406c0c1d | ||
|
|
0218acb7e7 | ||
|
|
a099545bec | ||
|
|
aca4f65c7e | ||
|
|
1896ca4e88 | ||
|
|
822498128b | ||
|
|
5cce0d7c7c | ||
|
|
642e44b98f | ||
|
|
76e249d31c | ||
|
|
17d4f5c2f8 | ||
|
|
15336b44d9 | ||
|
|
403f23b460 | ||
|
|
fb49f137ec | ||
|
|
d2d17e14ee | ||
|
|
f5ccd71d0c | ||
|
|
7903276f4c | ||
|
|
966311e627 | ||
|
|
2552cf248d | ||
|
|
9dd5d96332 | ||
|
|
6a5e1783b7 | ||
|
|
98b9dfaec9 | ||
|
|
219ebcb689 | ||
|
|
51d19891a4 | ||
|
|
6fc7817558 | ||
|
|
bdf1b22da5 | ||
|
|
82637e8187 | ||
|
|
1071a2655f | ||
|
|
78d5783b62 | ||
|
|
0be13d2dc2 | ||
|
|
51b584b159 | ||
|
|
7377f45b61 | ||
|
|
bfc42211d3 | ||
|
|
8b905e337c | ||
|
|
2b7cd813e7 | ||
|
|
0ca1698cf9 | ||
|
|
c1280db28a | ||
|
|
884db2f7be | ||
|
|
b63d41e1e5 | ||
|
|
4c24f170ea | ||
|
|
08777e9615 | ||
|
|
e1ba58f068 | ||
|
|
ac56700125 | ||
|
|
7b2c22696a | ||
|
|
717a043a32 | ||
|
|
9a9ede00bc | ||
|
|
b8487b6a7d | ||
|
|
25bd11cf27 | ||
|
|
1314db7109 | ||
|
|
57940605da | ||
|
|
cab1c3b370 | ||
|
|
b4873e57b4 | ||
|
|
6bd527771c | ||
|
|
02c24be8e4 | ||
|
|
4638ba9c07 | ||
|
|
de1c407348 | ||
|
|
ba980d0a62 | ||
|
|
e3bd360ec9 | ||
|
|
a00350486f | ||
|
|
e6cc30e167 | ||
|
|
155619184f | ||
|
|
c5d9c50897 | ||
|
|
6d7500c14c | ||
|
|
fd93c8601d | ||
|
|
0c7250f260 | ||
|
|
5b90a8bd7c | ||
|
|
fc0b0afdc3 | ||
|
|
2af6dded37 | ||
|
|
c9b24ef307 | ||
|
|
7dde353ee7 | ||
|
|
c395c6e5d7 | ||
|
|
b028cacf31 | ||
|
|
e1d2f86a41 | ||
|
|
5f107ab8a6 | ||
|
|
7f428cae88 | ||
|
|
6c5211a0ce | ||
|
|
f6aef68089 | ||
|
|
3f627e580a | ||
|
|
1b4570b79f | ||
|
|
b3f3cd5903 | ||
|
|
4b4275059f | ||
|
|
58797ab895 | ||
|
|
42b2d7fec5 | ||
|
|
b9ec171e7d | ||
|
|
5b597a2e5b | ||
|
|
c4c1993af6 | ||
|
|
e9ac8954be | ||
|
|
7722455726 | ||
|
|
ed0ec66996 | ||
|
|
0c34f53c93 | ||
|
|
84948e6382 | ||
|
|
5f4113edb3 | ||
|
|
8aa511f1fc | ||
|
|
7245bff300 | ||
|
|
88746d60ab | ||
|
|
8267a5fba7 | ||
|
|
fffa1aa0f3 | ||
|
|
248fdfcf73 | ||
|
|
1ab5a1b432 | ||
|
|
4c968c6ddd | ||
|
|
489fd56fe3 | ||
|
|
a44c89e8af | ||
|
|
93e8f59aab | ||
|
|
6f73079ce1 | ||
|
|
f96ebb0986 | ||
|
|
d144590d38 | ||
|
|
0e2447cd11 | ||
|
|
54310d95f9 | ||
|
|
4056edd20d | ||
|
|
1f7cc24df7 | ||
|
|
0307315769 | ||
|
|
c26097c2f1 | ||
|
|
05033c9ebd | ||
|
|
6d3fa654b7 | ||
|
|
62f9d1e3ae | ||
|
|
1d0f128351 | ||
|
|
f80125950c | ||
|
|
2a0ed8a2eb | ||
|
|
eaef8f6db2 | ||
|
|
1b2afd478b | ||
|
|
c05b417718 | ||
|
|
d4615d1118 | ||
|
|
497fe33d6f | ||
|
|
5e9f387175 | ||
|
|
1dfdae6de4 | ||
|
|
2004c25790 | ||
|
|
22336db97f | ||
|
|
72c9324d70 | ||
|
|
6e5958e37d | ||
|
|
54eb659032 | ||
|
|
e623e91e27 | ||
|
|
4dd03651f3 | ||
|
|
ce932f6479 | ||
|
|
0c84740450 | ||
|
|
65a2c451bb | ||
|
|
2464b092eb | ||
|
|
544940c48a | ||
|
|
9a826a3bd9 | ||
|
|
f423e1bb89 | ||
|
|
e955913115 | ||
|
|
7a1aac3343 | ||
|
|
97eff7eb57 | ||
|
|
f43f6fc39b | ||
|
|
0da8b8b801 | ||
|
|
fe6af26e2d | ||
|
|
0815f7f755 | ||
|
|
89e4862e5f | ||
|
|
6b63d80a7a | ||
|
|
90f43caf5b | ||
|
|
41fc3c76e9 | ||
|
|
abd159cce4 | ||
|
|
0ea2bfb30e | ||
|
|
1cc536af5a | ||
|
|
41b159fd11 | ||
|
|
1c7f608071 | ||
|
|
5351151352 | ||
|
|
a387075954 | ||
|
|
95ed19ae28 | ||
|
|
a4abd2bed9 | ||
|
|
20359deae6 | ||
|
|
5c571626e3 | ||
|
|
76a5117da7 | ||
|
|
eeea33db68 | ||
|
|
26f8ee48d6 | ||
|
|
91fd5406bc | ||
|
|
34fc0ec377 | ||
|
|
a23ae0f436 | ||
|
|
b8b2dd1a43 | ||
|
|
a91c3f1dd0 | ||
|
|
6058b78878 | ||
|
|
9649ca1630 | ||
|
|
e70fe1c42e | ||
|
|
227e5d1153 | ||
|
|
0c529b3899 | ||
|
|
a21a997478 | ||
|
|
008f983ba6 | ||
|
|
e315a162da | ||
|
|
61c7a06e7c | ||
|
|
dccda88f27 | ||
|
|
f856734c67 | ||
|
|
9f389cccfd | ||
|
|
082aecfc3a | ||
|
|
d650063a04 | ||
|
|
fd9689745c | ||
|
|
c4f69b6dfd | ||
|
|
c02301b666 | ||
|
|
f061867fd3 | ||
|
|
b15f0ecc0f | ||
|
|
ffc697ac27 | ||
|
|
3a16f511d9 | ||
|
|
6497d40521 | ||
|
|
8a4d164c2b |
No files matched your search
@@ -1,12 +1,301 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2016, PHP 5.6.21
|
||||
18 Aug 2016, PHP 5.6.25
|
||||
|
||||
- Core:
|
||||
- Bz2:
|
||||
. Fixed bug #72837 (integer overflow in bzdecompress caused heap
|
||||
corruption). (Stas)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70436 (Use After Free Vulnerability in unserialize()).
|
||||
(Taoguang Chen)
|
||||
. Fixed bug #72024 (microtime() leaks memory). (maroszek at gmx dot net)
|
||||
. Fixed bug #72581 (previous property undefined in Exception after
|
||||
deserialization). (Laruence)
|
||||
. Implemented FR #72614 (Support "nmake test" on building extensions by
|
||||
phpize). (Yuji Uchiyama)
|
||||
. Fixed bug #72641 (phpize (on Windows) ignores PHP_PREFIX).
|
||||
(Yuji Uchiyama)
|
||||
. Fixed bug #72663 (Create an Unexpected Object and Don't Invoke
|
||||
__wakeup() in Deserialization). (Stas)
|
||||
. Fixed bug #72681 (PHP Session Data Injection Vulnerability). (Stas)
|
||||
|
||||
- Calendar:
|
||||
. Fixed bug #67976 (cal_days_month() fails for final month of the French
|
||||
calendar). (cmb)
|
||||
. Fixed bug #71894 (AddressSanitizer: global-buffer-overflow in
|
||||
zif_cal_from_jd). (cmb)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #71144 (Segmentation fault when using cURL with ZTS).
|
||||
(maroszek at gmx dot net)
|
||||
. Fixed bug #71929 (Certification information (CERTINFO) data parsing error).
|
||||
(Pierrick)
|
||||
. Fixed bug #72807 (integer overflow in curl_escape caused heap
|
||||
corruption). (Stas)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug #66502 (DOM document dangling reference). (Sean Heelan, cmb)
|
||||
|
||||
- Ereg:
|
||||
. Fixed bug #72838 (Integer overflow lead to heap corruption in
|
||||
sql_regcase). (Stas)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #72627 (Memory Leakage In exif_process_IFD_in_TIFF). (Stas)
|
||||
. Fixed bug #72735 (Samsung picture thumb not read (zero size)). (Kalle, Remi)
|
||||
|
||||
- Filter:
|
||||
. Fixed bug #71745 (FILTER_FLAG_NO_RES_RANGE does not cover whole 127.0.0.0/8
|
||||
range). (bugs dot php dot net at majkl578 dot cz)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #72575 (using --allow-to-run-as-root should ignore missing user).
|
||||
(gooh)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #43828 (broken transparency of imagearc for truecolor in
|
||||
blendingmode). (cmb)
|
||||
. Fixed bug #66555 (Always false condition in ext/gd/libgd/gdkanji.c). (cmb)
|
||||
. Fixed bug #68712 (suspicious if-else statements). (cmb)
|
||||
. Fixed bug #70315 (500 Server Error but page is fully rendered). (cmb)
|
||||
. Fixed bug #72596 (imagetypes function won't advertise WEBP support). (cmb)
|
||||
. Fixed bug #72604 (imagearc() ignores thickness for full arcs). (cmb)
|
||||
. Fixed bug #72697 (select_colors write out-of-bounds). (Stas)
|
||||
. Fixed bug #72709 (imagesetstyle() causes OOB read for empty $styles). (cmb)
|
||||
. Fixed bug #72730 (imagegammacorrect allows arbitrary write access). (Stas)
|
||||
|
||||
- Intl:
|
||||
. Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain
|
||||
names). (cmb)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #72691 (mb_ereg_search raises a warning if a match zero-width).
|
||||
(cmb)
|
||||
. Fixed bug #72693 (mb_ereg_search increments search position when a match
|
||||
zero-width). (cmb)
|
||||
. Fixed bug #72694 (mb_ereg_search_setpos does not accept a string's last
|
||||
position). (cmb)
|
||||
. Fixed bug #72710 (`mb_ereg` causes buffer overflow on regexp compile error).
|
||||
(ju1ius)
|
||||
|
||||
- PCRE:
|
||||
. Fixed bug #72688 (preg_match missing group names in matches). (cmb)
|
||||
|
||||
- PDO_pgsql:
|
||||
. Fixed bug #70313 (PDO statement fails to throw exception). (Matteo)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug #72222 (ReflectionClass::export doesn't handle array constants).
|
||||
(Nikita Nefedov)
|
||||
|
||||
- SNMP:
|
||||
. Fixed bug #72708 (php_snmp_parse_oid integer overflow in memory
|
||||
allocation). (djodjo at gmail dot com)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #72330 (CSV fields incorrectly split if escape char followed by
|
||||
UTF chars). (cmb)
|
||||
. Fixed bug #72836 (integer overflow in base64_decode). (Stas)
|
||||
. Fixed bug #72848 (integer overflow in quoted_printable_encode). (Stas)
|
||||
. Fixed bug #72849 (integer overflow in urlencode). (Stas)
|
||||
. Fixed bug #72850 (integer overflow in php_uuencode). (Stas)
|
||||
. Fixed bug #72716 (initialize buffer before read). (Stas)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #41021 (Problems with the ftps wrapper). (vhuk)
|
||||
. Fixed bug #54431 (opendir() does not work with ftps:// wrapper). (vhuk)
|
||||
. Fixed bug #72667 (opendir() with ftp:// attempts to open data stream for
|
||||
non-existent directories). (vhuk)
|
||||
. Fixed bug #72764 (ftps:// opendir wrapper data channel encryption fails
|
||||
with IIS FTP 7.5, 8.5). (vhuk)
|
||||
. Fixed bug #72771 (ftps:// wrapper is vulnerable to protocol downgrade
|
||||
attack). (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #72122 (IteratorIterator breaks '@' error suppression). (kinglozzer)
|
||||
. Fixed bug #72646 (SplFileObject::getCsvControl does not return the escape
|
||||
character). (cmb)
|
||||
. Fixed bug #72684 (AppendIterator segfault with closed generator). (Pierrick)
|
||||
|
||||
- SQLite3:
|
||||
. Implemented FR #72653 (SQLite should allow opening with empty filename).
|
||||
(cmb)
|
||||
|
||||
- Wddx:
|
||||
. Fixed bug #72142 (WDDX Packet Injection Vulnerability in
|
||||
wddx_serialize_value()). (Taoguang Chen)
|
||||
. Fixed bug #72749 (wddx_deserialize allows illegal memory access) (Stas)
|
||||
. Fixed bug #72750 (wddx_deserialize null dereference). (Stas)
|
||||
. Fixed bug #72790 (wddx_deserialize null dereference with invalid xml).
|
||||
(Stas)
|
||||
. Fixed bug #72799 (wddx_deserialize null dereference in
|
||||
php_wddx_pop_element). (Stas)
|
||||
|
||||
21 Jul 2016, PHP 5.6.24
|
||||
|
||||
- Core:
|
||||
. Fixed bug #71936 (Segmentation fault destroying HTTP_RAW_POST_DATA).
|
||||
(mike dot laspina at gmail dot com, Remi)
|
||||
. Fixed bug #72496 (Cannot declare public method with signature incompatible
|
||||
with parent private method). (Pedro Magalhães)
|
||||
. Fixed bug #72138 (Integer Overflow in Length of String-typed ZVAL). (Stas)
|
||||
. Fixed bug #72513 (Stack-based buffer overflow vulnerability in
|
||||
virtual_file_ex). (loianhtuan at gmail dot com)
|
||||
. Fixed bug #72562 (Use After Free in unserialize() with Unexpected Session
|
||||
Deserialization). (taoguangchen at icloud dot com)
|
||||
. Fixed bug #72573 (HTTP_PROXY is improperly trusted by some PHP libraries and
|
||||
applications). (CVE-2016-5385) (Stas)
|
||||
|
||||
- bz2:
|
||||
. Fixed bug #72447 (Type Confusion in php_bz2_filter_create()). (gogil at
|
||||
stealien dot com).
|
||||
. Fixed bug #72613 (Inadequate error handling in bzread()). (Stas)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #66836 (DateTime::createFromFormat 'U' with pre 1970 dates fails
|
||||
parsing). (derick)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #50845 (exif_read_data() returns corrupted exif headers).
|
||||
(Bartosz Dziewoński)
|
||||
. Fixed bug #72603 (Out of bound read in exif_process_IFD_in_MAKERNOTE).
|
||||
(Stas)
|
||||
. Fixed bug #72618 (NULL Pointer Dereference in exif_process_user_comment).
|
||||
(Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #43475 (Thick styled lines have scrambled patterns). (cmb)
|
||||
. Fixed bug #53640 (XBM images require width to be multiple of 8). (cmb)
|
||||
. Fixed bug #64641 (imagefilledpolygon doesn't draw horizontal line). (cmb)
|
||||
. Fixed bug #72512 (gdImageTrueColorToPaletteBody allows arbitrary write/read
|
||||
access). (Pierre)
|
||||
. Fixed bug #72519 (imagegif/output out-of-bounds access). (Pierre)
|
||||
. Fixed bug #72558 (Integer overflow error within _gdContributionsAlloc()).
|
||||
(CVE-2016-6207) (Pierre)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #72533 (locale_accept_from_http out-of-bounds access). (Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #71915 (openssl_random_pseudo_bytes is not fork-safe).
|
||||
(Jakub Zelenka)
|
||||
. Fixed bug #72336 (openssl_pkey_new does not fail for invalid DSA params).
|
||||
(Jakub Zelenka)
|
||||
|
||||
- SNMP:
|
||||
. Fixed bug #72479 (Use After Free Vulnerability in SNMP with GC and
|
||||
unserialize()). (taoguangchen at icloud dot com)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #55701 (GlobIterator throws LogicException). (Valentin VĂLCIU)
|
||||
|
||||
- SQLite3:
|
||||
. Fixed bug #70628 (Clearing bindings on an SQLite3 statement doesn't work).
|
||||
(cmb)
|
||||
|
||||
- Streams:
|
||||
. Fixed bug #72439 (Stream socket with remote address leads to a segmentation
|
||||
fault). (Laruence)
|
||||
|
||||
- Xmlrpc:
|
||||
. Fixed bug #72606 (heap-buffer-overflow (write) simplestring_addn simplestring.c).
|
||||
(Stas)
|
||||
|
||||
- Zip:
|
||||
. Fixed bug #72520 (Stack-based buffer overflow vulnerability in
|
||||
php_stream_zip_opener). (loianhtuan at gmail dot com)
|
||||
|
||||
23 Jun 2016, PHP 5.6.23
|
||||
|
||||
- Core:
|
||||
. Fixed bug #72268 (Integer Overflow in nl2br()). (Stas)
|
||||
. Fixed bug #72275 (Integer Overflow in json_encode()/json_decode()/
|
||||
json_utf8_to_utf16()). (Stas)
|
||||
. Fixed bug #72400 (Integer Overflow in addcslashes/addslashes). (Stas)
|
||||
. Fixed bug #72403 (Integer Overflow in Length of String-typed ZVAL). (Stas)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #63740 (strtotime seems to use both sunday and monday as start of
|
||||
week). (Derick)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #66387 (Stack overflow with imagefilltoborder). (CVE-2015-8874)
|
||||
(cmb)
|
||||
. Fixed bug #72298 (pass2_no_dither out-of-bounds access). (Stas)
|
||||
. Fixed bug #72337 (invalid dimensions can lead to crash). (Pierre)
|
||||
. Fixed bug #72339 (Integer Overflow in _gd2GetHeader() resulting in
|
||||
heap overflow). (CVE-2016-5766) (Pierre)
|
||||
. Fixed bug #72407 (NULL Pointer Dereference at _gdScaleVert). (Stas)
|
||||
. Fixed bug #72446 (Integer Overflow in gdImagePaletteToTrueColor() resulting
|
||||
in heap overflow). (CVE-2016-5767) (Pierre)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #70484 (selectordinal doesn't work with named parameters).
|
||||
(Anatol)
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #72402 (_php_mb_regex_ereg_replace_exec - double free).
|
||||
(CVE-2016-5768) (Stas)
|
||||
|
||||
- mcrypt:
|
||||
. Fixed bug #72455 (Heap Overflow due to integer overflows). (CVE-2016-5769)
|
||||
(Stas)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #72140 (segfault after calling ERR_free_strings()).
|
||||
(Jakub Zelenka)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #72321 (invalid free in phar_extract_file()).
|
||||
(hji at dyntopia dot com)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #72262 (int/size_t confusion in SplFileObject::fread).
|
||||
(CVE-2016-5770) (Stas)
|
||||
. Fixed bug #72433 (Use After Free Vulnerability in PHP's GC algorithm and
|
||||
unserialize). (CVE-2016-5771) (Dmitry)
|
||||
|
||||
- WDDX:
|
||||
. Fixed bug #72340 (Double Free Courruption in wddx_deserialize).
|
||||
(CVE-2016-5772) (Stas)
|
||||
|
||||
- zip:
|
||||
. Fixed bug #72434 (ZipArchive class Use After Free Vulnerability in PHP's GC
|
||||
algorithm and unserialize). (CVE-2016-5773) (Dmitry)
|
||||
|
||||
26 May 2016, PHP 5.6.22
|
||||
|
||||
- Core:
|
||||
. Fixed bug #72172 (zend_hex_strtod should not use strlen).
|
||||
(bwitz at hotmail dot com )
|
||||
. Fixed bug #72114 (Integer underflow / arbitrary null write in
|
||||
fread/gzread). (CVE-2016-5096) (Stas)
|
||||
. Fixed bug #72135 (Integer Overflow in php_html_entities). (CVE-2016-5094)
|
||||
(Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #72227 (imagescale out-of-bounds read). (CVE-2013-7456) (Stas)
|
||||
|
||||
- Intl
|
||||
. Fixed bug #64524 (Add intl.use_exceptions to php.ini-*). (Anatol)
|
||||
. Fixed bug #72241 (get_icu_value_internal out-of-bounds read).
|
||||
(CVE-2016-5093) (Stas)
|
||||
|
||||
- Postgres:
|
||||
. Fixed bug #72151 (mysqli_fetch_object changed behaviour). (Anatol)
|
||||
|
||||
28 Apr 2016, PHP 5.6.21
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69537 (__debugInfo with empty string for key gives error).
|
||||
(krakjoe)
|
||||
. Fixed bug #71841 (EG(error_zval) is not handled well). (Laruence)
|
||||
|
||||
- BCmath:
|
||||
. Fixed bug #72093 (bcpowmod accepts negative scale and corrupts
|
||||
_one_ definition). (Stas)
|
||||
|
||||
- Curl:
|
||||
. Fixed bug #71831 (CURLOPT_NOPROXY applied as long instead of string).
|
||||
(Michael Sierks)
|
||||
@@ -14,6 +303,17 @@ PHP NEWS
|
||||
- Date:
|
||||
. Fixed bug #71889 (DateInterval::format Segmentation fault). (Thomas Punt)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug #72094 (Out of bounds heap read access in exif header processing). (Stas)
|
||||
|
||||
- GD:
|
||||
. Fixed bug #71952 (Corruption inside imageaffinematrixget). (Stas)
|
||||
. Fixed bug #71912 (libgd: signedness vulnerability). (CVE-2016-3074) (Stas)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #72061 (Out-of-bounds reads in zif_grapheme_stripos with negative
|
||||
offset). (Stas)
|
||||
|
||||
- OCI8:
|
||||
. Fixed bug #71422 (Fix ORA-01438: value larger than specified precision
|
||||
allowed for this column). (Chris Jones)
|
||||
@@ -43,6 +343,9 @@ PHP NEWS
|
||||
. Fixed bug #67512 (php_crypt() crashes if crypt_r() does not exist or
|
||||
_REENTRANT is not defined). (Nikita)
|
||||
|
||||
- XML:
|
||||
. Fixed bug #72099 (xml_parse_into_struct segmentation fault). (Stas)
|
||||
|
||||
31 Mar 2016, PHP 5.6.20
|
||||
|
||||
- CLI Server:
|
||||
@@ -60,17 +363,17 @@ PHP NEWS
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #71527 (Buffer over-write in finfo_open with malformed magic
|
||||
file). (Anatol)
|
||||
file). (CVE-2015-8865) (Anatol)
|
||||
|
||||
- Mbstring:
|
||||
. Fixed bug #71906 (AddressSanitizer: negative-size-param (-1) in
|
||||
mbfl_strcut). (Stas)
|
||||
mbfl_strcut). (CVE-2016-4073) (Stas)
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #47803, #69526 (Executing prepared statements is succesfull only
|
||||
for the first two statements). (einavitamar at gmail dot com, Anatol)
|
||||
. Fixed bug #71860 (Invalid memory write in phar on filename with \0 in
|
||||
name). (Stas)
|
||||
name). (CVE-2016-4072) (Stas)
|
||||
|
||||
- PDO_DBlib:
|
||||
. Fixed bug #54648 (PDO::MSSQL forces format of datetime fields).
|
||||
@@ -83,11 +386,11 @@ PHP NEWS
|
||||
|
||||
- SNMP:
|
||||
. Fixed bug #71704 (php_snmp_error() Format String Vulnerability).
|
||||
(andrew at jmpesp dot org)
|
||||
(CVE-2016-4071) (andrew at jmpesp dot org)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #71798 (Integer Overflow in php_raw_url_encode).
|
||||
(taoguangchen at icloud dot com, Stas)
|
||||
(CVE-2016-4070) (taoguangchen at icloud dot com, Stas)
|
||||
|
||||
03 Mar 2016, PHP 5.6.19
|
||||
|
||||
@@ -162,13 +465,19 @@ PHP NEWS
|
||||
on the same server). (Anatol)
|
||||
|
||||
- PCRE:
|
||||
. Upgraded bundled PCRE library to 8.38.
|
||||
. Upgraded bundled PCRE library to 8.38. (CVE-2015-8383, CVE-2015-8386,
|
||||
CVE-2015-8387, CVE-2015-8389, CVE-2015-8390, CVE-2015-8391, CVE-2015-8393,
|
||||
CVE-2015-8394)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (Stas)
|
||||
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (CVE-2016-4342)
|
||||
(Stas)
|
||||
. Fixed bug #71331 (Uninitialized pointer in phar_make_dirstream()).
|
||||
(CVE-2016-4343) (Stas)
|
||||
. Fixed bug #71391 (NULL Pointer Dereference in phar_tar_setupmetadata()).
|
||||
(Stas)
|
||||
. Fixed bug #71488 (Stack overflow when decompressing tar archives). (Stas)
|
||||
. Fixed bug #71488 (Stack overflow when decompressing tar archives).
|
||||
(CVE-2016-2554) (Stas)
|
||||
|
||||
- Session:
|
||||
. Fixed bug #69111 (Crash in SessionHandler::read()). (Anatol)
|
||||
@@ -201,7 +510,7 @@ PHP NEWS
|
||||
|
||||
- GD:
|
||||
. Fixed bug #70976 (Memory Read via gdImageRotateInterpolated Array Index
|
||||
Out of Bounds). (emmanuel dot law at gmail dot com)
|
||||
Out of Bounds). (CVE-2016-1903) (emmanuel dot law at gmail dot com)
|
||||
|
||||
- Mysqlnd:
|
||||
. Fixed bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction).
|
||||
@@ -314,9 +623,10 @@ PHP NEWS
|
||||
. Fixed bug #70389 (PDO constructor changes unrelated variables). (Laruence)
|
||||
|
||||
- Phar:
|
||||
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()). (Stas)
|
||||
. Fixed bug #69720 (Null pointer dereference in phar_get_fp_offset()).
|
||||
(CVE-2015-7803) (Stas)
|
||||
. FIxed bug #70433 (Uninitialized pointer in phar_make_dirstream when zip
|
||||
entry filename is "/"). (Stas)
|
||||
entry filename is "/"). (CVE-2015-7804) (Stas)
|
||||
|
||||
- Phpdbg:
|
||||
. Fix phpdbg_break_next() sometimes not breaking. (Bob)
|
||||
@@ -338,9 +648,10 @@ PHP NEWS
|
||||
. Fixed bug #69487 (SAPI may truncate POST data). (cmb)
|
||||
. Fixed bug #70198 (Checking liveness does not work as expected).
|
||||
(Shafreeck Sea, Anatol Belski)
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()). (Stas)
|
||||
. Fixed bug #70172 (Use After Free Vulnerability in unserialize()).
|
||||
(CVE-2015-6834) (Stas)
|
||||
. Fixed bug #70219 (Use after free vulnerability in session deserializer).
|
||||
(taoguangchen at icloud dot com)
|
||||
(CVE-2015-6835) (taoguangchen at icloud dot com)
|
||||
|
||||
- CLI server:
|
||||
. Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE).
|
||||
@@ -380,16 +691,16 @@ PHP NEWS
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70388 (SOAP serialize_function_call() type confusion / RCE).
|
||||
(Stas)
|
||||
(CVE-2015-6836) (Stas)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70290 (Null pointer deref (segfault) in spl_autoload via
|
||||
ob_start). (hugh at allthethings dot co dot nz)
|
||||
. Fixed bug #70303 (Incorrect constructor reflection for ArrayObject). (cmb)
|
||||
. Fixed bug #70365 (Use-after-free vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
SplObjectStorage). (CVE-2015-6834) (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70366 (Use-after-free vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
SplDoublyLinkedList). (CVE-2015-6834) (taoguangchen at icloud dot com)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70052 (getimagesize() fails for very large and very small WBMP).
|
||||
@@ -398,11 +709,12 @@ PHP NEWS
|
||||
INI_SCANNER_TYPED). (Tjerk)
|
||||
|
||||
- XSLT:
|
||||
. Fixed bug #69782 (NULL pointer dereference). (Stas)
|
||||
. Fixed bug #69782 (NULL pointer dereference). (CVE-2015-6837, CVE-2015-6838)
|
||||
(Stas)
|
||||
|
||||
- ZIP:
|
||||
. Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when
|
||||
creating directories). (neal at fb dot com)
|
||||
creating directories). (CVE-2014-9767) (neal at fb dot com)
|
||||
|
||||
06 Aug 2015, PHP 5.6.12
|
||||
|
||||
@@ -422,7 +734,8 @@ PHP NEWS
|
||||
|
||||
- GD:
|
||||
. Fixed bug #53156 (imagerectangle problem with point ordering). (cmb)
|
||||
. Fixed bug #66387 (Stack overflow with imagefilltoborder). (cmb)
|
||||
. Fixed bug #66387 (Stack overflow with imagefilltoborder). (CVE-2015-8874)
|
||||
(cmb)
|
||||
. Fixed bug #70102 (imagecreatefromwebm() shifts colors). (cmb)
|
||||
. Fixed bug #66590 (imagewebp() doesn't pad to even length). (cmb)
|
||||
. Fixed bug #66882 (imagerotate by -90 degrees truncates image by 1px). (cmb)
|
||||
@@ -436,18 +749,18 @@ PHP NEWS
|
||||
|
||||
- ODBC:
|
||||
. Fixed bug #69975 (PHP segfaults when accessing nvarchar(max) defined
|
||||
columns). (cmb)
|
||||
columns). (CVE-2015-8879) (cmb)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug #69882 (OpenSSL error "key values mismatch" after
|
||||
openssl_pkcs12_read with extra cert). (Tomasz Sawicki)
|
||||
. Fixed bug #70014 (openssl_random_pseudo_bytes() is not cryptographically
|
||||
secure). (Stas)
|
||||
secure). (CVE-2015-8867) (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)
|
||||
destination directory). (CVE-2015-6833) (Anatol Belski)
|
||||
|
||||
- SOAP:
|
||||
. Fixed bug #70081 (SoapClient info leak / null pointer dereference via
|
||||
@@ -455,13 +768,13 @@ PHP NEWS
|
||||
|
||||
- SPL:
|
||||
. Fixed bug #70068 (Dangling pointer in the unserialization of ArrayObject
|
||||
items). (sean.heelan)
|
||||
items). (CVE-2015-6832) (sean.heelan)
|
||||
. Fixed bug #70166 (Use After Free Vulnerability in unserialize() with
|
||||
SPLArrayObject). (taoguangchen at icloud dot com)
|
||||
SPLArrayObject). (CVE-2015-6831) (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70168 (Use After Free Vulnerability in unserialize() with
|
||||
SplObjectStorage). (taoguangchen at icloud dot com)
|
||||
SplObjectStorage). (CVE-2015-6831) (taoguangchen at icloud dot com)
|
||||
. Fixed bug #70169 (Use After Free Vulnerability in unserialize() with
|
||||
SplDoublyLinkedList). (taoguangchen at icloud dot com)
|
||||
SplDoublyLinkedList). (CVE-2015-6831) (taoguangchen at icloud dot com)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #70096 (Repeated iptcembed() adds superfluous FF bytes). (cmb)
|
||||
@@ -548,7 +861,8 @@ PHP NEWS
|
||||
on Windows. (Jorge Oliveira, Anatol)
|
||||
. Fixed bug #69646 (OS command injection vulnerability in escapeshellarg).
|
||||
(CVE-2015-4642) (Anatol Belski)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (Stas)
|
||||
. Fixed bug #69719 (Incorrect handling of paths with NULs). (CVE-2015-4598)
|
||||
(Stas)
|
||||
|
||||
- FTP
|
||||
. Improved fix for bug #69545 (Integer overflow in ftp_genlist() resulting in
|
||||
|
||||
@@ -218,6 +218,9 @@ PHP 5.6 UPGRADE NOTES
|
||||
. CURLOPT_KRBLEVEL
|
||||
. CURLOPT_KRB4LEVEL
|
||||
|
||||
curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
|
||||
as a string (PHP >= 5.6.25)
|
||||
|
||||
- Strings:
|
||||
substr_compare() now allows $length to be zero.
|
||||
pack() and unpack() now support 64-bit format specifiers: q, Q, J and P.
|
||||
@@ -400,6 +403,9 @@ PHP 5.6 UPGRADE NOTES
|
||||
- CURL:
|
||||
CURL_HTTP_VERSION_2_0 and CURL_VERSION_HTTP2 (>= 5.6.8)
|
||||
|
||||
- GD:
|
||||
IMG_WEBP (>= 5.6.25)
|
||||
|
||||
- LDAP:
|
||||
LDAP_ESCAPE_FILTER int(1)
|
||||
LDAP_ESCAPE_DN int(2)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Bug #72496 (declare public method with signature incompatible with parent private method should not throw a warning)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
private function getFoo()
|
||||
{
|
||||
return 'Foo';
|
||||
}
|
||||
|
||||
private function getBar()
|
||||
{
|
||||
return 'Bar';
|
||||
}
|
||||
|
||||
private function getBaz()
|
||||
{
|
||||
return 'Baz';
|
||||
}
|
||||
}
|
||||
|
||||
class Bar extends Foo
|
||||
{
|
||||
public function getFoo($extraArgument)
|
||||
{
|
||||
return $extraArgument;
|
||||
}
|
||||
|
||||
protected function getBar($extraArgument)
|
||||
{
|
||||
return $extraArgument;
|
||||
}
|
||||
|
||||
private function getBaz($extraArgument)
|
||||
{
|
||||
return $extraArgument;
|
||||
}
|
||||
}
|
||||
|
||||
echo "OK\n";
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -13,5 +13,5 @@ var_dump(gc_collect_cycles());
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
int(2)
|
||||
ok
|
||||
+5
-2
@@ -447,7 +447,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
|
||||
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key)+1, __d TSRMLS_CC)
|
||||
#define add_property_string(__arg, __key, __str, __duplicate) add_property_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
|
||||
#define add_property_stringl(__arg, __key, __str, __length, __duplicate) add_property_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
|
||||
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
|
||||
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
|
||||
|
||||
|
||||
ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC);
|
||||
@@ -458,7 +458,7 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
|
||||
|
||||
/** Build zend_call_info/cache from a zval*
|
||||
*
|
||||
* Caller is responsible to provide a return value, otherwise the we will crash.
|
||||
* Caller is responsible to provide a return value, otherwise the we will crash.
|
||||
* fci->retval_ptr_ptr = NULL;
|
||||
* In order to pass parameters the following members need to be set:
|
||||
* fci->param_count = 0;
|
||||
@@ -578,6 +578,9 @@ END_EXTERN_C()
|
||||
const char *__s=(s); \
|
||||
zval *__z = (z); \
|
||||
Z_STRLEN_P(__z) = strlen(__s); \
|
||||
if (UNEXPECTED(Z_STRLEN_P(__z) < 0)) { \
|
||||
zend_error(E_ERROR, "String size overflow"); \
|
||||
} \
|
||||
Z_STRVAL_P(__z) = (duplicate?estrndup(__s, Z_STRLEN_P(__z)):(char*)__s);\
|
||||
Z_TYPE_P(__z) = IS_STRING; \
|
||||
} while (0)
|
||||
|
||||
+5
-3
@@ -3252,8 +3252,8 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* If both methods are private do not enforce a signature */
|
||||
if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) {
|
||||
/* If the prototype method is private do not enforce a signature */
|
||||
if (proto->common.fn_flags & ZEND_ACC_PRIVATE) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3637,6 +3637,7 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||
{
|
||||
zend_property_info *child_info;
|
||||
zend_class_entry *parent_ce = ce->parent;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) {
|
||||
if (zend_hash_quick_find(&ce->properties_info, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) {
|
||||
@@ -3669,7 +3670,8 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
||||
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||
zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
|
||||
/* Don't keep default properties in GC (thry may be freed by opcache) */
|
||||
i_zval_ptr_dtor_nogc(ce->default_properties_table[parent_info->offset] ZEND_FILE_LINE_CC TSRMLS_CC);
|
||||
ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
|
||||
ce->default_properties_table[child_info->offset] = NULL;
|
||||
child_info->offset = parent_info->offset;
|
||||
|
||||
@@ -230,7 +230,7 @@ ZEND_METHOD(exception, __construct)
|
||||
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) { \
|
||||
if (value && Z_TYPE_P(value) != IS_NULL && Z_TYPE_P(value) != type) { \
|
||||
zval *tmp; \
|
||||
MAKE_STD_ZVAL(tmp); \
|
||||
ZVAL_STRINGL(tmp, name, sizeof(name)-1, 1); \
|
||||
|
||||
+14
-2
@@ -1397,7 +1397,13 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
||||
ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
|
||||
{
|
||||
int length = Z_STRLEN_P(op1) + 1;
|
||||
char *buf = str_erealloc(Z_STRVAL_P(op1), length + 1);
|
||||
char *buf;
|
||||
|
||||
if (UNEXPECTED(length < 0)) {
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
|
||||
buf = str_erealloc(Z_STRVAL_P(op1), length + 1);
|
||||
|
||||
buf[length - 1] = (char) Z_LVAL_P(op2);
|
||||
buf[length] = 0;
|
||||
@@ -1410,7 +1416,13 @@ ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2)
|
||||
ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2) /* {{{ */
|
||||
{
|
||||
int length = Z_STRLEN_P(op1) + Z_STRLEN_P(op2);
|
||||
char *buf = str_erealloc(Z_STRVAL_P(op1), length + 1);
|
||||
char *buf;
|
||||
|
||||
if (UNEXPECTED(length < 0)) {
|
||||
zend_error(E_ERROR, "String size overflow");
|
||||
}
|
||||
|
||||
buf = str_erealloc(Z_STRVAL_P(op1), length + 1);
|
||||
|
||||
memcpy(buf + Z_STRLEN_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||
buf[length] = 0;
|
||||
|
||||
+1
-1
@@ -2590,7 +2590,7 @@ ZEND_API double zend_hex_strtod(const char *str, const char **endptr)
|
||||
int any = 0;
|
||||
double value = 0;
|
||||
|
||||
if (strlen(str) < 2) {
|
||||
if (s[0] == '\0' || s[1] == '\0') {
|
||||
*endptr = str;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@@ -651,14 +651,14 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
realpath_cache_bucket *r = *bucket;
|
||||
*bucket = (*bucket)->next;
|
||||
|
||||
|
||||
/* if the pointers match then only subtract the length of the path */
|
||||
if(r->path == r->realpath) {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
|
||||
} else {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
}
|
||||
|
||||
|
||||
free(r);
|
||||
return;
|
||||
} else {
|
||||
@@ -734,7 +734,7 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
|
||||
realpath_cache_bucket *r = *bucket;
|
||||
*bucket = (*bucket)->next;
|
||||
|
||||
/* if the pointers match then only subtract the length of the path */
|
||||
/* if the pointers match then only subtract the length of the path */
|
||||
if(r->path == r->realpath) {
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1;
|
||||
} else {
|
||||
@@ -919,6 +919,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
if (pbuffer == NULL) {
|
||||
CloseHandle(hLink);
|
||||
return -1;
|
||||
}
|
||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||
@@ -1189,7 +1190,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
int add_slash;
|
||||
void *tmp;
|
||||
|
||||
if (path_length == 0 || path_length >= MAXPATHLEN-1) {
|
||||
if (path_length <= 0 || path_length >= MAXPATHLEN-1) {
|
||||
#ifdef TSRM_WIN32
|
||||
# if _MSC_VER < 1300
|
||||
errno = EINVAL;
|
||||
|
||||
+2
-2
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=6
|
||||
PHP_RELEASE_VERSION=21
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=25
|
||||
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`
|
||||
|
||||
|
||||
+41
-19
@@ -201,6 +201,21 @@ static void php_str2num(bc_num *num, char *str TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ split_bc_num
|
||||
Convert to bc_num detecting scale */
|
||||
static bc_num split_bc_num(bc_num num) {
|
||||
bc_num newnum;
|
||||
if (num->n_refs >= 1) {
|
||||
return num;
|
||||
}
|
||||
newnum = _bc_new_num_ex(0, 0, 0);
|
||||
*newnum = *num;
|
||||
newnum->n_refs = 1;
|
||||
num->n_refs--;
|
||||
return newnum;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto string bcadd(string left_operand, string right_operand [, int scale])
|
||||
Returns the sum of two arbitrary precision numbers */
|
||||
PHP_FUNCTION(bcadd)
|
||||
@@ -214,7 +229,7 @@ PHP_FUNCTION(bcadd)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -225,11 +240,12 @@ PHP_FUNCTION(bcadd)
|
||||
php_str2num(&first, left TSRMLS_CC);
|
||||
php_str2num(&second, right TSRMLS_CC);
|
||||
bc_add (first, second, &result, scale);
|
||||
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
@@ -253,7 +269,7 @@ PHP_FUNCTION(bcsub)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -266,6 +282,7 @@ PHP_FUNCTION(bcsub)
|
||||
bc_sub (first, second, &result, scale);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -292,11 +309,11 @@ PHP_FUNCTION(bcmul)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
@@ -305,6 +322,7 @@ PHP_FUNCTION(bcmul)
|
||||
bc_multiply (first, second, &result, scale TSRMLS_CC);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -331,11 +349,11 @@ PHP_FUNCTION(bcdiv)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
@@ -345,6 +363,7 @@ PHP_FUNCTION(bcdiv)
|
||||
switch (bc_divide(first, second, &result, scale TSRMLS_CC)) {
|
||||
case 0: /* OK */
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -374,13 +393,13 @@ PHP_FUNCTION(bcmod)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &left, &left_len, &right, &right_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bc_init_num(&first TSRMLS_CC);
|
||||
bc_init_num(&second TSRMLS_CC);
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
bc_str2num(&first, left, 0 TSRMLS_CC);
|
||||
bc_str2num(&second, right, 0 TSRMLS_CC);
|
||||
|
||||
|
||||
switch (bc_modulo(first, second, &result, 0 TSRMLS_CC)) {
|
||||
case 0:
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -391,7 +410,7 @@ PHP_FUNCTION(bcmod)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&result);
|
||||
@@ -424,8 +443,9 @@ PHP_FUNCTION(bcpowmod)
|
||||
scale_int = (int) ((int)scale < 0) ? 0 : scale;
|
||||
|
||||
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
|
||||
if (result->n_scale > scale) {
|
||||
result->n_scale = scale;
|
||||
if (result->n_scale > scale_int) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale_int;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
|
||||
@@ -433,7 +453,7 @@ PHP_FUNCTION(bcpowmod)
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
bc_free_num(&first);
|
||||
bc_free_num(&second);
|
||||
bc_free_num(&mod);
|
||||
@@ -455,7 +475,7 @@ PHP_FUNCTION(bcpow)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -468,6 +488,7 @@ PHP_FUNCTION(bcpow)
|
||||
bc_raise (first, second, &result, scale TSRMLS_CC);
|
||||
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
|
||||
@@ -494,16 +515,17 @@ PHP_FUNCTION(bcsqrt)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 2) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
|
||||
bc_init_num(&result TSRMLS_CC);
|
||||
php_str2num(&result, left TSRMLS_CC);
|
||||
|
||||
|
||||
if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
|
||||
if (result->n_scale > scale) {
|
||||
result = split_bc_num(result);
|
||||
result->n_scale = scale;
|
||||
}
|
||||
Z_STRVAL_P(return_value) = bc_num2str(result);
|
||||
@@ -531,7 +553,7 @@ PHP_FUNCTION(bccomp)
|
||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 3) {
|
||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
||||
}
|
||||
@@ -555,7 +577,7 @@ PHP_FUNCTION(bccomp)
|
||||
PHP_FUNCTION(bcscale)
|
||||
{
|
||||
long new_scale;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_scale) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded("bcmath")) print "skip";
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip valid only for windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod(1, "A", 128, -200));
|
||||
var_dump(bcpowmod(1, 1.2, 1, 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
string(3) "0.0"
|
||||
bc math warning: non-zero scale in exponent
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded("bcmath")) print "skip";
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip Not valid for windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(bcpowmod(1, "A", 128, -200));
|
||||
var_dump(bcpowmod(1, 1.2, 1, 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(1) "1"
|
||||
bc math warning: non-zero scale in exponent
|
||||
string(3) "0.0"
|
||||
+55
-41
@@ -15,7 +15,7 @@
|
||||
| Author: Sterling Hughes <sterling@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -138,29 +138,33 @@ struct php_bz2_stream_data_t {
|
||||
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
|
||||
size_t ret;
|
||||
|
||||
ret = BZ2_bzread(self->bz_file, buf, count);
|
||||
int bz2_ret;
|
||||
|
||||
if (ret == 0) {
|
||||
bz2_ret = BZ2_bzread(self->bz_file, buf, count);
|
||||
|
||||
if (bz2_ret < 0) {
|
||||
stream->eof = 1;
|
||||
return -1;
|
||||
}
|
||||
if (bz2_ret == 0) {
|
||||
stream->eof = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return (size_t)bz2_ret;
|
||||
}
|
||||
|
||||
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
||||
{
|
||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *) stream->abstract;
|
||||
|
||||
return BZ2_bzwrite(self->bz_file, (char*)buf, count);
|
||||
return BZ2_bzwrite(self->bz_file, (char*)buf, count);
|
||||
}
|
||||
|
||||
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
|
||||
{
|
||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
||||
int ret = EOF;
|
||||
|
||||
|
||||
if (close_handle) {
|
||||
BZ2_bzclose(self->bz_file);
|
||||
}
|
||||
@@ -192,11 +196,11 @@ php_stream_ops php_stream_bz2io_ops = {
|
||||
};
|
||||
|
||||
/* {{{ Bzip2 stream openers */
|
||||
PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz,
|
||||
PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz,
|
||||
const char *mode, php_stream *innerstream STREAMS_DC TSRMLS_DC)
|
||||
{
|
||||
struct php_bz2_stream_data_t *self;
|
||||
|
||||
|
||||
self = emalloc(sizeof(*self));
|
||||
|
||||
self->stream = innerstream;
|
||||
@@ -227,7 +231,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
virtual_filepath_ex(path, &path_copy, NULL TSRMLS_CC);
|
||||
#else
|
||||
path_copy = path;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (php_check_open_basedir(path_copy TSRMLS_CC)) {
|
||||
#ifdef VIRTUAL_DIR
|
||||
@@ -235,7 +239,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* try and open it directly first */
|
||||
bz_file = BZ2_bzopen(path_copy, mode);
|
||||
|
||||
@@ -246,11 +250,11 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
efree(path_copy);
|
||||
#endif
|
||||
path_copy = NULL;
|
||||
|
||||
|
||||
if (bz_file == NULL) {
|
||||
/* that didn't work, so try and get something from the network/wrapper */
|
||||
stream = php_stream_open_wrapper(path, mode, options | STREAM_WILL_CAST, opened_path);
|
||||
|
||||
|
||||
if (stream) {
|
||||
php_socket_t fd;
|
||||
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
|
||||
@@ -265,7 +269,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||
VCWD_UNLINK(*opened_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bz_file) {
|
||||
retstream = _php_stream_bz2open_from_BZFILE(bz_file, mode, stream STREAMS_REL_CC TSRMLS_CC);
|
||||
if (retstream) {
|
||||
@@ -341,7 +345,7 @@ static PHP_FUNCTION(bzread)
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
php_stream_from_zval(stream, &bz);
|
||||
|
||||
if ((len + 1) < 1) {
|
||||
@@ -351,13 +355,13 @@ static PHP_FUNCTION(bzread)
|
||||
|
||||
Z_STRVAL_P(return_value) = emalloc(len + 1);
|
||||
Z_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);
|
||||
|
||||
|
||||
if (Z_STRLEN_P(return_value) < 0) {
|
||||
efree(Z_STRVAL_P(return_value));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "could not read valid bz2 data from stream");
|
||||
RETURN_FALSE;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
|
||||
Z_TYPE_P(return_value) = IS_STRING;
|
||||
}
|
||||
@@ -373,7 +377,7 @@ static PHP_FUNCTION(bzopen)
|
||||
|
||||
BZFILE *bz; /* The compressed file stream */
|
||||
php_stream *stream = NULL;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &file, &mode, &mode_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -389,15 +393,15 @@ static PHP_FUNCTION(bzopen)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "filename cannot be empty");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (CHECK_ZVAL_NULL_PATH(*file)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
stream = php_stream_bz2open(NULL,
|
||||
Z_STRVAL_PP(file),
|
||||
mode,
|
||||
REPORT_ERRORS,
|
||||
Z_STRVAL_PP(file),
|
||||
mode,
|
||||
REPORT_ERRORS,
|
||||
NULL);
|
||||
} else if (Z_TYPE_PP(file) == IS_RESOURCE) {
|
||||
/* If it is a resource, than its a stream resource */
|
||||
@@ -406,7 +410,7 @@ static PHP_FUNCTION(bzopen)
|
||||
|
||||
php_stream_from_zval(stream, file);
|
||||
stream_mode_len = strlen(stream->mode);
|
||||
|
||||
|
||||
if (stream_mode_len != 1 && !(stream_mode_len == 2 && memchr(stream->mode, 'b', 2))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode);
|
||||
RETURN_FALSE;
|
||||
@@ -440,7 +444,7 @@ static PHP_FUNCTION(bzopen)
|
||||
if (FAILURE == php_stream_cast(stream, PHP_STREAM_AS_FD, (void *) &fd, REPORT_ERRORS)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
bz = BZ2_bzdopen(fd, mode);
|
||||
|
||||
stream = php_stream_bz2open_from_BZFILE(bz, mode, stream);
|
||||
@@ -494,7 +498,7 @@ static PHP_FUNCTION(bzcompress)
|
||||
work_factor = 0, /* Work factor for compression algorithm */
|
||||
argc; /* Argument count */
|
||||
int source_len; /* Length of the source data */
|
||||
unsigned int dest_len; /* Length of the destination buffer */
|
||||
unsigned int dest_len; /* Length of the destination buffer */
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
|
||||
@@ -503,19 +507,19 @@ static PHP_FUNCTION(bzcompress)
|
||||
}
|
||||
|
||||
/* Assign them to easy to use variables, dest_len is initially the length of the data
|
||||
+ .01 x length of data + 600 which is the largest size the results of the compression
|
||||
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
|
||||
+ .01 x length of data + 600 which is the largest size the results of the compression
|
||||
could possibly be, at least that's what the libbz2 docs say (thanks to jeremy@nirvani.net
|
||||
for pointing this out). */
|
||||
dest_len = (unsigned int) (source_len + (0.01 * source_len) + 600);
|
||||
|
||||
|
||||
/* Allocate the destination buffer */
|
||||
dest = emalloc(dest_len + 1);
|
||||
|
||||
|
||||
/* Handle the optional arguments */
|
||||
if (argc > 1) {
|
||||
block_size = zblock_size;
|
||||
}
|
||||
|
||||
|
||||
if (argc > 2) {
|
||||
work_factor = zwork_factor;
|
||||
}
|
||||
@@ -565,20 +569,30 @@ static PHP_FUNCTION(bzdecompress)
|
||||
/* in most cases bz2 offers at least 2:1 compression, so we use that as our base */
|
||||
bzs.avail_out = source_len * 2;
|
||||
bzs.next_out = dest = emalloc(bzs.avail_out + 1);
|
||||
|
||||
|
||||
while ((error = BZ2_bzDecompress(&bzs)) == BZ_OK && bzs.avail_in > 0) {
|
||||
/* compression is better then 2:1, need to allocate more memory */
|
||||
bzs.avail_out = source_len;
|
||||
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
|
||||
if (size > INT_MAX) {
|
||||
/* no reason to continue if we're going to drop it anyway */
|
||||
break;
|
||||
}
|
||||
dest = safe_erealloc(dest, 1, bzs.avail_out+1, (size_t) size );
|
||||
bzs.next_out = dest + size;
|
||||
}
|
||||
|
||||
if (error == BZ_STREAM_END || error == BZ_OK) {
|
||||
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
|
||||
dest = safe_erealloc(dest, 1, (size_t) size, 1);
|
||||
dest[size] = '\0';
|
||||
RETVAL_STRINGL(dest, (int) size, 0);
|
||||
if (size > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Decompressed size too big, max is %d", INT_MAX);
|
||||
efree(dest);
|
||||
RETVAL_LONG(BZ_MEM_ERROR);
|
||||
} else {
|
||||
dest = safe_erealloc(dest, 1, (size_t) size, 1);
|
||||
dest[size] = '\0';
|
||||
RETVAL_STRINGL(dest, (int) size, 0);
|
||||
}
|
||||
} else { /* real error */
|
||||
efree(dest);
|
||||
RETVAL_LONG(error);
|
||||
@@ -591,13 +605,13 @@ static PHP_FUNCTION(bzdecompress)
|
||||
/* {{{ php_bz2_error()
|
||||
The central error handling interface, does the work for bzerrno, bzerrstr and bzerror */
|
||||
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
|
||||
{
|
||||
{
|
||||
zval *bzp; /* BZip2 Resource Pointer */
|
||||
php_stream *stream;
|
||||
const char *errstr; /* Error string */
|
||||
int errnum; /* Error number */
|
||||
struct php_bz2_stream_data_t *self;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &bzp) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@@ -609,10 +623,10 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
|
||||
}
|
||||
|
||||
self = (struct php_bz2_stream_data_t *) stream->abstract;
|
||||
|
||||
|
||||
/* Fetch the error information */
|
||||
errstr = BZ2_bzerror(self->bz_file, &errnum);
|
||||
|
||||
|
||||
/* Determine what to return */
|
||||
switch (opt) {
|
||||
case PHP_BZ_ERRNO:
|
||||
@@ -623,7 +637,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
|
||||
break;
|
||||
case PHP_BZ_ERRBOTH:
|
||||
array_init(return_value);
|
||||
|
||||
|
||||
add_assoc_long (return_value, "errno", errnum);
|
||||
add_assoc_string(return_value, "errstr", (char*)errstr, 1);
|
||||
break;
|
||||
|
||||
@@ -396,7 +396,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||
zval_copy_ctor(&tmp);
|
||||
convert_to_long(&tmp);
|
||||
if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_LVAL_PP(tmpzval));
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%ld)", Z_LVAL(tmp));
|
||||
} else {
|
||||
blockSize100k = Z_LVAL(tmp);
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72447: Type Confusion in php_bz2_filter_create()
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("bz2")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$input = "AAAAAAAA";
|
||||
$param = array('blocks' => $input);
|
||||
|
||||
$fp = fopen('testfile', 'w');
|
||||
stream_filter_append($fp, 'bzip2.compress', STREAM_FILTER_WRITE, $param);
|
||||
fclose($fp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: stream_filter_append(): Invalid parameter given for number of blocks to allocate. (0) in %s%ebug72447.php on line %d
|
||||
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #72613 (Inadequate error handling in bzread())
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("bz2")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$fp = bzopen(__DIR__.'/72613.bz2', 'r');
|
||||
if ($fp === FALSE) {
|
||||
exit("ERROR: bzopen()");
|
||||
}
|
||||
$data = "";
|
||||
while (!feof($fp)) {
|
||||
$res = bzread($fp);
|
||||
if ($res === FALSE) {
|
||||
exit("ERROR: bzread()");
|
||||
}
|
||||
$data .= $res;
|
||||
}
|
||||
bzclose($fp);
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
+17
-7
@@ -359,6 +359,10 @@ PHP_FUNCTION(cal_days_in_month)
|
||||
}
|
||||
else {
|
||||
sdn_next = calendar->to_jd(year + 1, 1, 1);
|
||||
if (cal == CAL_FRENCH && sdn_next == 0) {
|
||||
/* The French calendar ends on 0014-13-05. */
|
||||
sdn_next = 2380953;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,15 +420,21 @@ PHP_FUNCTION(cal_from_jd)
|
||||
add_assoc_long(return_value, "year", year);
|
||||
|
||||
/* day of week */
|
||||
dow = DayOfWeek(jd);
|
||||
add_assoc_long(return_value, "dow", dow);
|
||||
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
|
||||
add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
|
||||
if (cal != CAL_JEWISH || year > 0) {
|
||||
dow = DayOfWeek(jd);
|
||||
add_assoc_long(return_value, "dow", dow);
|
||||
add_assoc_string(return_value, "abbrevdayname", DayNameShort[dow], 1);
|
||||
add_assoc_string(return_value, "dayname", DayNameLong[dow], 1);
|
||||
} else {
|
||||
add_assoc_null(return_value, "dow");
|
||||
add_assoc_string(return_value, "abbrevdayname", "", 1);
|
||||
add_assoc_string(return_value, "dayname", "", 1);
|
||||
}
|
||||
/* month name */
|
||||
if(cal == CAL_JEWISH) {
|
||||
/* special case for Jewish calendar */
|
||||
add_assoc_string(return_value, "abbrevmonth", JEWISH_MONTH_NAME(year)[month], 1);
|
||||
add_assoc_string(return_value, "monthname", JEWISH_MONTH_NAME(year)[month], 1);
|
||||
add_assoc_string(return_value, "abbrevmonth", (year > 0 ? JEWISH_MONTH_NAME(year)[month] : ""), 1);
|
||||
add_assoc_string(return_value, "monthname", (year > 0 ? JEWISH_MONTH_NAME(year)[month] : ""), 1);
|
||||
} else {
|
||||
add_assoc_string(return_value, "abbrevmonth", calendar->month_name_short[month], 1);
|
||||
add_assoc_string(return_value, "monthname", calendar->month_name_long[month], 1);
|
||||
@@ -737,7 +747,7 @@ PHP_FUNCTION(jdmonthname)
|
||||
break;
|
||||
case CAL_MONTH_JEWISH: /* jewish month */
|
||||
SdnToJewish(julday, &year, &month, &day);
|
||||
monthname = JEWISH_MONTH_NAME(year)[month];
|
||||
monthname = (year > 0 ? JEWISH_MONTH_NAME(year)[month] : "");
|
||||
break;
|
||||
case CAL_MONTH_FRENCH: /* french month */
|
||||
SdnToFrench(julday, &year, &month, &day);
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #67976 (cal_days_month() fails for final month of the French calendar)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(cal_days_in_month(CAL_FRENCH, 13, 14));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(5)
|
||||
@@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Bug #71894 (AddressSanitizer: global-buffer-overflow in zif_cal_from_jd)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(cal_from_jd(347997, CAL_JEWISH));
|
||||
var_dump(jdmonthname(347997,CAL_MONTH_JEWISH));?>
|
||||
--EXPECT--
|
||||
array(9) {
|
||||
["date"]=>
|
||||
string(5) "0/0/0"
|
||||
["month"]=>
|
||||
int(0)
|
||||
["day"]=>
|
||||
int(0)
|
||||
["year"]=>
|
||||
int(0)
|
||||
["dow"]=>
|
||||
NULL
|
||||
["abbrevdayname"]=>
|
||||
string(0) ""
|
||||
["dayname"]=>
|
||||
string(0) ""
|
||||
["abbrevmonth"]=>
|
||||
string(0) ""
|
||||
["monthname"]=>
|
||||
string(0) ""
|
||||
}
|
||||
string(0) ""
|
||||
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
jdtogregorian(): test overflow
|
||||
--CREDITS--
|
||||
neweracracker@gmail.com
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
for ($i=536838860; $i<536838870; $i++) {
|
||||
echo $i, ':', jdtogregorian($i), PHP_EOL;
|
||||
}
|
||||
echo 'DONE', PHP_EOL;
|
||||
?>
|
||||
--EXPECT--
|
||||
536838860:10/11/1465102
|
||||
536838861:10/12/1465102
|
||||
536838862:10/13/1465102
|
||||
536838863:10/14/1465102
|
||||
536838864:10/15/1465102
|
||||
536838865:10/16/1465102
|
||||
536838866:10/17/1465102
|
||||
536838867:0/0/0
|
||||
536838868:0/0/0
|
||||
536838869:0/0/0
|
||||
DONE
|
||||
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
jdtojewish(): test overflow
|
||||
--CREDITS--
|
||||
neweracracker@gmail.com
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('calendar')) die('skip ext/calendar required');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
for ($i=324542840; $i<324542850; $i++) {
|
||||
echo $i, ':', jdtojewish($i), PHP_EOL;
|
||||
}
|
||||
echo 'DONE', PHP_EOL;
|
||||
?>
|
||||
--EXPECT--
|
||||
324542840:12/7/887605
|
||||
324542841:12/8/887605
|
||||
324542842:12/9/887605
|
||||
324542843:12/10/887605
|
||||
324542844:12/11/887605
|
||||
324542845:12/12/887605
|
||||
324542846:12/13/887605
|
||||
324542847:0/0/0
|
||||
324542848:0/0/0
|
||||
324542849:0/0/0
|
||||
DONE
|
||||
+20
-48
@@ -1833,38 +1833,6 @@ static void alloc_curl_handle(php_curl **ch)
|
||||
/* }}} */
|
||||
|
||||
#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
|
||||
/* {{{ split_certinfo
|
||||
*/
|
||||
static void split_certinfo(char *string, zval *hash)
|
||||
{
|
||||
char *org = estrdup(string);
|
||||
char *s = org;
|
||||
char *split;
|
||||
|
||||
if(org) {
|
||||
do {
|
||||
char *key;
|
||||
char *val;
|
||||
char *tmp;
|
||||
|
||||
split = strstr(s, "; ");
|
||||
if(split)
|
||||
*split = '\0';
|
||||
|
||||
key = s;
|
||||
tmp = memchr(key, '=', 64);
|
||||
if(tmp) {
|
||||
*tmp = '\0';
|
||||
val = tmp+1;
|
||||
add_assoc_string(hash, key, val, 1);
|
||||
}
|
||||
s = split+2;
|
||||
} while(split);
|
||||
efree(org);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ create_certinfo
|
||||
*/
|
||||
static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC)
|
||||
@@ -1888,17 +1856,7 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC)
|
||||
if(tmp) {
|
||||
*tmp = '\0';
|
||||
len = strlen(s);
|
||||
if(!strcmp(s, "Subject") || !strcmp(s, "Issuer")) {
|
||||
zval *hash;
|
||||
|
||||
MAKE_STD_ZVAL(hash);
|
||||
array_init(hash);
|
||||
|
||||
split_certinfo(&slist->data[len+1], hash);
|
||||
add_assoc_zval(certhash, s, hash);
|
||||
} else {
|
||||
add_assoc_string(certhash, s, &slist->data[len+1], 1);
|
||||
}
|
||||
add_assoc_string(certhash, s, &slist->data[len+1], 1);
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not extract hash key from certificate info");
|
||||
}
|
||||
@@ -1925,7 +1883,9 @@ static void _php_curl_set_default_options(php_curl *ch)
|
||||
curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
|
||||
#if !defined(ZTS)
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
|
||||
#endif
|
||||
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
|
||||
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
|
||||
|
||||
@@ -2263,7 +2223,14 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC)
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
# if defined(ZTS)
|
||||
if (option == CURLOPT_DNS_USE_GLOBAL_CACHE) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled");
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
|
||||
|
||||
break;
|
||||
case CURLOPT_SAFE_UPLOAD:
|
||||
convert_to_long_ex(zvalue);
|
||||
@@ -2547,12 +2514,13 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
|
||||
} else {
|
||||
zend_hash_next_index_insert(ch->to_free->slist, &slist, sizeof(struct curl_slist *), NULL);
|
||||
if (slist) {
|
||||
if (Z_REFCOUNT_P(ch->clone) <= 1) {
|
||||
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
|
||||
} else {
|
||||
zend_hash_next_index_insert(ch->to_free->slist, &slist, sizeof(struct curl_slist *), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
error = curl_easy_setopt(ch->cp, option, slist);
|
||||
|
||||
break;
|
||||
@@ -3510,6 +3478,10 @@ PHP_FUNCTION(curl_escape)
|
||||
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
|
||||
|
||||
if ((res = curl_easy_escape(ch->cp, str, str_len))) {
|
||||
if (strlen(res) > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Escaped string is too long, maximum is %d", INT_MAX);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETVAL_STRING(res, 1);
|
||||
curl_free(res);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #71144 (Sementation fault when using cURL with ZTS)
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
<?php if (!PHP_ZTS) { print "skip only for zts build"; } ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$ch = curl_init();
|
||||
var_dump(curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, 1));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: curl_setopt(): CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled in %sbug71144.php on line %d
|
||||
bool(false)
|
||||
+71
-1629
File diff suppressed because it is too large.
Load diff
+28
-28
@@ -310,33 +310,33 @@ void timelib_dump_rel_time(timelib_rel_time *d)
|
||||
|
||||
timelib_long timelib_parse_tz_cor(char **ptr)
|
||||
{
|
||||
char *begin = *ptr, *end;
|
||||
timelib_long tmp;
|
||||
char *begin = *ptr, *end;
|
||||
timelib_long tmp;
|
||||
|
||||
while (isdigit(**ptr) || **ptr == ':') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
switch (end - begin) {
|
||||
case 1:
|
||||
case 2:
|
||||
return HOUR(strtol(begin, NULL, 10));
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
if (begin[1] == ':') {
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 2, NULL, 10);
|
||||
return tmp;
|
||||
} else if (begin[2] == ':') {
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
|
||||
return tmp;
|
||||
} else {
|
||||
tmp = strtol(begin, NULL, 10);
|
||||
return HOUR(tmp / 100) + tmp % 100;
|
||||
}
|
||||
case 5:
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
|
||||
return tmp;
|
||||
}
|
||||
return 0;
|
||||
while (isdigit(**ptr) || **ptr == ':') {
|
||||
++*ptr;
|
||||
}
|
||||
end = *ptr;
|
||||
switch (end - begin) {
|
||||
case 1: /* H */
|
||||
case 2: /* HH */
|
||||
return HOUR(strtol(begin, NULL, 10));
|
||||
break;
|
||||
case 3: /* H:M */
|
||||
case 4: /* H:MM, HH:M, HHMM */
|
||||
if (begin[1] == ':') {
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 2, NULL, 10);
|
||||
return tmp;
|
||||
} else if (begin[2] == ':') {
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
|
||||
return tmp;
|
||||
} else {
|
||||
tmp = strtol(begin, NULL, 10);
|
||||
return HOUR(tmp / 100) + tmp % 100;
|
||||
}
|
||||
case 5: /* HH:MM */
|
||||
tmp = HOUR(strtol(begin, NULL, 10)) + strtol(begin + 3, NULL, 10);
|
||||
return tmp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -38,8 +38,8 @@
|
||||
# define timelib_free free
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 201502
|
||||
#define TIMELIB_ASCII_VERSION "2015.02"
|
||||
#define TIMELIB_VERSION 201602
|
||||
#define TIMELIB_ASCII_VERSION "2016.02"
|
||||
|
||||
#define TIMELIB_NONE 0x00
|
||||
#define TIMELIB_OVERRIDE_TIME 0x01
|
||||
|
||||
+1553
-1345
File diff suppressed because it is too large.
Load diff
@@ -152,9 +152,17 @@ static void do_adjust_for_weekday(timelib_time* time)
|
||||
current_dow = timelib_day_of_week(time->y, time->m, time->d);
|
||||
if (time->relative.weekday_behavior == 2)
|
||||
{
|
||||
if (time->relative.weekday == 0) {
|
||||
/* To make "this week" work, where the current DOW is a "sunday" */
|
||||
if (current_dow == 0 && time->relative.weekday != 0) {
|
||||
time->relative.weekday = -6;
|
||||
}
|
||||
|
||||
/* To make "sunday this week" work, where the current DOW is not a
|
||||
* "sunday" */
|
||||
if (time->relative.weekday == 0 && current_dow != 0) {
|
||||
time->relative.weekday = 7;
|
||||
}
|
||||
|
||||
time->d -= current_dow;
|
||||
time->d += time->relative.weekday;
|
||||
return;
|
||||
|
||||
+3
-2
@@ -2059,6 +2059,7 @@ static void date_register_classes(TSRMLS_D)
|
||||
date_object_handlers_immutable.clone_obj = date_object_clone_date;
|
||||
date_object_handlers_immutable.compare_objects = date_object_compare_date;
|
||||
date_object_handlers_immutable.get_properties = date_object_get_properties;
|
||||
date_object_handlers_immutable.get_gc = date_object_get_gc;
|
||||
zend_class_implements(date_ce_immutable TSRMLS_CC, 1, date_ce_interface);
|
||||
|
||||
INIT_CLASS_ENTRY(ce_timezone, "DateTimeZone", date_funcs_timezone);
|
||||
@@ -2225,7 +2226,7 @@ static HashTable *date_object_get_properties(zval *object TSRMLS_DC)
|
||||
|
||||
props = zend_std_get_properties(object TSRMLS_CC);
|
||||
|
||||
if (!dateobj->time || GC_G(gc_active)) {
|
||||
if (!dateobj->time) {
|
||||
return props;
|
||||
}
|
||||
|
||||
@@ -4941,7 +4942,7 @@ static HashTable *date_object_get_properties_period(zval *object TSRMLS_DC)
|
||||
|
||||
props = zend_std_get_properties(object TSRMLS_CC);
|
||||
|
||||
if (!period_obj->start || GC_G(gc_active)) {
|
||||
if (!period_obj->start) {
|
||||
return props;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ print "TZ=Asia/Baku - wrong day.\n";
|
||||
date_default_timezone_set("Asia/Baku");
|
||||
$tStamp = mktime (17, 17, 17, 1, 8299, 1970);
|
||||
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
|
||||
$strtotime_tstamp = strtotime("next Sunday", $tStamp);
|
||||
$strtotime_tstamp = strtotime("second Monday", $tStamp);
|
||||
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
|
||||
print "wanted=Sunday 00:00:00\n\n";
|
||||
print "wanted=Monday 00:00:00\n\n";
|
||||
|
||||
print "TZ=America/Noronha - wrong day.\n";
|
||||
date_default_timezone_set("America/Noronha");
|
||||
@@ -227,8 +227,8 @@ wanted=Thursday 00:00:00
|
||||
|
||||
TZ=Asia/Baku - wrong day.
|
||||
tStamp=Sunday 1992-09-20 17:17:17 AZST 1
|
||||
result=Sunday 1992-09-27 00:00:00 AZT 0
|
||||
wanted=Sunday 00:00:00
|
||||
result=Monday 1992-09-28 00:00:00 AZT 0
|
||||
wanted=Monday 00:00:00
|
||||
|
||||
TZ=America/Noronha - wrong day.
|
||||
tStamp=Friday 1999-10-01 17:17:17 FNT 0
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
Bug #63740 (strtotime seems to use both sunday and monday as start of week)
|
||||
--FILE--
|
||||
<?php
|
||||
$dates = [
|
||||
'2015-07-04',
|
||||
'2015-07-05',
|
||||
'2015-07-06',
|
||||
'2015-07-07',
|
||||
'2015-07-08',
|
||||
'2015-07-09',
|
||||
'2015-07-10',
|
||||
'2015-07-11',
|
||||
'2015-07-12',
|
||||
'2015-07-13',
|
||||
'2015-07-14',
|
||||
];
|
||||
|
||||
foreach ( $dates as $date )
|
||||
{
|
||||
$dt = new DateTimeImmutable( "$date 00:00 UTC" );
|
||||
|
||||
echo $dt->format( "D Y-m-d H:i" ), " → ";
|
||||
|
||||
$dtn = $dt->modify( "this week" );
|
||||
|
||||
echo $dtn->format( "D Y-m-d H:i" ), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Sat 2015-07-04 00:00 → Mon 2015-06-29 00:00
|
||||
Sun 2015-07-05 00:00 → Mon 2015-06-29 00:00
|
||||
Mon 2015-07-06 00:00 → Mon 2015-07-06 00:00
|
||||
Tue 2015-07-07 00:00 → Mon 2015-07-06 00:00
|
||||
Wed 2015-07-08 00:00 → Mon 2015-07-06 00:00
|
||||
Thu 2015-07-09 00:00 → Mon 2015-07-06 00:00
|
||||
Fri 2015-07-10 00:00 → Mon 2015-07-06 00:00
|
||||
Sat 2015-07-11 00:00 → Mon 2015-07-06 00:00
|
||||
Sun 2015-07-12 00:00 → Mon 2015-07-06 00:00
|
||||
Mon 2015-07-13 00:00 → Mon 2015-07-13 00:00
|
||||
Tue 2015-07-14 00:00 → Mon 2015-07-13 00:00
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #66836 (DateTime::createFromFormat 'U' with pre 1970 dates fails parsing)
|
||||
--INI--
|
||||
date.timezone=Europe/Berlin
|
||||
--FILE--
|
||||
<?php
|
||||
foreach (['-1', '-86400', '-1000000'] as $timestamp) {
|
||||
$dt = DateTime::createFromFormat('U', $timestamp);
|
||||
var_dump($dt->format('U') === $timestamp);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #66502 (DOM document dangling reference)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('dom')) die('skip requires ext/dom');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$dom = new DOMDocument('1.0', 'UTF-8');
|
||||
$element = $dom->appendChild(new DOMElement('root'));
|
||||
$comment = new DOMComment("Comment 0");
|
||||
$comment = $element->appendChild($comment);
|
||||
|
||||
$comment->__construct("Comment 1");
|
||||
$comment->__construct("Comment 2");
|
||||
$comment->__construct("Comment 3");
|
||||
echo 'DONE', PHP_EOL;
|
||||
?>
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -743,6 +743,11 @@ PHP_EREG_API PHP_FUNCTION(sql_regcase)
|
||||
|
||||
for (i = j = 0; i < string_len; i++) {
|
||||
c = (unsigned char) string[i];
|
||||
if ( j >= INT_MAX - 1 || (isalpha(c) && j >= INT_MAX - 4)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "String too long, max length is %d", INT_MAX);
|
||||
efree(tmp);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (isalpha(c)) {
|
||||
tmp[j++] = '[';
|
||||
tmp[j++] = toupper(c);
|
||||
|
||||
+65
-16
@@ -1709,6 +1709,10 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
|
||||
break;
|
||||
case TAG_FMT_UNDEFINED:
|
||||
if (value) {
|
||||
if (tag == TAG_MAKER_NOTE) {
|
||||
length = MIN(length, strlen(value));
|
||||
}
|
||||
|
||||
/* do not recompute length here */
|
||||
info_value->s = estrndup(value, length);
|
||||
info_data->length = length;
|
||||
@@ -2613,6 +2617,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
*pszEncoding = NULL;
|
||||
/* Copy the comment */
|
||||
if (ByteCount>=8) {
|
||||
const zend_encoding *from, *to;
|
||||
if (!memcmp(szValuePtr, "UNICODE\0", 8)) {
|
||||
*pszEncoding = estrdup((const char*)szValuePtr);
|
||||
szValuePtr = szValuePtr+8;
|
||||
@@ -2633,14 +2638,16 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
} else {
|
||||
decode = ImageInfo->decode_unicode_le;
|
||||
}
|
||||
to = zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC);
|
||||
from = zend_multibyte_fetch_encoding(decode TSRMLS_CC);
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
if (!to || !from || zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(decode TSRMLS_CC)
|
||||
to,
|
||||
from
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
|
||||
}
|
||||
@@ -2655,13 +2662,15 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
|
||||
szValuePtr = szValuePtr+8;
|
||||
ByteCount -= 8;
|
||||
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
|
||||
if (zend_multibyte_encoding_converter(
|
||||
to = zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC);
|
||||
from = zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC);
|
||||
if (!to || !from || zend_multibyte_encoding_converter(
|
||||
(unsigned char**)pszInfoPtr,
|
||||
&len,
|
||||
(unsigned char*)szValuePtr,
|
||||
ByteCount,
|
||||
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
|
||||
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC)
|
||||
to,
|
||||
from
|
||||
TSRMLS_CC) == (size_t)-1) {
|
||||
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
|
||||
}
|
||||
@@ -2718,8 +2727,14 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
char *dir_start;
|
||||
|
||||
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type))
|
||||
return FALSE;
|
||||
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
|
||||
#ifdef EXIF_DEBUG
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "No maker note data found. Detected maker: %s (length = %d)", ImageInfo->make, strlen(ImageInfo->make));
|
||||
#endif
|
||||
/* unknown manufacturer, not an error, use it as a string */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
maker_note = maker_note_array+i;
|
||||
|
||||
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/
|
||||
@@ -2732,6 +2747,12 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
break;
|
||||
}
|
||||
|
||||
if (maker_note->offset >= value_len) {
|
||||
/* Do not go past the value end */
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dir_start = value_ptr + maker_note->offset;
|
||||
|
||||
#ifdef EXIF_DEBUG
|
||||
@@ -2760,10 +2781,19 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
offset_base = value_ptr;
|
||||
break;
|
||||
case MN_OFFSET_GUESS:
|
||||
if (maker_note->offset + 10 + 4 >= value_len) {
|
||||
/* Can not read dir_start+10 since it's beyond value end */
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X", value_len);
|
||||
return FALSE;
|
||||
}
|
||||
offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel);
|
||||
#ifdef EXIF_DEBUG
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Using automatic offset correction: 0x%04X", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff);
|
||||
#endif
|
||||
if (offset_diff < 0 || offset_diff >= value_len ) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data bad offset: 0x%04X length 0x%04X", offset_diff, value_len);
|
||||
return FALSE;
|
||||
}
|
||||
offset_base = value_ptr + offset_diff;
|
||||
break;
|
||||
default:
|
||||
@@ -2772,7 +2802,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
|
||||
}
|
||||
|
||||
if ((2+NumDirEntries*12) > value_len) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + x%04X*12 = x%04X > x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2878,11 +2908,11 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
}
|
||||
|
||||
fpos = php_stream_tell(ImageInfo->infile);
|
||||
php_stream_seek(ImageInfo->infile, offset_val, SEEK_SET);
|
||||
php_stream_seek(ImageInfo->infile, displacement+offset_val, SEEK_SET);
|
||||
fgot = php_stream_tell(ImageInfo->infile);
|
||||
if (fgot!=offset_val) {
|
||||
if (fgot!=displacement+offset_val) {
|
||||
EFREE_IF(outside);
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Wrong file pointer: 0x%08X != 0x%08X", fgot, offset_val);
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Wrong file pointer: 0x%08X != 0x%08X", fgot, displacement+offset_val);
|
||||
return FALSE;
|
||||
}
|
||||
fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count);
|
||||
@@ -2955,7 +2985,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
/* When there are any characters after the first NUL */
|
||||
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
|
||||
ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
|
||||
spprintf(&ImageInfo->Copyright, 0, "%s, %s", ImageInfo->CopyrightPhotographer, ImageInfo->CopyrightEditor);
|
||||
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
|
||||
/* but we are not supposed to change this */
|
||||
/* keep in mind that image_info does not store editor value */
|
||||
@@ -3058,7 +3088,10 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
|
||||
break;
|
||||
|
||||
case TAG_MAKER_NOTE:
|
||||
exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC);
|
||||
if (!exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC)) {
|
||||
EFREE_IF(outside);
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case TAG_EXIF_IFD_POINTER:
|
||||
@@ -3124,6 +3157,11 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
|
||||
|
||||
ImageInfo->sections_found |= FOUND_IFD0;
|
||||
|
||||
if ((dir_start + 2) >= (offset_base+IFDlength)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
|
||||
|
||||
if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) {
|
||||
@@ -3147,6 +3185,10 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start,
|
||||
* Hack to make it process IDF1 I hope
|
||||
* There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail
|
||||
*/
|
||||
if ((dir_start+2+12*de + 4) >= (offset_base+IFDlength)) {
|
||||
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size");
|
||||
return FALSE;
|
||||
}
|
||||
NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);
|
||||
if (NextDirOffset) {
|
||||
/* the next line seems false but here IFDlength means length of all IFDs */
|
||||
@@ -3196,9 +3238,13 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
|
||||
}
|
||||
|
||||
/* Check the next two values for correctness. */
|
||||
if (length < 8) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
|
||||
return;
|
||||
}
|
||||
exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel);
|
||||
offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel);
|
||||
if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
|
||||
if (exif_value_2a != 0x2a || offset_of_ifd < 0x08) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)");
|
||||
return;
|
||||
}
|
||||
@@ -3722,8 +3768,11 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
|
||||
fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size);
|
||||
if (fgot < ImageInfo->Thumbnail.size) {
|
||||
EXIF_ERRLOG_THUMBEOF(ImageInfo)
|
||||
efree(ImageInfo->Thumbnail.data);
|
||||
ImageInfo->Thumbnail.data = NULL;
|
||||
} else {
|
||||
exif_thumbnail_build(ImageInfo TSRMLS_CC);
|
||||
}
|
||||
exif_thumbnail_build(ImageInfo TSRMLS_CC);
|
||||
}
|
||||
#ifdef EXIF_DEBUG
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) done");
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 785 KiB |
@@ -0,0 +1,140 @@
|
||||
--TEST--
|
||||
Bug #50845 (exif_read_data() returns corrupted exif headers)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
$infile = dirname(__FILE__).'/bug50845.jpg';
|
||||
var_dump(exif_read_data($infile));
|
||||
--EXPECTF--
|
||||
array(44) {
|
||||
["FileName"]=>
|
||||
string(12) "bug50845.jpg"
|
||||
["FileDateTime"]=>
|
||||
int(%d)
|
||||
["FileSize"]=>
|
||||
int(803603)
|
||||
["FileType"]=>
|
||||
int(2)
|
||||
["MimeType"]=>
|
||||
string(10) "image/jpeg"
|
||||
["SectionsFound"]=>
|
||||
string(30) "ANY_TAG, IFD0, THUMBNAIL, EXIF"
|
||||
["COMPUTED"]=>
|
||||
array(9) {
|
||||
["html"]=>
|
||||
string(26) "width="5472" height="3648""
|
||||
["Height"]=>
|
||||
int(3648)
|
||||
["Width"]=>
|
||||
int(5472)
|
||||
["IsColor"]=>
|
||||
int(1)
|
||||
["ByteOrderMotorola"]=>
|
||||
int(0)
|
||||
["ApertureFNumber"]=>
|
||||
string(5) "f/7.1"
|
||||
["Copyright"]=>
|
||||
string(13) "Public Domain"
|
||||
["Thumbnail.FileType"]=>
|
||||
int(2)
|
||||
["Thumbnail.MimeType"]=>
|
||||
string(10) "image/jpeg"
|
||||
}
|
||||
["ImageDescription"]=>
|
||||
string(295) "A U.S. Marine Corps MV-22 Osprey lands on the USS Whidbey Island (LSD-41), May 5, 2016. The vehicles were loaded to support a theater security cooperation event as a part of a MEU readiness exercise. (U.S. Marine Corps photo by Lance Cpl. Koby I. Saunders/22 Marine Expeditionary Unit/ Released)"
|
||||
["Make"]=>
|
||||
string(5) "Canon"
|
||||
["Model"]=>
|
||||
string(22) "Canon EOS-1D X Mark II"
|
||||
["Orientation"]=>
|
||||
int(1)
|
||||
["XResolution"]=>
|
||||
string(5) "240/1"
|
||||
["YResolution"]=>
|
||||
string(5) "240/1"
|
||||
["ResolutionUnit"]=>
|
||||
int(2)
|
||||
["Artist"]=>
|
||||
string(24) "Lance Cpl. Koby Saunders"
|
||||
["Copyright"]=>
|
||||
string(13) "Public Domain"
|
||||
["Exif_IFD_Pointer"]=>
|
||||
int(12572)
|
||||
["THUMBNAIL"]=>
|
||||
array(6) {
|
||||
["Compression"]=>
|
||||
int(6)
|
||||
["XResolution"]=>
|
||||
string(5) "240/1"
|
||||
["YResolution"]=>
|
||||
string(5) "240/1"
|
||||
["ResolutionUnit"]=>
|
||||
int(2)
|
||||
["JPEGInterchangeFormat"]=>
|
||||
int(860)
|
||||
["JPEGInterchangeFormatLength"]=>
|
||||
int(11204)
|
||||
}
|
||||
["ExposureTime"]=>
|
||||
string(5) "1/200"
|
||||
["FNumber"]=>
|
||||
string(5) "71/10"
|
||||
["ExposureProgram"]=>
|
||||
int(1)
|
||||
["ISOSpeedRatings"]=>
|
||||
int(100)
|
||||
["UndefinedTag:0x8830"]=>
|
||||
int(2)
|
||||
["UndefinedTag:0x8832"]=>
|
||||
int(100)
|
||||
["ExifVersion"]=>
|
||||
string(4) "0230"
|
||||
["ShutterSpeedValue"]=>
|
||||
string(15) "7643856/1000000"
|
||||
["ApertureValue"]=>
|
||||
string(15) "5655638/1000000"
|
||||
["ExposureBiasValue"]=>
|
||||
string(3) "0/1"
|
||||
["MaxApertureValue"]=>
|
||||
string(3) "4/1"
|
||||
["MeteringMode"]=>
|
||||
int(5)
|
||||
["Flash"]=>
|
||||
int(16)
|
||||
["FocalLength"]=>
|
||||
string(4) "24/1"
|
||||
["ColorSpace"]=>
|
||||
int(65535)
|
||||
["FocalPlaneXResolution"]=>
|
||||
string(12) "5472000/1438"
|
||||
["FocalPlaneYResolution"]=>
|
||||
string(11) "3648000/958"
|
||||
["FocalPlaneResolutionUnit"]=>
|
||||
int(2)
|
||||
["CustomRendered"]=>
|
||||
int(0)
|
||||
["ExposureMode"]=>
|
||||
int(1)
|
||||
["WhiteBalance"]=>
|
||||
int(0)
|
||||
["SceneCaptureType"]=>
|
||||
int(0)
|
||||
["UndefinedTag:0xA431"]=>
|
||||
string(12) "002099000358"
|
||||
["UndefinedTag:0xA432"]=>
|
||||
array(4) {
|
||||
[0]=>
|
||||
string(4) "24/1"
|
||||
[1]=>
|
||||
string(5) "105/1"
|
||||
[2]=>
|
||||
string(3) "0/0"
|
||||
[3]=>
|
||||
string(3) "0/0"
|
||||
}
|
||||
["UndefinedTag:0xA434"]=>
|
||||
string(22) "EF24-105mm f/4L IS USM"
|
||||
["UndefinedTag:0xA435"]=>
|
||||
string(10) "000044bc4c"
|
||||
}
|
||||
@@ -13,8 +13,4 @@ exif_read_data(__DIR__ . '/bug54002_2.jpeg');
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug54002_1.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug54002_1.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug54002_2.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug54002_2.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d
|
||||
Warning: exif_read_data(bug54002_2.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d
|
||||
@@ -10,7 +10,9 @@ echo "Test\n";
|
||||
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Test
|
||||
int(76)
|
||||
|
||||
Warning: exif_read_data(bug62523_2.jpg): IFD data bad offset: 0xADB23672 length 0x0D94 in %s%ebug62523_2.php on line %d
|
||||
int(30)
|
||||
Done
|
||||
@@ -0,0 +1,61 @@
|
||||
--TEST--
|
||||
Bug #72094: Out of bounds heap read access in exif header processing
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_1.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_2.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_3.jpg'));
|
||||
print_r(exif_read_data(__DIR__ . '/bug72094_4.jpg'));
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Process tag(x8298=Copyright ): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Illegal IFD offset in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): File structure corrupted in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_1.jpg): Invalid JPEG file in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): Illegal IFD size in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): File structure corrupted in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_2.jpg): Invalid JPEG file in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Illegal IFD size in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): File structure corrupted in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_3.jpg): Invalid JPEG file in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): Invalid TIFF start (1) in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): File structure corrupted in %s%ebug72094.php on line %d
|
||||
|
||||
Warning: exif_read_data(bug72094_4.jpg): Invalid JPEG file in %s%ebug72094.php on line %d
|
||||
DONE
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug #72603 (Out of bound read in exif_process_IFD_in_MAKERNOTE)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(count(exif_read_data(dirname(__FILE__) . "/bug72603.jpeg")));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug72603.jpeg): %s in %s%ebug72603.php on line %d
|
||||
int(%d)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,11 @@
|
||||
--TEST--
|
||||
Bug 72618 (NULL Pointer Dereference in exif_process_user_comment)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(count(exif_read_data(dirname(__FILE__) . "/bug72618.jpg")));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(bug72618.jpg): %s in %s%ebug72618.php on line %d
|
||||
int(%d)
|
||||
@@ -0,0 +1,71 @@
|
||||
--TEST--
|
||||
Bug #72627 (Memory Leakage In exif_process_IFD_in_TIFF)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
$exif = exif_read_data(__DIR__ . '/bug72627.tiff',0,0,true);
|
||||
var_dump($exif);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: exif_read_data(%s): Thumbnail goes IFD boundary or end of file reached in %sbug72627.php on line %d
|
||||
|
||||
Warning: exif_read_data(%s): Error in TIFF: filesize(x04E2) less than start of IFD dir(x829A0004) in %sbug72627.php on line %d
|
||||
|
||||
Warning: exif_read_data(%s): Thumbnail goes IFD boundary or end of file reached in %sbug72627.php on line %d
|
||||
array(11) {
|
||||
["FileName"]=>
|
||||
string(13) "bug72627.tiff"
|
||||
["FileDateTime"]=>
|
||||
int(%d)
|
||||
["FileSize"]=>
|
||||
int(1250)
|
||||
["FileType"]=>
|
||||
int(7)
|
||||
["MimeType"]=>
|
||||
string(10) "image/tiff"
|
||||
["SectionsFound"]=>
|
||||
string(30) "ANY_TAG, IFD0, THUMBNAIL, EXIF"
|
||||
["COMPUTED"]=>
|
||||
array(10) {
|
||||
["html"]=>
|
||||
string(24) "width="128" height="132""
|
||||
["Height"]=>
|
||||
int(132)
|
||||
["Width"]=>
|
||||
int(128)
|
||||
["IsColor"]=>
|
||||
int(0)
|
||||
["ByteOrderMotorola"]=>
|
||||
int(0)
|
||||
["ApertureFNumber"]=>
|
||||
string(5) "f/1.0"
|
||||
["Thumbnail.FileType"]=>
|
||||
int(2)
|
||||
["Thumbnail.MimeType"]=>
|
||||
string(10) "image/jpeg"
|
||||
["Thumbnail.Height"]=>
|
||||
int(132)
|
||||
["Thumbnail.Width"]=>
|
||||
int(128)
|
||||
}
|
||||
["XResolution"]=>
|
||||
string(21) "1414812756/1414812756"
|
||||
["THUMBNAIL"]=>
|
||||
array(5) {
|
||||
["ImageWidth"]=>
|
||||
int(128)
|
||||
["ImageLength"]=>
|
||||
int(132)
|
||||
["JPEGInterchangeFormat"]=>
|
||||
int(1280)
|
||||
["JPEGInterchangeFormatLength"]=>
|
||||
int(100)
|
||||
["THUMBNAIL"]=>
|
||||
NULL
|
||||
}
|
||||
["ExposureTime"]=>
|
||||
string(21) "1414812756/1414812756"
|
||||
["FNumber"]=>
|
||||
string(21) "1414812756/1414812756"
|
||||
}
|
||||
Binary file not shown.
@@ -704,6 +704,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
if (flags & FILTER_FLAG_NO_PRIV_RANGE) {
|
||||
if (
|
||||
(ip[0] == 10) ||
|
||||
(ip[0] == 169 && ip[1] == 254) ||
|
||||
(ip[0] == 172 && (ip[1] >= 16 && ip[1] <= 31)) ||
|
||||
(ip[0] == 192 && ip[1] == 168)
|
||||
) {
|
||||
@@ -714,10 +715,18 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||
if (flags & FILTER_FLAG_NO_RES_RANGE) {
|
||||
if (
|
||||
(ip[0] == 0) ||
|
||||
(ip[0] == 10) ||
|
||||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
|
||||
(ip[0] == 127) ||
|
||||
(ip[0] == 169 && ip[1] == 254) ||
|
||||
(ip[0] == 172 && (ip[1] >= 16 && ip[1] <= 31)) ||
|
||||
(ip[0] == 192 && ip[1] == 0 && ip[2] == 0) ||
|
||||
(ip[0] == 192 && ip[1] == 0 && ip[2] == 2) ||
|
||||
(ip[0] == 127 && ip[1] == 0 && ip[2] == 0 && ip[3] == 1) ||
|
||||
(ip[0] == 192 && ip[1] == 88 && ip[2] == 99) ||
|
||||
(ip[0] == 192 && ip[1] == 168) ||
|
||||
(ip[0] == 198 && (ip[1] == 18 || ip[1] == 19)) ||
|
||||
(ip[0] == 198 && ip[1] == 51 && ip[2] == 100) ||
|
||||
(ip[0] == 203 && ip[1] == 0 && ip[2] == 113) ||
|
||||
(ip[0] >= 224 && ip[0] <= 255)
|
||||
) {
|
||||
RETURN_VALIDATION_FAILED
|
||||
|
||||
@@ -41,7 +41,7 @@ string(9) "127.0.0.1"
|
||||
bool(false)
|
||||
string(12) "192.0.34.166"
|
||||
bool(false)
|
||||
string(9) "192.0.0.1"
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "192.0.34.166"
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
--TEST--
|
||||
Bug #71745 FILTER_FLAG_NO_RES_RANGE does not cover whole 127.0.0.0/8 range
|
||||
--FILE--
|
||||
<?php
|
||||
//https://tools.ietf.org/html/rfc6890#section-2.1
|
||||
|
||||
$privateRanges = array();
|
||||
// 10.0.0.0/8
|
||||
$privateRanges['10.0.0.0/8'] = array('10.0.0.0', '10.255.255.255');
|
||||
|
||||
// 169.254.0.0/16
|
||||
$privateRanges['168.254.0.0/16'] = array('169.254.0.0', '169.254.255.255');
|
||||
|
||||
// 172.16.0.0/12
|
||||
$privateRanges['172.16.0.0/12'] = array('172.16.0.0', '172.31.0.0');
|
||||
|
||||
// 192.168.0.0/16
|
||||
$privateRanges['192.168.0.0/16'] = array('192.168.0.0', '192.168.255.255');
|
||||
|
||||
foreach ($privateRanges as $key => $range) {
|
||||
list($min, $max) = $range;
|
||||
var_dump($key);
|
||||
var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
|
||||
var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
|
||||
}
|
||||
|
||||
$reservedRanges = array();
|
||||
|
||||
// 0.0.0.0/8
|
||||
$reserverRanges['0.0.0.0/8'] = array('0.0.0.0', '0.255.255.255');
|
||||
|
||||
// 10.0.0.0/8
|
||||
$reserverdRanges['10.0.0.0/8'] = array('10.0.0.0', '10.255.255.255');
|
||||
|
||||
// 100.64.0.0/10
|
||||
$reserverdRanges['10.64.0.0/10'] = array('100.64.0.0', '100.127.255.255');
|
||||
|
||||
// 127.0.0.0/8
|
||||
$reserverdRanges['127.0.0.0/8'] = array('127.0.0.0', '127.255.255.255');
|
||||
|
||||
// 169.254.0.0/16
|
||||
$reserverdRanges['169.254.0.0/16'] = array('169.254.0.0', '169.254.255.255');
|
||||
|
||||
// 172.16.0.0/12
|
||||
$reserverdRanges['172.16.0.0/12'] = array('172.16.0.0', '172.31.0.0');
|
||||
|
||||
// 192.0.0.0/24
|
||||
$reserverdRanges['192.0.0.0/24'] = array('192.0.0.0', '192.0.0.255');
|
||||
|
||||
// 192.0.0.0/29
|
||||
$reserverdRanges['192.0.0.0/29'] = array('192.0.0.0', '192.0.0.7');
|
||||
|
||||
// 192.0.2.0/24
|
||||
$reserverdRanges['192.0.2.0/24'] = array('192.0.2.0', '192.0.2.255');
|
||||
|
||||
// 198.18.0.0/15
|
||||
$reserverdRanges['198.18.0.0/15'] = array('198.18.0.0', '198.19.255.255');
|
||||
|
||||
// 198.51.100.0/24
|
||||
$reserverdRanges['198.51.100.0/24'] = array('198.51.100.0', '198.51.100.255');
|
||||
|
||||
// 192.88.99.0/24
|
||||
$reserverdRanges['192.88.99.0/24'] = array('192.88.99.0', '192.88.99.255');
|
||||
|
||||
// 192.168.0.0/16
|
||||
$reserverdRanges['192.168.0.0/16'] = array('192.168.0.0', '192.168.255.255');
|
||||
|
||||
// 203.0.113.0/24
|
||||
$reserverdRanges['203.0.113.0/24'] = array('203.0.113.0', '203.0.113.255');
|
||||
|
||||
// 240.0.0.0/4 + 255.255.255.255/32
|
||||
$reserverdRanges['240.0.0.0/4'] = array('224.0.0.0', '255.255.255.255');
|
||||
|
||||
foreach ($reserverdRanges as $key => $range) {
|
||||
list($min, $max) = $range;
|
||||
var_dump($key);
|
||||
var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
|
||||
var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
|
||||
}
|
||||
|
||||
|
||||
|
||||
--EXPECT--
|
||||
string(10) "10.0.0.0/8"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(14) "168.254.0.0/16"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(13) "172.16.0.0/12"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(14) "192.168.0.0/16"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(10) "10.0.0.0/8"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "10.64.0.0/10"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(11) "127.0.0.0/8"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(14) "169.254.0.0/16"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(13) "172.16.0.0/12"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "192.0.0.0/24"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "192.0.0.0/29"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(12) "192.0.2.0/24"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(13) "198.18.0.0/15"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(15) "198.51.100.0/24"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(14) "192.88.99.0/24"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(14) "192.168.0.0/16"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(14) "203.0.113.0/24"
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(11) "240.0.0.0/4"
|
||||
bool(false)
|
||||
bool(false)
|
||||
+47
-46
@@ -1,48 +1,49 @@
|
||||
-----BEGIN CERTIFICATE REQUEST-----
|
||||
MIIBmzCCAQQCAQAwWzELMAkGA1UEBhMCUFQxCzAJBgNVBAgTAkx4MQswCQYDVQQH
|
||||
EwJMeDEcMBoGA1UEChMTQSBtaW5oYSBlbXByZXNhLCBTQTEUMBIGA1UECxMLUEhQ
|
||||
IFFBIFRlYW0wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM9mfEOSYwXf58ch
|
||||
4NyO1QOU1XMfquz8OVpvMUITABLAevZpeQn6vZPHNyXHFQC0QC8scydK1rAYd2U+
|
||||
9K2aPub6ioMjYyjPpAE07l9EAAPUEBlqqsziB/wT8QjWkByyJEkYu+o0Wyjokhfn
|
||||
BMPvm52wLWUx9nvUeNDCftnKg1wxAgMBAAGgADANBgkqhkiG9w0BAQQFAAOBgQDD
|
||||
s1FeqPxnF2bWj8/dG8MyPaRfOAMVz1UsCZUciXIVG5LSIvR2qnMC3iEYt3s13sEq
|
||||
z8VJlNHa8nniE+VFNv093yIu+PlWXMEvb5y5EFqP2AYq3RAT+SJsSxGqIdzPZiKY
|
||||
INaktLCZmQ/E1v7/4hFzVRq9ydJI82DVS1nv282Whw==
|
||||
-----END CERTIFICATE REQUEST-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIC4zCCAkygAwIBAgIBADANBgkqhkiG9w0BAQQFADBbMQswCQYDVQQGEwJQVDEL
|
||||
MAkGA1UECBMCTHgxCzAJBgNVBAcTAkx4MRwwGgYDVQQKExNBIG1pbmhhIGVtcHJl
|
||||
c2EsIFNBMRQwEgYDVQQLEwtQSFAgUUEgVGVhbTAeFw0wNjExMTkxODIzNTNaFw0w
|
||||
NzExMTkxODIzNTNaMFsxCzAJBgNVBAYTAlBUMQswCQYDVQQIEwJMeDELMAkGA1UE
|
||||
BxMCTHgxHDAaBgNVBAoTE0EgbWluaGEgZW1wcmVzYSwgU0ExFDASBgNVBAsTC1BI
|
||||
UCBRQSBUZWFtMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDPZnxDkmMF3+fH
|
||||
IeDcjtUDlNVzH6rs/DlabzFCEwASwHr2aXkJ+r2TxzclxxUAtEAvLHMnStawGHdl
|
||||
PvStmj7m+oqDI2Moz6QBNO5fRAAD1BAZaqrM4gf8E/EI1pAcsiRJGLvqNFso6JIX
|
||||
5wTD75udsC1lMfZ71HjQwn7ZyoNcMQIDAQABo4G2MIGzMB0GA1UdDgQWBBTIga5L
|
||||
q+Ub1SWXgNZRYCpq3c8Z+jCBgwYDVR0jBHwweoAUyIGuS6vlG9Ull4DWUWAqat3P
|
||||
GfqhX6RdMFsxCzAJBgNVBAYTAlBUMQswCQYDVQQIEwJMeDELMAkGA1UEBxMCTHgx
|
||||
HDAaBgNVBAoTE0EgbWluaGEgZW1wcmVzYSwgU0ExFDASBgNVBAsTC1BIUCBRQSBU
|
||||
ZWFtggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAe6AA8aC3KDI8
|
||||
smd+7XWjaTSp1Q0uMkEZ2PEBzif2I1aPPqw1CQykJ1iDdC/8PJ1yEIezloP2XQoZ
|
||||
NjTaCO+uubay03ncoPTZvDUwExN9BYFAYgc2z3tLMHYbA7kM2sIbKys7ZQegLibr
|
||||
TSKYQOBeYA/FB9GHECJGU3zBRvYi+Og=
|
||||
MIIDhTCCAm2gAwIBAgIJAN75FFz+owOAMA0GCSqGSIb3DQEBCwUAMFkxCzAJBgNV
|
||||
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
|
||||
aWRnaXRzIFB0eSBMdGQxEjAQBgNVBAMMCTEyNy4wLjAuMTAeFw0xNjA3MjUxMjM3
|
||||
MTJaFw0yNjA3MjMxMjM3MTJaMFkxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21l
|
||||
LVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQBgNV
|
||||
BAMMCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALtG
|
||||
AIrNUDItISfpAqztL2TFEWEHLGTzCEh5Ag2sdMD7UYbqIPHLOE4EINv+dqEMM0Nz
|
||||
LYnw7ChtVegXT907xCaQcmeDFSdhqze4L8zawDfnn4syB8XAwGYJfpstYwe3nO6+
|
||||
0WvLSb1A5TYNeyoXjwlAUKElxkeWAo51uhR41GDhDQ9GgpqX1ccAhmSoUhgIRSzf
|
||||
6f4KE3WTdzl1p12ZtkYHB8Jo2jB/JXnwGOz6isLnpRvkex4B7sUX+7u1MqK/e1X7
|
||||
Hi1G/VkaAfC2SOfjTePtGBDBXrQ1arYXDPRA04sgFzSh55l7lC/4HasQ/jAb3h95
|
||||
dcEIqyc69iioaN1c1NcCAwEAAaNQME4wHQYDVR0OBBYEFNv3kefb1H+6/6CpjiBi
|
||||
+I2s9E90MB8GA1UdIwQYMBaAFNv3kefb1H+6/6CpjiBi+I2s9E90MAwGA1UdEwQF
|
||||
MAMBAf8wDQYJKoZIhvcNAQELBQADggEBAIzSEWpHSaBs7KduBRXX5+qFxBN6OCPl
|
||||
7ID0rxAOYfw7ruzbmwgOpBgMIHGn+KqA6CmQI0jh9bZbv5TV2aFpFsUihugPc2lW
|
||||
5EshCozxlEPmIJNsO8jDqPE4w3m4KiVTscRWjBa5cco+lwLDqboerm2l7vvrtr6B
|
||||
pgLaZct1c73MouvoJSCGK5EOGW7jsgaxjxJ3UZug+24Ko1wulO2cgBLhda9Ilrnx
|
||||
CIKI9h8Z2WVWuVQfyCyO1g7XkJgkBec77OhxD+m4onzPY6waqnnhmFOBcS+gKgBV
|
||||
jHeK9DCvZ9zet3EyEp6fyQOOtsC+gU0piYgfsQL7aCp5oLe+fjTiuUY=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: DES-EDE3-CBC,928762DB6DE222AD
|
||||
|
||||
oOxNUBX0wrqmRqb3IEZMogc1bnVm6JoW6YFjGfHNcIz0jS7UPDhUFDR26y0dYujL
|
||||
LEgxOcYo8ItvGcXSRbs+3W7lISbosgkB0DOaKx5jVmOGwUVRergUUSY8rbf93FtP
|
||||
27CEvAfsU6do5HmlJ34mYZW1k+onCznlJXJkupQ5jmiily3GwEdr/5mMIVOmXQ6p
|
||||
xWkxHySDKyVbR0v4JY3SJLRBuhgofYNG5155PiqZ7KwYY4Aw60eVgINsvJCF9/8b
|
||||
kEj+lecHbBdAf7N82320Ga+F+VeFnUl0gWFjoIF9UFCO80+7ZvIGdGlyPkr4zMvt
|
||||
TsC1snJQdHg+IlT3sGayYrQANpTG6GPYhn3KEvK5aqq+bPEe5lija0gw34jbPCo+
|
||||
TjHR76lToxzubGZODyyF/rjl5KwUbqTCNuv1PX1jTx7n7sCbu+KHpqXMhTHLKtby
|
||||
+Wh7WAfsVrbIW+P85/mkfhPbPZ2621f9cyStdFGgWU4dHdD00HIGOgAJvUSbC2Au
|
||||
oVUoKf2818t1s9aA4ptog04sNi+Ixu+z+3yYNLZj51j4ZX3KuXxLIiQvlvFQ8LQi
|
||||
RHGQk3u2W3iNtDKKUQjMPaB2FlVtC7FmtHBCpRmos6ld240DDyucqMdIDTMaqV0+
|
||||
sL4X+LIeBM/hP/IquRTuQBHBmgjkN4845ihTUJOanyKx605ANq/roHzXrbIxhR5p
|
||||
pcJLCBMLMWgdOCJMZRavSq04iXeNfP6Mk/joVpHS62Ljdfc94BBLfsOKOErA20Nq
|
||||
lfvbZqy2tI5IIDoq05S8FU0DYNqq/hyrv9Udo8IAo+WkBOABm0x/WA==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC7RgCKzVAyLSEn
|
||||
6QKs7S9kxRFhByxk8whIeQINrHTA+1GG6iDxyzhOBCDb/nahDDNDcy2J8OwobVXo
|
||||
F0/dO8QmkHJngxUnYas3uC/M2sA355+LMgfFwMBmCX6bLWMHt5zuvtFry0m9QOU2
|
||||
DXsqF48JQFChJcZHlgKOdboUeNRg4Q0PRoKal9XHAIZkqFIYCEUs3+n+ChN1k3c5
|
||||
daddmbZGBwfCaNowfyV58Bjs+orC56Ub5HseAe7FF/u7tTKiv3tV+x4tRv1ZGgHw
|
||||
tkjn403j7RgQwV60NWq2Fwz0QNOLIBc0oeeZe5Qv+B2rEP4wG94feXXBCKsnOvYo
|
||||
qGjdXNTXAgMBAAECggEAD7yDISa9fWnjZlojGmrX16zjl/alWVo+sPBSJtn9+ZVk
|
||||
tWSJHihIc+3O4Q2R5FiFGj7cbcHr5j3BwT3sPRfflKoAowgVx/hiDc2RXrJnAouZ
|
||||
EXZDxu86e5iCpgF7V9OrATjRmjA74wZH/HHHjrLqFwnrfI8TCULmthfYag35Mqax
|
||||
qrIEzvSuYdaGxblNe+ZfnVEDW2F9DLBGcma0ffUlJp8AvV7bpo8Rj/JovPxit/VS
|
||||
UdwSRxwSAugctFpmcGlFkoQfxUx1WdEy8hjopLrayMjCCJvRUL4+C4zT9r9PBHOj
|
||||
fCSbJ+ajQIoRrgaL9bURk8BFMHY8+yMUsWEYVSmFAQKBgQDtOvPkhvZsNocUB5nJ
|
||||
ti3SXyDQ6OZQuKKHPSeDV/EvmZKeNlrQ1ZnwXLP3vkcedDOkt1nEVq/hUewpjt08
|
||||
2MvmMwJBQEnmbTzMf43DtlXsStdP1lhYaFbU4iMM5zRfyBHDu1GPZEPXvKKpJUk0
|
||||
M+jYIyTAP3mcZhqDKn0mPVP7VwKBgQDKFy9DtWFKxCvhFQvHx7YeZiVWJbIst/O4
|
||||
ZyuPVAErni0hzSeCkmm7+F9hgEdPSLRcSaeTWP4L0u1cixECKboIhoNs38aft7o3
|
||||
MdnI2RDSEKtKX2uVuhvpGDNuGpBAc8Qu8iCiv5INSC36ZhD1h++O/TiiUdgRJ3yX
|
||||
yeG7ej+CgQKBgCR5F95e0aw5hfMSaBaXJ9xcO9Niu2ZVvMdGI7kR4EcNOXmRqczJ
|
||||
ym0mE5VXb9/Cxd3hQq/pFAl0avbIvEMKoe62kPYvSC1hRiO6yLT6Z6N4rjncHqEZ
|
||||
CaCZVAI72dWQEQsi1ZtSMwwMOIYA8YxRHs98N75HBA+DszfPZIZoj2zpAoGBAJHp
|
||||
B3ElhmeLF/tdTLIj2bQ9H/wBH5H2Bvw/UU4c4vNxMzjSfRJjUAAtpgAptFLkNYTk
|
||||
kR9sA5DZ7BMDPXaIVg9Nv5peP3SWHNc5IPtI7kIdUu9R0cW7J+e2V3vJphlC/ITA
|
||||
wRuAoZ0BXmEKTHhae3aMEdXwrcZE8kpNsrO/4hcBAoGBAMISiPJPuxAX1UtqcxTa
|
||||
mDJfnQ2gxRu6AK9VmXqo0X4IBxDSnTjcL0huUlS849wgsE5oTXgdYb2hn+TXM5JJ
|
||||
NsEXLhV09X1mrk4M4LV1npd0mYxvFsO4+p+IX5YLiahInmQtq0gx3DWE8wouVFER
|
||||
4yzfp27z8MZT8Qvr/ZI9lzWd
|
||||
-----END PRIVATE KEY-----
|
||||
+28
-10
@@ -2,7 +2,7 @@
|
||||
|
||||
$socket = null;
|
||||
$errno = 0;
|
||||
$context = stream_context_create(array('ssl' => array('local_cert' => dirname(__FILE__).'/cert.pem', 'passphrase' => 'pass')));
|
||||
$context = stream_context_create(array('ssl' => array('local_cert' => dirname(__FILE__).'/cert.pem')));
|
||||
|
||||
for ($i=0; $i<10 && !$socket; ++$i) {
|
||||
$port = rand(50000, 65535);
|
||||
@@ -265,7 +265,7 @@ if ($pid) {
|
||||
|
||||
} elseif (preg_match("~^NLST(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) {
|
||||
|
||||
if (isset($m[1]) && $m[1] === 'bogusdir') {
|
||||
if (isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) {
|
||||
fputs($s, "250 $m[1]: No such file or directory\r\n");
|
||||
continue;
|
||||
}
|
||||
@@ -276,11 +276,20 @@ if ($pid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
fputs($s, "150 File status okay; about to open data connection\r\n");
|
||||
if (empty($pasv)) {
|
||||
fputs($s, "150 File status okay; about to open data connection\r\n");
|
||||
if (!$fs = stream_socket_client("tcp://$host:$port")) {
|
||||
fputs($s, "425 Can't open data connection\r\n");
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
fputs($s, "125 Data connection already open; transfer starting.\r\n");
|
||||
$fs=$pasvs;
|
||||
}
|
||||
|
||||
if (!$fs = stream_socket_client("tcp://$host:$port")) {
|
||||
fputs($s, "425 Can't open data connection\r\n");
|
||||
continue;
|
||||
|
||||
if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
|
||||
die("SSLv23 handshake failed.\n");
|
||||
}
|
||||
|
||||
if (empty($m[1]) || $m[1] !== 'emptydir') {
|
||||
@@ -368,7 +377,7 @@ if ($pid) {
|
||||
}
|
||||
fputs($s, "226 Closing data Connection.\r\n");
|
||||
break;
|
||||
case "mediumfile":
|
||||
case "mediumfile":
|
||||
fputs($s, "150 File status okay; about to open data connection.\r\n");
|
||||
for($i = 0; $i < 150; $i++){
|
||||
fputs($fs, "This is line $i of the test data.\n");
|
||||
@@ -384,13 +393,22 @@ if ($pid) {
|
||||
|
||||
|
||||
}elseif (preg_match('/^PASV/', $buf, $matches)) {
|
||||
$port = $pasv_port;
|
||||
$p2 = $port % ((int) 1 << 8);
|
||||
$p1 = ($port-$p2)/((int) 1 << 8);
|
||||
$pasv=true;
|
||||
$p2 = $pasv_port % ((int) 1 << 8);
|
||||
$p1 = ($pasv_port-$p2)/((int) 1 << 8);
|
||||
$host = "127.0.0.1";
|
||||
if (!empty($ssl)) {
|
||||
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
|
||||
} else {
|
||||
$soc = stream_socket_server("tcp://127.0.0.1:$pasv_port");
|
||||
}
|
||||
|
||||
fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
|
||||
|
||||
$pasvs = stream_socket_accept($soc,10);
|
||||
|
||||
}elseif (preg_match('/^EPSV/', $buf, $matches)) {
|
||||
fputs($s, "550 Extended passsive mode not supported.\r\n");
|
||||
} elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
|
||||
fputs($s, "200 OK\r\n");
|
||||
|
||||
|
||||
+54
-12
@@ -69,6 +69,9 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
#include <gd.h>
|
||||
#ifndef HAVE_GD_BUNDLED
|
||||
# include <gd_errors.h>
|
||||
#endif
|
||||
#include <gdfontt.h> /* 1 Tiny font */
|
||||
#include <gdfonts.h> /* 2 Small font */
|
||||
#include <gdfontmb.h> /* 3 Medium bold font */
|
||||
@@ -96,7 +99,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int);
|
||||
|
||||
#include "gd_ctx.c"
|
||||
|
||||
/* as it is not really public, duplicate declaration here to avoid
|
||||
/* as it is not really public, duplicate declaration here to avoid
|
||||
pointless warnings */
|
||||
int overflow2(int a, int b);
|
||||
|
||||
@@ -1099,6 +1102,18 @@ void php_gd_error_method(int type, const char *format, va_list args)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
switch (type) {
|
||||
case GD_DEBUG:
|
||||
case GD_INFO:
|
||||
case GD_NOTICE:
|
||||
type = E_NOTICE;
|
||||
break;
|
||||
case GD_WARNING:
|
||||
type = E_WARNING;
|
||||
break;
|
||||
default:
|
||||
type = E_ERROR;
|
||||
}
|
||||
php_verror(NULL, "", type, format, args TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1148,6 +1163,7 @@ PHP_MINIT_FUNCTION(gd)
|
||||
REGISTER_LONG_CONSTANT("IMG_PNG", 4, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_WBMP", 8, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_XPM", 16, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_WEBP", 32, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
/* special colours for gd */
|
||||
REGISTER_LONG_CONSTANT("IMG_COLOR_TILED", gdTiled, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -1181,7 +1197,7 @@ PHP_MINIT_FUNCTION(gd)
|
||||
REGISTER_LONG_CONSTANT("IMG_CROP_SIDES", GD_CROP_SIDES, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_CROP_THRESHOLD", GD_CROP_THRESHOLD, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
|
||||
|
||||
REGISTER_LONG_CONSTANT("IMG_BELL", GD_BELL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_BESSEL", GD_BESSEL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("IMG_BILINEAR_FIXED", GD_BILINEAR_FIXED, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -1539,6 +1555,7 @@ PHP_FUNCTION(imagesetstyle)
|
||||
int * stylearr;
|
||||
int index;
|
||||
HashPosition pos;
|
||||
int num_styles;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &IM, &styles) == FAILURE) {
|
||||
return;
|
||||
@@ -1546,8 +1563,14 @@ PHP_FUNCTION(imagesetstyle)
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
|
||||
|
||||
num_styles = zend_hash_num_elements(HASH_OF(styles));
|
||||
if (num_styles == 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "styles array must not be empty");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* copy the style values in the stylearr */
|
||||
stylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0);
|
||||
stylearr = safe_emalloc(sizeof(int), num_styles, 0);
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(HASH_OF(styles), &pos);
|
||||
|
||||
@@ -1635,11 +1658,11 @@ PHP_FUNCTION(imagetruecolortopalette)
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
|
||||
|
||||
if (ncolors <= 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of colors has to be greater than zero");
|
||||
if (ncolors <= 0 || ncolors > INT_MAX) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of colors has to be greater than zero and no more than %d", INT_MAX);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
gdImageTrueColorToPalette(im, dither, ncolors);
|
||||
gdImageTrueColorToPalette(im, dither, (int)ncolors);
|
||||
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@@ -2200,6 +2223,9 @@ PHP_FUNCTION(imagetypes)
|
||||
#if defined(HAVE_GD_XPM)
|
||||
ret |= 16;
|
||||
#endif
|
||||
#ifdef HAVE_GD_WEBP
|
||||
ret |= 32;
|
||||
#endif
|
||||
|
||||
if (zend_parse_parameters_none() == FAILURE) {
|
||||
return;
|
||||
@@ -3056,6 +3082,11 @@ PHP_FUNCTION(imagegammacorrect)
|
||||
return;
|
||||
}
|
||||
|
||||
if ( input <= 0.0 || output <= 0.0 ) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Gamma values should be positive");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
|
||||
|
||||
if (gdImageTrueColor(im)) {
|
||||
@@ -3887,7 +3918,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
|
||||
#endif /* VIRTUAL_DIR */
|
||||
|
||||
PHP_GD_CHECK_OPEN_BASEDIR(fontname, "Invalid font filename");
|
||||
|
||||
|
||||
#ifdef HAVE_GD_FREETYPE
|
||||
if (extended) {
|
||||
error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex);
|
||||
@@ -4465,7 +4496,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
int x, y;
|
||||
float x_ratio, y_ratio;
|
||||
long ignore_warning;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -5097,7 +5128,7 @@ PHP_FUNCTION(imagecropauto)
|
||||
break;
|
||||
|
||||
case GD_CROP_THRESHOLD:
|
||||
if (color < 0) {
|
||||
if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Color argument missing with threshold mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -5145,6 +5176,10 @@ PHP_FUNCTION(imagescale)
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_h <= 0 || tmp_w <= 0) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
new_width = tmp_w;
|
||||
new_height = tmp_h;
|
||||
|
||||
@@ -5344,7 +5379,7 @@ PHP_FUNCTION(imageaffinematrixget)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing y position");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (type == GD_AFFINE_TRANSLATE) {
|
||||
res = gdAffineTranslate(affine, x, y);
|
||||
} else {
|
||||
@@ -5362,8 +5397,15 @@ PHP_FUNCTION(imageaffinematrixget)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number is expected as option");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_double_ex(&options);
|
||||
angle = Z_DVAL_P(options);
|
||||
if(Z_TYPE_P(options) != IS_DOUBLE) {
|
||||
zval dval;
|
||||
dval = *options;
|
||||
zval_copy_ctor(&dval);
|
||||
convert_to_double(&dval);
|
||||
angle = Z_DVAL(dval);
|
||||
} else {
|
||||
angle = Z_DVAL_P(options);
|
||||
}
|
||||
|
||||
if (type == GD_AFFINE_SHEAR_HORIZONTAL) {
|
||||
res = gdAffineShearHorizontal(affine, angle);
|
||||
|
||||
+120
-37
@@ -133,6 +133,10 @@ gdImagePtr gdImageCreate (int sx, int sy)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (overflow2(sizeof(unsigned char *), sx)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
im = (gdImage *) gdCalloc(1, sizeof(gdImage));
|
||||
|
||||
/* Row-major ever since gd 1.3 */
|
||||
@@ -186,7 +190,7 @@ gdImagePtr gdImageCreateTrueColor (int sx, int sy)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (overflow2(sizeof(int), sx)) {
|
||||
if (overflow2(sizeof(int *), sx)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -595,15 +599,18 @@ void gdImageColorDeallocate (gdImagePtr im, int color)
|
||||
|
||||
void gdImageColorTransparent (gdImagePtr im, int color)
|
||||
{
|
||||
if (color < 0) {
|
||||
return;
|
||||
}
|
||||
if (!im->trueColor) {
|
||||
if((color >= im->colorsTotal)) {
|
||||
return;
|
||||
}
|
||||
/* Make the old transparent color opaque again */
|
||||
if (im->transparent != -1) {
|
||||
im->alpha[im->transparent] = gdAlphaOpaque;
|
||||
}
|
||||
if (color > -1 && color < im->colorsTotal && color < gdMaxColors) {
|
||||
im->alpha[color] = gdAlphaTransparent;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
im->alpha[color] = gdAlphaTransparent;
|
||||
}
|
||||
im->transparent = color;
|
||||
}
|
||||
@@ -1051,11 +1058,13 @@ void gdImageAABlend (gdImagePtr im)
|
||||
}
|
||||
}
|
||||
|
||||
static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
|
||||
|
||||
static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col)
|
||||
{
|
||||
if (im->thick > 1) {
|
||||
int thickhalf = im->thick >> 1;
|
||||
gdImageFilledRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col);
|
||||
_gdImageFilledHRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col);
|
||||
} else {
|
||||
if (x2 < x1) {
|
||||
int t = x2;
|
||||
@@ -1098,12 +1107,12 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
int thick = im->thick;
|
||||
|
||||
if (color == gdAntiAliased) {
|
||||
/*
|
||||
/*
|
||||
gdAntiAliased passed as color: use the much faster, much cheaper
|
||||
and equally attractive gdImageAALine implementation. That
|
||||
clips too, so don't clip twice.
|
||||
*/
|
||||
gdImageAALine(im, x1, y1, x2, y2, im->AA_color);
|
||||
gdImageAALine(im, x1, y1, x2, y2, im->AA_color);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1661,23 +1670,17 @@ long lsqrt (long n)
|
||||
/* s and e are integers modulo 360 (degrees), with 0 degrees
|
||||
being the rightmost extreme and degrees changing clockwise.
|
||||
cx and cy are the center in pixels; w and h are the horizontal
|
||||
and vertical diameter in pixels. Nice interface, but slow.
|
||||
See gd_arc_f_buggy.c for a better version that doesn't
|
||||
seem to be bug-free yet. */
|
||||
and vertical diameter in pixels. */
|
||||
|
||||
void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color)
|
||||
{
|
||||
if ((s % 360) == (e % 360)) {
|
||||
gdImageEllipse(im, cx, cy, w, h, color);
|
||||
} else {
|
||||
gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill);
|
||||
}
|
||||
gdImageFilledArc(im, cx, cy, w, h, s, e, color, gdNoFill);
|
||||
}
|
||||
|
||||
void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color, int style)
|
||||
{
|
||||
gdPoint pts[3];
|
||||
int i;
|
||||
gdPoint pts[363];
|
||||
int i, pti;
|
||||
int lx = 0, ly = 0;
|
||||
int fx = 0, fy = 0;
|
||||
|
||||
@@ -1705,7 +1708,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
|
||||
}
|
||||
}
|
||||
|
||||
for (i = s; i <= e; i++) {
|
||||
for (i = s, pti = 1; i <= e; i++, pti++) {
|
||||
int x, y;
|
||||
x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
|
||||
y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
|
||||
@@ -1714,19 +1717,28 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
|
||||
if (style & gdNoFill) {
|
||||
gdImageLine(im, lx, ly, x, y, color);
|
||||
} else {
|
||||
/* This is expensive! */
|
||||
pts[0].x = lx;
|
||||
pts[0].y = ly;
|
||||
pts[1].x = x;
|
||||
pts[1].y = y;
|
||||
pts[2].x = cx;
|
||||
pts[2].y = cy;
|
||||
gdImageFilledPolygon(im, pts, 3, color);
|
||||
}
|
||||
if (y == ly) {
|
||||
pti--; /* don't add this point */
|
||||
if (((i > 270 || i < 90) && x > lx) || ((i > 90 && i < 270) && x < lx)) {
|
||||
/* replace the old x coord, if increasing on the
|
||||
right side or decreasing on the left side */
|
||||
pts[pti].x = x;
|
||||
}
|
||||
} else {
|
||||
pts[pti].x = x;
|
||||
pts[pti].y = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fx = x;
|
||||
fy = y;
|
||||
if (!(style & (gdChord | gdNoFill))) {
|
||||
pts[0].x = cx;
|
||||
pts[0].y = cy;
|
||||
pts[pti].x = x;
|
||||
pts[pti].y = y;
|
||||
}
|
||||
}
|
||||
lx = x;
|
||||
ly = y;
|
||||
@@ -1753,6 +1765,10 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
|
||||
gdImageLine(im, cx, cy, lx, ly, color);
|
||||
gdImageLine(im, cx, cy, fx, fy, color);
|
||||
}
|
||||
} else {
|
||||
pts[pti].x = cx;
|
||||
pts[pti].y = cy;
|
||||
gdImageFilledPolygon(im, pts, pti+1, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1769,6 +1785,12 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!im->trueColor) {
|
||||
if ((color > (im->colorsTotal - 1)) || (border > (im->colorsTotal - 1)) || (color < 0)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
restoreAlphaBlending = im->alphaBlendingFlag;
|
||||
im->alphaBlendingFlag = 0;
|
||||
|
||||
@@ -1880,7 +1902,7 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
|
||||
return;
|
||||
}
|
||||
|
||||
alphablending_bak = im->alphaBlendingFlag;
|
||||
alphablending_bak = im->alphaBlendingFlag;
|
||||
im->alphaBlendingFlag = 0;
|
||||
|
||||
if (nc==gdTiled){
|
||||
@@ -1892,7 +1914,7 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
|
||||
wx2=im->sx;wy2=im->sy;
|
||||
oc = gdImageGetPixel(im, x, y);
|
||||
if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) {
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1955,7 +1977,7 @@ skip: for (x++; x<=x2 && (gdImageGetPixel(im, x, y)!=oc); x++);
|
||||
efree(stack);
|
||||
|
||||
done:
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
im->alphaBlendingFlag = alphablending_bak;
|
||||
}
|
||||
|
||||
static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc)
|
||||
@@ -2063,7 +2085,7 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
|
||||
x1ul = x1 - half;
|
||||
y1ul = y1 - half;
|
||||
|
||||
|
||||
x2lr = x2 + half;
|
||||
y2lr = y2 + half;
|
||||
|
||||
@@ -2114,10 +2136,53 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
}
|
||||
}
|
||||
|
||||
void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (x1 == x2 && y1 == y2) {
|
||||
gdImageSetPixel(im, x1, y1, color);
|
||||
return;
|
||||
}
|
||||
|
||||
if (x1 > x2) {
|
||||
x = x1;
|
||||
x1 = x2;
|
||||
x2 = x;
|
||||
}
|
||||
|
||||
if (y1 > y2) {
|
||||
y = y1;
|
||||
y1 = y2;
|
||||
y2 = y;
|
||||
}
|
||||
|
||||
if (x1 < 0) {
|
||||
x1 = 0;
|
||||
}
|
||||
|
||||
if (x2 >= gdImageSX(im)) {
|
||||
x2 = gdImageSX(im) - 1;
|
||||
}
|
||||
|
||||
if (y1 < 0) {
|
||||
y1 = 0;
|
||||
}
|
||||
|
||||
if (y2 >= gdImageSY(im)) {
|
||||
y2 = gdImageSY(im) - 1;
|
||||
}
|
||||
|
||||
for (x = x1; (x <= x2); x++) {
|
||||
for (y = y1; (y <= y2); y++) {
|
||||
gdImageSetPixel (im, x, y, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void _gdImageFilledVRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if (x1 == x2 && y1 == y2) {
|
||||
gdImageSetPixel(im, x1, y1, color);
|
||||
@@ -2159,6 +2224,11 @@ void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int
|
||||
}
|
||||
}
|
||||
|
||||
void gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
_gdImageFilledVRectangle(im, x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
void gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h)
|
||||
{
|
||||
int c;
|
||||
@@ -2265,7 +2335,7 @@ void gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int s
|
||||
int tox, toy;
|
||||
int ncR, ncG, ncB;
|
||||
toy = dstY;
|
||||
|
||||
|
||||
for (y = srcY; y < (srcY + h); y++) {
|
||||
tox = dstX;
|
||||
for (x = srcX; x < (srcX + w); x++) {
|
||||
@@ -2362,7 +2432,7 @@ void gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int
|
||||
int colorMap[gdMaxColors];
|
||||
/* Stretch vectors */
|
||||
int *stx, *sty;
|
||||
|
||||
|
||||
if (overflow2(sizeof(int), srcW)) {
|
||||
return;
|
||||
}
|
||||
@@ -2661,6 +2731,19 @@ void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c)
|
||||
maxy = p[i].y;
|
||||
}
|
||||
}
|
||||
/* necessary special case: horizontal line */
|
||||
if (n > 1 && miny == maxy) {
|
||||
x1 = x2 = p[0].x;
|
||||
for (i = 1; (i < n); i++) {
|
||||
if (p[i].x < x1) {
|
||||
x1 = p[i].x;
|
||||
} else if (p[i].x > x2) {
|
||||
x2 = p[i].x;
|
||||
}
|
||||
}
|
||||
gdImageLine(im, x1, miny, x2, miny, c);
|
||||
return;
|
||||
}
|
||||
pmaxy = maxy;
|
||||
/* 2.0.16: Optimization by Ilia Chipitsine -- don't waste time offscreen */
|
||||
if (miny < 0) {
|
||||
@@ -2907,7 +2990,7 @@ int gdAlphaBlend (int dst, int src) {
|
||||
src_weight = gdAlphaTransparent - src_alpha;
|
||||
dst_weight = (gdAlphaTransparent - dst_alpha) * src_alpha / gdAlphaMax;
|
||||
tot_weight = src_weight + dst_weight;
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* What red, green and blue result values will we use? */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -138,16 +138,29 @@ static int _gd2GetHeader(gdIOCtxPtr in, int *sx, int *sy, int *cs, int *vers, in
|
||||
if (gd2_compressed(*fmt)) {
|
||||
nc = (*ncx) * (*ncy);
|
||||
GD2_DBG(php_gd_error("Reading %d chunk index entries", nc));
|
||||
if (overflow2(sizeof(t_chunk_info), nc)) {
|
||||
goto fail1;
|
||||
}
|
||||
sidx = sizeof(t_chunk_info) * nc;
|
||||
if (sidx <= 0) {
|
||||
goto fail1;
|
||||
}
|
||||
cidx = gdCalloc(sidx, 1);
|
||||
if (cidx == NULL) {
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
for (i = 0; i < nc; i++) {
|
||||
if (gdGetInt(&cidx[i].offset, in) != 1) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
if (gdGetInt(&cidx[i].size, in) != 1) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
if (cidx[i].offset < 0 || cidx[i].size < 0) {
|
||||
gdFree(cidx);
|
||||
goto fail1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,14 +601,26 @@ nomatch:
|
||||
* code in turn. When the buffer fills up empty it and start over.
|
||||
*/
|
||||
|
||||
static unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
|
||||
static const unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F,
|
||||
0x001F, 0x003F, 0x007F, 0x00FF,
|
||||
0x01FF, 0x03FF, 0x07FF, 0x0FFF,
|
||||
0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF };
|
||||
|
||||
|
||||
/* Arbitrary value to mark output is done. When we see EOFCode, then we don't
|
||||
* expect to see any more data. If we do (e.g. corrupt image inputs), cur_bits
|
||||
* might be negative, so flag it to return early.
|
||||
*/
|
||||
#define CUR_BITS_FINISHED -1000
|
||||
|
||||
|
||||
static void
|
||||
output(code_int code, GifCtx *ctx)
|
||||
{
|
||||
if (ctx->cur_bits == CUR_BITS_FINISHED) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->cur_accum &= masks[ ctx->cur_bits ];
|
||||
|
||||
if( ctx->cur_bits > 0 )
|
||||
@@ -655,8 +667,10 @@ output(code_int code, GifCtx *ctx)
|
||||
ctx->cur_bits -= 8;
|
||||
}
|
||||
|
||||
flush_char(ctx);
|
||||
/* Flag that it's done to prevent re-entry. */
|
||||
ctx->cur_bits = CUR_BITS_FINISHED;
|
||||
|
||||
flush_char(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+131
-85
@@ -41,8 +41,8 @@
|
||||
downscaling using the fixed point implementations are usually much faster
|
||||
than the existing gdImageCopyResampled while having a similar or better
|
||||
quality.
|
||||
|
||||
For image rotations, the optimized versions have a lazy antialiasing for
|
||||
|
||||
For image rotations, the optimized versions have a lazy antialiasing for
|
||||
the edges of the images. For a much better antialiased result, the affine
|
||||
function is recommended.
|
||||
*/
|
||||
@@ -635,7 +635,7 @@ static inline int _color_blend (const int dst, const int src)
|
||||
}
|
||||
}
|
||||
|
||||
static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor)
|
||||
static inline int _setEdgePixel(const gdImagePtr src, unsigned int x, unsigned int y, gdFixed coverage, const int bgColor)
|
||||
{
|
||||
const gdFixed f_127 = gd_itofx(127);
|
||||
register int c = src->tpixels[y][x];
|
||||
@@ -879,20 +879,42 @@ int getPixelInterpolated(gdImagePtr im, const double x, const double y, const in
|
||||
static inline LineContribType * _gdContributionsAlloc(unsigned int line_length, unsigned int windows_size)
|
||||
{
|
||||
unsigned int u = 0;
|
||||
LineContribType *res;
|
||||
LineContribType *res;
|
||||
int overflow_error = 0;
|
||||
|
||||
res = (LineContribType *) gdMalloc(sizeof(LineContribType));
|
||||
if (!res) {
|
||||
return NULL;
|
||||
}
|
||||
res->WindowSize = windows_size;
|
||||
res->LineLength = line_length;
|
||||
res->ContribRow = (ContributionType *) gdMalloc(line_length * sizeof(ContributionType));
|
||||
|
||||
for (u = 0 ; u < line_length ; u++) {
|
||||
res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double));
|
||||
}
|
||||
return res;
|
||||
res->WindowSize = windows_size;
|
||||
res->LineLength = line_length;
|
||||
if (overflow2(line_length, sizeof(ContributionType))) {
|
||||
gdFree(res);
|
||||
return NULL;
|
||||
}
|
||||
res->ContribRow = (ContributionType *) gdMalloc(line_length * sizeof(ContributionType));
|
||||
if (res->ContribRow == NULL) {
|
||||
gdFree(res);
|
||||
return NULL;
|
||||
}
|
||||
for (u = 0 ; u < line_length ; u++) {
|
||||
if (overflow2(windows_size, sizeof(double))) {
|
||||
overflow_error = 1;
|
||||
} else {
|
||||
res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double));
|
||||
}
|
||||
if (overflow_error == 1 || res->ContribRow[u].Weights == NULL) {
|
||||
unsigned int i;
|
||||
u--;
|
||||
for (i=0;i<=u;i++) {
|
||||
gdFree(res->ContribRow[i].Weights);
|
||||
}
|
||||
gdFree(res->ContribRow);
|
||||
gdFree(res);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline void _gdContributionsFree(LineContribType * p)
|
||||
@@ -907,59 +929,62 @@ static inline void _gdContributionsFree(LineContribType * p)
|
||||
|
||||
static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter)
|
||||
{
|
||||
double width_d;
|
||||
double scale_f_d = 1.0;
|
||||
const double filter_width_d = DEFAULT_BOX_RADIUS;
|
||||
double width_d;
|
||||
double scale_f_d = 1.0;
|
||||
const double filter_width_d = DEFAULT_BOX_RADIUS;
|
||||
int windows_size;
|
||||
unsigned int u;
|
||||
LineContribType *res;
|
||||
int overflow_error = 0;
|
||||
|
||||
if (scale_d < 1.0) {
|
||||
width_d = filter_width_d / scale_d;
|
||||
scale_f_d = scale_d;
|
||||
} else {
|
||||
width_d= filter_width_d;
|
||||
}
|
||||
if (scale_d < 1.0) {
|
||||
width_d = filter_width_d / scale_d;
|
||||
scale_f_d = scale_d;
|
||||
} else {
|
||||
width_d= filter_width_d;
|
||||
}
|
||||
|
||||
windows_size = 2 * (int)ceil(width_d) + 1;
|
||||
res = _gdContributionsAlloc(line_size, windows_size);
|
||||
|
||||
for (u = 0; u < line_size; u++) {
|
||||
const double dCenter = (double)u / scale_d;
|
||||
/* get the significant edge points affecting the pixel */
|
||||
register int iLeft = MAX(0, (int)floor (dCenter - width_d));
|
||||
int iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);
|
||||
double dTotalWeight = 0.0;
|
||||
windows_size = 2 * (int)ceil(width_d) + 1;
|
||||
res = _gdContributionsAlloc(line_size, windows_size);
|
||||
if (res == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
for (u = 0; u < line_size; u++) {
|
||||
const double dCenter = (double)u / scale_d;
|
||||
/* get the significant edge points affecting the pixel */
|
||||
register int iLeft = MAX(0, (int)floor (dCenter - width_d));
|
||||
int iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1);
|
||||
double dTotalWeight = 0.0;
|
||||
int iSrc;
|
||||
|
||||
res->ContribRow[u].Left = iLeft;
|
||||
res->ContribRow[u].Right = iRight;
|
||||
/* Cut edge points to fit in filter window in case of spill-off */
|
||||
if (iRight - iLeft + 1 > windows_size) {
|
||||
if (iLeft < ((int)src_size - 1 / 2)) {
|
||||
iLeft++;
|
||||
} else {
|
||||
iRight--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cut edge points to fit in filter window in case of spill-off */
|
||||
if (iRight - iLeft + 1 > windows_size) {
|
||||
if (iLeft < ((int)src_size - 1 / 2)) {
|
||||
iLeft++;
|
||||
} else {
|
||||
iRight--;
|
||||
}
|
||||
}
|
||||
res->ContribRow[u].Left = iLeft;
|
||||
res->ContribRow[u].Right = iRight;
|
||||
|
||||
for (iSrc = iLeft; iSrc <= iRight; iSrc++) {
|
||||
dTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));
|
||||
}
|
||||
for (iSrc = iLeft; iSrc <= iRight; iSrc++) {
|
||||
dTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc)));
|
||||
}
|
||||
|
||||
if (dTotalWeight < 0.0) {
|
||||
_gdContributionsFree(res);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dTotalWeight > 0.0) {
|
||||
for (iSrc = iLeft; iSrc <= iRight; iSrc++) {
|
||||
res->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
if (dTotalWeight > 0.0) {
|
||||
for (iSrc = iLeft; iSrc <= iRight; iSrc++) {
|
||||
res->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline void _gdScaleRow(gdImagePtr pSrc, unsigned int src_width, gdImagePtr dst, unsigned int dst_width, unsigned int row, LineContribType *contrib)
|
||||
@@ -1047,6 +1072,9 @@ static inline void _gdScaleVert (const gdImagePtr pSrc, const unsigned int src_w
|
||||
}
|
||||
|
||||
contrib = _gdContributionsCalc(dst_height, src_height, (double)(dst_height) / (double)(src_height), pSrc->interpolation);
|
||||
if (contrib == NULL) {
|
||||
return;
|
||||
}
|
||||
/* scale each column */
|
||||
for (u = 0; u < dst_width - 1; u++) {
|
||||
_gdScaleCol(pSrc, src_width, pDst, dst_width, dst_height, u, contrib);
|
||||
@@ -1059,6 +1087,10 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
|
||||
gdImagePtr tmp_im;
|
||||
gdImagePtr dst;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Convert to truecolor if it isn't; this code requires it. */
|
||||
if (!src->trueColor) {
|
||||
gdImagePaletteToTrueColor(src);
|
||||
@@ -1087,6 +1119,10 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
|
||||
{
|
||||
gdImagePtr tmp_im;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tmp_im = gdImageCreateTrueColor(new_width, src_height);
|
||||
if (tmp_im == NULL) {
|
||||
return NULL;
|
||||
@@ -1096,7 +1132,7 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
|
||||
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
|
||||
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
|
||||
|
||||
gdFree(tmp_im);
|
||||
gdImageDestroy(tmp_im);
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -1120,6 +1156,10 @@ gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width,
|
||||
unsigned long dst_offset_y = 0;
|
||||
unsigned int i;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dst_img = gdImageCreateTrueColor(new_width, new_height);
|
||||
|
||||
if (dst_img == NULL) {
|
||||
@@ -1221,11 +1261,21 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int
|
||||
gdImagePtr new_img;
|
||||
const int transparent = im->transparent;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_img = gdImageCreateTrueColor(new_width, new_height);
|
||||
if (new_img == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
new_img->transparent = gdTrueColorAlpha(im->red[transparent], im->green[transparent], im->blue[transparent], im->alpha[transparent]);
|
||||
|
||||
if (transparent < 0) {
|
||||
/* uninitialized */
|
||||
new_img->transparent = -1;
|
||||
} else {
|
||||
new_img->transparent = gdTrueColorAlpha(im->red[transparent], im->green[transparent], im->blue[transparent], im->alpha[transparent]);
|
||||
}
|
||||
|
||||
for (i=0; i < _height; i++) {
|
||||
long j;
|
||||
@@ -1313,6 +1363,10 @@ static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_w
|
||||
long i;
|
||||
gdImagePtr new_img;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_img = gdImageCreateTrueColor(new_width, new_height);
|
||||
if (!new_img){
|
||||
return NULL;
|
||||
@@ -1412,6 +1466,10 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
|
||||
unsigned int dst_offset_y = 0;
|
||||
long i;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* impact perf a bit, but not that much. Implementation for palette
|
||||
images can be done at a later point.
|
||||
*/
|
||||
@@ -1451,13 +1509,8 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
|
||||
src_offset_y[0] = m;
|
||||
}
|
||||
|
||||
if (m < 1) {
|
||||
src_offset_x[1] = n;
|
||||
src_offset_y[1] = m;
|
||||
} else {
|
||||
src_offset_x[1] = n;
|
||||
src_offset_y[1] = m;
|
||||
}
|
||||
src_offset_x[1] = n;
|
||||
src_offset_y[1] = m;
|
||||
|
||||
if ((m < 1) || (n >= src_w - 1)) {
|
||||
src_offset_x[2] = n;
|
||||
@@ -1509,13 +1562,8 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
|
||||
src_offset_y[8] = m;
|
||||
}
|
||||
|
||||
if (m >= src_h - 1) {
|
||||
src_offset_x[8] = n;
|
||||
src_offset_y[8] = m;
|
||||
} else {
|
||||
src_offset_x[9] = n;
|
||||
src_offset_y[9] = m;
|
||||
}
|
||||
src_offset_x[9] = n;
|
||||
src_offset_y[9] = m;
|
||||
|
||||
if ((m >= src_h-1) || (n >= src_w-1)) {
|
||||
src_offset_x[10] = n;
|
||||
@@ -1541,13 +1589,8 @@ gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, co
|
||||
src_offset_y[12] = m;
|
||||
}
|
||||
|
||||
if (m >= src_h - 2) {
|
||||
src_offset_x[13] = n;
|
||||
src_offset_y[13] = m;
|
||||
} else {
|
||||
src_offset_x[13] = n;
|
||||
src_offset_y[13] = m;
|
||||
}
|
||||
src_offset_x[13] = n;
|
||||
src_offset_y[13] = m;
|
||||
|
||||
if ((m >= src_h - 2) || (n >= src_w - 1)) {
|
||||
src_offset_x[14] = n;
|
||||
@@ -1634,7 +1677,11 @@ gdImagePtr gdImageScale(const gdImagePtr src, const unsigned int new_width, cons
|
||||
gdImagePtr im_scaled = NULL;
|
||||
|
||||
if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (src->interpolation_id) {
|
||||
@@ -1680,6 +1727,10 @@ gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, co
|
||||
unsigned int i;
|
||||
gdImagePtr dst;
|
||||
|
||||
if (new_width == 0 || new_height == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dst = gdImageCreateTrueColor(new_width, new_height);
|
||||
if (!dst) {
|
||||
return NULL;
|
||||
@@ -1948,13 +1999,8 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const
|
||||
src_offset_y[0] = m;
|
||||
}
|
||||
|
||||
if (m < 1) {
|
||||
src_offset_x[1] = n;
|
||||
src_offset_y[1] = m;
|
||||
} else {
|
||||
src_offset_x[1] = n;
|
||||
src_offset_y[1] = m ;
|
||||
}
|
||||
src_offset_x[1] = n;
|
||||
src_offset_y[1] = m;
|
||||
|
||||
if ((m < 1) || (n >= src_w-1)) {
|
||||
src_offset_x[2] = - 1;
|
||||
@@ -2007,8 +2053,8 @@ gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const
|
||||
}
|
||||
|
||||
if (m >= src_h-1) {
|
||||
src_offset_x[8] = - 1;
|
||||
src_offset_y[8] = - 1;
|
||||
src_offset_x[9] = - 1;
|
||||
src_offset_y[9] = - 1;
|
||||
} else {
|
||||
src_offset_x[9] = n;
|
||||
src_offset_y[9] = m;
|
||||
@@ -2284,7 +2330,7 @@ int gdTransformAffineGetImage(gdImagePtr *dst,
|
||||
if (!src->trueColor) {
|
||||
gdImagePaletteToTrueColor(src);
|
||||
}
|
||||
|
||||
|
||||
/* Translate to dst origin (0,0) */
|
||||
gdAffineTranslate(m, -bbox.x, -bbox.y);
|
||||
gdAffineConcat(m, affine, m);
|
||||
@@ -2343,7 +2389,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
|
||||
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {
|
||||
interpolation_id_bak = src->interpolation_id;
|
||||
interpolation_bak = src->interpolation;
|
||||
|
||||
|
||||
gdImageSetInterpolationMethod(src, GD_BICUBIC);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
* If it is not working, it's not Thomas G. Lane's fault.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
SETTING THIS ONE CAUSES STRIPED IMAGE
|
||||
to be done: solve this
|
||||
#define ORIGINAL_LIB_JPEG_REVERSE_ODD_ROWS
|
||||
@@ -152,7 +152,7 @@
|
||||
* color space, and repeatedly splits the "largest" remaining box until we
|
||||
* have as many boxes as desired colors. Then the mean color in each
|
||||
* remaining box becomes one of the possible output colors.
|
||||
*
|
||||
*
|
||||
* The second pass over the image maps each input pixel to the closest output
|
||||
* color (optionally after applying a Floyd-Steinberg dithering correction).
|
||||
* This mapping is logically trivial, but making it go fast enough requires
|
||||
@@ -1320,16 +1320,16 @@ pass2_no_dither (j_decompress_ptr cinfo,
|
||||
#else
|
||||
r = gdTrueColorGetRed (*inptr);
|
||||
g = gdTrueColorGetGreen (*inptr);
|
||||
/*
|
||||
/*
|
||||
2.0.24: inptr must not be incremented until after
|
||||
transparency check, if any. Thanks to "Super Pikeman."
|
||||
transparency check, if any. Thanks to "Super Pikeman."
|
||||
*/
|
||||
b = gdTrueColorGetBlue (*inptr);
|
||||
|
||||
/* If the pixel is transparent, we assign it the palette index that
|
||||
* will later be added at the end of the palette as the transparent
|
||||
* index. */
|
||||
if ((oim->transparent >= 0) && (oim->transparent == *(inptr - 1)))
|
||||
if ((oim->transparent >= 0) && (oim->transparent == *inptr))
|
||||
{
|
||||
*outptr++ = nim->colorsTotal;
|
||||
inptr++;
|
||||
@@ -1795,7 +1795,7 @@ static void gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int color
|
||||
}
|
||||
} else {
|
||||
nim = oim;
|
||||
}
|
||||
}
|
||||
if (!oim->trueColor)
|
||||
{
|
||||
/* (Almost) nothing to do! */
|
||||
@@ -2004,7 +2004,7 @@ static void gdImageTrueColorToPaletteBody (gdImagePtr oim, int dither, int color
|
||||
}
|
||||
|
||||
/* Success! Get rid of the truecolor image data. */
|
||||
if (!cimP) {
|
||||
if (!cimP) {
|
||||
oim->trueColor = 0;
|
||||
/* Junk the truecolor pixels */
|
||||
for (i = 0; i < oim->sy; i++)
|
||||
|
||||
@@ -330,7 +330,7 @@ han2zen (int *p1, int *p2)
|
||||
{
|
||||
if ((*p2 >= 74 && *p2 <= 103) || (*p2 >= 110 && *p2 <= 122))
|
||||
(*p2)++;
|
||||
else if (*p2 == 131 && *p2 == 69)
|
||||
else if (*p2 == 131 || *p2 == 69)
|
||||
*p2 = 148;
|
||||
}
|
||||
else if (handaku && *p2 >= 110 && *p2 <= 122)
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ void gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out)
|
||||
if (gdImageGetPixel(image, x, y) == fg) {
|
||||
c |= b;
|
||||
}
|
||||
if ((b == 128) || (x == sx && y == sy)) {
|
||||
if ((b == 128) || (x == sx - 1)) {
|
||||
b = 1;
|
||||
if (p) {
|
||||
gdCtxPrintf(out, ", ");
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
--TEST--
|
||||
Bug #43475 (Thick styled lines have scrambled patterns)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/similarity.inc';
|
||||
|
||||
function setStyleAndThickness($im, $color, $thickness)
|
||||
{
|
||||
$style = array();
|
||||
$i = 0;
|
||||
while ($i < 16 * $thickness) {
|
||||
$style[$i++] = $color;
|
||||
}
|
||||
while ($i < 20 * $thickness) {
|
||||
$style[$i++] = IMG_COLOR_TRANSPARENT;
|
||||
}
|
||||
while ($i < 28 * $thickness) {
|
||||
$style[$i++] = $color;
|
||||
}
|
||||
while ($i < 32 * $thickness) {
|
||||
$style[$i++] = IMG_COLOR_TRANSPARENT;
|
||||
}
|
||||
imagesetstyle($im, $style);
|
||||
imagesetthickness($im, $thickness);
|
||||
}
|
||||
|
||||
$im = imagecreate(800, 800);
|
||||
imagecolorallocate($im, 255, 255, 255);
|
||||
$black = imagecolorallocate($im, 0, 0, 0);
|
||||
|
||||
setStyleAndThickness($im, $black, 1);
|
||||
imageline($im, 50, 250, 550, 250, IMG_COLOR_STYLED);
|
||||
imageline($im, 550, 250, 550, 750, IMG_COLOR_STYLED);
|
||||
imageline($im, 550, 750, 50, 250, IMG_COLOR_STYLED);
|
||||
|
||||
setStyleAndThickness($im, $black, 2);
|
||||
imageline($im, 100, 200, 600, 200, IMG_COLOR_STYLED);
|
||||
imageline($im, 600, 200, 600, 700, IMG_COLOR_STYLED);
|
||||
imageline($im, 600, 700, 100, 200, IMG_COLOR_STYLED);
|
||||
|
||||
setStyleAndThickness($im, $black, 4);
|
||||
imageline($im, 150, 150, 650, 150, IMG_COLOR_STYLED);
|
||||
imageline($im, 650, 150, 650, 650, IMG_COLOR_STYLED);
|
||||
imageline($im, 650, 650, 150, 150, IMG_COLOR_STYLED);
|
||||
|
||||
setStyleAndThickness($im, $black, 6);
|
||||
imageline($im, 200, 100, 700, 100, IMG_COLOR_STYLED);
|
||||
imageline($im, 700, 100, 700, 600, IMG_COLOR_STYLED);
|
||||
imageline($im, 700, 600, 200, 100, IMG_COLOR_STYLED);
|
||||
|
||||
$ex = imagecreatefrompng(__DIR__ . '/bug43475.png');
|
||||
var_dump(calc_image_dissimilarity($ex, $im) < 1e-5);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
Bug #43828 (broken transparency of imagearc for truecolor in blendingmode)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip ext/gd not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$im = imagecreatetruecolor(100,100);
|
||||
|
||||
$transparent = imagecolorallocatealpha($im, 255, 255, 255, 80);
|
||||
imagefilledrectangle($im, 0,0, 99,99, $transparent);
|
||||
$color = imagecolorallocatealpha($im, 0, 255, 0, 100);
|
||||
imagefilledarc($im, 49, 49, 99,99, 0 , 360, $color, IMG_ARC_PIE);
|
||||
|
||||
ob_start();
|
||||
imagepng($im);
|
||||
echo md5(ob_get_clean());
|
||||
imagedestroy($im);
|
||||
?>
|
||||
--EXPECT--
|
||||
3d82e4525f19790ae1055366e2a36917
|
||||
@@ -12,8 +12,6 @@ $white = imagecolorallocate($im, 255, 255, 255);
|
||||
imagefilledrectangle($im, 2, 2, 6, 6, $white);
|
||||
imagexbm($im, NULL);
|
||||
?>
|
||||
--XFAIL--
|
||||
Padding is not implemented yet
|
||||
--EXPECT--
|
||||
#define image_width 9
|
||||
#define image_height 9
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
--TEST--
|
||||
Bug #64641 (imagefilledpolygon doesn't draw horizontal line)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . '/similarity.inc';
|
||||
|
||||
$im = imagecreatetruecolor(640, 480);
|
||||
|
||||
$points = array(
|
||||
100, 100,
|
||||
100, 200,
|
||||
100, 300
|
||||
);
|
||||
imagefilledpolygon($im, $points, 3, 0xFFFF00);
|
||||
|
||||
$points = array(
|
||||
300, 200,
|
||||
400, 200,
|
||||
500, 200
|
||||
);
|
||||
imagefilledpolygon($im, $points, 3, 0xFFFF00);
|
||||
|
||||
$ex = imagecreatefrompng(__DIR__ . '/bug64641.png');
|
||||
if (($diss = calc_image_dissimilarity($ex, $im)) < 1e-5) {
|
||||
echo "IDENTICAL";
|
||||
} else {
|
||||
echo "DISSIMILARITY: $diss";
|
||||
}
|
||||
imagedestroy($ex);
|
||||
|
||||
imagedestroy($im);
|
||||
?>
|
||||
--EXPECT--
|
||||
IDENTICAL
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #71912 (libgd: signedness vulnerability)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
if(!function_exists('imagecreatefromgd2')) die('skip imagecreatefromgd2() not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . "invalid_neg_size.gd2");
|
||||
?>
|
||||
OK
|
||||
--EXPECTF--
|
||||
|
||||
Warning: imagecreatefromgd2(): '%s%einvalid_neg_size.gd2' is not a valid GD2 file in %s%ebug71912.php on line %d
|
||||
OK
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #71952 (Corruption inside imageaffinematrixget)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$vals=[str_repeat("A","200"),0,1,2,3,4,5,6,7,8,9];
|
||||
imageaffinematrixget(4,$vals[0]);
|
||||
var_dump($vals[0]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(200) "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72227: imagescale out-of-bounds read
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$img = imagecreatetruecolor ( 100, 100);
|
||||
imagescale($img, 13, 1, IMG_BICUBIC);
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72298: pass2_no_dither out-of-bounds access
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img = imagecreatetruecolor (1 , 1);
|
||||
imagecolortransparent($img, 0);
|
||||
imagetruecolortopalette($img, false, 4);
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
#72337 segfault in imagescale with new dimensions being <=0)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!function_exists('imagescale')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(1, 1);
|
||||
imagescale($im, 0, 0, IMG_BICUBIC_FIXED);
|
||||
echo "OK";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Bug #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow
|
||||
--SKIPIF--
|
||||
<?php if (!function_exists("imagecreatefromgd2")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$fname = dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug72339.gd";
|
||||
|
||||
$fh = fopen($fname, "w");
|
||||
fwrite($fh, "gd2\x00");
|
||||
fwrite($fh, pack("n", 2));
|
||||
fwrite($fh, pack("n", 1));
|
||||
fwrite($fh, pack("n", 1));
|
||||
fwrite($fh, pack("n", 0x40));
|
||||
fwrite($fh, pack("n", 2));
|
||||
fwrite($fh, pack("n", 0x5AA0)); // Chunks Wide
|
||||
fwrite($fh, pack("n", 0x5B00)); // Chunks Vertically
|
||||
fwrite($fh, str_repeat("\x41\x41\x41\x41", 0x1000000)); // overflow data
|
||||
fclose($fh);
|
||||
|
||||
$im = imagecreatefromgd2($fname);
|
||||
|
||||
if ($im) {
|
||||
imagedestroy($im);
|
||||
}
|
||||
unlink($fname);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagecreatefromgd2(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
|
||||
in %sbug72339.php on line %d
|
||||
|
||||
Warning: imagecreatefromgd2(): '%sbug72339.gd' is not a valid GD2 file in %sbug72339.php on line %d
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #19366 (gdimagefill() function crashes (fixed in bundled libgd))
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img = imagecreatetruecolor(100, 100);
|
||||
imagecolortransparent($img, -1000000);
|
||||
imagetruecolortopalette($img, TRUE, 3);
|
||||
imagecolortransparent($img, 9);
|
||||
echo "OK";
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access, var 0
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$img = imagecreatetruecolor(13, 1007);
|
||||
|
||||
imagecolortransparent($img, -10066304);
|
||||
imagetruecolortopalette($img, TRUE, 3);
|
||||
imagescale($img, 1, 65535);
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
==DONE==
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access, var 1
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die("skip gd extension not available\n");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$img = imagecreatetruecolor(100, 100);
|
||||
imagecolortransparent($img, -1000000);
|
||||
imagetruecolortopalette($img, TRUE, 3);
|
||||
imagecolortransparent($img, 9);
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
==DONE==
|
||||
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Bug #72596 (imagetypes function won't advertise WEBP support)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(function_exists('imagewebp') === (bool) (imagetypes() & IMG_WEBP));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #72604 (imagearc() ignores thickness for full arcs)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip requires ext/gd');
|
||||
if (!(imagetypes() & IMG_PNG)) die('skip requires PNG support');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(100, 100);
|
||||
imagesetthickness($im, 5);
|
||||
imagearc($im, 50, 50, 90, 90, 0, 360, 0xffffff);
|
||||
ob_start();
|
||||
imagepng($im);
|
||||
$imagestring = ob_get_clean();
|
||||
echo md5($imagestring);
|
||||
?>
|
||||
--EXPECT--
|
||||
2ffa6afb915afbdf870cf6459477bc8a
|
||||
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #72697: select_colors write out-of-bounds
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!function_exists("imagecreatetruecolor")) die("skip");
|
||||
if (PHP_INT_MAX !== 9223372036854775807) die("skip for 64-bit long systems only");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$img=imagecreatetruecolor(10, 10);
|
||||
imagetruecolortopalette($img, false, PHP_INT_MAX / 8);
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than 2147483647 in %sbug72697.php on line %d
|
||||
DONE
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
Bug #72709 (imagesetstyle() causes OOB read for empty $styles)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip ext/gd not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagecreatetruecolor(1, 1);
|
||||
var_dump(imagesetstyle($im, array()));
|
||||
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
|
||||
imagedestroy($im);
|
||||
?>
|
||||
====DONE====
|
||||
--EXPECTF--
|
||||
Warning: imagesetstyle(): styles array must not be empty in %s%ebug72709.php on line %d
|
||||
bool(false)
|
||||
====DONE====
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #72730: imagegammacorrect allows arbitrary write access
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!function_exists("imagecreatetruecolor")) die("skip");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$img = imagecreatetruecolor(1, 1);
|
||||
imagegammacorrect($img, -1, 1337);
|
||||
?>
|
||||
DONE
|
||||
--EXPECTF--
|
||||
Warning: imagegammacorrect(): Gamma values should be positive in %sbug72730.php on line %d
|
||||
DONE
|
||||
@@ -25,26 +25,28 @@ var_dump(gd_info());
|
||||
*** Testing gd_info() : variation ***
|
||||
array(%d) {
|
||||
["GD Version"]=>
|
||||
string(%d) %a
|
||||
string(%d) %s
|
||||
["FreeType Support"]=>
|
||||
bool%a
|
||||
bool(%a
|
||||
["T1Lib Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["GIF Read Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["GIF Create Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["JPEG Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["PNG Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["WBMP Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["XPM Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["XBM Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
["WebP Support"]=>
|
||||
bool(%s)
|
||||
["JIS-mapped Japanese Font Support"]=>
|
||||
bool%a
|
||||
bool(%s)
|
||||
}
|
||||
===DONE===
|
||||
@@ -0,0 +1,43 @@
|
||||
--TEST--
|
||||
Github #215 (imagefilltoborder stack overflow when invalid pallete index used)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("gd")) die("skip GD not present");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$image = imagecreate( 10, 10 );
|
||||
$bgd = imagecolorallocate( $image, 0, 0, 0 );
|
||||
$border = imagecolorallocate( $image, 255, 0, 0 );
|
||||
$fillcolor = imagecolorallocate( $image, 255, 0, 0 );
|
||||
|
||||
/* Use unallocated color index */
|
||||
imagefilltoborder( $image, 0,0, $border+10, $fillcolor);
|
||||
echo "#1 passes\n";
|
||||
|
||||
/* Use negative color index */
|
||||
imagefilltoborder( $image, 0,0, -$border, $fillcolor);
|
||||
echo "#2 passes\n";
|
||||
|
||||
|
||||
/* Use unallocated color index */
|
||||
imagefilltoborder( $image, 0,0, $border, $fillcolor+10);
|
||||
echo "#3 passes\n";
|
||||
|
||||
/* Use negative color index */
|
||||
imagefilltoborder( $image, 0,0, $border, -$fillcolor);
|
||||
echo "#4 passes\n";
|
||||
|
||||
|
||||
/* Use negative color index */
|
||||
imagefilltoborder( $image, 0,0, $border+10, $fillcolor+10);
|
||||
echo "#5 passes";
|
||||
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
#1 passes
|
||||
#2 passes
|
||||
#3 passes
|
||||
#4 passes
|
||||
#5 passes
|
||||
@@ -26,5 +26,5 @@ var_dump(md5(base64_encode($imgsrc)));
|
||||
var_dump($corA);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(32) "b856a0b1a15efe0f79551ebbb5651fe8"
|
||||
string(32) "f95489d97f4f1a5c4dc265388922d1ec"
|
||||
int(842163455)
|
||||
@@ -25,4 +25,4 @@ ob_end_clean();
|
||||
echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
894f394c7f2e2364642ef27fea6bfc33
|
||||
beffeaf5231adaaff1f21a2108fb6f7e
|
||||
@@ -25,4 +25,4 @@ ob_end_clean();
|
||||
echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
b77bbb8207e5adbebfcc8bd1c4074305
|
||||
b467492b806001c3720b3f18cfbde5b0
|
||||
@@ -25,4 +25,4 @@ ob_end_clean();
|
||||
echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
b8b572812b3c85678f6c38c4ecca7619
|
||||
cfad369fc6d863785d3c95b4b4788225
|
||||
@@ -29,4 +29,4 @@ if ($gamma){
|
||||
echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
30639772903913594bc665743e1b9ab8
|
||||
e79553115df689ea5df18a4636380569
|
||||
@@ -29,4 +29,4 @@ if ($gamma){
|
||||
echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
7716c0905ae08bd84b4d6cba8969a42e
|
||||
b017b1ddc8bda00e82aa8cbfb54c35d4
|
||||
@@ -28,4 +28,4 @@ echo md5(base64_encode($img));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
0843f63ab2f9fddedd69b0b421686bc5
|
||||
1d41787ff70aa0c7eea5ee9304afa36b
|
||||
@@ -25,4 +25,4 @@ Warning: imagetruecolortopalette() expects parameter 3 to be long, resource give
|
||||
|
||||
Warning: imagetruecolortopalette() expects parameter 3 to be long, array given in %s on line %d
|
||||
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d
|
||||
@@ -16,6 +16,6 @@ imagetruecolortopalette($image, true, -1);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d
|
||||
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero in %s on line %d
|
||||
Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d
|
||||
Binary file not shown.
@@ -112,7 +112,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
int haystack_len, needle_len;
|
||||
unsigned char *found;
|
||||
long loffset = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t offset = 0, noffset = 0;
|
||||
int ret_pos;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", (char **)&haystack, &haystack_len, (char **)&needle, &needle_len, &loffset) == FAILURE) {
|
||||
@@ -132,6 +132,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
|
||||
/* we checked that it will fit: */
|
||||
offset = (int32_t) loffset;
|
||||
noffset = offset >= 0 ? offset : haystack_len + offset;
|
||||
|
||||
/* the offset is 'grapheme count offset' so it still might be invalid - we'll check it later */
|
||||
|
||||
@@ -146,7 +147,7 @@ PHP_FUNCTION(grapheme_strpos)
|
||||
/* quick check to see if the string might be there
|
||||
* I realize that 'offset' is 'grapheme count offset' but will work in spite of that
|
||||
*/
|
||||
found = (unsigned char *)php_memnstr((char *)haystack + offset, (char *)needle, needle_len, (char *)haystack + haystack_len);
|
||||
found = (unsigned char *)php_memnstr((char *)haystack + noffset, (char *)needle, needle_len, (char *)haystack + haystack_len);
|
||||
|
||||
/* if it isn't there the we are done */
|
||||
if (!found) {
|
||||
@@ -214,12 +215,13 @@ PHP_FUNCTION(grapheme_stripos)
|
||||
is_ascii = ( grapheme_ascii_check(haystack, haystack_len) >= 0 );
|
||||
|
||||
if ( is_ascii ) {
|
||||
int32_t noffset = offset >= 0 ? offset : haystack_len + offset;
|
||||
needle_dup = (unsigned char *)estrndup((char *)needle, needle_len);
|
||||
php_strtolower((char *)needle_dup, needle_len);
|
||||
haystack_dup = (unsigned char *)estrndup((char *)haystack, haystack_len);
|
||||
php_strtolower((char *)haystack_dup, haystack_len);
|
||||
|
||||
found = (unsigned char*) php_memnstr((char *)haystack_dup + offset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len);
|
||||
found = (unsigned char*) php_memnstr((char *)haystack_dup + noffset, (char *)needle_dup, needle_len, (char *)haystack_dup + haystack_len);
|
||||
|
||||
efree(haystack_dup);
|
||||
efree(needle_dup);
|
||||
@@ -537,7 +539,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
efree(ustr);
|
||||
}
|
||||
ubrk_close(bi);
|
||||
RETURN_EMPTY_STRING();
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
/* find the end point of the string to return */
|
||||
@@ -576,7 +578,7 @@ PHP_FUNCTION(grapheme_substr)
|
||||
sub_str_end_pos = ustr_len;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(sub_str_start_pos > sub_str_end_pos) {
|
||||
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_substr: length is beyond start", 1 TSRMLS_CC );
|
||||
|
||||
|
||||
+1
-4
@@ -158,15 +158,12 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
|
||||
len = uidna_nameToUnicodeUTF8(uts46, domain, (int32_t)domain_len,
|
||||
buffer, buffer_capac, &info, &status);
|
||||
}
|
||||
if (php_intl_idn_check_status(status, "failed to convert name",
|
||||
if (len >= 255 || php_intl_idn_check_status(status, "failed to convert name",
|
||||
mode TSRMLS_CC) == FAILURE) {
|
||||
uidna_close(uts46);
|
||||
efree(buffer);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if (len >= 255) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "ICU returned an unexpected length");
|
||||
}
|
||||
|
||||
buffer[len] = '\0';
|
||||
|
||||
|
||||
Loaded 100 of 240 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user