[FFmpeg-cvslog] avformat/imf_cpl: xmlNodeListGetString() can return NULL
Michael Niedermayer
git at videolan.org
Mon Oct 30 02:10:19 EET 2023
ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jul 23 20:03:01 2023 +0200| [c09250be43d823621646ba9e984f478a028c2b2f] | committer: Michael Niedermayer
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 at sandflow.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 509ce40f188734ec74078ebdd8d71f80116d9eaf)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c09250be43d823621646ba9e984f478a028c2b2f
---
libavformat/imf_cpl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavformat/imf_cpl.c b/libavformat/imf_cpl.c
index f2c6b6f064..a688a44711 100644
--- a/libavformat/imf_cpl.c
+++ b/libavformat/imf_cpl.c
@@ -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;
}
More information about the ffmpeg-cvslog
mailing list