mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
avformat/imf_cpl: xmlNodeListGetString() can return NULL
Fixes: NULL pointer dereference Fixes: 60166/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5998301577871360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 509ce40f188734ec74078ebdd8d71f80116d9eaf) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
1759fd0d82
commit
c09250be43
@ -76,6 +76,8 @@ int ff_imf_xml_read_uuid(xmlNodePtr element, AVUUID uuid)
|
||||
int ret = 0;
|
||||
|
||||
element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
|
||||
if (!element_text)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ret = av_uuid_urn_parse(element_text, uuid);
|
||||
if (ret) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid UUID\n");
|
||||
@ -92,7 +94,7 @@ int ff_imf_xml_read_rational(xmlNodePtr element, AVRational *rational)
|
||||
int ret = 0;
|
||||
|
||||
element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
|
||||
if (sscanf(element_text, "%i %i", &rational->num, &rational->den) != 2) {
|
||||
if (element_text == NULL || sscanf(element_text, "%i %i", &rational->num, &rational->den) != 2) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid rational number\n");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
}
|
||||
@ -107,7 +109,7 @@ int ff_imf_xml_read_uint32(xmlNodePtr element, uint32_t *number)
|
||||
int ret = 0;
|
||||
|
||||
element_text = xmlNodeListGetString(element->doc, element->xmlChildrenNode, 1);
|
||||
if (sscanf(element_text, "%" PRIu32, number) != 1) {
|
||||
if (element_text == NULL || sscanf(element_text, "%" PRIu32, number) != 1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Invalid unsigned 32-bit integer");
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user