Commit 168ffe18d for imagemagick.org
commit 168ffe18def968f886c023146a478897866fd621
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Thu Feb 19 22:40:41 2026 +0100
Write after we have checked if the realloc failed (GHSA-3j4x-rwrx-xxj9)
diff --git a/coders/pdb.c b/coders/pdb.c
index 7fd2399cd..00d4e2f0f 100644
--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -616,9 +616,9 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception)
*r=(char) c;
c=ReadBlobByte(image);
}
- *r='\0';
if (comment == (char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ *r='\0';
(void) SetImageProperty(image,"comment",comment,exception);
comment=DestroyString(comment);
}