emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 05aa6d4: Fix off-by-1 bug in --enable-checking=st


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 05aa6d4: Fix off-by-1 bug in --enable-checking=stringbytes
Date: Fri, 10 Nov 2017 18:44:09 -0500 (EST)

branch: emacs-26
commit 05aa6d4a68c036602f253fb27c3ca8995533b4c7
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix off-by-1 bug in --enable-checking=stringbytes
    
    Evidently nobody builds Emacs with --enable-checking=all,
    which is no surprise as it is so slow as to be unusable nowadays.
    Perhaps we should remove the slowest checks, or move them into
    another category, or speed them up, or something.
    * src/alloc.c (SDATA_SIZE) [GC_CHECK_STRING_BYTES]: Fix off-by-one
    error in size calculation, which caused a failure when
    --enable-checking=stringbytes was used.  I introduced this bug in
    2016-09-08T01:08:address@hidden "Port flexible array
    members to GCC + valgrind".
---
 src/alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/alloc.c b/src/alloc.c
index 0fc79fe..5a44d7a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1760,7 +1760,7 @@ static char const 
string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 
 #ifdef GC_CHECK_STRING_BYTES
 
-#define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, NBYTES)
+#define SDATA_SIZE(NBYTES) FLEXSIZEOF (struct sdata, data, (NBYTES) + 1)
 
 #else /* not GC_CHECK_STRING_BYTES */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]