]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix arithmetic overflow in GC consing count
authorPaul Eggert <eggert@day>
Sat, 27 Jul 2019 17:24:19 +0000 (10:24 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 27 Jul 2019 17:24:45 +0000 (10:24 -0700)
* src/alloc.c (allow_garbage_collection):
Redo expression to avoid signed arithmetic overflow
in an intermediate expression when CONSING is negative.

src/alloc.c

index c17bdb719a94247a0f8fe4ebaacb15172cd26580..5e089311a273788c3012834f69f2df0c6e41c206 100644 (file)
@@ -5498,7 +5498,7 @@ staticpro (Lisp_Object const *varaddress)
 static void
 allow_garbage_collection (intmax_t consing)
 {
-  consing_until_gc -= OBJECT_CT_MAX - consing;
+  consing_until_gc = consing - (OBJECT_CT_MAX - consing_until_gc);
   garbage_collection_inhibited--;
 }