* font.c (font_unparse_xlfd): Don't blindly alloca long strings.
[bpt/emacs.git] / src / ChangeLog
index 2677f03..f94f9c4 100644 (file)
@@ -1,4 +1,55 @@
-2011-08-16  Paul Eggert  <eggert@cs.ucla.edu>
+2011-08-29  Paul Eggert  <eggert@cs.ucla.edu>
+
+       sprintf-related integer and memory overflow issues.
+
+       * doprnt.c (doprnt): Support printing ptrdiff_t and intmax_t values.
+       (esprintf, esnprintf, exprintf, evxprintf): New functions.
+       * keyboard.c (command_loop_level): Now EMACS_INT, not int.
+       (cmd_error): kbd macro iterations count is now EMACS_INT, not int.
+       (modify_event_symbol): Do not assume that the length of
+       name_alist_or_stem is safe to alloca and fits in int.
+       (Fexecute_extended_command): Likewise for function name and binding.
+       (Frecursion_depth): Wrap around reliably on integer overflow.
+       * keymap.c (push_key_description): First arg is now EMACS_INT, not int,
+       since some callers pass EMACS_INT values.
+       (Fsingle_key_description): Don't crash if symbol name contains more
+       than MAX_ALLOCA bytes.
+       * minibuf.c (minibuf_level): Now EMACS_INT, not int.
+       (get_minibuffer): Arg is now EMACS_INT, not int.
+       * lisp.h (get_minibuffer, push_key_description): Reflect API changes.
+       (esprintf, esnprintf, exprintf, evxprintf): New decls.
+       * window.h (command_loop_level, minibuf_level): Reflect API changes.
+
+       * dbusbind.c (xd_signature, Fdbus_register_signal):
+       Do not overrun buffer; instead, report string overflow.
+
+       * dispnew.c (add_window_display_history): Don't overrun buffer.
+       Truncate instead; this is OK since it's just a log.
+
+       * editfns.c (Fcurrent_time_zone): Don't overrun buffer
+       even if the time zone offset is outlandishly large.
+       Don't mishandle offset == INT_MIN.
+
+       * emacs.c (main) [NS_IMPL_COCOA]: Don't overrun buffer
+       when creating daemon; the previous buffer-overflow check was incorrect.
+
+       * eval.c (verror): Simplify by rewriting in terms of evxprintf,
+       which has the guts of the old verror function.
+
+       * filelock.c (lock_file_1, lock_file): Don't blindly alloca long name;
+       use SAFE_ALLOCA instead.  Use esprintf to avoid int-overflow issues.
+
+       * font.c (font_unparse_xlfd): Don't blindly alloca long strings.
+       Don't assume XINT result fits in int, or that XFLOAT_DATA * 10
+       fits in int, when using sprintf.  Use single snprintf to count
+       length of string rather than counting it via multiple sprintfs;
+       that's simpler and more reliable.
+       (APPEND_SPRINTF): New macro.
+       (font_unparse_fcname): Use it to avoid sprintf buffer overrun.
+       (generate_otf_features) [0 && HAVE_LIBOTF]: Use esprintf, not
+       sprintf, in case result does not fit in int.
+
+2011-08-26  Paul Eggert  <eggert@cs.ucla.edu>
 
        Integer and memory overflow issues (Bug#9196).
 
        (bidi_cache_ensure_space, bidi_shelve_cache): Use it.
        (bidi_cache_ensure_space): Avoid integer overflow when allocating.
 
+       * bidi.c (bidi_cache_shrink):
        * buffer.c (overlays_at, overlays_in, record_overlay_string)
        (overlay_strings):
        Don't update size of array until after memory allocation succeeds,
        (gs_load): Use printmax_t to print the widest integers possible.
        Check for integer overflow when computing image height and width.
 
+2011-08-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (redisplay_window): Don't force window start if point
+       will be invisible in the resulting window.  (Bug#9324)
+
+2011-08-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (compute_display_string_pos): Return 2 in DISP_PROP when
+       the display spec is of the form `(space ...)'.
+       (handle_display_spec): Return the value returned by
+       handle_single_display_spec, not just 1 or zero.
+       (handle_single_display_spec): If the display spec is of the form
+       `(space ...)', and specifies display in the text area, return 2
+       rather than 1.
+       (try_cursor_movement): Check for the need to scroll more
+       accurately, and prefer exact match for point under bidi.  Don't
+       advance `row' beyond the last row of the window.
+
+       * dispextern.h (struct bidi_it): Rename the disp_prop_p member
+       into disp_prop; all users changed.
+
+       * bidi.c (bidi_fetch_char): If compute_display_string_pos returns
+       DISP_PROP = 2, substitute the u+2029 PARAGRAPH SEPARATOR character
+       for the text covered by the display property.
+
+2011-08-25  Chong Yidong  <cyd@stupidchicken.com>
+
+       * buffer.c (Fbury_buffer_internal): Rename from Funrecord_buffer.
+       Change return value to nil.
+       (Frecord_buffer): Delete unused function.
+
+2011-08-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (Fcurrent_bidi_paragraph_direction): For unibyte
+       buffers, return left-to-right.
+       (set_cursor_from_row): Consider candidate row a win if its glyph
+       represents a newline and point is on that newline.  Fixes cursor
+       positioning on the newline at EOL of R2L text within L2R
+       paragraph, and vice versa.
+       (try_cursor_movement): Check continued rows, in addition to
+       continuation rows.  Fixes unwarranted scroll when point enters a
+       continued line of R2L text within an L2R paragraph, or vice versa.
+       (cursor_row_p): Consider the case of point being equal to
+       MATRIX_ROW_END_CHARPOS.  Prevents cursor being stuck when moving
+       from the end of a short line to the beginning of a continued line
+       of R2L text within L2R paragraph.
+       (RECORD_MAX_MIN_POS): For max_pos, use IT_CHARPOS even for
+       composed characters.
+
+       * bidi.c (bidi_check_type): Use xassert.
+       (bidi_cache_iterator_state): Update the disp_pos and disp_prop_p
+       members.
+
+2011-08-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_get_type): Abort if we get zero as the bidi type of
+       a character.
+
+2011-08-23  Chong Yidong  <cyd@stupidchicken.com>
+
+       * nsfont.m (ns_otf_to_script): Fix typo.
+
+2011-08-22  Kenichi Handa  <handa@m17n.org>
+
+       * chartab.c (Fset_char_table_extra_slot): Do not inhibit setting a
+       extra slot even if the purpose is char-code-property-table.
+
+2011-08-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (redisplay_window): When computing centering_position,
+       account for the height of the header line.  (Bug#8874)
+
+       * dispnew.c (buffer_posn_from_coords): Use buf_charpos_to_bytepos
+       instead of CHAR_TO_BYTE.  Fixes a crash when a completion
+       candidate is selected by the mouse, and that candidate has a
+       composed character under the mouse.
+
+       * xdisp.c (x_produce_glyphs): Set it->nglyphs to 1.  Fixes pixel
+       coordinates reported by pos-visible-in-window-p for a composed
+       character in column zero.
+
+2011-08-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * cmds.c (Fself_insert_command): Mention post-self-insert-hook.
+
+2011-08-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (BUFFER_POS_REACHED_P): If this is a composition,
+       consider it a hit if to_charpos is anywhere in the range of the
+       composed buffer positions.
+
+2011-08-22  Chong Yidong  <cyd@stupidchicken.com>
+
+       * image.c (gif_load): Don't assume that each subimage has the same
+       dimensions as the base image.  Handle disposal method that is
+       "undefined" by the gif spec (Bug#9335).
+
+2011-08-20  Chong Yidong  <cyd@stupidchicken.com>
+
+       * eval.c (Fsignal): Handle `debug' symbol in error handler (Bug#9329).
+       (Fcondition_case): Document `debug' symbol in error handler.
+
+2011-08-19  Eli Zaretskii  <eliz@gnu.org>
+
+       * xfaces.c (face_at_buffer_position): Avoid repeated evaluation of
+       face ID by FACE_FROM_ID, and avoid a crash when mouse is moved
+       from an Org mode buffer to a Speedbar frame.
+
+       * xdisp.c (RECORD_MAX_MIN_POS): If the display element comes from
+       a composition, take its buffer position from IT->cmp_it.charpos.
+       Fixes cursor positioning at the beginning of a line that begins
+       with a composed character.
+
+2011-08-18  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_get_type): If bidi_type_table reports zero as the
+       character bidirectional type, use STRONG_L instead.  Fixes crashes
+       in a buffer produced by `describe-categories'.
+
+       * dispextern.h (struct bidi_it): Move disp_pos and disp_prop_p
+       members before the level stack, so they would be saved and
+       restored when copying iterator state.  Fixes incorrect reordering
+       around TABs covered by display properties.
+
+2011-08-18  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * process.c (Fnetwork_interface_list): Correctly determine buffer
+       size.
+
+2011-08-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * eval.c (internal_condition_case, internal_condition_case_1)
+       (internal_condition_case_2, internal_condition_case_n):
+       Remove unnecessary aborts (Bug#9081).
+
+2011-08-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * lread.c (Fload) [DOS_NT]: If `openp' returns -2, but the file
+       has no `load' handler, try opening the file locally.  (Bug#9311)
+
+2011-08-16  Ken Brown  <kbrown@cornell.edu>
+
+       * gmalloc.c: Expand comment.
+
 2011-08-16  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (set_cursor_from_row): Don't accept a previous candidate
        * unexcw.c ( __malloc_initialized): Declare external variable.
        (fixup_executable): Force the dumped emacs to reinitialize malloc.
 
-       * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo): New
-       variables.
+       * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo):
+       New variables.
        (malloc_initialize_1) [CYGWIN]: Prepare for reinitializing the
        dumped emacs.
        (_free_internal_nolock) [CYGWIN]: Ignore requests to free storage
 2011-08-14  Kenichi Handa  <handa@m17n.org>
 
        * process.c (create_process): Call setup_process_coding_systems
-       after the pid of the process is set to -1.
+       after the pid of the process is set to -1 (Bug#8162).
 
 2011-08-14  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (iterate_out_of_display_property): xassert that
        IT->position is set to within IT->object's boundaries.  Break from
        the loop as soon as EOB is reached; avoids infloops in redisplay
-       when IT->position is set up wrongly due to some bug.  Set
-       IT->current to match the bidi iterator unconditionally.
+       when IT->position is set up wrongly due to some bug.
+       Set IT->current to match the bidi iterator unconditionally.
        (push_display_prop): Allow GET_FROM_STRING as IT->method on
        entry.  Force push_it to save on the stack the current
        buffer/string position, to be restored by pop_it.  Fix flags in
 2011-08-08  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (forward_to_next_line_start): Allow to use the
-       no-display-properties-and-no-overlays under bidi display.  Set
-       disp_pos in the bidi iterator to avoid searches for display
+       no-display-properties-and-no-overlays under bidi display.
+       Set disp_pos in the bidi iterator to avoid searches for display
        properties and overlays.
 
 2011-08-08  Chong Yidong  <cyd@stupidchicken.com>
        * bidi.c <bidi_cache_total_alloc>: Now static.
        (bidi_initialize): Initialize bidi_cache_total_alloc.
 
-       *xdisp.c (display_line): Release buffer allocated for shelved bidi
+       * xdisp.c (display_line): Release buffer allocated for shelved bidi
        cache.  (Bug#9221)
 
        * bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total