From: Paul Eggert Date: Wed, 26 Aug 2020 07:07:08 +0000 (-0700) Subject: regex-emacs omit POS runtime check X-Git-Tag: emacs-28.0.90~6398 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=438975bbaa25b7de74993e7928c45cf5779442b8;p=emacs.git regex-emacs omit POS runtime check * src/regex-emacs.c (re_match_2_internal): Replace unnecessary runtime check of POS with some eassumes. --- diff --git a/src/regex-emacs.c b/src/regex-emacs.c index c44cce9f787..954a193371a 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -3864,6 +3864,10 @@ re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string2, ptrdiff_t size2, ptrdiff_t pos, struct re_registers *regs, ptrdiff_t stop) { + eassume (0 <= size1); + eassume (0 <= size2); + eassume (0 <= pos && pos <= stop && stop <= size1 + size2); + /* General temporaries. */ int mcnt; @@ -3979,14 +3983,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, best_regend = best_regstart + num_regs; } - /* The starting position is bogus. */ - if (pos < 0 || pos > size1 + size2) - { - unbind_to (count, Qnil); - SAFE_FREE (); - return -1; - } - /* Initialize subexpression text positions to -1 to mark ones that no start_memory/stop_memory has been seen for. */ for (ptrdiff_t reg = 1; reg < num_regs; reg++)