History

avcodec/aacdec_template: Fix running cleanup in decode_ics_info()

Fixes: out of array read Fixes: 2873/clusterfuzz-testcase-minimized-5924145713905664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Previous version reviewed-by: Alex Converse <alex.converse@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer committed 9 years ago

Commit 6f03ffb1 parent a2e444d1 file · +9 −4Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/aacdec_template.c+9−4
@@ -1281,6 +1281,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, · 1280 unmodified lines
12811281 const MPEG4AudioConfig *const m4ac = &ac->oc[1].m4ac;
12821282 const int aot = m4ac->object_type;
12831283 const int sampling_index = m4ac->sampling_index;
1284+ int ret_fail = AVERROR_INVALIDDATA;
1285+
12841286 if (aot != AOT_ER_AAC_ELD) {
12851287 if (get_bits1(gb)) {
12861288 av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n");
@@ -1331,8 +1333,10 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, · 44 unmodified lines
13311333 ics->num_swb = ff_aac_num_swb_512[sampling_index];
13321334 ics->tns_max_bands = ff_tns_max_bands_512[sampling_index];
13331335 }
1334− if (!ics->num_swb || !ics->swb_offset)
1335− return AVERROR_BUG;
1336+ if (!ics->num_swb || !ics->swb_offset) {
1337+ ret_fail = AVERROR_BUG;
1338+ goto fail;
1339+ }
13361340 } else {
13371341 ics->swb_offset = ff_swb_offset_1024[sampling_index];
13381342 ics->num_swb = ff_aac_num_swb_1024[sampling_index];
@@ -1356,7 +1360,8 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, · 17 unmodified lines
13561360 if (aot == AOT_ER_AAC_LD) {
13571361 av_log(ac->avctx, AV_LOG_ERROR,
13581362 "LTP in ER AAC LD not yet implemented.\n");
1359− return AVERROR_PATCHWELCOME;
1363+ ret_fail = AVERROR_PATCHWELCOME;
1364+ goto fail;
13601365 }
13611366 if ((ics->ltp.present = get_bits(gb, 1)))
13621367 decode_ltp(&ics->ltp, gb, ics->max_sfb);
@@ -1375,7 +1380,7 @@ static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, · 12 unmodified lines
13751380 return 0;
13761381 fail:
13771382 ics->max_sfb = 0;
1378− return AVERROR_INVALIDDATA;
1383+ return ret_fail;
13791384 }
13801385
13811386 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t