From 166adb37b3b516b4a629030ef39f1b5da32bc185 Mon Sep 17 00:00:00 2001 From: ph10 Date: Fri, 20 May 2016 10:33:36 +0000 Subject: Minor refactor to avoid compiler warning. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1648 2f5784b3-3f2a-0410-8824-cb99058d5e15 --- ChangeLog | 3 +++ pcre_compile.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24e35e5..c2c3921 100644 --- a/ChangeLog +++ b/ChangeLog @@ -81,6 +81,9 @@ Version 8.39 xx-xxxxxx-201x 20. A racing condition is fixed in JIT reported by Mozilla. +21. Minor code refactor to avoid "array subscript is below array bounds" +compiler warning. + Version 8.38 23-November-2015 ----------------------------- diff --git a/pcre_compile.c b/pcre_compile.c index 254c629..ec202fd 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -4566,6 +4566,10 @@ for (;; ptr++) unsigned int tempbracount; pcre_uint32 ec; pcre_uchar mcbuffer[8]; + + /* Come here to restart the loop without advancing the pointer. */ + + REDO_LOOP: /* Get next character in the pattern */ @@ -4712,11 +4716,7 @@ for (;; ptr++) /* If we skipped any characters, restart the loop. Otherwise, we didn't see a comment. */ - if (ptr > wscptr) - { - ptr--; - continue; - } + if (ptr > wscptr) goto REDO_LOOP; } /* Skip over (?# comments. We need to do this here because we want to know if @@ -4857,15 +4857,15 @@ for (;; ptr++) if (STRNCMP_UC_C8(ptr+1, STRING_WEIRD_STARTWORD, 6) == 0) { nestptr = ptr + 7; - ptr = sub_start_of_word - 1; - continue; + ptr = sub_start_of_word; + goto REDO_LOOP; } if (STRNCMP_UC_C8(ptr+1, STRING_WEIRD_ENDWORD, 6) == 0) { nestptr = ptr + 7; - ptr = sub_end_of_word - 1; - continue; + ptr = sub_end_of_word; + goto REDO_LOOP; } /* Handle a real character class. */ -- cgit v1.2.1