]> granicus.if.org Git - onig/commitdiff
fix backref number == 0 case
authorK.Kosako <kosako@sofnec.co.jp>
Fri, 30 Jun 2017 02:17:11 +0000 (11:17 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Fri, 30 Jun 2017 02:17:11 +0000 (11:17 +0900)
src/regparse.c

index b53f2bf8b712024103f586502b34031c98a3098c..a91d95c1e8dcb3d1ec4722d610f0592dd0b1d6a6 100644 (file)
@@ -3568,9 +3568,9 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
           if (num_type != IS_NOT_NUM) {
             if (num_type == IS_REL_NUM) {
               back_num = backref_rel_to_abs(back_num, env);
-              if (back_num <= 0)
-                return ONIGERR_INVALID_BACKREF;
             }
+            if (back_num <= 0)
+              return ONIGERR_INVALID_BACKREF;
 
             if (IS_SYNTAX_BV(syn, ONIG_SYN_STRICT_CHECK_BACKREF)) {
               if (back_num > env->num_mem ||