]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5260
authorCristy <urban-warrior@imagemagick.org>
Sun, 28 Jan 2018 21:55:03 +0000 (16:55 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sun, 28 Jan 2018 22:37:22 +0000 (17:37 -0500)
MagickCore/token-private.h

index d83d90cb003770f281da7a553a10f9be6594aefe..fc6b433220099cbdbfff39ede1badcd761ac93f1 100644 (file)
@@ -118,19 +118,15 @@ static inline int GetNextUTFCode(const char *text,unsigned int *octets)
       {
         unicode&=utf_info[i].utf_mask;
         if (unicode < utf_info[i].utf_value)
-          {
-            errno=EILSEQ;
-            return(-1);
-          }
+          break;
         *octets=(unsigned int) (i+1);
         return(unicode);
       }
     c=(int) (*text++ ^ 0x80) & 0xff;
     if ((c & 0xc0) != 0)
-      {
-        errno=EILSEQ;
-        return(-1);
-      }
+      break;
+    if (unicode > 0x10FFFF)
+      break;
     unicode=(unicode << 6) | c;
   }
   errno=EILSEQ;