bitwriter: Add overflow check
authorErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 8 Jan 2016 23:59:41 +0000 (10:59 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 8 Jan 2016 23:59:46 +0000 (10:59 +1100)
commit28817ba52fdd92b0a49f84b2e8848199efc00242
treef0a5840b24894582b3438cea93d7fb54d6ab3323
parent262505bd90a528c7add0bdade9afba132be8b1fc
bitwriter: Add overflow check

The old version of `FLAC__bitwriter_write_raw_uint32()` assumes that the
unused bits of the `val` argument are equal to zero, but don't check it.

This patch adds a new version of that function which does have the check
and then calls a new function `FLAC__bitwriter_write_raw_uint32_nocheck()`
which behaves like the old one.

Code updated to use these two functions as needed.

Patch-from: lvqcl <lvqcl.mail@gmail.com>
src/libFLAC/bitwriter.c