aboutsummaryrefslogtreecommitdiffstats
path: root/libAACdec/src/rvlcbit.cpp
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2018-09-06 23:02:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-09-06 23:02:17 +0000
commit42f714f2ab2bc90ee320ef5f071a078179a59405 (patch)
tree630a5e3b45019785d952869e743e4f681d2278f4 /libAACdec/src/rvlcbit.cpp
parent4d801e44baece3ce866fd31538f8569d148bd372 (diff)
parent15292f7e9620caf9e8df26a62efc2a2891ea822e (diff)
downloadfdk-aac-42f714f2ab2bc90ee320ef5f071a078179a59405.tar.gz
fdk-aac-42f714f2ab2bc90ee320ef5f071a078179a59405.tar.bz2
fdk-aac-42f714f2ab2bc90ee320ef5f071a078179a59405.zip
Merge "Prevent bit buffer counter overflow." into pi-dev
Diffstat (limited to 'libAACdec/src/rvlcbit.cpp')
-rw-r--r--libAACdec/src/rvlcbit.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libAACdec/src/rvlcbit.cpp b/libAACdec/src/rvlcbit.cpp
index c06cf96..b0c4596 100644
--- a/libAACdec/src/rvlcbit.cpp
+++ b/libAACdec/src/rvlcbit.cpp
@@ -123,10 +123,10 @@ read direction. It is called very often, therefore it makes sense to inline it
--------------------------------------------------------------------------------------------
*/
-UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pPosition,
- UCHAR readDirection) {
+UCHAR rvlcReadBitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor,
+ INT *pPosition, UCHAR readDirection) {
UINT bit;
- INT readBitOffset = *pPosition - FDKgetBitCnt(bs);
+ INT readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pPosition;
if (readBitOffset) {
FDKpushBiDirectional(bs, readBitOffset);