History

aacdec_usac: clean up nb_elems on error

Require that there is a valid layout with a valid number of channels before accepting nb_elems. The value is required when flushing. Thanks to kasper93 for figuring it out.

Lynne committed 2 years ago

Commit 62cd6d91 parent 5c328e61 file · +3 −0Browse files

Unified · Split

libavcodec/aac/aacdec_usac.c+3−0
@@ -401,6 +401,7 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx, · 400 unmodified lines
401 if (usac->nb_elems > 64) {401 if (usac->nb_elems > 64) {
402 av_log(ac->avctx, AV_LOG_ERROR, "Too many elements: %i\n",402 av_log(ac->avctx, AV_LOG_ERROR, "Too many elements: %i\n",
403 usac->nb_elems);403 usac->nb_elems);
404 usac->nb_elems = 0;
404 return AVERROR(EINVAL);405 return AVERROR(EINVAL);
405 }406 }
406 407
@@ -413,6 +414,7 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx, · 6 unmodified lines
413 (elem_id[0] + elem_id[1] + elem_id[2] + 1) > nb_channels) {414 (elem_id[0] + elem_id[1] + elem_id[2] + 1) > nb_channels) {
414 av_log(ac->avctx, AV_LOG_ERROR, "Too many channels for the channel "415 av_log(ac->avctx, AV_LOG_ERROR, "Too many channels for the channel "
415 "configuration\n");416 "configuration\n");
417 usac->nb_elems = 0;
416 return AVERROR(EINVAL);418 return AVERROR(EINVAL);
417 }419 }
418 420
@@ -458,6 +460,7 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx, · 39 unmodified lines
458 ret = ff_aac_output_configure(ac, layout_map, elem_id[0] + elem_id[1] + elem_id[2], OC_GLOBAL_HDR, 0);460 ret = ff_aac_output_configure(ac, layout_map, elem_id[0] + elem_id[1] + elem_id[2], OC_GLOBAL_HDR, 0);
459 if (ret < 0) {461 if (ret < 0) {
460 av_log(avctx, AV_LOG_ERROR, "Unable to parse channel config!\n");462 av_log(avctx, AV_LOG_ERROR, "Unable to parse channel config!\n");
463 usac->nb_elems = 0;
461 return ret;464 return ret;
462 }465 }
463 466

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