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
401401 if (usac->nb_elems > 64) {
402402 av_log(ac->avctx, AV_LOG_ERROR, "Too many elements: %i\n",
403403 usac->nb_elems);
404+ usac->nb_elems = 0;
404405 return AVERROR(EINVAL);
405406 }
406407
@@ -413,6 +414,7 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx, · 6 unmodified lines
413414 (elem_id[0] + elem_id[1] + elem_id[2] + 1) > nb_channels) {
414415 av_log(ac->avctx, AV_LOG_ERROR, "Too many channels for the channel "
415416 "configuration\n");
417+ usac->nb_elems = 0;
416418 return AVERROR(EINVAL);
417419 }
418420
@@ -458,6 +460,7 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx, · 39 unmodified lines
458460 ret = ff_aac_output_configure(ac, layout_map, elem_id[0] + elem_id[1] + elem_id[2], OC_GLOBAL_HDR, 0);
459461 if (ret < 0) {
460462 av_log(avctx, AV_LOG_ERROR, "Unable to parse channel config!\n");
463+ usac->nb_elems = 0;
461464 return ret;
462465 }
463466

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