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
752752 type = ffio_read_leb(pbc);
753753 if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN)
754754 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+ }
756760 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+ }
758766 ret = param_parse(s, c, pbc, type, audio_element, &element->recon_gain_info);
759− else {
767+ } else {
760768 unsigned param_definition_size = ffio_read_leb(pbc);
761769 avio_skip(pbc, param_definition_size);
762770 }

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