diff options
| author | Paul Eggert | 2019-06-08 23:38:18 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-08 23:38:40 -0700 |
| commit | 1e6396ec3df3b55cebf0f7380ed6dd43775a3a5b (patch) | |
| tree | 27fba0a6180e5ee9c11d75fda1d6e14dc3a60749 /src | |
| parent | 5abaea334cf4c0e004fca2b8b272e091eb5b5444 (diff) | |
| download | emacs-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.c | 3 |
1 files changed, 1 insertions, 2 deletions
| @@ -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); |