From c124fa566cee937a3bf21735f47209217503106b Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 9 Oct 2005 14:11:44 +0000 Subject: [PATCH] Bugfix #34704 (Infinite recursion due to corrupt JPEG) (Tim Starling) --- ext/exif/exif.c | 6 +++++ ext/exif/tests/bug34704.jpg | Bin 0 -> 9976 bytes ext/exif/tests/bug34704.phpt | 44 +++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100755 ext/exif/tests/bug34704.jpg create mode 100755 ext/exif/tests/bug34704.phpt diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 0523a5c3f0..5ec0542073 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3031,6 +3031,12 @@ static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, return FALSE; } } + /* + * Ignore IFD2 if it purportedly exists + */ + if (section_index == SECTION_THUMBNAIL) { + return FALSE; + } /* * Hack to make it process IDF1 I hope * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail diff --git a/ext/exif/tests/bug34704.jpg b/ext/exif/tests/bug34704.jpg new file mode 100755 index 0000000000000000000000000000000000000000..42b14c1908fc30fa8b7f45827487a760826c8416 GIT binary patch literal 9976 zcmeHtWl$VlyX~L@1b4T=U4sOeK!VHQE(sFcGQdEv00DwC5FijN0W#P?2=0*J8r*g8 z0Kr`j?|a_w-0#n=y665oRcCc|_w($vd)KpeSM{#yz3!*)mjT3TN~%f#G&D58i-!Yn zzrxz3=+qmyQ`|?l}*25(IHBbKl4ISg5I3Nx#-XmfFIvNHBIwl4d7AEFH z&%g%`fJuTy$|5X}O{Vh_$m&Th5(58>15&7Hr_dcaU=y`|9g2%bNkvUV%g({c#myro z{#Zg%O8VJzMI~hwRW&_*14AQY6H^;oyI1xOj!sZ7Zy%Vi-9!Ng(_#wL~50lxGkV-*R( zAy zth}@Pz=1kC>5(zADR=BI-Zt{#=MJ~mY&=ZLW8MUATbdO5mj5`L5}liKs*N}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L zQRo*BXKU0nf*8%!N@x#?^8iEz;=?baU#UovPf4Afmb#d|*o$wvO;rfS3r}Eh zGNl-d^Xr)`Z|lC=U_#nv$@Qt?C(VJLP+E5!C%x7RM!UpoUghAlXuSuNA)|j>i^X{z zdFc5(s|f+Y1a>5`-t$1F@Rd<&%oTXwE{TiN zdNl3<#MIl_b)|57fzg7AC~cv^c9y5Zr#C!aRmlSirlJ*<$(gN#jX7h76s?t!$28F4 zO9B>m1Q(Wd2$;_XadON38#|lDeZlnoul0zL@Sg4?@sADAk{_nVLxar~iPROSoi1c` zrHqk7X>=uVA5~oIW7T_r?2-SteAGa~+D_$lu8Eg+=@6^0e483a#}ly;otyW9i3Cj8!d7&I`M z8}g_iD52k-ucDIoSQo*&E4ZH?_79)Dv8P8J40>^k^c17=UcBYacE#wosthbpH{hd;gPn_uJJjo?tA`vOvy8o?t(?$?DfH+*03sQWzl;65Izc(SfAj79yITee1M|VP@!;9O#KL;8rr_f|IA4H7 zj~?OTlMs=Tk`R%QkWtc8k&)91JyHO4&JJj%_fdiK1LA`NJFvwdR7?$SrIygkZh+?jhb3DX_Kee zEbxWlFPf@6MSb(sHNHqzY))Yb^<9{w)`*)wq23P+5nslrSRXcM7ki^biQFfw +--INI-- +magic_quotes_runtime=0 +output_handler= +zlib.output_compression=0 +--FILE-- + +===DONE=== +--EXPECT-- +array(7) { + ["FileName"]=> + string(12) "bug34704.jpg" + ["FileDateTime"]=> + int(1128866682) + ["FileSize"]=> + int(9976) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(4) "IFD0" + ["COMPUTED"]=> + array(5) { + ["html"]=> + string(24) "width="386" height="488"" + ["Height"]=> + int(488) + ["Width"]=> + int(386) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + } +} +===DONE=== \ No newline at end of file -- 2.40.0