gfx/ots/ots-fix-sparc64.patch
author Justin Lebar <justin.lebar@gmail.com>
Mon, 23 Apr 2012 00:42:13 -0400
changeset 95431 ee415e3f509d36f663a2abdbe99dfb7d94f63d31
parent 68767 32f760d04b38a52dfae7c6a9bc5d22430baf4d79
child 98773 7ffffcb45b9402c0b2cb12e8fdd0d8293a7e48fb
permissions -rw-r--r--
Bug 746055 - On desktop, increase image.mem.max_decoded_image_kb to 250mb, effectively backing out bug 732820. r=joe, a=desktop-only

diff --git a/gfx/ots/include/opentype-sanitiser.h b/gfx/ots/include/opentype-sanitiser.h
--- a/gfx/ots/include/opentype-sanitiser.h
+++ b/gfx/ots/include/opentype-sanitiser.h
@@ -57,18 +57,20 @@ class OTSStream {
 
     if (chksum_buffer_offset_ == 4) {
       // TODO(yusukes): This cast breaks the strict-aliasing rule.
       chksum_ += ntohl(*reinterpret_cast<const uint32_t*>(chksum_buffer_));
       chksum_buffer_offset_ = 0;
     }
 
     while (length >= 4) {
-      chksum_ += ntohl(*reinterpret_cast<const uint32_t*>(
-          reinterpret_cast<const uint8_t*>(data) + offset));
+      uint32_t tmp;
+      std::memcpy(&tmp, reinterpret_cast<const uint8_t *>(data) + offset,
+        sizeof(uint32_t));
+      chksum_ += ntohl(tmp);
       length -= 4;
       offset += 4;
     }
 
     if (length) {
       if (chksum_buffer_offset_ != 0) return false;  // not reached
       if (length > 4) return false;  // not reached
       std::memcpy(chksum_buffer_,