Commit 85dc1a5bf for imagemagick.org
commit 85dc1a5bf1ba54a2475e140074889724bd49a97c
Author: Cristy <urban-warrior@imagemagick.org>
Date: Thu Jan 22 19:54:46 2026 -0500
https://github.com/ImageMagick/ImageMagick/issues/8537
diff --git a/coders/pdb.c b/coders/pdb.c
index df302bfc0..7fd2399cd 100644
--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -271,10 +271,6 @@ static MagickBooleanType IsPDB(const unsigned char *magick,const size_t length)
*/
static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
- unsigned char
- attributes,
- tag[3];
-
Image
*image;
@@ -288,17 +284,9 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
pdb_info;
Quantum
- index;
-
- ssize_t
- x;
-
- Quantum
+ index,
*q;
- unsigned char
- *p;
-
size_t
bits_per_pixel,
num_pad_bytes,
@@ -309,10 +297,14 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
count,
img_offset,
comment_offset = 0,
+ x,
y;
unsigned char
- *pixels;
+ attributes,
+ *p,
+ *pixels,
+ tag[3];
/*
Open image file.
@@ -403,8 +395,8 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
/*
Initialize image structure.
*/
- image->columns=(size_t) pdb_image.width;
- image->rows=(size_t) pdb_image.height;
+ image->columns=(size_t) MagickAbsoluteValue(pdb_image.width);
+ image->rows=(size_t) MagickAbsoluteValue(pdb_image.height);
image->depth=8;
image->storage_class=PseudoClass;
bits_per_pixel=pdb_image.type == 0 ? 2UL : pdb_image.type == 2 ? 4UL : 1UL;