Index: trunk/phase3/includes/media/PNGMetadataExtractor.php |
— | — | @@ -203,6 +203,11 @@ |
204 | 204 | } elseif ( $chunk_type == 'tEXt' ) { |
205 | 205 | $buf = self::read( $fh, $chunk_size ); |
206 | 206 | |
| 207 | + // In case there is no \x00 which will make explode fail. |
| 208 | + if ( strpos( $buf, "\x00" ) === false ) { |
| 209 | + throw new Exception( __METHOD__ . ": Read error on tEXt chunk" ); |
| 210 | + } |
| 211 | + |
207 | 212 | list( $keyword, $content ) = explode( "\x00", $buf, 2 ); |
208 | 213 | if ( $keyword === '' || $content === '' ) { |
209 | 214 | throw new Exception( __METHOD__ . ": Read error on tEXt chunk" ); |
— | — | @@ -231,6 +236,11 @@ |
232 | 237 | if ( function_exists( 'gzuncompress' ) ) { |
233 | 238 | $buf = self::read( $fh, $chunk_size ); |
234 | 239 | |
| 240 | + // In case there is no \x00 which will make explode fail. |
| 241 | + if ( strpos( $buf, "\x00" ) === false ) { |
| 242 | + throw new Exception( __METHOD__ . ": Read error on zTXt chunk" ); |
| 243 | + } |
| 244 | + |
235 | 245 | list( $keyword, $postKeyword ) = explode( "\x00", $buf, 2 ); |
236 | 246 | if ( $keyword === '' || $postKeyword === '' ) { |
237 | 247 | throw new Exception( __METHOD__ . ": Read error on zTXt chunk" ); |