History

avformat/iamf_parse: ensure there's at most one of each parameter types in audio elements

Should prevent potential memory leaks on invalid files.

James Almer committed 1 year ago

Commit 5470d021 parent 05265351 file · +11 −3Browse files

Unified · Split

libavformat/iamf_parse.c+11−3
@@ -752,11 +752,19 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len) · 751 unmodified lines
752 type = ffio_read_leb(pbc);752 type = ffio_read_leb(pbc);
753 if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN)753 if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN)
754 ret = AVERROR_INVALIDDATA;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 ret = param_parse(s, c, pbc, type, audio_element, &element->demixing_info);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 ret = param_parse(s, c, pbc, type, audio_element, &element->recon_gain_info);766 ret = param_parse(s, c, pbc, type, audio_element, &element->recon_gain_info);
759 else {767 } else {
760 unsigned param_definition_size = ffio_read_leb(pbc);768 unsigned param_definition_size = ffio_read_leb(pbc);
761 avio_skip(pbc, param_definition_size);769 avio_skip(pbc, param_definition_size);
762 }770 }

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