MediaWiki r55541 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r55540‎ | r55541 (on ViewVC)‎ | r55542 >
Date:23:27, 23 August 2009
Author:brion
Status:ok
Tags:
Comment:
* (bug 20364) Fixed regression in GIF metadata loading

There was a missing parameter in GIFMetadataExtractor's skipBlock() call for 'netscape 2.0' data blocks, which threw a monkey in the works.
Now also checking for exceptions thrown by the metadata load and stubbing out null metadata for files which can't be read, rather than letting the exception bubble up and kill MediaWiki. :)
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/media/GIFMetadataExtractor.php
@@ -101,7 +101,7 @@
102102 // NETSCAPE2.0 (application name)
103103 if ($blockLength != 11 || $data != 'NETSCAPE2.0') {
104104 fseek( $fh, -($blockLength + 1), SEEK_CUR );
105 - self::skipBlock();
 105+ self::skipBlock( $fh );
106106 continue;
107107 }
108108
Index: trunk/phase3/includes/media/GIF.php
@@ -12,8 +12,15 @@
1313 class GIFHandler extends BitmapHandler {
1414
1515 function getMetadata( $image, $filename ) {
16 - if ( !isset($image->parsedGIFMetadata) )
17 - $image->parsedGIFMetadata = GIFMetadataExtractor::getMetadata( $filename );
 16+ if ( !isset($image->parsedGIFMetadata) ) {
 17+ try {
 18+ $image->parsedGIFMetadata = GIFMetadataExtractor::getMetadata( $filename );
 19+ } catch( Exception $e ) {
 20+ // Broken file?
 21+ wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
 22+ return '0';
 23+ }
 24+ }
1825
1926 return serialize($image->parsedGIFMetadata);
2027
Index: trunk/phase3/RELEASE-NOTES
@@ -427,6 +427,7 @@
428428 target page
429429 * (bug 20365) Page name with with c/g/h/j/s/u + x are now correctly handled in
430430 Special:MovePage with Esperanto as content language
 431+* (bug 20364) Fixed regression in GIF metadata loading
431432
432433 == API changes in 1.16 ==
433434

Status & tagging log

Personal tools
Namespaces

Variants
Views
Actions
Navigation
Support
Download
Development
Communication
Toolbox