* insdel.c, lisp.h (buffer_overflow): New function.
[bpt/emacs.git] / src / ChangeLog
index e4e95ba..f7f1833 100644 (file)
@@ -1,12 +1,84 @@
-2011-06-14  Paul Eggert  <eggert@cs.ucla.edu>
+2011-06-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * insdel.c, lisp.h (buffer_overflow): New function.
+       (insert_from_buffer_1, replace_range, replace_range_2):
+       * insdel.c (make_gap_larger):
+       * editfns.c (Finsert_char):
+       * fileio.c (Finsert_file_contents): Use it, to normalize wording.
+
+       * buffer.h (BUF_BYTES_MAX): Cast to ptrdiff_t so that it's signed.
+
+2011-06-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Integer overflow and signedness fixes (Bug#8873).
+
+       * ccl.c (ASCENDING_ORDER): New macro, to work around GCC bug 43772.
+       (GET_CCL_RANGE, IN_INT_RANGE): Use it.
+
+       * fileio.c: Don't assume EMACS_INT fits in off_t.
+       (emacs_lseek): New static function.
+       (Finsert_file_contents, Fwrite_region): Use it.
+       Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate.
+
+       * fns.c (Fload_average): Don't assume 100 * load average fits in int.
+
+       * fns.c: Don't overflow int when computing a list length.
+       * fns.c (QUIT_COUNT_HEURISTIC): New constant.
+       (Flength, Fsafe_length): Use EMACS_INT, not int, to avoid unwanted
+       truncation on 64-bit hosts.  Check for QUIT every
+       QUIT_COUNT_HEURISTIC entries rather than every other entry; that's
+       faster and is responsive enough.
+       (Flength): Report an error instead of overflowing an integer.
+       (Fsafe_length): Return a float if the value is not representable
+       as a fixnum.  This shouldn't happen except in contrived situations.
+       (Fnthcdr, Fsort): Don't assume list length fits in int.
+       (Fcopy_sequence): Don't assume vector length fits in int.
+
+       * alloc.c: Check that resized vectors' lengths fit in fixnums.
+       (header_size, word_size): New constants.
+       (allocate_vectorlike): Don't check size overflow here.
+       (allocate_vector): Check it here instead, since this is the only
+       caller of allocate_vectorlike that could cause overflow.
+       Check that the new vector's length is representable as a fixnum.
+
+       * fns.c (next_almost_prime): Don't return a multiple of 3 or 5.
+       The previous code was bogus.  For example, next_almost_prime (32)
+       returned 39, which is undesirable as it is a multiple of 3; and
+       next_almost_prime (24) returned 25, which is a multiple of 5 so
+       why was the code bothering to check for multiples of 7?
+
+       * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, for vector length.
+
+       * eval.c, doprnt.c (SIZE_MAX): Remove; inttypes.h defines this now.
+
+       Variadic C functions now count arguments with ptrdiff_t.
+       This partly undoes my 2011-03-30 change, which replaced int with size_t.
+       Back then I didn't know that the Emacs coding style prefers signed int.
+       Also, in the meantime I found a few more instances where arguments
+       were being counted with int, which may truncate counts on 64-bit
+       machines, or EMACS_INT, which may be unnecessarily wide.
+       * lisp.h (struct Lisp_Subr.function.aMANY)
+       (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
+       Arg counts are now ptrdiff_t, not size_t.
+       All variadic functions and their callers changed accordingly.
+       (struct gcpro.nvars): Now size_t, not size_t.  All uses changed.
+       * bytecode.c (exec_byte_code): Check maxdepth for overflow,
+       to avoid potential buffer overrun.  Don't assume arg counts fit in 'int'.
+       * callint.c (Fcall_interactively): Check arg count for overflow,
+       to avoid potential buffer overrun.  Use signed char, not 'int',
+       for 'varies' array, so that we needn't bother to check its size
+       calculation for overflow.
+       * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
+       * eval.c (apply_lambda):
+       * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
+       (struct textprop_rec.argnum): Now ptrdiff_t, not int.  All uses changed.
+       (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
 
        * callint.c (Fcall_interactively): Don't use index var as event count.
 
        * vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
        * mem-limits.h (SIZE): Remove; no longer used.
 
-2011-06-13  Paul Eggert  <eggert@cs.ucla.edu>
-
        * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works.
 
        Remove unnecessary casts.
 
        * alloc.c (Fmake_string): Check for out-of-range init.
 
+2011-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (Fdefvaralias): Also mark the target as variable-special-p.
+
+2011-06-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xfns.c (x_set_scroll_bar_default_width): Remove argument to
+       xg_get_default_scrollbar_width.
+
+       * gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3.
+       (int_gtk_range_get_value): Move to the scroll bar part of the file.
+       (style_changed_cb): Call update_theme_scrollbar_width and call
+       x_set_scroll_bar_default_width and xg_frame_set_char_size for
+       all frames (Bug#8505).
+       (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
+       Call gtk_window_set_resizable if HAVE_GTK3.
+       (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
+       and height if HAVE_GTK3 (Bug#8505).
+       (scroll_bar_width_for_theme): New variable.
+       (update_theme_scrollbar_width): New function.
+       (xg_get_default_scrollbar_width): Move code to
+       update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
+       (xg_initialize): Call update_theme_scrollbar_width.
+
+       * gtkutil.h (xg_get_default_scrollbar_width): Remove argument.
+
+       * emacsgtkfixed.c, emacsgtkfixed.h: New files.
+
 2011-06-12  Martin Rudalics  <rudalics@gmx.at>
 
        * frame.c (make_frame): Call other_buffer_safely instead of