Index: trunk/phase3/includes/media/JpegMetadataExtractor.php |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | throw new MWException( 'Too many jpeg segments. Aborting' ); |
60 | 60 | } |
61 | 61 | if ( $buffer !== "\xFF" ) { |
62 | | - throw new MWException( "Error reading jpeg file marker" ); |
| 62 | + throw new MWException( "Error reading jpeg file marker. Expected 0xFF but got " . bin2hex( $buffer ) ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | $buffer = fread( $fh, 1 ); |
— | — | @@ -123,6 +123,9 @@ |
124 | 124 | } elseif ( $buffer === "\xD9" || $buffer === "\xDA" ) { |
125 | 125 | // EOI - end of image or SOS - start of scan. either way we're past any interesting segments |
126 | 126 | return $segments; |
| 127 | + } elseif ( $buffer === "\xFF" ) { |
| 128 | + // Padding byte. Skip. |
| 129 | + continue; |
127 | 130 | } else { |
128 | 131 | // segment we don't care about, so skip |
129 | 132 | $size = unpack( "nint", fread( $fh, 2 ) ); |