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.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -401,6 +401,7 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx, · 400 unmodified lines | ||
| 401 | 401 | if (usac->nb_elems > 64) { |
| 402 | 402 | av_log(ac->avctx, AV_LOG_ERROR, "Too many elements: %i\n", |
| 403 | 403 | usac->nb_elems); |
| 404 | + usac->nb_elems = 0; | |
| 404 | 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 | 414 | (elem_id[0] + elem_id[1] + elem_id[2] + 1) > nb_channels) { |
| 414 | 415 | av_log(ac->avctx, AV_LOG_ERROR, "Too many channels for the channel " |
| 415 | 416 | "configuration\n"); |
| 417 | + usac->nb_elems = 0; | |
| 416 | 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 | 460 | ret = ff_aac_output_configure(ac, layout_map, elem_id[0] + elem_id[1] + elem_id[2], OC_GLOBAL_HDR, 0); |
| 459 | 461 | if (ret < 0) { |
| 460 | 462 | av_log(avctx, AV_LOG_ERROR, "Unable to parse channel config!\n"); |
| 463 | + usac->nb_elems = 0; | |
| 461 | 464 | return ret; |
| 462 | 465 | } |
| 463 | 466 | |