vp8/encoder/bitstream: fix int sanitizer warnings
authorHien Ho <hienho@google.com>
Mon, 12 Aug 2019 22:26:43 +0000 (15:26 -0700)
committerHien Ho <hienho@google.com>
Tue, 13 Aug 2019 23:38:24 +0000 (23:38 +0000)
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: I2b630bf22cad28b5a7a8a37f6938e6ebe12bc64e

vp8/encoder/bitstream.c

index 64bf0a7..3daa4e2 100644 (file)
@@ -171,7 +171,7 @@ void vp8_pack_tokens(vp8_writer *w, const TOKENEXTRA *p, int xcount) {
 
         validate_buffer(w->buffer + w->pos, 1, w->buffer_end, w->error);
 
-        w->buffer[w->pos++] = (lowvalue >> (24 - offset));
+        w->buffer[w->pos++] = (lowvalue >> (24 - offset)) & 0xff;
         lowvalue <<= offset;
         shift = count;
         lowvalue &= 0xffffff;