emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 1e6396e: Fix int overflow bug in ‘equal’


From: Paul Eggert
Subject: [Emacs-diffs] master 1e6396e: Fix int overflow bug in ‘equal’
Date: Sun, 9 Jun 2019 02:38:44 -0400 (EDT)

branch: master
commit 1e6396ec3df3b55cebf0f7380ed6dd43775a3a5b
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix int overflow bug in ‘equal’
    
    * src/fns.c (internal_equal):
    Fix bug when vector lengths exceed INT_MAX.
---
 src/fns.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/fns.c b/src/fns.c
index 7d54431..8307a36 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2425,7 +2425,6 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum 
equal_kind equal_kind,
 
     case Lisp_Vectorlike:
       {
-       register int i;
        ptrdiff_t size = ASIZE (o1);
        /* Pseudovectors have the type encoded in the size field, so this test
           actually checks that the objects have the same type as well as the
@@ -2479,7 +2478,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum 
equal_kind equal_kind,
              return false;
            size &= PSEUDOVECTOR_SIZE_MASK;
          }
-       for (i = 0; i < size; i++)
+       for (ptrdiff_t i = 0; i < size; i++)
          {
            Lisp_Object v1, v2;
            v1 = AREF (o1, i);



reply via email to

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