mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
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
This commit is contained in:
parent
71ad192c1f
commit
fbb1690198
3 changed files with 150 additions and 33 deletions
111
ext/exif/exif.c
111
ext/exif/exif.c
|
@ -89,7 +89,7 @@ typedef unsigned char uchar;
|
|||
|
||||
#define EFREE_IF(ptr) if (ptr) efree(ptr)
|
||||
|
||||
#define MAX_IFD_NESTING_LEVEL 100
|
||||
#define MAX_IFD_NESTING_LEVEL 150
|
||||
|
||||
/* {{{ arginfo */
|
||||
ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
|
||||
|
@ -989,6 +989,112 @@ static tag_info_array tag_table_VND_SAMSUNG = {
|
|||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
static tag_info_array tag_table_VND_PANASONIC = {
|
||||
{ 0x0001, "Quality"},
|
||||
{ 0x0002, "FirmwareVersion"},
|
||||
{ 0x0003, "WhiteBalance"},
|
||||
{ 0x0004, "0x0004"},
|
||||
{ 0x0007, "FocusMode"},
|
||||
{ 0x000f, "AFMode"},
|
||||
{ 0x001a, "ImageStabilization"},
|
||||
{ 0x001c, "Macro"},
|
||||
{ 0x001f, "ShootingMode"},
|
||||
{ 0x0020, "Audio"},
|
||||
{ 0x0021, "DataDump"},
|
||||
{ 0x0022, "0x0022"},
|
||||
{ 0x0023, "WhiteBalanceBias"},
|
||||
{ 0x0024, "FlashBias"},
|
||||
{ 0x0025, "InternalSerialNumber"},
|
||||
{ 0x0026, "ExifVersion"},
|
||||
{ 0x0027, "0x0027"},
|
||||
{ 0x0028, "ColorEffect"},
|
||||
{ 0x0029, "TimeSincePowerOn"},
|
||||
{ 0x002a, "BurstMode"},
|
||||
{ 0x002b, "SequenceNumber"},
|
||||
{ 0x002c, "Contrast"},
|
||||
{ 0x002d, "NoiseReduction"},
|
||||
{ 0x002e, "SelfTimer"},
|
||||
{ 0x002f, "0x002f"},
|
||||
{ 0x0030, "Rotation"},
|
||||
{ 0x0031, "AFAssistLamp"},
|
||||
{ 0x0032, "ColorMode"},
|
||||
{ 0x0033, "BabyAge1"},
|
||||
{ 0x0034, "OpticalZoomMode"},
|
||||
{ 0x0035, "ConversionLens"},
|
||||
{ 0x0036, "TravelDay"},
|
||||
{ 0x0039, "Contrast"},
|
||||
{ 0x003a, "WorldTimeLocation"},
|
||||
{ 0x003b, "TextStamp1"},
|
||||
{ 0x003c, "ProgramISO"},
|
||||
{ 0x003d, "AdvancedSceneType"},
|
||||
{ 0x003e, "TextStamp2"},
|
||||
{ 0x003f, "FacesDetected"},
|
||||
{ 0x0040, "Saturation"},
|
||||
{ 0x0041, "Sharpness"},
|
||||
{ 0x0042, "FilmMode"},
|
||||
{ 0x0044, "ColorTempKelvin"},
|
||||
{ 0x0045, "BracketSettings"},
|
||||
{ 0x0046, "WBAdjustAB"},
|
||||
{ 0x0047, "WBAdjustGM"},
|
||||
{ 0x0048, "FlashCurtain"},
|
||||
{ 0x0049, "LongShutterNoiseReduction"},
|
||||
{ 0x004b, "ImageWidth"},
|
||||
{ 0x004c, "ImageHeight"},
|
||||
{ 0x004d, "AFPointPosition"},
|
||||
{ 0x004e, "FaceDetInfo"},
|
||||
{ 0x0051, "LensType"},
|
||||
{ 0x0052, "LensSerialNumber"},
|
||||
{ 0x0053, "AccessoryType"},
|
||||
{ 0x0054, "AccessorySerialNumber"},
|
||||
{ 0x0059, "Transform1"},
|
||||
{ 0x005d, "IntelligentExposure"},
|
||||
{ 0x0060, "LensFirmwareVersion"},
|
||||
{ 0x0061, "FaceRecInfo"},
|
||||
{ 0x0062, "FlashWarning"},
|
||||
{ 0x0065, "Title"},
|
||||
{ 0x0066, "BabyName"},
|
||||
{ 0x0067, "Location"},
|
||||
{ 0x0069, "Country"},
|
||||
{ 0x006b, "State"},
|
||||
{ 0x006d, "City"},
|
||||
{ 0x006f, "Landmark"},
|
||||
{ 0x0070, "IntelligentResolution"},
|
||||
{ 0x0077, "BurstSheed"},
|
||||
{ 0x0079, "IntelligentDRange"},
|
||||
{ 0x007c, "ClearRetouch"},
|
||||
{ 0x0080, "City2"},
|
||||
{ 0x0086, "ManometerPressure"},
|
||||
{ 0x0089, "PhotoStyle"},
|
||||
{ 0x008a, "ShadingCompensation"},
|
||||
{ 0x008c, "AccelerometerZ"},
|
||||
{ 0x008d, "AccelerometerX"},
|
||||
{ 0x008e, "AccelerometerY"},
|
||||
{ 0x008f, "CameraOrientation"},
|
||||
{ 0x0090, "RollAngle"},
|
||||
{ 0x0091, "PitchAngle"},
|
||||
{ 0x0093, "SweepPanoramaDirection"},
|
||||
{ 0x0094, "PanoramaFieldOfView"},
|
||||
{ 0x0096, "TimerRecording"},
|
||||
{ 0x009d, "InternalNDFilter"},
|
||||
{ 0x009e, "HDR"},
|
||||
{ 0x009f, "ShutterType"},
|
||||
{ 0x00a3, "ClearRetouchValue"},
|
||||
{ 0x00ab, "TouchAE"},
|
||||
{ 0x0e00, "PrintIM"},
|
||||
{ 0x4449, "0x4449"},
|
||||
{ 0x8000, "MakerNoteVersion"},
|
||||
{ 0x8001, "SceneMode"},
|
||||
{ 0x8004, "WBRedLevel"},
|
||||
{ 0x8005, "WBGreenLevel"},
|
||||
{ 0x8006, "WBBlueLevel"},
|
||||
{ 0x8007, "FlashFired"},
|
||||
{ 0x8008, "TextStamp3"},
|
||||
{ 0x8009, "TextStamp4"},
|
||||
{ 0x8010, "BabyAge2"},
|
||||
{ 0x8012, "Transform2"},
|
||||
TAG_TABLE_END
|
||||
};
|
||||
|
||||
typedef enum mn_byte_order_t {
|
||||
MN_ORDER_INTEL = 0,
|
||||
MN_ORDER_MOTOROLA = 1,
|
||||
|
@ -1020,7 +1126,8 @@ static const maker_note_type maker_note_array[] = {
|
|||
{ tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
|
||||
{ tag_table_VND_NIKON_990, "NIKON", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
|
||||
{ tag_table_VND_OLYMPUS, "OLYMPUS OPTICAL CO.,LTD", NULL, "OLYMP\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
|
||||
{ tag_table_VND_SAMSUNG, "SAMSUNG", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}
|
||||
{ tag_table_VND_SAMSUNG, "SAMSUNG", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},
|
||||
{ tag_table_VND_PANASONIC, "Panasonic", NULL, "Panasonic\x00\x00\x00", 12, 12, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
|
|
BIN
ext/exif/tests/redhat-bug1362571.jpg
Normal file
BIN
ext/exif/tests/redhat-bug1362571.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
10
ext/exif/tests/redhat-bug1362571.phpt
Normal file
10
ext/exif/tests/redhat-bug1362571.phpt
Normal file
|
@ -0,0 +1,10 @@
|
|||
--TEST--
|
||||
Redhat bug #1362571 (PHP not returning full results for exif_read_data function)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . 'redhat-bug1362571.jpg')) > 0);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
Loading…
Add table
Add a link
Reference in a new issue