From 9642fc7fc5574ff936d42126b8363e33346a62c3 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 28 Jan 2018 16:55:03 -0500 Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5260 --- MagickCore/token-private.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MagickCore/token-private.h b/MagickCore/token-private.h index d83d90cb0..fc6b43322 100644 --- a/MagickCore/token-private.h +++ b/MagickCore/token-private.h @@ -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; -- 2.40.0