From 5ad63e5dc4d76359ca4807521e1e31a77572500c Mon Sep 17 00:00:00 2001
From: "Tobias S. Josefowitz" <tobij@tobij.de>
Date: Tue, 6 Apr 2021 22:48:32 +0200
Subject: [PATCH] Image.XWD: Improve size checks to better detect malformed
 images

Thanks to Cezary Cerekwicki <ccerekwicki@opera.com> for the report.
---
 src/modules/Image/encodings/xwd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/modules/Image/encodings/xwd.c b/src/modules/Image/encodings/xwd.c
index c9fd506b27..6b24ba927a 100644
--- a/src/modules/Image/encodings/xwd.c
+++ b/src/modules/Image/encodings/xwd.c
@@ -302,7 +302,7 @@ void img_xwd__decode(INT32 args,int header_only,int skipcmap)
       n++;
       push_text("image");
 
-      if (s->len-(int)(header.header_size+header.ncolors*12)<0)
+      if (s->len-(unsigned int)(header.header_size+header.ncolors*12)<0)
 	 push_empty_string();
       else
 	 push_string(make_shared_binary_string(
-- 
GitLab