]> granicus.if.org Git - onig/commitdiff
check invalid code point value in onigenc_mb2_code_to_mbclen(): fix segmentation...
authorK.Kosako <kosako@sofnec.co.jp>
Tue, 9 Jul 2019 07:50:41 +0000 (16:50 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Tue, 9 Jul 2019 07:50:41 +0000 (16:50 +0900)
src/regenc.c

index 63765650f5f2461e06524c6aa50a672fd7591d93..9fab721e000c512244a841ca0c75f24b6e262db7 100644 (file)
@@ -853,6 +853,8 @@ onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigCaseFoldType flag,
 extern int
 onigenc_mb2_code_to_mbclen(OnigCodePoint code)
 {
+  if ((code & (~0xffff)) != 0) return ONIGERR_INVALID_CODE_POINT_VALUE;
+
   if ((code & 0xff00) != 0) return 2;
   else return 1;
 }