Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl2/grep/dist/lib Moving pointers could fail if re...



details:   https://anonhg.NetBSD.org/src/rev/57653b8f15af
branches:  trunk
changeset: 1014565:57653b8f15af
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Sep 26 11:39:17 2020 +0000

description:
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.

diffstat:

 external/gpl2/grep/dist/lib/regex.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 0a644b3d2c34 -r 57653b8f15af external/gpl2/grep/dist/lib/regex.c
--- a/external/gpl2/grep/dist/lib/regex.c       Sat Sep 26 10:56:37 2020 +0000
+++ b/external/gpl2/grep/dist/lib/regex.c       Sat Sep 26 11:39:17 2020 +0000
@@ -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 @@
     /* 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 @@
     /* 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)                                             \



Home | Main Index | Thread Index | Old Index