diff options
| author | Glenn Morris | 2012-11-12 18:25:59 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-11-12 18:25:59 -0800 |
| commit | f78ee6afc094cdfd6162bfd645836e84875dcddf (patch) | |
| tree | 3a2c4f5d6441e53adadb69ed2af0b64abf3cf239 /src | |
| parent | b95a9c0cba301ef8f1920a1d123ccd6873c14a63 (diff) | |
| parent | f8705f6e3102454bf1e3213956eb3ac8160ff047 (diff) | |
| download | emacs-f78ee6afc094cdfd6162bfd645836e84875dcddf.tar.gz emacs-f78ee6afc094cdfd6162bfd645836e84875dcddf.zip | |
Merge from emacs-24; up to 2012-11-09T14:45:15Z!dmantipov@yandex.ru
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 16 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5905c667852..88352c201b6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-11-13 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (decode_mode_spec): Limit the value of WIDTH argument | ||
| 4 | passed to pint2str and pint2hrstr to be at most the size of the | ||
| 5 | frame's decode_mode_spec_buffer. This avoids crashes with very | ||
| 6 | large values of FIELD_WIDTH argument to decode_mode_spec. | ||
| 7 | (Bug#12867) | ||
| 8 | |||
| 1 | 2012-11-13 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2012-11-13 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | Fix a race with verify-visited-file-modtime (Bug#12863). | 11 | Fix a race with verify-visited-file-modtime (Bug#12863). |
diff --git a/src/xdisp.c b/src/xdisp.c index 5bda3347fe8..12d7b89291c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -21371,6 +21371,12 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 21371 | Lisp_Object obj; | 21371 | Lisp_Object obj; |
| 21372 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 21372 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 21373 | char *decode_mode_spec_buf = f->decode_mode_spec_buffer; | 21373 | char *decode_mode_spec_buf = f->decode_mode_spec_buffer; |
| 21374 | /* We are going to use f->decode_mode_spec_buffer as the buffer to | ||
| 21375 | produce strings from numerical values, so limit preposterously | ||
| 21376 | large values of FIELD_WIDTH to avoid overrunning the buffer's | ||
| 21377 | end. The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE | ||
| 21378 | bytes plus the terminating null. */ | ||
| 21379 | int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f)); | ||
| 21374 | struct buffer *b = current_buffer; | 21380 | struct buffer *b = current_buffer; |
| 21375 | 21381 | ||
| 21376 | obj = Qnil; | 21382 | obj = Qnil; |
| @@ -21466,7 +21472,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 21466 | { | 21472 | { |
| 21467 | ptrdiff_t col = current_column (); | 21473 | ptrdiff_t col = current_column (); |
| 21468 | wset_column_number_displayed (w, make_number (col)); | 21474 | wset_column_number_displayed (w, make_number (col)); |
| 21469 | pint2str (decode_mode_spec_buf, field_width, col); | 21475 | pint2str (decode_mode_spec_buf, width, col); |
| 21470 | return decode_mode_spec_buf; | 21476 | return decode_mode_spec_buf; |
| 21471 | } | 21477 | } |
| 21472 | 21478 | ||
| @@ -21497,14 +21503,14 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 21497 | case 'i': | 21503 | case 'i': |
| 21498 | { | 21504 | { |
| 21499 | ptrdiff_t size = ZV - BEGV; | 21505 | ptrdiff_t size = ZV - BEGV; |
| 21500 | pint2str (decode_mode_spec_buf, field_width, size); | 21506 | pint2str (decode_mode_spec_buf, width, size); |
| 21501 | return decode_mode_spec_buf; | 21507 | return decode_mode_spec_buf; |
| 21502 | } | 21508 | } |
| 21503 | 21509 | ||
| 21504 | case 'I': | 21510 | case 'I': |
| 21505 | { | 21511 | { |
| 21506 | ptrdiff_t size = ZV - BEGV; | 21512 | ptrdiff_t size = ZV - BEGV; |
| 21507 | pint2hrstr (decode_mode_spec_buf, field_width, size); | 21513 | pint2hrstr (decode_mode_spec_buf, width, size); |
| 21508 | return decode_mode_spec_buf; | 21514 | return decode_mode_spec_buf; |
| 21509 | } | 21515 | } |
| 21510 | 21516 | ||
| @@ -21611,12 +21617,12 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 21611 | line_number_displayed = 1; | 21617 | line_number_displayed = 1; |
| 21612 | 21618 | ||
| 21613 | /* Make the string to show. */ | 21619 | /* Make the string to show. */ |
| 21614 | pint2str (decode_mode_spec_buf, field_width, topline + nlines); | 21620 | pint2str (decode_mode_spec_buf, width, topline + nlines); |
| 21615 | return decode_mode_spec_buf; | 21621 | return decode_mode_spec_buf; |
| 21616 | no_value: | 21622 | no_value: |
| 21617 | { | 21623 | { |
| 21618 | char* p = decode_mode_spec_buf; | 21624 | char* p = decode_mode_spec_buf; |
| 21619 | int pad = field_width - 2; | 21625 | int pad = width - 2; |
| 21620 | while (pad-- > 0) | 21626 | while (pad-- > 0) |
| 21621 | *p++ = ' '; | 21627 | *p++ = ' '; |
| 21622 | *p++ = '?'; | 21628 | *p++ = '?'; |