diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2018-06-08 18:03:16 +0200 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-09-10 23:19:19 +0000 |
commit | 9744e41c40598c6a0b74440f3b5be63f9f3708a5 (patch) | |
tree | 66fe1fc4eb2c283bcebf91e53f365c6b22f1b47c /libAACdec/src/aacdec_hcr_bit.cpp | |
parent | 61381bd0f4bc012876ccf4b63eafddd2d60c35c9 (diff) | |
download | fdk-aac-9744e41c40598c6a0b74440f3b5be63f9f3708a5.tar.gz fdk-aac-9744e41c40598c6a0b74440f3b5be63f9f3708a5.tar.bz2 fdk-aac-9744e41c40598c6a0b74440f3b5be63f9f3708a5.zip |
Prevent bit buffer counter overflow.
While long-term test we discovered a bit counter overflow in the bit buffer.
The bit buffer state was only used by HCR and RVLC tool and can easily be substituted with FDKgetValidBits() call.
The following patch completely removes the bit counter and all its obsolete functions.
Bug: 112662184
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: Icee0519d26a2aa62367d2dece59cd3d60ffcade7
(cherry picked from commit 15292f7e9620caf9e8df26a62efc2a2891ea822e)
Diffstat (limited to 'libAACdec/src/aacdec_hcr_bit.cpp')
-rw-r--r-- | libAACdec/src/aacdec_hcr_bit.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libAACdec/src/aacdec_hcr_bit.cpp b/libAACdec/src/aacdec_hcr_bit.cpp index a53ef16..0198659 100644 --- a/libAACdec/src/aacdec_hcr_bit.cpp +++ b/libAACdec/src/aacdec_hcr_bit.cpp @@ -132,13 +132,14 @@ read direction. It is called very often, therefore it makes sense to inline it return: - bit from bitstream -------------------------------------------------------------------------------------------- */ -UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pLeftStartOfSegment, +UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, const INT bsAnchor, + INT *pLeftStartOfSegment, INT *pRightStartOfSegment, UCHAR readDirection) { UINT bit; INT readBitOffset; if (readDirection == FROM_LEFT_TO_RIGHT) { - readBitOffset = *pLeftStartOfSegment - FDKgetBitCnt(bs); + readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pLeftStartOfSegment; if (readBitOffset) { FDKpushBiDirectional(bs, readBitOffset); } @@ -147,7 +148,7 @@ UINT HcrGetABitFromBitstream(HANDLE_FDK_BITSTREAM bs, INT *pLeftStartOfSegment, *pLeftStartOfSegment += 1; } else { - readBitOffset = *pRightStartOfSegment - FDKgetBitCnt(bs); + readBitOffset = (INT)FDKgetValidBits(bs) - bsAnchor + *pRightStartOfSegment; if (readBitOffset) { FDKpushBiDirectional(bs, readBitOffset); } |