The enums don't cover all possible values read from the bitstream.
This fixes undefined behaviour sanitizer errors.
Fixes: 31011/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-4981228811976704
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
This commit updates the fuzzer to use correct value of
kSignalingModesSize and prevent OOB access on kSignalingModes
Test: ./aac_enc_fuzzer
Bug: 180220144
Change-Id: Ic9d01c5c166f2291d8d8ffacaa7813fb1560322b
Added SPDX-license-identifier-Apache-2.0 to:
fuzzer/Android.bp
Added SPDX-license-identifier-Apache-2.0 legacy_by_exception_only to:
Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: I518bcad1cb91b80b2bcce1726f53aadf9afc749e
The enums don't cover all possible values read from the bitstream.
This fixes undefined behaviour sanitizer errors.
Fixes: 27647/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-5654559200116736
Fixes: 28193/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-4901213455515648
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Operating the FDK encoder in A2DP with variable bitrate mode
configuration resulted in unexpected encoder return value AACENC_ENCODE_ERROR.
Due to peak bitrate restriction the encoder quite often runs into requantization.
In case the bitrate constraint is not fulfilled, the so-called crash recovery is
used as final emergency step. The crash recovery reduces the overall bit
consumption considering the given number of bits to be saved. The bit difference
is extracted from audio element structures. In VBR mode the element wise bit
consumption state was not updated since there is typically no bitrate limitation
required.
The patch solves the choppy audio problems and increases audio quality for
AAC VBR encoding.
The changes in FDKaacEnc_QCMain() ensure that audio element bit info is always
updated. This is achieved by always calling FDKaacEnc_BitResRedistribution()
and FDKaacEnc_prepareBitDistribution() with maxBitsPerFrame variable as total
bits parameter.
Furthermore, VBR assumes a certain target bitrate which is used for internal
configuration and limitations. In case the peak bitrate parameter is less than
the VBR mode target bitrate the maximum of both bitrate configurations was used.
The function FDKaacEnc_AdjustVBRBitrateMode() is added to adjust the encoder
internal VBR mode to a desired target bitrate less than given peak bitrate.
It is possible that the peak bitrate is very close to the desired target bitrate.
The virtual available bitreservoir is quite low and the encoder would run quite
often into requantization with needless audio quality reduction. In such a
configuration, it is a better choice to use the CBR targeted threshold adaption
to avoid audio quality reduction.
In FDKaacEnc_Initialize(), there was already a bitResMode selection depending
on available bitreservoir for CBR. This selection will now also be used for VBR.
In case the bitResMode is AACENC_BR_MODE_FULL and VBR mode is selected, the VBR
threshold adaption is used. Otherwise, CBR threshold adaption strategy is used
and therefore, no unnecessary fill bits are written.
Bug: 161400526
Test: see bug
Change-Id: I1865f817180150da6add2623a64f1a102622784a
Bug: 158010610
Bug: 173497308
Test: ran atest DecoderConformanceTest, ImageReaderDecoderTest,
VideoDecoderPerfTest, VideoEncoderTest. Compare the
before and after enabling CFI results since there was a number of tests
that were initially failing.
Change-Id: I0d0d2a76512dc909a67f34adacff9ffbf536dbe7
The enum doesn't cover all possible values read from the bitstream.
This fixes undefined behaviour sanitizer errors.
Fixes: 27624/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBFDK_AAC_fuzzer-6049277318791168
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg