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

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