pcrs_compile_replacement(): Add two assertions
authorFabian Keil <fk@fabiankeil.de>
Wed, 25 May 2016 10:50:28 +0000 (10:50 +0000)
committerFabian Keil <fk@fabiankeil.de>
Wed, 25 May 2016 10:50:28 +0000 (10:50 +0000)
pcrs.c

diff --git a/pcrs.c b/pcrs.c
index 93f5827..955ccf8 100644 (file)
--- a/pcrs.c
+++ b/pcrs.c
@@ -1,4 +1,4 @@
-const char pcrs_rcs[] = "$Id: pcrs.c,v 1.48 2015/12/27 12:45:46 fabiankeil Exp $";
+const char pcrs_rcs[] = "$Id: pcrs.c,v 1.49 2016/05/08 10:45:51 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/pcrs.c,v $
@@ -375,6 +375,8 @@ static pcrs_substitute *pcrs_compile_replacement(const char *replacement, int tr
                goto plainchar;
             }
 
+            assert(l < PCRS_MAX_SUBMATCHES - 1);
+            assert(r->backref[l] < PCRS_MAX_SUBMATCHES + 2);
             /* Valid and in range? -> record */
             if ((0 <= r->backref[l]) &&
                (r->backref[l] < PCRS_MAX_SUBMATCHES + 2) &&