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

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