Blame SOURCES/0001-Fix-CVE-2022-46285-Infinite-loop-on-unclosed-comment.patch
|
|
f8f308 |
From c6cd85b7d0a725552a7277748504a33f0fc3e121 Mon Sep 17 00:00:00 2001
|
|
|
f8f308 |
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
f8f308 |
Date: Sat, 17 Dec 2022 12:23:45 -0800
|
|
|
f8f308 |
Subject: [PATCH libXpm 1/6] Fix CVE-2022-46285: Infinite loop on unclosed
|
|
|
f8f308 |
comments
|
|
|
f8f308 |
|
|
|
f8f308 |
When reading XPM images from a file with libXpm 3.5.14 or older, if a
|
|
|
f8f308 |
comment in the file is not closed (i.e. a C-style comment starts with
|
|
|
f8f308 |
"/*" and is missing the closing "*/"), the ParseComment() function will
|
|
|
f8f308 |
loop forever calling getc() to try to read the rest of the comment,
|
|
|
f8f308 |
failing to notice that it has returned EOF, which may cause a denial of
|
|
|
f8f308 |
service to the calling program.
|
|
|
f8f308 |
|
|
|
f8f308 |
Reported-by: Marco Ivaldi <raptor@0xdeadbeef.info>
|
|
|
f8f308 |
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
f8f308 |
---
|
|
|
f8f308 |
src/data.c | 4 ++++
|
|
|
f8f308 |
1 file changed, 4 insertions(+)
|
|
|
f8f308 |
|
|
|
f8f308 |
diff --git a/src/data.c b/src/data.c
|
|
|
f8f308 |
index 898889c..bfad4ff 100644
|
|
|
f8f308 |
--- a/src/data.c
|
|
|
f8f308 |
+++ b/src/data.c
|
|
|
f8f308 |
@@ -174,6 +174,10 @@ ParseComment(xpmData *data)
|
|
|
f8f308 |
notend = 0;
|
|
|
f8f308 |
Ungetc(data, *s, file);
|
|
|
f8f308 |
}
|
|
|
f8f308 |
+ else if (c == EOF) {
|
|
|
f8f308 |
+ /* hit end of file before the end of the comment */
|
|
|
f8f308 |
+ return XpmFileInvalid;
|
|
|
f8f308 |
+ }
|
|
|
f8f308 |
}
|
|
|
f8f308 |
return 0;
|
|
|
f8f308 |
}
|
|
|
f8f308 |
--
|
|
|
f8f308 |
2.39.0
|
|
|
f8f308 |
|