shithub: jbig2

Download patch

ref: 2c008750ba1c7f884304333c38903592cfd90ea8
parent: f1df2a053c81e3f57280a59f917c62edc90b639b
author: Alex Cherepanov <alex.cherepanov@artifex.com>
date: Mon Jan 28 06:09:04 EST 2013

Bug 693284: Don't shift 32-bit value by 32.


--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -255,7 +255,8 @@
       int log_table_size = table->log_table_size;
       int PREFLEN;
 
-      entry = &table->entries[this_word >> (32 - log_table_size)];
+      /* SumatraPDF: shifting by the size of the operand is undefined */
+      entry = &table->entries[log_table_size > 0 ? this_word >> (32 - log_table_size) : 0];
       flags = entry->flags;
       PREFLEN = entry->PREFLEN;
       if ((flags == (byte)-1) && (PREFLEN == (byte)-1) && (entry->u.RANGELOW == -1))