vp8/encoder/boolhuff: fix integer sanitizer warnings
authorHien Ho <hienho@google.com>
Wed, 19 Jun 2019 23:41:22 +0000 (16:41 -0700)
committerHien Ho <hienho@google.com>
Fri, 28 Jun 2019 20:27:38 +0000 (20:27 +0000)
from sanitizer run:
runtime error: implicit conversion from type 'unsigned int' of value 256
(32-bit, unsigned) to type 'unsigned char' changed the value to
 0 (8-bit, unsigned)

BUG=webm:1615

Change-Id: I9321bbd58a305419bc8669ecd7594adc47e8b116

vp8/encoder/boolhuff.h

index 8ac0a2c..8cc61bd 100644 (file)
@@ -92,7 +92,7 @@ static void vp8_encode_bool(BOOL_CODER *bc, int bit, int probability) {
     }
 
     validate_buffer(bc->buffer + bc->pos, 1, bc->buffer_end, bc->error);
-    bc->buffer[bc->pos++] = (lowvalue >> (24 - offset));
+    bc->buffer[bc->pos++] = (lowvalue >> (24 - offset) & 0xff);
 
     lowvalue <<= offset;
     shift = count;