shithub: libvpx

Download patch

ref: c003b97d11e714b5fdca6657e7f57413a9514007
parent: b4c4f6486244cc5e6817b37ef4a2e6983d0301c5
author: Jim Bankoski <[email protected]>
date: Thu Jun 6 12:48:34 EDT 2013

fix vp9_wb_write_bit uninitialized variable

This fixes a valgrind error.

Change-Id: I0e1ef212ba09d65e3d71dd209f0786ae6530d2c8

--- a/vp9/encoder/vp9_write_bit_buffer.h
+++ b/vp9/encoder/vp9_write_bit_buffer.h
@@ -26,8 +26,12 @@
   const int off = wb->bit_offset;
   const int p = off / CHAR_BIT;
   const int q = CHAR_BIT - 1 - off % CHAR_BIT;
-  wb->bit_buffer[p] &= ~(1 << q);
-  wb->bit_buffer[p] |= bit << q;
+  if (q == CHAR_BIT -1) {
+    wb->bit_buffer[p] = bit << q;
+  } else {
+    wb->bit_buffer[p] &= ~(1 << q);
+    wb->bit_buffer[p] |= bit << q;
+  }
   wb->bit_offset = off + 1;
 }