]> granicus.if.org Git - imagemagick/commitdiff
Avoid overflow when parsing PSD resource blocks
authorCristy <urban-warrior@imagemagick.org>
Fri, 6 May 2016 14:03:01 +0000 (10:03 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 6 May 2016 14:03:01 +0000 (10:03 -0400)
coders/psd.c

index b26513c0fde207a5634c13063c0e527003e81299..eb107f47e57f1e3826cf97a4d35ab5bc551da86b 100644 (file)
@@ -643,7 +643,7 @@ static void ParseImageResourceBlocks(Image *image,
     p=PushShortPixel(MSBEndian,p,&id);
     p=PushShortPixel(MSBEndian,p,&short_sans);
     p=PushLongPixel(MSBEndian,p,&count);
-    if (p+count > blocks+length)
+    if ((p+count) > (blocks+length-16))
       return;
     switch (id)
     {