ChangeLog 314 KB
Newer Older
1 2
2011-10-12  Paul Eggert  <eggert@cs.ucla.edu>

3 4 5
	* xdisp.c (set_cursor_from_row): Simplify conditionals,
	to pacify GCC 4.6.1 x86-64 with -O2 -Wstrict-overflow.

6 7 8
	* lread.c (read_escape): Allow hex escapes as large as ?\xfffffff.
	Some packages use them to denote characters with modifiers.

9 10 11 12 13 14
2011-10-11  Andreas Schwab  <schwab@linux-m68k.org>

	* lisp.h (GCPRO1_VAR, GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR)
	(GCPRO5_VAR, GCPRO6_VAR, UNGCPRO_VAR): Add whitespace to avoid
	matching a pp-number.  Rename parameter var to var1.

15 16 17 18
2011-10-11  Stefan Monnier  <monnier@iro.umontreal.ca>

	* minibuf.c (Finternal_complete_buffer): Fix last change (bug#9709).

Glenn Morris's avatar
Glenn Morris committed
19 20 21 22 23
2011-10-08  Glenn Morris  <rgm@gnu.org>

	* callint.c (Fcall_interactively): Give a more explicit error for the
	'c' case with a non-character input.  (Bug#8479)

24 25
2011-10-08  Eli Zaretskii  <eliz@gnu.org>

26 27
	* xdisp.c (hscroll_window_tree): Support hscroll in right-to-left
	lines.
28 29
	(set_cursor_from_row): Fix cursor positioning in mixed L2R+R2L
	lines that are hscrolled on the left.
30

31 32 33
	* dispnew.c (buffer_posn_from_coords): Account for a possible
	presence of header-line.  (Bug#4426)

34 35 36 37 38
2011-10-07  Stefan Monnier  <monnier@iro.umontreal.ca>

	* buffer.c (syms_of_buffer) <enable-multibyte-characters>: Don't
	advertise functionality which we discourage or doesn't work.

39 40 41 42 43 44 45 46 47 48 49 50
2011-10-07  Paul Eggert  <eggert@cs.ucla.edu>

	* alloc.c (GC_LISP_OBJECT_ALIGNMENT): Use offsetof, not __alignof__
	or sizeof.  __alignof__ gives the wrong answer on Fedora x86-64
	with GCC 4.6.1 when configured with CC='gcc -m32' --with-wide-int;
	this makes Emacs dump core during garbage collection on rare
	occasions.  sizeof is obviously inferior to offsetof here, so
	stick with offsetof.
	(GC_POINTER_ALIGNMENT): New macro.
	(mark_memory): Omit 3rd (offset) arg; caller changed.
	Don't assume EMACS_INT alignment is the same as pointer alignment.

51 52 53 54 55 56
2011-10-03  Stefan Monnier  <monnier@iro.umontreal.ca>

	* keyboard.c (read_key_sequence_remapped): New var.
	(read_key_sequence): Compute remapping in the right buffer.
	(command_loop_1): Use read_key_sequence's remapping directly.

57 58
2011-10-02  Stefan Monnier  <monnier@iro.umontreal.ca>

59 60 61 62
	* dired.c (file_name_completion): Don't expand file name.
	(Ffile_name_completion, Ffile_name_all_completions): Expand file name
	before checking file name handler.

63 64 65
	* minibuf.c (Finternal_complete_buffer): Only show internal buffers if
	they've been requested explicitly (bug#9591).

Chong Yidong's avatar
Chong Yidong committed
66
2011-10-01  Andreas Schwab  <schwab@linux-m68k.org>
67 68 69 70 71

	* keymap.c (Fsingle_key_description): Use make_specified_string
	instead of build_string to build string from push_key_description.
	(Bug#5193)

72 73
2011-09-30  Paul Eggert  <eggert@cs.ucla.edu>

74 75 76 77 78 79 80 81
	* buffer.h (struct buffer): Use time_t, not int, for a time stamp.
	This fixes a Y2038 bug on 64-bit hosts.
	* buffer.c (reset_buffer):
	* fileio.c (Fdo_auto_save, Fset_buffer_auto_saved)
	(Fclear_buffer_auto_save_failure):
	Use 0, not -1, to represent an unset failure time, since time_t
	might not be signed.

82 83 84 85 86 87 88 89 90 91 92 93 94 95
	Remove dependency on glibc malloc internals.
	* alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
	Move back here from lisp.h, but with their new implementations.
	(XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
	(XMALLOC_OVERRUN_SIZE_SIZE): Move these new lisp.h macros here.
	* charset.c (charset_table_init): New static var.
	(syms_of_charset): Use it instead of xmalloc.  This removes a
	dependency on glibc malloc internals.  See Eli Zaretskii's comment in
	<http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00815.html>.
	* lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
	Move back to alloc.c.
	(XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
	(XMALLOC_OVERRUN_SIZE_SIZE): Move to alloc.c.

96 97 98 99 100 101
2011-09-30  Jan Djärv  <jan.h.d@swipnet.se>

	* nsterm.m (windowDidResize): Call x_set_window_size only when
	ns_in_resize is true.  Otherwise set pixelwidth/height and
	call change_frame_size (Bug#9628).

102 103
2011-09-30  Paul Eggert  <eggert@cs.ucla.edu>

104 105 106 107
	Port --enable-checking=all to Fedora 14 x86-64.
	* charset.c (syms_of_charset): Also account for glibc malloc's
	internal overhead when calculating the initial malloc maximum.

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
	Port --enable-checking=all to Fedora 14 x86.
	* alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
	Move to lisp.h.
	(xmalloc_put_size, xmalloc_get_size, overrun_check_malloc)
	(overrun_check_realloc, overrun_check_free):
	Use XMALLOC_OVERRUN_SIZE_SIZE, not sizeof (size_t).
	That way, xmalloc returns a properly-aligned pointer even if
	XMALLOC_OVERRUN_CHECK is defined.  The old debugging code happened
	to align OK on typical 64-bit hosts, but not on Fedora 14 x86.
	* charset.c (syms_of_charset): Take XMALLOC_OVERRUN_CHECK_OVERHEAD
	into account when calculating the initial malloc maximum.
	* lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
	Move here from alloc.c, so that charset.c can use it too.
	Properly align; the old code wasn't right for common 32-bit hosts
	when configured with --enable-checking=all.
	(XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
	(XMALLOC_OVERRUN_SIZE_SIZE): New macros.

Eli Zaretskii's avatar
Eli Zaretskii committed
126 127
2011-09-29  Eli Zaretskii  <eliz@gnu.org>

128
	* sysdep.c (snprintf) [!EOVERFLOW]: If EOVERFLOW is not defined,
Eli Zaretskii's avatar
Eli Zaretskii committed
129 130
	use EDOM.

131 132 133 134 135 136 137 138 139
2011-09-28  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (compute_display_string_end): If there's no display
	string at CHARPOS, return -1.

	* bidi.c (bidi_fetch_char): When compute_display_string_end
	returns a negative value, treat the character as a normal
	character not covered by a display string.  (Bug#9624)

Juanma Barranquero's avatar
Juanma Barranquero committed
140 141 142 143
2011-09-28  Juanma Barranquero  <lekktu@gmail.com>

	* lread.c (Fread_from_string): Fix typo in docstring.

144 145 146 147 148
2011-09-27  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (handle_invisible_prop): If invisible text ends on a
	newline, reseat the iterator instead of bidi-iterating there one
	character at a time.  (Bug#9610)
149 150
	(BUFFER_POS_REACHED_P, move_it_in_display_line_to): Bail when past
	TO_CHARPOS if the bidi iterator is at base embedding level.
151

152 153 154 155 156
2011-09-27  Andreas Schwab  <schwab@linux-m68k.org>

	* lread.c (readevalloop): Use correct code for NBSP.
	(read1): Likewise.  (Bug#9608)

157 158 159 160 161
2011-09-25  Michael Albinus  <michael.albinus@gmx.de>

	* dbusbind.c (Fdbus_register_signal): When service is not
	registered, use nil in Vdbus_registered_objects_table.  (Bug#9581)

162 163 164 165
2011-09-25  Glenn Morris  <rgm@gnu.org>

	* buffer.c (truncate-lines): Doc fix.

166 167 168 169 170
2011-09-24  Chong Yidong  <cyd@stupidchicken.com>

	* window.c (Fwindow_prev_buffers, Fset_window_prev_buffers)
	(Fset_window_next_buffers): Doc fix.

171 172 173 174
2011-09-24  Glenn Morris  <rgm@gnu.org>

	* minibuf.c (read_minibuf): Disable line truncation.  (Bug#5715)

175 176
2011-09-24  Paul Eggert  <eggert@cs.ucla.edu>

177 178
	Fix minor problems found by static checking.
	* xdisp.c (string_from_display_spec): Don't assume vecsize fits in int.
179 180
	* indent.c (Fvertical_motion): Fix == vs = typo.

181 182
2011-09-24  Eli Zaretskii  <eliz@gnu.org>

183 184
	* dispnew.c (syms_of_display) <redisplay-dont-pause>:
	Default value is now t.  Doc fix.
185

186
	* indent.c (Fvertical_motion): Compute and apply the overshoot
187
	logic when moving up, not only when moving down.  Fix the
188
	confusing name and values of the it_overshoot_expected variable;
189
	logic changes accordingly.  (Bug#9254) (Bug#9549)
190 191 192 193 194 195

	* xdisp.c (pos_visible_p): Produce correct pixel coordinates when
	CHARPOS is covered by a display string which includes newlines.
	(move_it_vertically_backward): Avoid inflooping when START_CHARPOS
	is covered by a display string with embedded newlines.

196 197 198 199
2011-09-24  Michael Albinus  <michael.albinus@gmx.de>

	* dbusbind.c (Fdbus_register_signal): Add match rule to
	Vdbus_registered_objects_table.  (Bug#9581)
200 201
	(Fdbus_register_method, Vdbus_registered_objects_table):
	Fix docstring.
202

203 204
2011-09-24  Jim Meyering  <meyering@redhat.com>

205
	do not ignore write error for any output size
206 207 208 209 210 211 212 213 214 215 216 217
	The previous change was incomplete.
	While it makes emacs --batch detect the vast majority of stdout
	write failures, errors were still ignored whenever the output size is
	k * (BUFSIZ+1) - 4.  E.g., on a system with BUFSIZ of 4096,
	  $ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \
	      && echo FAIL: ignored write error
	  FAIL: ignored write error
	  $ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \
	      && echo FAIL: ignored write error
	  FAIL: ignored write error
	* emacs.c (Fkill_emacs): Also test ferror.  (Bug#9574)

218 219 220 221 222
2011-09-23  Andreas Schwab  <schwab@linux-m68k.org>

	* emacs.c (Fkill_emacs): In noninteractive mode exit
	non-successfully if a write error occurred on stdout.  (Bug#9574)

223 224 225 226 227 228 229 230
2011-09-21  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (pop_it): Allow it->object that is a cons cell to pass
	the xassert test.

	* dispextern.h (struct it): Update the comment documenting what
	can it->OBJECT be.

231 232 233 234 235 236 237
2011-09-20  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): If the row ends in a newline from
	a display string, extend search for cursor position to end of row.
	(find_row_edges): If the row ends in a newline from a display
	string, increment its MATRIX_ROW_END_CHARPOS by one.  (Bug#9549)
	Handle the case of a display string with multiple newlines.
238 239 240
	(Fcurrent_bidi_paragraph_direction): Fix search for previous
	non-empty line.  Fixes confusing cursor motion with arrow keys at
	the beginning of a line that starts with whitespace.
241

242 243 244 245 246
2011-09-19  Lars Magne Ingebrigtsen  <larsi@gnus.org>

	* lread.c (Fread_from_string): Document what FINAL-STRING-INDEX is
	(bug#9493).

247 248 249 250 251
2011-09-18  Chong Yidong  <cyd@stupidchicken.com>

	* xfns.c (Fx_create_frame): Handle the bitmapIcon resource as
	boolean (Bug#9154).

Eli Zaretskii's avatar
Eli Zaretskii committed
252 253 254 255 256 257 258
2011-09-18  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (display_line): Record maximum and minimum buffer
	positions even if no glyphs were produced (e.g., by a zero-width
	stretch).  Fixes bug#9530 on a TTY.  Under word-wrap, don't record
	buffer positions that will be removed from the glyph row because
	they don't fit.
259 260 261
	(produce_stretch_glyph): Fix a bug in :align-to on a TTY when the
	column is beyond frame width: don't subtract 1 "pixel" when
	computing width of the stretch.
262 263 264
	(reseat_at_next_visible_line_start): Undo the change made on
	2011-09-17 that saved paragraph information and restored it after
	the call to `reseat'.  (Bug#9545)
Eli Zaretskii's avatar
Eli Zaretskii committed
265

266
2011-09-18  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
267 268 269 270

	* xdisp.c (expose_window): Save original value of phys_cursor_on_p
	and turn window cursor on if cleared (Bug#9415).

271
2011-09-18  Andreas Schwab  <schwab@linux-m68k.org>
272 273 274 275

	* search.c (boyer_moore): Take unibyte characters from pattern
	literally.  (Bug#9458)

276 277 278 279
2011-09-18  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (reseat_at_next_visible_line_start): Fix last change.

280 281
2011-09-18  Paul Eggert  <eggert@cs.ucla.edu>

282 283 284 285
	Fix minor problem found by static checking.
	* xdisp.c (reseat_at_next_visible_line_start): Mark locals as
	initialized, to pacify gcc -Wuninitialized.

286 287 288 289 290
	* fileio.c: Report proper errno when syscall falls.
	(Finsert_file_contents): Save and restore errno,
	so that report_file_error outputs the correct diagnostic.
	(Fwrite_region) [CLASH_DETECTION]: Likewise.

291 292 293 294
2011-09-18  Eli Zaretskii  <eliz@gnu.org>

	* .gdbinit (pgx): Fix references to fields of `struct glyph'.

295 296 297 298 299
2011-09-17  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (produce_stretch_glyph): Another fix for changes made on
	2011-08-30T17:32:44Z!eliz@gnu.org.  (Bug#9530)

300 301
2011-09-17  Eli Zaretskii  <eliz@gnu.org>

302 303 304 305 306 307 308 309 310 311 312
	* xdisp.c (reseat_at_next_visible_line_start): Keep information
	about the current paragraph and restore it after the call to
	reseat.

	* bidi.c (MAX_PARAGRAPH_SEARCH): New macro.
	(bidi_find_paragraph_start): Search back for paragraph beginning
	at most MAX_PARAGRAPH_SEARCH lines; if not found, return BEGV_BYTE.
	(bidi_move_to_visually_next): Only trigger paragraph-related
	computations when the last character is a newline or at EOB, not
	just any NEUTRAL_B.  (Bug#9470)

313 314 315
	* xdisp.c (set_cursor_from_row): Don't invoke special treatment of
	truncated lines if point is covered by a display string.  (Bug#9524)

316 317 318 319 320 321 322 323
2011-09-16  Paul Eggert  <eggert@cs.ucla.edu>

	* xselect.c: Relax test for outgoing X longs (Bug#9498).
	(cons_to_x_long): New function.
	(lisp_data_to_selection_data): Use it.  Correct the test for
	short-versus-long data; it was negated.  Break out of vector
	loop, for efficiency, when a long datum is discovered.

324 325 326 327
2011-09-16  Stefan Monnier  <monnier@iro.umontreal.ca>

	* eval.c (Fquote): Document its non-consing behavior (bug#9482).

328 329 330 331 332
2011-09-16  Eli Zaretskii  <eliz@gnu.org>

	* image.c (tiff_handler): Work around a bug in MinGW GCC 3.x (see
	GCC PR/17406) by declaring this function with external scope.

333 334 335 336 337
2011-09-15  Paul Eggert  <eggert@cs.ucla.edu>

	* editfns.c (Fformat): Fix bug in text-property fix (Bug#9514).
	Don't mishandle (length (format "%%")) and (format "%4000s%%" "").

338 339 340 341
2011-09-15  Andreas Schwab  <schwab@linux-m68k.org>

	* editfns.c (Fformat): Correctly handle text properties on "%%".

342 343 344 345 346 347 348 349 350 351
2011-09-15  Eli Zaretskii  <eliz@gnu.org>

	* xterm.c (x_draw_composite_glyph_string_foreground):
	* w32term.c (x_draw_composite_glyph_string_foreground):
	* term.c (encode_terminal_code):
	* composite.c (composition_update_it, get_composition_id):
	* xdisp.c (get_next_display_element)
	(fill_composite_glyph_string): Add comments about special meaning
	of TAB characters in a composition.

352 353 354
2011-09-15  Paul Eggert  <eggert@cs.ucla.edu>

	* editfns.c (Fformat): Fix off-by-1 bug for "%%b" (Bug#9514).
Paul Eggert's avatar
Paul Eggert committed
355 356
	This occurs when processing a multibyte format.
	Problem reported by Wolfgang Jenker.
357

358 359 360 361 362
2011-09-15  Johan Bockgård  <bojohan@gnu.org>

	* xdisp.c (try_cursor_movement): Only check for exact match if
	cursor hpos found by set_cursor_from_row is valid.  (Bug#9495)

Paul Eggert's avatar
Paul Eggert committed
363 364 365 366 367 368 369 370 371 372
2011-09-14  Paul Eggert  <eggert@cs.ucla.edu>

	Remove unused external symbols.
	* dispextern.h (calc_pixel_width_or_height): Remove decl.
	* xdisp.c (calc_pixel_width_or_height): Now static.
	* doprnt.c (exprintf) [! (HAVE_X_WINDOWS && USE_X_TOOLKIT)]: Remove.
	* indent.c (check_display_width):
	* w32term.c: Fix comment to match code.
	* xterm.c, xterm.h (x_catching_errors): Remove.

373 374 375 376 377 378 379 380 381 382
2011-09-14  Paul Eggert  <eggert@cs.ucla.edu>

	* xselect.c: Use signed conversions more consistently (Bug#9498).
	(selection_data_to_lisp_data): Assume incoming selection data are
	signed integers, not unsigned.  This is to be consistent with
	outgoing selection data, which was modified to use signed integers
	in as part of the fix to Bug#9196 in response to Jan D.'s comment
	in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#32> that X11
	expects long, not unsigned long.

383 384 385 386 387 388
2011-09-14  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (try_window_reusing_current_matrix): Fix incorrect
	computation of loop end.  Reported by Johan Bockgård
	<bojohan@gnu.org>.

389 390 391 392
2011-09-13  Chong Yidong  <cyd@stupidchicken.com>

	* frame.c (Fother_visible_frames_p): Function deleted.

393 394 395 396 397
2011-09-12  Eli Zaretskii  <eliz@gnu.org>

	* indent.c (compute_motion): Process display vector front to back
	rather than the other way around.  (Bug#2496)

398 399 400 401
2011-09-12  Stefan Monnier  <monnier@iro.umontreal.ca>

	* fileio.c (Finsert_file_contents): Don't assume beg_offset is 0.

402 403 404 405
2011-09-11  Chong Yidong  <cyd@stupidchicken.com>

	* minibuf.c (Fread_from_minibuffer): Doc fix.

406 407 408 409 410
2011-09-11  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (produce_stretch_glyph): Fix a typo made in changes from
	2011-08-30T17:32:44Z!eliz@gnu.org.  (Bug#9475)

411 412 413 414 415
2011-09-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>

	* fileio.c (Fvisited_file_modtime): Document `(-1 65535)' as a
	value for non-existent files.

416 417 418 419 420 421 422 423
2011-09-11  Eli Zaretskii  <eliz@gnu.org>

	* fileio.c (Finsert_file_contents): If the file cannot be opened,
	set its "size" to -1.  This will set the modtime_size field of
	the corresponding buffer to -1, which is what
	verify-visited-file-modtime expects for files that do not exist.
	(Bug#9139)

424 425 426 427 428 429 430 431 432
2011-09-11  Paul Eggert  <eggert@cs.ucla.edu>

	* keymap.h (KEY_DESCRIPTION_SIZE, push_key_description): Move decls
	here ...
	* lisp.h: ... from here.  push_key_description is no longer
	defined in keyboard.c, so its declaration should not be in
	lisp.h's "Defined in keyboard.c" section, and KEY_DESCRIPTION_SIZE
	logically belongs with push_key_description.

433 434 435 436 437 438
2011-09-10  Paul Eggert  <eggert@cs.ucla.edu>

	* buffer.h: Include <sys/types.h> instead of <time.h>.
	Otherwise, off_t wasn't defined on FreeBSD 9.0-BETA2 i386.
	Problem reported by Herbert J. Skuhra.

439 440 441 442 443
2011-09-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>

	* xml.c (parse_region): Make the parsing work for
	non-comment-starting XML files again (bug#9144).

444 445 446 447 448
2011-09-10  Andreas Schwab  <schwab@linux-m68k.org>

	* image.c (gif_load): Fix calculation of bottom and right corner.
	(Bug#9468)

449 450 451 452 453
2011-09-10  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (MAX_DISP_SCAN): Decrease to 250.  Prevents sluggish
	redisplay in small windows.

454 455 456 457
2011-09-09  Eli Zaretskii  <eliz@gnu.org>

	* frame.c (x_report_frame_params): Cast to avoid compiler warnings.

458 459 460 461 462
2011-09-08  Martin Rudalics  <rudalics@gmx.at>

	* window.c (Fset_window_prev_buffers, Fset_window_next_buffers):
	Operate on live windows only.

463 464 465 466
2011-09-08  Juanma Barranquero  <lekktu@gmail.com>

	* emacs.c (my_heap_start): #ifdef to avoid warnings when unused.

467 468 469 470 471
2011-09-07  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (move_it_in_display_line_to): Call RESTORE_IT on ppos_it
	only under bidi iteration.

472 473 474 475
2011-09-07  Jan Djärv  <jan.h.d@swipnet.se>

	* gtkutil.c (xg_make_tool_item): Insert comment about eventbox.

476 477 478 479 480 481 482 483 484 485 486 487 488 489
2011-09-06  Paul Eggert  <eggert@cs.ucla.edu>

	isnan: Fix porting problem to Solaris 10 with bundled gcc.
	Without this fix, the command to link temacs failed due to an
	undefined symbol __builtin_isnan.  This is because
	/usr/include/iso/math_c99.h #defines isnan(x) to
	__builtin_isnan(x), but the bundled gcc, which identifies itself
	as gcc 3.4.3 (csl-sol210-3_4-branch+sol_rpath), does not have
	a __builtin_isnan.
	* floatfns.c (isnan): #undef, and then #define to a clone of
	what's in data.c.
	(Fisnan): Always define, since it's always available now.
	(syms_of_floatfns): Always define isnan at the Lisp level.

Paul Eggert's avatar
Paul Eggert committed
490
2011-09-06  Paul Eggert  <eggert@cs.ucla.edu>
Paul Eggert's avatar
Paul Eggert committed
491 492 493

	* Makefile.in (gl-stamp): move-if-change now in build-aux (Bug#9169).

Paul Eggert's avatar
Paul Eggert committed
494
2011-09-06  Paul Eggert  <eggert@cs.ucla.edu>
495

Paul Eggert's avatar
Paul Eggert committed
496
	* fileio.c: Fix bugs with large file offsets (Bug#9428).
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
	The previous code assumed that file offsets (off_t values) fit in
	EMACS_INT variables, which is not true on typical 32-bit hosts.
	The code messed up by falsely reporting buffer overflow in cases
	such as (insert-file-contents "big" nil 1 2) into an empty buffer
	when "big" contains more than 2**29 bytes, even though this
	inserts just one byte and does not overflow the buffer.
	(Finsert_file_contents): Store file offsets as off_t
	values, not as EMACS_INT values.  Check for overflow when
	converting between EMACS_INT and off_t.  When checking for
	buffer overflow or for overlap, take the offsets into account.
	Don't use EMACS_INT for small values where int suffices.
	When checking for overlap, fix a typo: ZV was used where
	ZV_BYTE was intended.
	(Fwrite_region): Don't assume off_t fits into 'long'.
	* buffer.h (struct buffer.modtime_size): Now off_t, not EMACS_INT.

513 514 515 516
2011-09-05  Michael Albinus  <michael.albinus@gmx.de>

	* dbusbind.c (xd_signature_cat): Rename from signature_cat.

Paul Eggert's avatar
Paul Eggert committed
517
2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
Paul Eggert's avatar
Paul Eggert committed
518

Paul Eggert's avatar
Paul Eggert committed
519
	sprintf-related integer and memory overflow issues (Bug#9412).
520 521

	* doprnt.c (doprnt): Support printing ptrdiff_t and intmax_t values.
522
	(esprintf, exprintf, evxprintf): New functions.
523 524 525 526 527 528 529 530 531 532 533 534 535
	* 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.
536
	(esprintf, exprintf, evxprintf): New decls.
537 538
	* window.h (command_loop_level, minibuf_level): Reflect API changes.

539 540
	* dbusbind.c (signature_cat): New function.
	(xd_signature, Fdbus_register_signal):
541 542
	Do not overrun buffer; instead, report string overflow.

543 544 545
	* dispnew.c (add_window_display_history): Don't overrun buffer.
	Truncate instead; this is OK since it's just a log.

546 547 548 549
	* editfns.c (Fcurrent_time_zone): Don't overrun buffer
	even if the time zone offset is outlandishly large.
	Don't mishandle offset == INT_MIN.

550 551 552
	* emacs.c (main) [NS_IMPL_COCOA]: Don't overrun buffer
	when creating daemon; the previous buffer-overflow check was incorrect.

553 554 555
	* eval.c (verror): Simplify by rewriting in terms of evxprintf,
	which has the guts of the old verror function.

556 557 558
	* filelock.c (lock_file_1, lock_file): Don't blindly alloca long name;
	use SAFE_ALLOCA instead.  Use esprintf to avoid int-overflow issues.

559 560
	* font.c: Include <float.h>, for DBL_MAX_10_EXP.
	(font_unparse_xlfd): Don't blindly alloca long strings.
561
	Don't assume XINT result fits in int, or that XFLOAT_DATA * 10
562
	fits in int, when using sprintf.  Use single snprintf to count
563 564 565 566 567 568
	length of string rather than counting it via multiple sprintfs;
	that's simpler and more reliable.
	(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.

569 570 571
	* fontset.c (num_auto_fontsets): Now printmax_t, not int.
	(fontset_from_font): Print it.

572 573 574 575 576 577 578 579 580 581
	* frame.c (tty_frame_count): Now printmax_t, not int.
	(make_terminal_frame, set_term_frame_name): Print it.
	(x_report_frame_params): In X, window IDs are unsigned long,
	not signed long, so print them as unsigned.
	(validate_x_resource_name): Check for implausibly long names,
	and don't assume name length fits in 'int'.
	(x_get_resource_string): Don't blindly alloca invocation name;
	use SAFE_ALLOCA.  Use esprintf, not sprintf, in case result does
	not fit in int.

582 583
	* gtkutil.c: Include <float.h>, for DBL_MAX_10_EXP.
	(xg_check_special_colors, xg_set_geometry):
584 585
	Make sprintf buffers a bit bigger, to avoid potential buffer overrun.

586 587 588
	* lread.c (dir_warning): Don't blindly alloca buffer; use SAFE_ALLOCA.
	Use esprintf, not sprintf, in case result does not fit in int.

589 590 591 592 593 594
	* macros.c (executing_kbd_macro_iterations): Now EMACS_INT, not int.
	(Fend_kbd_macro): Don't mishandle MOST_NEGATIVE_FIXNUM by treating
	it as a large positive number.
	(Fexecute_kbd_macro): Don't assume repeat count fits in int.
	* macros.h (executing_kbd_macro_iterations): Now EMACS_INT, not int.

595 596 597
	* nsterm.m ((NSSize)windowWillResize): Use esprintf, not sprintf,
	in case result does not fit in int.

598 599 600 601 602 603 604 605
	* print.c (float_to_string): Detect width overflow more reliably.
	(print_object): Make sprintf buffer a bit bigger, to avoid potential
	buffer overrun.  Don't assume list length fits in 'int'.  Treat
	print length of 0 as 0, not as infinity; to be consistent with other
	uses of print length in this function.  Don't overflow print length
	index.  Don't assume hash table size fits in 'long', or that
	vectorlike size fits in 'unsigned long'.

606 607 608
	* process.c (make_process): Use printmax_t, not int, to format
	process-name gensyms.

609 610
	* sysdep.c (snprintf) [! HAVE_SNPRINTF]: New function.

611 612 613
	* term.c (produce_glyphless_glyph): Make sprintf buffer a bit bigger
	to avoid potential buffer overrun.

614 615 616
	* xfaces.c (x_update_menu_appearance): Don't overrun buffer
	if X resource line is longer than 512 bytes.

617 618 619
	* xfns.c (x_window): Make sprintf buffer a bit bigger
	to avoid potential buffer overrun.

620 621
	* xterm.c (x_io_error_quitter): Don't overrun sprintf buffer.

622 623
	* xterm.h (x_check_errors): Add ATTRIBUTE_FORMAT_PRINTF.

624 625
2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>

626
	Integer overflow fixes for scrolling, etc.
Paul Eggert's avatar
Paul Eggert committed
627 628
	Without these, Emacs silently mishandles large integers sometimes.
	For example, "C-u 4294967297 M-x recenter" was treated as if
629 630
	it were "C-u 1 M-x recenter" on a typical 64-bit host.

Paul Eggert's avatar
Paul Eggert committed
631 632
	* xdisp.c (try_window_id): Check Emacs fixnum range before
	converting to 'int'.
Paul Eggert's avatar
Paul Eggert committed
633

Paul Eggert's avatar
Paul Eggert committed
634
	* window.c (window_scroll_line_based, Frecenter):
635 636 637 638 639 640 641 642
	Check that an Emacs fixnum is in range before assigning it to 'int'.
	(Frecenter, Fmove_to_window_line): Use EMACS_INT, not int, for
	values converted from Emacs fixnums.
	(Frecenter): Don't wrap around a line count if it is out of 'int'
	range; instead, treat it as an extreme value.
	(Fset_window_configuration, compare_window_configurations):
	Use ptrdiff_t, not int, for index that might exceed 2 GiB.

Paul Eggert's avatar
Paul Eggert committed
643 644 645
	* search.c (Freplace_match): Use ptrdiff_t, not int, for indexes
	that can exceed INT_MAX.  Check that EMACS_INT value is in range
	before assigning it to the (possibly-narrower) index.
646 647
	(match_limit): Don't assume that a fixnum can fit in 'int'.

Paul Eggert's avatar
Paul Eggert committed
648
	* print.c (print_object): Use ptrdiff_t, not int, for index that can
Paul Eggert's avatar
Paul Eggert committed
649 650
	exceed INT_MAX.

Paul Eggert's avatar
Paul Eggert committed
651
	* indent.c (position_indentation): Now takes ptrdiff_t, not int.
652 653 654 655
	(Fvertical_motion): Don't wrap around LINES values that don't fit
	in 'int'.  Instead, treat them as extreme values.  This is good
	enough for windows, which can't have more than INT_MAX lines anyway.

656 657
2011-09-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>

658 659
	* Require libxml/parser.h to avoid compilation warning.

660 661 662 663 664
	* emacs.c (shut_down_emacs): Call xmlCleanupParser on shutdown.

	* xml.c (parse_region): Don't call xmlCleanupParser after parsing,
	since this reportedly can destroy thread storage.

665 666 667 668 669
2011-08-30  Chong Yidong  <cyd@stupidchicken.com>

	* syntax.c (find_defun_start): Update all cache variables if
	exiting early (Bug#9401).

670 671
2011-08-30  Eli Zaretskii  <eliz@gnu.org>

672 673
	* image.c (x_bitmap_pixmap): Cast to int to avoid compiler warnings.

674 675 676 677 678 679 680
	* xdisp.c (produce_stretch_glyph): No longer static, compiled also
	when HAVE_WINDOW_SYSTEM is not defined.  Support both GUI and TTY
	frames.  Call tty_append_glyph in the TTY case.  (Bug#9402)

	* term.c (tty_append_glyph): New function.
	(produce_stretch_glyph): Static function and its prototype deleted.

681 682
	* dispextern.h (produce_stretch_glyph, tty_append_glyph):
	Add prototypes.
683

684 685 686 687 688
2011-08-29  Paul Eggert  <eggert@cs.ucla.edu>

	* image.c (parse_image_spec): Check for nonnegative, not for positive,
	when checking :margin (Bug#9390).
	(IMAGE_NON_NEGATIVE_INTEGER_VALUE_OR_PAIR):
689
	Rename from IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,
690 691
	so that the name doesn't mislead.  All uses changed.

692 693 694 695 696
2011-08-28  Johan Bockgård  <bojohan@gnu.org>

	* term.c (init_tty) [HAVE_GPM]: Move mouse settings after
	set_tty_hooks.

697 698 699 700 701 702 703
2011-08-27  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (move_it_to): Don't bail out early when reaching
	position beyond to_charpos, if we are scanning backwards.
	(move_it_vertically_backward): When DY == 0, make sure we get to
	the first character in the line after the newline.

704 705 706 707 708 709 710 711 712 713
2011-08-27  Paul Eggert  <eggert@cs.ucla.edu>

	* ccl.c: Improve and simplify overflow checking (Bug#9196).
	(ccl_driver): Do not generate an out-of-range pointer.
	(Fccl_execute_on_string): Remove unnecessary check for
	integer overflow, noted by Stefan Monnier in
	<http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00979.html>.
	Remove a FIXME that didn't need fixing.
	Simplify the newly-introduced buffer reallocation code.

714 715 716 717
2011-08-27  Juanma Barranquero  <lekktu@gmail.com>

	* makefile.w32-in ($(BLD)/alloc.$(O)): Depend on lib/verify.h.

Paul Eggert's avatar
Paul Eggert committed
718
2011-08-26  Paul Eggert  <eggert@cs.ucla.edu>
719

Paul Eggert's avatar
Paul Eggert committed
720
	Integer and memory overflow issues (Bug#9196).
721

722 723 724 725 726
	* doc.c (get_doc_string): Rework so that
	get_doc_string_buffer_size is the actual buffer size, rather than
	being 1 less than the actual buffer size; this makes xpalloc more
	convenient.

Paul Eggert's avatar
Paul Eggert committed
727 728 729 730
	* image.c (x_allocate_bitmap_record, cache_image):
	* xselect.c (Fx_register_dnd_atom):
	Simplify previous changes by using xpalloc.

731 732 733
	* buffer.c (overlay_str_len): Now ptrdiff_t, not EMACS_INT,
	since either will do and ptrdiff_t is convenient with xpalloc.

734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774
	* charset.c (charset_table_size)
	(struct charset_sort_data.priority): Now ptrdiff_t.
	(charset_compare): Don't overflow if priorities differ greatly.
	(Fsort_charsets): Don't assume list length fits in int.
	Check for size-calculation overflow when allocating sort data.
	(syms_of_charset): Allocate an initial charset table that is
	just under 64 KiB, to avoid problems with glibc malloc and mmap.

	* cmds.c (internal_self_insert): Check for size-calculation overflow.

	* composite.h (struct composition.glyph_len): Now int, not unsigned.
	The actual value is always <= INT_MAX, and leaving it unsigned made
	overflow checking harder.

	* dispextern.h (struct glyph_matrix.rows_allocated)
	(struct face_cache.size): Now ptrdiff_t, for convenience in use
	with xpalloc.  The values are still always <= INT_MAX.

	* indent.c (compute_motion): Adjust to region_cache_forward sig change.

	* lisp.h (xnmalloc, xnrealloc, xpalloc): New decls.
	(SAFE_NALLOCA): New macro.

	* region-cache.c (struct boundary.pos, find_cache_boundary)
	(move_cache_gap, insert_cache_boundary, delete_cache_boundaries)
	(set_cache_region, invalidate_region_cache)
	(revalidate_region_cache, know_region_cache, region_cache_forward)
	(region_cache_backward, pp_cache):
	Use ptrdiff_t, not EMACS_INT, since either will do.  This is needed
	so that ptrdiff_t * can be passed to xpalloc.
	(struct region_cache): Similarly, for gap_start, gap_len, cache_len,
	beg_unchanged, end_unchanged, buffer_beg, buffer_end members.
	(pp_cache): Don't assume cache_len fits in int.
	* region-cache.h: Adjust extern decls to match.

	* search.c (scan_buffer, Freplace_match): Use ptrdiff_t, not
	EMACS_INT, since either will do, for xpalloc.

	* alloc.c: Include verify.h, and check that int fits in ptrdiff_t.
	(xnmalloc, xnrealloc, xpalloc): New functions.

775 776 777 778
	* bidi.c (bidi_shelve_header_size): New constant.
	(bidi_cache_ensure_space, bidi_shelve_cache): Use it.
	(bidi_cache_ensure_space): Avoid integer overflow when allocating.

779
	* bidi.c (bidi_cache_shrink):
780 781 782 783
	* buffer.c (overlays_at, overlays_in, record_overlay_string)
	(overlay_strings):
	Don't update size of array until after memory allocation succeeds,
	because xmalloc/xrealloc may not return.
784 785 786 787
	(struct sortstrlist.bytes): Now ptrdiff_t, as EMACS_INT doesn't help
	now that we have proper integer overflow checking.
	(record_overlay_string, overlay_strings): Catch overflows when
	calculating size of overlay_str_buf.
788

789 790 791 792 793
	* callproc.c (Fcall_process): Check for size overflow when
	calculating size of args2.
	(child_setup): Avoid overflow by using size_t rather than ptrdiff_t.
	Normally we prefer signed values, but sticking with ptrdiff_t would
	require adding more-complicated checks.
794 795 796 797

	* ccl.c (Fccl_execute_on_string): Check for memory overflow.
	Use ptrdiff_t rather than EMACS_INT where ptrdiff_t will do.
	Redo buffer-overflow calculations to avoid integer overflow.
798
	Add a FIXME comment where memory seems to be over-allocated.
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837

	* character.c (Fstring): Check for size-calculation overflow.

	* coding.c (produce_chars): Redo buffer-overflow calculations to avoid
	unnecessary integer overflow.  Check for size overflow.
	(encode_coding_object): Don't update size until xmalloc succeeds.

	* composite.c (get_composition_id): Check for overflow in glyph
	length calculations.

	Integer and memory overflow fixes for display code.
	* dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int.
	* dispnew.c (adjust_glyph_matrix, realloc_glyph_pool)
	(scrolling_window): Check for overflow in size calculations.
	(line_draw_cost, realloc_glyph_pool, add_row_entry):
	Don't assume glyph table len fits in int.
	(struct row_entry.bucket, row_entry_pool_size, row_entry_idx)
	(row_table_size): Now ptrdiff_t, not int.
	(scrolling_window): Avoid overflow in size calculations.
	Don't update size until allocation succeeds.
	* fns.c (concat): Check for overflow in size calculations.
	(next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT.
	* lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
	(NEXT_ALMOST_PRIME_LIMIT): New constant.

	* doc.c (get_doc_string_buffer_size): Now ptrdiff_t, not int.
	(get_doc_string): Check for size calculation overflow.
	Don't update size until allocation succeeds.
	(get_doc_string, Fsubstitute_command_keys): Use ptrdiff_t, not
	EMACS_INT, where ptrdiff_t will do.
	(Fsubstitute_command_keys): Check for string overflow.

	* editfns.c (set_time_zone_rule): Don't assume environment length
	fits in int.
	(message_length): Now ptrdiff_t, not int.
	(Fmessage_box): Don't update size until allocation succeeds.
	Don't assume message length fits in int.
	(Fformat): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t will do.

838 839 840 841
	* emacs.c (main): Do not reallocate argv, since there is a null at
	the end that can be overwritten, and this way there's no need to
	worry about size-calculation overflow.
	(sort_args): Check for size-calculation overflow.
842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880

	* eval.c (init_eval_once, grow_specpdl): Don't update size until
	alloc succeeds.
	(call_debugger, grow_specpdl): Redo calculations to avoid overflow.

	* frame.c (set_menu_bar_lines, x_set_frame_parameters)
	(x_set_scroll_bar_width, x_figure_window_size):
	Check for integer overflow.
	(x_set_alpha): Do not assume XINT fits in int.

	* frame.h (struct frame): Use int, not EMACS_INT, where int works.
	This is for the members text_lines, text_cols, total_lines, total_cols,
	where the system imposes an 'int' limit.

	* fringe.c (Fdefine_fringe_bitmap):
	Don't update size until alloc works.

	* ftfont.c (ftfont_get_open_type_spec, setup_otf_gstring)
	(ftfont_shape_by_flt): Check for integer overflow in size calculations.

	* gtkutil.c (get_utf8_string, xg_store_widget_in_map):
	Check for size-calculation overflow.
	(get_utf8_string): Use ptrdiff_t, not size_t, where either will
	do, as we prefer signed integers.
	(id_to_widget.max_size, id_to_widget.used)
	(xg_store_widget_in_map, xg_remove_widget_from_map)
	(xg_get_widget_from_map, xg_get_scroll_id_for_window)
	(xg_remove_scroll_bar, xg_update_scrollbar_pos):
	Use and return ptrdiff_t, not int.
	(xg_gtk_scroll_destroy): Don't assume ptrdiff_t fits in int.
	* gtkutil.h: Change prototypes to match the above.

	* image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): Remove; these
	are duplicate now that they've been promoted to lisp.h.
	(x_allocate_bitmap_record, x_alloc_image_color)
	(make_image_cache, cache_image, xpm_load):
	Don't update size until alloc is done.
	(xpm_load, lookup_rgb_color, lookup_pixel_color, x_to_xcolors)
	(x_detect_edges):
881
	Check for size calculation overflow.
882 883 884
	(ct_colors_allocated_max): New constant.
	(x_to_xcolors, x_detect_edges): Reorder multiplicands to avoid
	overflow.
885

886 887 888 889 890
	* keyboard.c (read_char, menu_bar_items, tool_bar_items)
	(read_char_x_menu_prompt, read_char_minibuf_menu_width)
	(read_char_minibuf_menu_prompt, follow_key, read_key_sequence):
	Use ptrdiff_t, not int, to count maps.
	(read_char_minibuf_menu_prompt): Check for overflow in size
891 892
	calculations.  Don't update size until allocation succeeds.
	Redo calculations to avoid overflow.
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943
	* keyboard.h: Change prototypes to match the above.

	* keymap.c (cmm_size, current_minor_maps): Use ptrdiff_t, not int,
	to count maps.
	(current_minor_maps): Check for size calculation overflow.
	* keymap.h: Change prototypes to match the above.

	* lread.c (read1, init_obarray): Don't update size until alloc done.

	* macros.c (Fstart_kbd_macro): Don't update size until alloc done.
	(store_kbd_macro_char): Reorder multiplicands to avoid overflow.

	* nsterm.h (struct ns_color_table.size, struct ns_color_table.avail):
	Now ptrdiff_t, not int.
	* nsterm.m (ns_index_color): Use ptrdiff_t, not int, for table indexes.
	(ns_draw_fringe_bitmap): Rewrite to avoid overflow.

	* process.c (Fnetwork_interface_list): Check for overflow
	in size calculation.

	* region-cache.c (move_cache_gap): Check for size calculation overflow.

	* scroll.c (do_line_insertion_deletion_costs): Check for size calc
	overflow.  Don't bother calling xmalloc when xrealloc will do.

	* search.c (Freplace_match): Check for size calculation overflow.
	(Fset_match_data): Don't assume list lengths fit in 'int'.

	* sysdep.c (system_process_attributes): Use ptrdiff_t, not int,
	for command line length.  Do not attempt to address one before the
	beginning of an array, as that's not portable.

	* term.c (max_frame_lines): Remove; unused.
	(encode_terminal_src_size, encode_terminal_dst_size): Now ptrdiff_t,
	not int.
	(encode_terminal_code, calculate_costs): Check for size
	calculation overflow.
	(encode_terminal_code): Use ptrdiff_t, not int, to record glyph
	table lengths and related sizes.  Don't update size until alloc
	done.  Redo calculations to avoid overflow.
	(calculate_costs): Don't bother calling xmalloc when xrealloc will do.

	* termcap.c (tgetent): Use ptrdiff_t, not int, to record results of
	subtracting pointers.
	(gobble_line): Check for overflow more carefully.  Don't update size
	until alloc done.

	* tparam.c (tparam1): Use ptrdiff_t, not int, for sizes.
	Don't update size until alloc done.
	Redo size calculations to avoid overflow.
	Check for size calculation overflow.
944
	(main) [DEBUG]: Fix typo in invoking tparam1.
945 946 947 948 949

	* xdisp.c (store_mode_line_noprop_char, x_consider_frame_title):
	Use ptrdiff_t, not int, for sizes.
	(store_mode_line_noprop_char): Don't update size until alloc done.

950 951 952 953 954 955
	* xfaces.c (lface_id_to_name_size, Finternal_make_lisp_face):
	Use ptrdiff_t, not int, for sizes.
	(Finternal_make_lisp_face, cache_face):
	Check for size calculation overflow.
	(cache_face): Treat size calculation overflows as if they were
	memory exhaustion (the usual treatment), rather than aborting.
956 957 958 959 960 961

	* xfns.c (x_encode_text, x_set_name_internal)
	(Fx_change_window_property): Use ptrdiff_t, not int, to count
	sizes, since they can exceed INT_MAX in size.  Check for size
	calculation overflow.

962 963
	* xgselect.c (gfds_size): Now ptrdiff_t, for convenience with xpalloc.
	(xg_select): Check for size calculation overflow.
964 965
	Don't update size until alloc done.

966
	* xrdb.c (get_environ_db): Don't assume path length fits in int,
967
	as sprintf is limited to int lengths.
968

969 970
	* xselect.c (X_LONG_SIZE, X_SHRT_MAX, X_SHRT_MIN, X_LONG_MAX)
	(X_LONG_MIN): New macros.
971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988
	Use them to make the following changes clearer.
	(MAX_SELECTION_QUANTUM): Make the other bounds on this value clearer.
	This change doesn't affect the value now, but it may help remind
	future maintainers not to raise the value too much later.
	(SELECTION_QUANTUM): Remove, replacing with ...
	(selection_quantum): ... new function, which avoids overflow.
	All uses changed.
	(struct selection_data.size): Now ptrdiff_t, not int, to avoid
	assumption that selection length fits in 'int'.
	(x_reply_selection_request, x_handle_selection_request)
	(x_get_window_property, receive_incremental_selection)
	(x_get_window_property_as_lisp_data, selection_data_to_lisp_data)
	(lisp_data_to_selection_data, clean_local_selection_data):
	Use ptrdiff_t, not int, to record length of selection.
	(x_reply_selection_request, x_get_window_property)
	(receive_incremental_selection, x_property_data_to_lisp):
	Redo calculations to avoid overflow.
	(x_reply_selection_request): When sending hint, ceiling it at
989
	X_LONG_MAX rather than relying on wraparound overflow to send
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014
	something.
	(x_get_window_property, receive_incremental_selection)
	(lisp_data_to_selection_data, x_property_data_to_lisp):
	Check for size-calculation overflow.
	(x_get_window_property, receive_incremental_selection)
	(lisp_data_to_selection_data, Fx_register_dnd_atom):
	Don't store size until memory allocation succeeds.
	(x_get_window_property): Plug memory leak on memory exhaustion.
	Don't double-block input; malloc is safe here.  Don't assume 2**34
	- 4 fits in unsigned long.  Add an xassert to check
	XGetWindowProperty overflow.  Be more careful about overflow
	calculations, and distinguish size from memory overflow better.
	(receive_incremental_selection): When tracing, don't assume
	unsigned int is less than INT_MAX.
	(x_selection_data_to_lisp_data): Remove unnecessary (and in theory
	harmful) conversions of unsigned short to int.
	(lisp_data_to_selection_data): Don't assume that integers
	in the range -65535 through -1 fit in an X unsigned short.
	Don't assume that ULONG_MAX == X_ULONG_MAX.  Don't store into
	result parameters unless successful.  Rely on cons_to_unsigned
	to report problems with elements; the old code wasn't right anyway.
	(x_check_property_data): Check for int overflow; we cannot use
	a wider type due to X limits.
	(x_handle_dnd_message): Use unsigned int, to avoid int overflow.

1015
	* xsmfns.c (smc_save_yourself_CB): Check for size calc overflow.
1016

1017 1018
	* xterm.c (x_color_cells, x_send_scrollbar_event, handle_one_xevent)
	(x_term_init): Check for size calculation overflow.
1019 1020
	(x_color_cells): Don't store size until memory allocation succeeds.
	(handle_one_xevent): Use ptrdiff_t, not int, for byte counts.
1021
	Don't assume alloca size is less than MAX_ALLOCA.
1022 1023
	(x_term_init): Don't assume length fits in int (sprintf is limited
	to int size).
Paul Eggert's avatar
Paul Eggert committed
1024

1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035
	Use ptrdiff_t for composition IDs.
	* character.c (lisp_string_width):
	* composite.c (composition_table_size, n_compositions)
	(get_composition_id, composition_gstring_from_id):
	* dispextern.h (struct glyph_string.cmp_id, struct composition_it.id):
	* xdisp.c (BUILD_COMPOSITE_GLYPH_STRING):
	* window.c (Frecenter):
	Use ptrdiff_t, not int, for composition IDs.
	* composite.c (get_composition_id): Check for integer overflow.
	* composite.h: Adjust prototypes to match the above changes.

1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
	Use ptrdiff_t for hash table indexes.
	* category.c (hash_get_category_set):
	* ccl.c (ccl_driver):
	* charset.h (struct charset.hash_index, CHECK_CHARSET_GET_ID):
	* coding.c (coding_system_charset_list, detect_coding_system):
	* coding.h (struct coding_system.id):
	* composite.c (get_composition_id, gstring_lookup_cache):
	* fns.c (hash_lookup, hash_put, Fgethash, Fputhash):
	* image.c (xpm_get_color_table_h):
	* lisp.h (hash_lookup, hash_put):
	* minibuf.c (Ftest_completion):
	Use ptrdiff_t for hash table indexes, not int (which is too
	narrow, on 64-bit hosts) or EMACS_INT (which is too wide, on
	32-bit --with-wide-int hosts).

1051 1052 1053 1054
	* charset.c (Fdefine_charset_internal): Check for integer overflow.
	Add a FIXME comment about memory leaks.
	(syms_of_charset): Don't assume xmalloc returns.

1055 1056 1057 1058 1059 1060
	Don't assume that stated character widths fit in int.
	* character.c (Fchar_width, c_string_width, lisp_string_width):
	* character.h (CHAR_WIDTH):
	* indent.c (MULTIBYTE_BYTES_WIDTH):
	Use sanitize_char_width to avoid undefined and/or bad behavior
	with outlandish widths.
1061
	* character.h (sanitize_tab_width): Rename from sanitize_width,
1062 1063 1064
	now that we have two such functions.  All uses changed.
	(sanitize_char_width): New inline function.

1065 1066 1067 1068 1069 1070 1071 1072
	Don't assume that tab-width fits in int.
	* character.h (sanitize_width): New inline function.
	(SANE_TAB_WIDTH): New macro.
	(ASCII_CHAR_WIDTH): Use it.
	* indent.c (sane_tab_width): Remove.  All uses replaced by
	SANE_TAB_WIDTH (current_buffer).
	* xdisp.c (init_iterator): Use SANE_TAB_WIDTH.

1073 1074 1075
	* fileio.c: Integer overflow issues with file modes.
	(Fset_file_modes, auto_save_1): Don't assume EMACS_INT fits in int.

1076 1077 1078 1079
	* charset.c (read_hex): New arg OVERFLOW.  All uses changed.
	Remove unreachable code.
	(read_hex, load_charset_map_from_file): Check for integer overflow.

1080 1081 1082 1083 1084 1085
	* xterm.c: don't go over XClientMessageEvent limit
	(scroll_bar_windows_size): Now ptrdiff_t, as we prefer signed.
	(x_send_scroll_bar_event): Likewise.  Check that the size does not
	exceed limits imposed by XClientMessageEvent, as well as the usual
	ptrdiff_t and size_t limits.

1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
	* keyboard.c: Overflow, signedness and related fixes.
	(make_lispy_movement): Use same integer type in forward decl
	that is used in the definition.
	(read_key_sequence, keyremap_step):
	Change bufsize argument back to int, undoing my 2011-03-30 change.
	We prefer signed types, and int is wide enough here.
	(parse_tool_bar_item): Don't assume tool_bar_max_label_size is less
	than TYPE_MAXIMUM (EMACS_INT) / 2.  Don't let the label size grow
	larger than STRING_BYTES_BOUND.  Use ptrdiff_t for Emacs string
	length, not size_t.  Use ptrdiff_t for index, not int.
	(keyremap_step, read_key_sequence): Redo bufsize check to avoid
	possibility of integer overflow.

1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
	Overflow, signedness and related fixes for images.

	* dispextern.h (struct it.stack[0].u.image.image_id)
	(struct_it.image_id, struct image.id, struct image_cache.size)
	(struct image_cache.used, struct image_cache.ref_count):
	* gtkutil.c (update_frame_tool_bar):
	* image.c (x_reference_bitmap, Fimage_size, Fimage_mask_p)
	(Fimage_metadata, free_image_cache, clear_image_cache, lookup_image)
	(cache_image, mark_image_cache, x_kill_gs_process, Flookup_image):
	* nsmenu.m (update_frame_tool_bar):
	* xdisp.c (calc_pixel_width_or_height):
	* xfns.c (image_cache_refcount):
	Image IDs are now ptrdiff_t, not int, to avoid arbitrary limits
	on typical 64-bit hosts.

	* image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
	(x_bitmap_pixmap, x_create_x_image_and_pixmap):
	Omit unnecessary casts to int.
	(parse_image_spec): Check that integers fall into 'int' range
	when the callers expect that.
	(image_ascent): Redo ascent calculation to avoid int overflow.
	(clear_image_cache): Avoid overflow when sqrt (INT_MAX) < nimages.
	(lookup_image): Remove unnecessary tests.
	(xbm_image_p): Locals are now of int, not EMACS_INT,
	since parse_image_check makes sure they fit into int.
	(png_load, gif_load, svg_load_image):
	Prefer int to unsigned where either will do.
	(tiff_handler): New function, combining the cores of the
1127 1128
	old tiff_error_handler and tiff_warning_handler.
	This function is rewritten to use vsnprintf and thereby avoid
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
	stack buffer overflows.  It uses only the features of vsnprintf
	that are common to both POSIX and native Microsoft.
	(tiff_error_handler, tiff_warning_handler): Use it.
	(tiff_load, gif_load, imagemagick_load_image):
	Don't assume :index value fits in 'int'.
	(gif_load): Omit unnecessary cast to double, and avoid double-rounding.
	(imagemagick_load_image): Check that crop parameters fit into
	the integer types that MagickCropImage accepts.  Don't assume
	Vimagemagick_render_type has a nonnegative value.  Don't assume
	size_t fits in 'long'.
	(gs_load): Use printmax_t to print the widest integers possible.
	Check for integer overflow when computing image height and width.

1142 1143 1144 1145 1146
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)

1147 1148 1149 1150 1151 1152 1153 1154 1155
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.
1156
	(try_cursor_movement): Check for the need to scroll more
1157 1158
	accurately, and prefer exact match for point under bidi.
	Don't advance `row' beyond the last row of the window.
1159 1160 1161 1162 1163 1164 1165 1166

	* 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.

1167 1168 1169 1170 1171 1172
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.

Eli Zaretskii's avatar
Eli Zaretskii committed
1173 1174
2011-08-24  Eli Zaretskii  <eliz@gnu.org>

1175 1176
	* xdisp.c (Fcurrent_bidi_paragraph_direction): For unibyte
	buffers, return left-to-right.
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189
	(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.
1190

Eli Zaretskii's avatar
Eli Zaretskii committed
1191 1192 1193 1194
	* bidi.c (bidi_check_type): Use xassert.
	(bidi_cache_iterator_state): Update the disp_pos and disp_prop_p
	members.

1195 1196 1197 1198 1199
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.

1200 1201 1202 1203
2011-08-23  Chong Yidong  <cyd@stupidchicken.com>

	* nsfont.m (ns_otf_to_script): Fix typo.

1204 1205 1206 1207 1208
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.

1209 1210
2011-08-23  Eli Zaretskii  <eliz@gnu.org>

1211 1212 1213
	* xdisp.c (redisplay_window): When computing centering_position,
	account for the height of the header line.  (Bug#8874)

1214 1215 1216 1217 1218
	* 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.

1219 1220 1221 1222
	* 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.

1223 1224 1225 1226
2011-08-23  Stefan Monnier  <monnier@iro.umontreal.ca>

	* cmds.c (Fself_insert_command): Mention post-self-insert-hook.

1227 1228 1229 1230 1231 1232
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.

1233 1234 1235 1236 1237 1238
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).

1239 1240 1241
2011-08-20  Chong Yidong  <cyd@stupidchicken.com>

	* eval.c (Fsignal): Handle `debug' symbol in error handler (Bug#9329).
1242
	(Fcondition_case): Document `debug' symbol in error handler.
1243

1244 1245
2011-08-19  Eli Zaretskii  <eliz@gnu.org>

1246 1247 1248 1249
	* 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.

1250 1251 1252 1253 1254
	* 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.

1255 1256
2011-08-18  Eli Zaretskii  <eliz@gnu.org>

1257 1258 1259 1260
	* 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'.

1261 1262 1263 1264 1265
	* 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.

1266 1267 1268 1269 1270
2011-08-18  Andreas Schwab  <schwab@linux-m68k.org>

	* process.c (Fnetwork_interface_list): Correctly determine buffer
	size.

1271 1272 1273
2011-08-17  Chong Yidong  <cyd@stupidchicken.com>

	* eval.c (internal_condition_case, internal_condition_case_1)
1274 1275
	(internal_condition_case_2, internal_condition_case_n):
	Remove unnecessary aborts (Bug#9081).
1276

1277 1278 1279 1280 1281
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)

Ken Brown's avatar
Ken Brown committed
1282 1283 1284 1285
2011-08-16  Ken Brown  <kbrown@cornell.edu>

	* gmalloc.c: Expand comment.

1286 1287 1288 1289 1290
2011-08-16  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (set_cursor_from_row): Don't accept a previous candidate
	if it fails the cursor_row_p test.  Fixes cursor positioning at ZV.

1291 1292 1293 1294 1295 1296 1297
2011-08-16  Ken Brown  <kbrown@cornell.edu>

	Fix memory allocation problems in Cygwin build (Bug#9273).

	* unexcw.c ( __malloc_initialized): Declare external variable.
	(fixup_executable): Force the dumped emacs to reinitialize malloc.

1298 1299
	* gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo):
	New variables.
1300 1301 1302 1303 1304 1305 1306 1307
	(malloc_initialize_1) [CYGWIN]: Prepare for reinitializing the
	dumped emacs.
	(_free_internal_nolock) [CYGWIN]: Ignore requests to free storage
	in the static heap.
	[CYGWIN] (special_realloc): New function.
	(_realloc_internal_nolock) [CYGWIN]: Use the new function on
	requests to realloc storage in the static heap.

1308 1309 1310 1311
2011-08-15  Paul Eggert  <eggert@cs.ucla.edu>

	* bidi.c (bidi_initialize): Remove unused local.

1312 1313
2011-08-15  Eli Zaretskii  <eliz@gnu.org>

1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327
	* biditype.h: File removed.

	* bidimirror.h: File removed.

	* deps.mk (bidi.o): Remove biditype.h and
	bidimirror.h.

	* makefile.w32-in ($(BLD)/bidi.$(O)): Remove biditype.h and
	bidimirror.h.

	* dispextern.h: Fix a typo in the comment to bidi_type_t.

	* chartab.c: Improve commentary for the uniprop_table API.

1328 1329
	* bidi.c (bidi_paragraph_init): Support zero value of
	bidi_ignore_explicit_marks_for_paragraph_level.
1330 1331
	(bidi_initialize): Use uniprop_table instead of including
	biditype.h and bidimirror.h.
1332

1333 1334 1335 1336
	* xdisp.c (move_it_in_display_line_to): Don't reset pixel
	coordinates of the iterator when restoring from ppos_it.
	(Bug#9296)

1337 1338 1339
2011-08-14  Kenichi Handa  <handa@m17n.org>

	* process.c (create_process): Call setup_process_coding_systems
1340
	after the pid of the process is set to -1 (Bug#8162).
1341

1342 1343 1344 1345 1346 1347 1348
2011-08-14  Eli Zaretskii  <eliz@gnu.org>

	* xdisp.c (move_it_in_display_line_to): Don't invoke
	IT_RESET_X_ASCENT_DESCENT when iterator position was restored from
	ppos_it.  Fixes vertical cursor motion when line beginning is
	covered by an image.  (Bug#9296)

1349 1350 1351 1352 1353 1354 1355
2011-08-14  Jan Djärv  <jan.h.d@swipnet.se>

	* nsterm.h (ns_run_ascript): Declare.
	(NSAPP_DATA2_RUNASSCRIPT): Define.

	* nsfns.m (as_script, as_result, as_status): New static variables.
	(ns_run_ascript): New function.
Juanma Barranquero's avatar
Juanma Barranquero committed
1356
	(Fns_do_applescript): Set variables as_*.  Make an NSApplicationDefined
1357 1358 1359 1360 1361 1362 1363
	event with data2 set to NSAPP_DATA2_RUNASSCRIPT, post it and then start
	the event loop.  Get status from as_status (Bug#7276).

	* nsterm.m (sendEvent): If event is NSApplicationDefined and
	data2 is NSAPP_DATA2_RUNASSCRIPT, call ns_run_ascript and then exit
	the event loop (Bug#7276).

1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377
2011-08-14  Andreas Schwab  <schwab@linux-m68k.org>

	* gnutls.c (QCgnutls_bootprop_priority)
	(QCgnutls_bootprop_trustfiles, QCgnutls_bootprop_keylist)
	(QCgnutls_bootprop_crlfiles, QCgnutls_bootprop_callbacks)
	(QCgnutls_bootprop_loglevel, QCgnutls_bootprop_hostname)
	(QCgnutls_bootprop_min_prime_bits, QCgnutls_bootprop_verify_flags)
	(QCgnutls_bootprop_verify_hostname_error)
	(QCgnutls_bootprop_callbacks_verify): Rename from
	Qgnutls_bootprop_..., all uses changed.

	* xfaces.c (QCignore_defface): Rename from Qignore_defface, all
	uses changed.

1378 1379
2011-08-14  Paul Eggert  <eggert@cs.ucla.edu>

1380 1381 1382
	* xfaces.c (Qframe_set_background_mode): Now static.
	* dispextern.h (Qframe_set_background_mode): Remove decl.

1383 1384
	* process.c (Fnetwork_interface_info): Declare local only if needed.

1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395
2011-08-13  Jan Djärv  <jan.h.d@swipnet.se>

	* process.c: Include ifaddrs.h and net/if_dl.h if available (Bug#8477).
	(Fnetwork_interface_list): Allocate in increments of bytes instead
	of sizeof (struct ifreq).  Iterate over ifconf.ifc_req by counting
	bytes (Bug#8477).  Count bytes correctly when ifr_addr is a struct
	sockaddr.
	(struct ifflag_def): notrailers is smart on OSX.
	(Fnetwork_interface_info): Handle case when ifr_flags is negative.
	Get hardware address with getifaddrs if available.

1396 1397 1398 1399 1400
2011-08-12  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
1401 1402
	when IT->position is set up wrongly due to some bug.
	Set IT->current to match the bidi iterator unconditionally.
Eli Zaretskii's avatar