]> granicus.if.org Git - libvpx/commitdiff
Fix a signed shift overflow in vpx_rb_read_inv_signed_literal.
authorAlex Converse <aconverse@google.com>
Thu, 19 Nov 2015 23:04:20 +0000 (15:04 -0800)
committerAlex Converse <aconverse@google.com>
Thu, 19 Nov 2015 23:04:20 +0000 (15:04 -0800)
Found with clang -fsanitize=integer

Change-Id: I17cb2166c06ff463abfaf9b0e6bc749d0d6fdf94

vpx_dsp/bitreader_buffer.c

index bb917263ebb0400f97d97aa10f58e8176cf914fb..d7b55cf9f410ed962dd71a427c9c2e8e02dbb0f5 100644 (file)
@@ -45,7 +45,7 @@ int vpx_rb_read_inv_signed_literal(struct vpx_read_bit_buffer *rb,
                                    int bits) {
 #if CONFIG_MISC_FIXES
   const int nbits = sizeof(unsigned) * 8 - bits - 1;
-  const unsigned value = vpx_rb_read_literal(rb, bits + 1) << nbits;
+  const unsigned value = (unsigned)vpx_rb_read_literal(rb, bits + 1) << nbits;
   return ((int) value) >> nbits;
 #else
   return vpx_rb_read_signed_literal(rb, bits);