You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avformat/iamf_parse: ensure there's at most one of each parameter types in audio elements
Should prevent potential memory leaks on invalid files. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@ -752,11 +752,19 @@ static int audio_element_obu(void *s, IAMFContext *c, AVIOContext *pb, int len)
|
|||||||
type = ffio_read_leb(pbc);
|
type = ffio_read_leb(pbc);
|
||||||
if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN)
|
if (type == AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN)
|
||||||
ret = AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
else if (type == AV_IAMF_PARAMETER_DEFINITION_DEMIXING)
|
else if (type == AV_IAMF_PARAMETER_DEFINITION_DEMIXING) {
|
||||||
|
if (element->demixing_info) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
ret = param_parse(s, c, pbc, type, audio_element, &element->demixing_info);
|
ret = param_parse(s, c, pbc, type, audio_element, &element->demixing_info);
|
||||||
else if (type == AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN)
|
} else if (type == AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN) {
|
||||||
|
if (element->recon_gain_info) {
|
||||||
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
ret = param_parse(s, c, pbc, type, audio_element, &element->recon_gain_info);
|
ret = param_parse(s, c, pbc, type, audio_element, &element->recon_gain_info);
|
||||||
else {
|
} else {
|
||||||
unsigned param_definition_size = ffio_read_leb(pbc);
|
unsigned param_definition_size = ffio_read_leb(pbc);
|
||||||
avio_skip(pbc, param_definition_size);
|
avio_skip(pbc, param_definition_size);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user