Should prevent potential memory leaks on invalid files.
Unified · Split
| @@ -752,11 +752,19 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) · 751 unmodified lines | ||
| 752 | 752 | type = ffio_read_leb(pbc); |
| 753 | 753 | if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN) |
| 754 | 754 | ret = AVERROR_INVALIDDATA; |
| 755 | − else if (type == AV_IAMF_PARAMETER_DEFINITION_DEMIXING) | |
| 755 | + else if (type == AV_IAMF_PARAMETER_DEFINITION_DEMIXING) { | |
| 756 | + if (element->demixing_info) { | |
| 757 | + ret = AVERROR_INVALIDDATA; | |
| 758 | + goto fail; | |
| 759 | + } | |
| 756 | 760 | ret = param_parse(s, c, pbc, type, audio_element, &element->demixing_info); |
| 757 | − else if (type == AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN) | |
| 761 | + } else if (type == AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN) { | |
| 762 | + if (element->recon_gain_info) { | |
| 763 | + ret = AVERROR_INVALIDDATA; | |
| 764 | + goto fail; | |
| 765 | + } | |
| 758 | 766 | ret = param_parse(s, c, pbc, type, audio_element, &element->recon_gain_info); |
| 759 | − else { | |
| 767 | + } else { | |
| 760 | 768 | unsigned param_definition_size = ffio_read_leb(pbc); |
| 761 | 769 | avio_skip(pbc, param_definition_size); |
| 762 | 770 | } |