Bug 775794. r=jgilbert. a=akeybl
authorBrian R. Bondy <netzen@gmail.com>
Sat, 21 Jul 2012 13:57:35 -0400
changeset 100799 94b439f3d2d009163285de3627063313f02a4255
parent 100798 fe218b1f8f241098fc3cde86730a39a97e712c64
child 100804 afbe9366cccc7b9d94a224d9b108bbaaf7ca8530
push id173
push userlsblakk@mozilla.com
push dateFri, 24 Aug 2012 15:39:16 +0000
treeherdermozilla-release@bcc45eb1fb41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, akeybl
bugs775794
milestone15.0
Bug 775794. r=jgilbert. a=akeybl
image/decoders/nsICODecoder.cpp
--- a/image/decoders/nsICODecoder.cpp
+++ b/image/decoders/nsICODecoder.cpp
@@ -132,16 +132,18 @@ bool nsICODecoder::FillBitmapFileHeaderB
 // this difference though.
 bool
 nsICODecoder::FixBitmapHeight(PRInt8 *bih) 
 {
   // Get the height from the BMP file information header
   PRInt32 height;
   memcpy(&height, bih + 8, sizeof(height));
   height = LITTLE_TO_NATIVE32(height);
+  // BMPs can be stored inverted by having a negative height
+  height = abs(height);
 
   // The bitmap height is by definition * 2 what it should be to account for
   // the 'AND mask'. It is * 2 even if the `AND mask` is not present.
   height /= 2;
 
   if (height > 256) {
     return false;
   }