From: Paul Eggert Date: Sat, 18 Jun 2011 15:08:31 +0000 (-0700) Subject: * fns.c (concat): Catch string overflow earlier. X-Git-Tag: emacs-pretest-24.0.90~104^2~473^2~60 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a498d7f4f8ce688079d32cac4858ba78d2a9081e;p=emacs.git * fns.c (concat): Catch string overflow earlier. Do not rely on integer wraparound. --- diff --git a/src/ChangeLog b/src/ChangeLog index 79d9b636e09..b9cf18cedd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-06-18 Paul Eggert + * fns.c (concat): Catch string overflow earlier. + Do not rely on integer wraparound. + * dispextern.h (struct it.overlay_strings_charpos): EMACS_INT, not int. 2011-06-17 Paul Eggert diff --git a/src/fns.c b/src/fns.c index a19c886e3e1..4c1505ab0f1 100644 --- a/src/fns.c +++ b/src/fns.c @@ -565,8 +565,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args, } result_len += len; - if (result_len < 0) - error ("String overflow"); + if (STRING_BYTES_BOUND < result_len) + string_overflow (); } if (! some_multibyte)