summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-17 12:18:24 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-12 15:47:43 -0800
commitf7a167a48a950b89b91f5123a0ec8d9a7cb97495 (patch)
tree6cbf80ce8fad4229baa8a12181e79324c3925f41
parent0ff2c6af823ce7712c06150c43c9b403846a035f (diff)
test: add test case for CVE-2022-46285 (unclosed comments)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--test/Makefile.am1
-rw-r--r--test/pixmaps/README.md3
-rw-r--r--test/pixmaps/invalid/unending-comment-c.xpm30
3 files changed, 34 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 897eee1..175eccb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -92,5 +92,6 @@ EXTRA_DIST = \
pixmaps/invalid/doom2.xpm \
pixmaps/invalid/invalid-type.xpm \
pixmaps/invalid/no-contents.xpm \
+ pixmaps/invalid/unending-comment-c.xpm \
pixmaps/no-mem/oversize.xpm \
tap-test
diff --git a/test/pixmaps/README.md b/test/pixmaps/README.md
index 2481d14..f361f77 100644
--- a/test/pixmaps/README.md
+++ b/test/pixmaps/README.md
@@ -52,6 +52,9 @@ return XpmFileInvalid when parsed.
- no-contents.xpm - This file has a valid header but no contents
+- unending-comment-c.xpm - This file has a C comment block without the
+ closing "*/" to test for CVE-2022-46285
+
no-mem
------
diff --git a/test/pixmaps/invalid/unending-comment-c.xpm b/test/pixmaps/invalid/unending-comment-c.xpm
new file mode 100644
index 0000000..c6056c6
--- /dev/null
+++ b/test/pixmaps/invalid/unending-comment-c.xpm
@@ -0,0 +1,30 @@
+/* XPM */
+static char * sample_xpm[] = {
+"15 19 6 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+"@ c #99FFCC",
+"# c #66CCCC",
+"$ c #339966",
+/* This is the comment that never ends, it just goes on and on again...
+ Based on test case provided by Marco Ivaldi for CVE-2022-46285
+".+++++++++++++.",
+"+@@@@@@@@@@@@#+",
+"+@###########$+",
+"+@###....####$+",
+"+@##......###$+",
+"+@#...$$...##$+",
+"+@#..$$##..$#$+",
+"+@##$$##...$#$+",
+"+@#####...$$#$+",
+"+@####...$$##$+",
+"+@####..$$###$+",
+"+@####..$####$+",
+"+@#####$$####$+",
+"+@####..#####$+",
+"+@####..$####$+",
+"+@#####$$####$+",
+"+@###########$+",
+"+#$$$$$$$$$$$$+",
+".+++++++++++++."};