mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
Avoid relying on FOR_EACH_TAIL internals in 'Fnthcdr' (bug#81115)
The new FOR_EACH_TAIL code detects simple cycles sooner than the old code did, leading to integer overflows. * src/fns.c (Fnthcdr): Avoid integer overflow if cycle is detected early.
This commit is contained in:
parent
0bef3c0e87
commit
c1eb458d6b
1 changed files with 4 additions and 1 deletions
|
|
@ -1824,7 +1824,10 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
|
|||
mpz_export (&iz, NULL, -1, sizeof iz, 0, 0, mpz[0]);
|
||||
num += iz;
|
||||
}
|
||||
num += cycle_length - large_num % cycle_length;
|
||||
if (num < cycle_length)
|
||||
num += cycle_length;
|
||||
num -= large_num % cycle_length;
|
||||
eassume (num >= 0);
|
||||
}
|
||||
num %= cycle_length;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue