Fixes: out of array read
Fixes: 1072/clusterfuzz-testcase-
6456688074817536
Fixes: 1398/clusterfuzz-testcase-minimized-
4576913622302720
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
/**
* Save current output configuration if and only if it has been locked.
*/
/**
* Save current output configuration if and only if it has been locked.
*/
-static void push_output_configuration(AACContext *ac) {
+static int push_output_configuration(AACContext *ac) {
+ int pushed = 0;
+
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
ac->oc[0] = ac->oc[1];
if (ac->oc[1].status == OC_LOCKED || ac->oc[0].status == OC_NONE) {
ac->oc[0] = ac->oc[1];
}
ac->oc[1].status = OC_NONE;
}
ac->oc[1].status = OC_NONE;
case TYPE_PCE: {
uint8_t layout_map[MAX_ELEM_ID*4][3];
int tags;
case TYPE_PCE: {
uint8_t layout_map[MAX_ELEM_ID*4][3];
int tags;
- push_output_configuration(ac);
+
+ int pushed = push_output_configuration(ac);
+ if (pce_found && !pushed) {
+ err = AVERROR_INVALIDDATA;
+ goto fail;
+ }
+
tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb,
payload_alignment);
if (tags < 0) {
tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb,
payload_alignment);
if (tags < 0) {