Fixed Redhat bug #1362571 (PHP not returning full results for exif_read_data function)
There are two factors for this bug fix:
- First of all, the maximum nesting level has been increased to 150 (previously 100), I'm not sure how much an impact this will have, but increasing this value also seems to resolve PHP bug #66443 (Corrupt EXIF header: maximum directory nesting level reached for some cameras.)
- Second, this adds support for most common Panasonic EXIF tags, again this list is based off the Exiv2 website
Note about Panasonic's format:
From what I could find, then the offset was always 12 bytes for such, the signature always had the 'P' capitalized, and the rest lower cased, followed by 3 NULL bytes
@Remi, can you review this? I'm gonna look into Sony (which is huge btw!) and your patch next
Fixed bug #72735 (Samsung picture thumb not read (zero size))
It seems like there is no maker data for "Samsung", this causes the IDF tag parsing to fail, and it bails early on, despite there still is valid remaining data in image, such as the thumbnail data as reported in the bug.
I used the Exiv2 website as a reference guide for tags that's specific to Samsung's EXIF data, which should also mean that we will be able to name some of those tags more specifically now.
I have chosen again not to commit this to other branches, simply because I'm not 100% sure on the byte order and offsets for Samsung, I did some research and it seems like there are many variants, but this (very copy/pasted), entry works for this particular image and does not break any other tests. This does add a new feature I suppose, while also fixing a bug, but I will leave it to the other branch RMs to decide on how far down they will want to merge this.
Xinchen Hui [Wed, 3 Aug 2016 04:17:35 +0000 (12:17 +0800)]
Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src:
Fixed compiler warning (Sorry Anatol, but this one was killing me)
Revert "Fixed bug #72735 (Samsung picture thumb not read (zero size))"
Fixed bug #72735 (Samsung picture thumb not read (zero size))
Minor touches to the exif build script on Windows; ADD_EXTENSION_DEP() will already ERROR() out, so the WARNING() statement would never be returned anyway.
Fixed bug #72735 (Samsung picture thumb not read (zero size))
This fix is only committed to master for now. I'm no exif expert on this matter, so someone else might want to take a look over this and merge as wanted in case this will break something.
In exif_process_IFD_in_JPEG() we loop over the tag entries and try to process the IFD tag, this is fine and all, however in case one fail to process correctly, the entire routine is aborted, which means that other possible data, such as the thumbnail data as reported in #72735 may not be read, despite it is there, perfectly valid.
Also, big props to whoever added EXIF_DEBUG, this rocks!
Minor touches to the exif build script on Windows; ADD_EXTENSION_DEP() will already ERROR() out, so the WARNING() statement would never be returned anyway.
There are probably other similar cases around ext/, however the main reason for fixing this was for the typo (libxml > mbstring).
Fix #72709: imagesetstyle() causes OOB read for empty $styles
Calling imagesetstyle() with an empty $styles array caused gdImageSetStyle()
to be called with `noOfPixels==0`, what could have lead to OOB reads.
Actually, this issue will be fixed in libgd, but to avoid issues when older
libgd is in use, we simply disallow passing an empty $styles array to
imagesetstyle(), what wouldn't serve a useful purpose anyway.
PCRE-8.39 throws weird valgrind backtraces on some systems, see
http://news.php.net/php.cvs/93494 . Those could be false positives
due to some changes in JIT, still i couldn't 100% ensure this.
Thus, better we continue to ship 8.38 bundled for now, and apply
patches, if needed.
Fix ext/standard build with the recent fixes to array.c
This solution might not be canon, but it works by re-using _php_math_round() from math.c, since round() is not available
in the C++98 Standard Library on Windows at least. At the same
time it seems like the symbol export for it was missing from
php_math.h.
The primary changes are:
a) Use the ht_iterator mechanism to ensure safety not only if the
iterated array itself changes, but also if it is replaced (and
potentially destroyed) entirely. We use the same semantics for
behavior under modification as foreach-by-reference. In
particular, we advance to the next element before processing it.
If the iterated entity is exchanged we iterate the new one from
the start. If it is not an array/object we warn and abort.
b) Always create a reference to the current value. Previously the
code kept the value as a non-reference and updated it to the
reference value produced by the user callback. However this is
unsafe, as the array may have been reallocated in the meantime,
so the previous value pointer is no longer value.
c) Around a recursive walk, incref the reference containing the
array. This ensures that the location where the currently
iterated value is stored cannot be freed.
One problem I was not able to solve is that we cannot decrement
the apply count if the array is exchanged during a recursive walk.