From afc9a2af9bd5c09f6d5360859d06b1d817094b85 Mon Sep 17 00:00:00 2001
From: "Tobias S. Josefowitz" <tobij@tobij.de>
Date: Tue, 13 Apr 2021 00:51:19 +0200
Subject: [PATCH] Image.XWD: Further improve size check

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 6b24ba927a..74b565a795 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-(unsigned int)(header.header_size+header.ncolors*12)<0)
+      if ((size_t)s->len < (header.header_size+header.ncolors*12))
 	 push_empty_string();
       else
 	 push_string(make_shared_binary_string(
-- 
GitLab