From: openKylin Developers <packaging@lists.openkylin.top>
Date: Mon, 1 Jun 2026 16:35:44 +0800
Subject: Autogenerated patch header for a single-debian-patch file.

Forwarded: not-needed

The delta against upstream is either kept as a single patch, or maintained
in some VCS, and exported as a single patch instead of more manageable
atomic patches.
---
 libdjvu/GString.h           | 4 ++--
 libdjvu/IW44EncodeCodec.cpp | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libdjvu/GString.h b/libdjvu/GString.h
index 6cf65f2..bbaef3b 100644
--- a/libdjvu/GString.h
+++ b/libdjvu/GString.h
@@ -136,8 +136,8 @@ typedef unsigned __int32 uint32_t;
 typedef unsigned __int16 uint16_t;
 # else
 # pragma message("Please verify defs for uint32_t and uint16_t")
-typedef unsigned int   uint32_t // verify
-typedef unsigned short uint16_t // verify
+typedef unsigned int   uint32_t; // verify
+typedef unsigned short uint16_t; // verify
 # endif
 #endif
 
diff --git a/libdjvu/IW44EncodeCodec.cpp b/libdjvu/IW44EncodeCodec.cpp
index f81eaeb..200c8b5 100644
--- a/libdjvu/IW44EncodeCodec.cpp
+++ b/libdjvu/IW44EncodeCodec.cpp
@@ -1424,7 +1424,10 @@ IWBitmap::Encode::init(const GBitmap &bm, const GP<GBitmap> gmask)
   int h = bm.rows();
   int g = bm.get_grays()-1;
   signed char *buffer;
-  GPBuffer<signed char> gbuffer(buffer,w*h);
+  size_t sz = w * h;
+  if (sz == 0 || g <= 0 || sz / (size_t)w != (size_t)h)
+    G_THROW("IW44Image: inconsistent image size (corrupted file?)");
+  GPBuffer<signed char> gbuffer(buffer,sz);
   // Prepare gray level conversion table
   signed char  bconv[256];
   for (i=0; i<256; i++)
