X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=blobdiff_plain;f=includes%2Fmedia%2FGIFMetadataExtractor.php;h=a26539a87a4e033a4661612e178ebe67e44262f8;hb=225dae4ab511f6142fafb7a801fdb8ae14aa603f;hp=de409e78e78be9f5b7425e0037dfd4c57d09f4db;hpb=adae996840b9e782f6e14b21c433a83e37c3a74e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/GIFMetadataExtractor.php b/includes/media/GIFMetadataExtractor.php index de409e78e7..a26539a87a 100644 --- a/includes/media/GIFMetadataExtractor.php +++ b/includes/media/GIFMetadataExtractor.php @@ -54,9 +54,9 @@ class GIFMetadataExtractor { * @return array */ static function getMetadata( $filename ) { - self::$gifFrameSep = pack( "C", ord( "," ) ); - self::$gifExtensionSep = pack( "C", ord( "!" ) ); - self::$gifTerm = pack( "C", ord( ";" ) ); + self::$gifFrameSep = pack( "C", ord( "," ) ); // 2C + self::$gifExtensionSep = pack( "C", ord( "!" ) ); // 21 + self::$gifTerm = pack( "C", ord( ";" ) ); // 3B $frameCount = 0; $duration = 0.0; @@ -82,8 +82,11 @@ class GIFMetadataExtractor { throw new Exception( "Not a valid GIF file; header: $buf" ); } - // Skip over width and height. - fread( $fh, 4 ); + // Read width and height. + $buf = fread( $fh, 2 ); + $width = unpack( 'v', $buf )[1]; + $buf = fread( $fh, 2 ); + $height = unpack( 'v', $buf )[1]; // Read BPP $buf = fread( $fh, 1 ); @@ -158,9 +161,9 @@ class GIFMetadataExtractor { UtfNormal\Validator::quickIsNFCVerify( $dataCopy ); if ( $dataCopy !== $data ) { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $data = iconv( 'windows-1252', 'UTF-8', $data ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); } $commentCount = count( $comment );