summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2011-04-21 12:59:07 +0300
committerMartin Storsjo <martin@martin.st>2012-01-31 10:35:49 +0200
commitf4e98bac0ff1e43cf2f789f717ea903e9e2a3511 (patch)
tree7a6d1b69ce8965cdc0d72d6032fdf07c10026a0e /media/libstagefright/codecs
parentd24a8f7c0a833fcb4aa7d794ad4656e662e91be9 (diff)
downloadframeworks_base-f4e98bac0ff1e43cf2f789f717ea903e9e2a3511.zip
frameworks_base-f4e98bac0ff1e43cf2f789f717ea903e9e2a3511.tar.gz
frameworks_base-f4e98bac0ff1e43cf2f789f717ea903e9e2a3511.tar.bz2
stagefright aacenc: Safeguard against overwriting bits
Previously, if bits above the lowest noBitsToWrite were set, they would be ORed into the previous cache word, setting unrelated bits erroneously. This doesn't noticeably affect the performance of the codec as a whole. Change-Id: Ie9935533c4299b8f07cb14485f039a9be9c84016
Diffstat (limited to 'media/libstagefright/codecs')
-rw-r--r--media/libstagefright/codecs/aacenc/src/bitbuffer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/aacenc/src/bitbuffer.c b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
index a706893..0ce93d3 100644
--- a/media/libstagefright/codecs/aacenc/src/bitbuffer.c
+++ b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
@@ -152,6 +152,7 @@ Word16 WriteBits(HANDLE_BIT_BUF hBitBuf,
wBitPos = hBitBuf->wBitPos;
wBitPos += noBitsToWrite;
+ writeValue &= ~(0xffffffff << noBitsToWrite); // Mask out everything except the lowest noBitsToWrite bits
writeValue <<= 32 - wBitPos;
writeValue |= hBitBuf->cache;