Module Name:    src
Committed By:   martin
Date:           Fri Feb 19 17:41:19 UTC 2021

Modified Files:
        src/external/gpl2/grep/dist/lib [netbsd-9]: regex.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1208):

        external/gpl2/grep/dist/lib/regex.c: revision 1.3

Moving pointers could fail if realloc() allocates a new memory region
where the difference between old and new address exceeds an int. Use
ptrdiff_t for calculations instead.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.18.1 src/external/gpl2/grep/dist/lib/regex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl2/grep/dist/lib/regex.c
diff -u src/external/gpl2/grep/dist/lib/regex.c:1.2 src/external/gpl2/grep/dist/lib/regex.c:1.2.18.1
--- src/external/gpl2/grep/dist/lib/regex.c:1.2	Sun Jan 10 22:16:40 2016
+++ src/external/gpl2/grep/dist/lib/regex.c	Fri Feb 19 17:41:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: regex.c,v 1.2 2016/01/10 22:16:40 christos Exp $	*/
+/*	$NetBSD: regex.c,v 1.2.18.1 2021/02/19 17:41:19 martin Exp $	*/
 
 /* Extended regular expression matching and search library,
    version 0.12.
@@ -2047,7 +2047,7 @@ static reg_errcode_t compile_range _RE_A
     /* If the buffer moved, move all the pointers into it.  */		\
     if (old_buffer != COMPILED_BUFFER_VAR)				\
       {									\
-	int incr = COMPILED_BUFFER_VAR - old_buffer;			\
+	ptrdiff_t incr = COMPILED_BUFFER_VAR - old_buffer;			\
 	MOVE_BUFFER_POINTER (b);					\
 	MOVE_BUFFER_POINTER (begalt);					\
 	if (fixup_alt_jump)						\
@@ -2075,7 +2075,7 @@ static reg_errcode_t compile_range _RE_A
     /* If the buffer moved, move all the pointers into it.  */		\
     if (old_buffer != COMPILED_BUFFER_VAR)				\
       {									\
-	int incr = COMPILED_BUFFER_VAR - old_buffer;			\
+	ptrdiff_t incr = COMPILED_BUFFER_VAR - old_buffer;			\
 	MOVE_BUFFER_POINTER (b);					\
 	MOVE_BUFFER_POINTER (begalt);					\
 	if (fixup_alt_jump)						\

Reply via email to