Commit 2d4494cba for imagemagick.org

commit 2d4494cba39919ce970ed14f9404e7fd86edd162
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Thu Apr 9 07:58:30 2026 +0200

    Corrected check to avoid possible overflow.

diff --git a/coders/psd.c b/coders/psd.c
index 7733ac0ca..d6e624244 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -1858,7 +1858,7 @@ static void ParseAdditionalInfo(LayerInfo *layer_info)
         length|=(unsigned int) (*p++) << 16;
         length|=(unsigned int) (*p++) << 8;
         length|=(unsigned int) (*p++);
-        if (length * 2 > size - 4)
+        if ((size < 4) || (length > (size - 4) / 2))
           break;
         if (sizeof(layer_info->name) <= length)
           break;