]> granicus.if.org Git - onig/commitdiff
fix #55 : Byte value expressed in octal must be smaller than 256
authorK.Kosako <kosako@sofnec.co.jp>
Fri, 19 May 2017 06:44:47 +0000 (15:44 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Fri, 19 May 2017 06:44:47 +0000 (15:44 +0900)
src/regparse.c

index 665998ec38952c3eec0c68ae389d24fe6ea6aacc..f7acc5fd175374559b13a1c47f18d7bb08a5f052 100644 (file)
@@ -3020,7 +3020,7 @@ fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
         PUNFETCH;
         prev = p;
         num = scan_unsigned_octal_number(&p, end, 3, enc);
-        if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
+        if (num < 0 || num >= 256) return ONIGERR_TOO_BIG_NUMBER;
         if (p == prev) {  /* can't read nothing. */
           num = 0; /* but, it's not error */
         }
@@ -3392,7 +3392,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
       if (IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_OCTAL3)) {
         prev = p;
         num = scan_unsigned_octal_number(&p, end, (c == '0' ? 2:3), enc);
-        if (num < 0) return ONIGERR_TOO_BIG_NUMBER;
+        if (num < 0 || num >= 256) return ONIGERR_TOO_BIG_NUMBER;
         if (p == prev) {  /* can't read nothing. */
           num = 0; /* but, it's not error */
         }