From: Paul Eggert Date: Sun, 9 Jun 2019 06:38:18 +0000 (-0700) Subject: Fix int overflow bug in ‘equal’ X-Git-Tag: emacs-27.0.90~2653 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1e6396ec3df3b55cebf0f7380ed6dd43775a3a5b;p=emacs.git Fix int overflow bug in ‘equal’ * src/fns.c (internal_equal): Fix bug when vector lengths exceed INT_MAX. --- diff --git a/src/fns.c b/src/fns.c index 7d5443150d4..8307a36a09d 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);