Module Name: src
Committed By: mlelstv
Date: Sat Sep 26 11:39:17 UTC 2020
Modified Files:
src/external/gpl2/grep/dist/lib: regex.c
Log Message:
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.3 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.3
--- 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 Sat Sep 26 11:39:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: regex.c,v 1.2 2016/01/10 22:16:40 christos Exp $ */
+/* $NetBSD: regex.c,v 1.3 2020/09/26 11:39:17 mlelstv 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) \