Blame SOURCES/0001-Fix-CVE-2022-46285-Infinite-loop-on-unclosed-comment.patch

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