aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-06-08 23:38:18 -0700
committerPaul Eggert2019-06-08 23:38:40 -0700
commit1e6396ec3df3b55cebf0f7380ed6dd43775a3a5b (patch)
tree27fba0a6180e5ee9c11d75fda1d6e14dc3a60749 /src
parent5abaea334cf4c0e004fca2b8b272e091eb5b5444 (diff)
downloademacs-1e6396ec3df3b55cebf0f7380ed6dd43775a3a5b.tar.gz
emacs-1e6396ec3df3b55cebf0f7380ed6dd43775a3a5b.zip
Fix int overflow bug in ‘equal’
* src/fns.c (internal_equal): Fix bug when vector lengths exceed INT_MAX.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c3
1 files changed, 1 insertions, 2 deletions
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,
2425 2425
2426 case Lisp_Vectorlike: 2426 case Lisp_Vectorlike:
2427 { 2427 {
2428 register int i;
2429 ptrdiff_t size = ASIZE (o1); 2428 ptrdiff_t size = ASIZE (o1);
2430 /* Pseudovectors have the type encoded in the size field, so this test 2429 /* Pseudovectors have the type encoded in the size field, so this test
2431 actually checks that the objects have the same type as well as the 2430 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,
2479 return false; 2478 return false;
2480 size &= PSEUDOVECTOR_SIZE_MASK; 2479 size &= PSEUDOVECTOR_SIZE_MASK;
2481 } 2480 }
2482 for (i = 0; i < size; i++) 2481 for (ptrdiff_t i = 0; i < size; i++)
2483 { 2482 {
2484 Lisp_Object v1, v2; 2483 Lisp_Object v1, v2;
2485 v1 = AREF (o1, i); 2484 v1 = AREF (o1, i);