aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-10-24 14:57:02 -0700
committerPaul Eggert2011-10-24 14:57:02 -0700
commit6efdadfdbad817826a8c311f5e3fae449bcf0471 (patch)
treea16236b2dca73c3b898ac95e4addabda71f34c7d /src
parent43f6f8d5ca052c2511c7988f188e65d507e703d0 (diff)
downloademacs-6efdadfdbad817826a8c311f5e3fae449bcf0471.tar.gz
emacs-6efdadfdbad817826a8c311f5e3fae449bcf0471.zip
* lread.c: Fix off-by-one error that can read outside a buffer.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/lread.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 34914c96c6c..8e2ef5e0eb2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12011-10-23 Paul Eggert <eggert@cs.ucla.edu> 12011-10-24 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Fix integer width and related bugs. 3 Fix integer width and related bugs.
4 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): 4 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
@@ -495,6 +495,7 @@
495 (openp): Check for out-of-range argument to 'access'. 495 (openp): Check for out-of-range argument to 'access'.
496 (read1): Use int, not EMACS_INT, where int is wide enough. 496 (read1): Use int, not EMACS_INT, where int is wide enough.
497 Don't assume fixnum fits into int. 497 Don't assume fixnum fits into int.
498 Fix off-by-one error that can read outside a buffer.
498 (read_filtered_event): Use duration_to_sec_usec 499 (read_filtered_event): Use duration_to_sec_usec
499 to do proper overflow checking on durations. 500 to do proper overflow checking on durations.
500 * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow 501 * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow
diff --git a/src/lread.c b/src/lread.c
index 75d05a2b2f3..d7c5db3a02c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2508,11 +2508,13 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2508 ptrdiff_t size; 2508 ptrdiff_t size;
2509 2509
2510 tmp = read_vector (readcharfun, 0); 2510 tmp = read_vector (readcharfun, 0);
2511 size = ASIZE (tmp);
2512 if (size == 0)
2513 error ("Invalid size char-table");
2511 if (! RANGED_INTEGERP (1, AREF (tmp, 0), 3)) 2514 if (! RANGED_INTEGERP (1, AREF (tmp, 0), 3))
2512 error ("Invalid depth in char-table"); 2515 error ("Invalid depth in char-table");
2513 depth = XINT (AREF (tmp, 0)); 2516 depth = XINT (AREF (tmp, 0));
2514 size = ASIZE (tmp) - 2; 2517 if (chartab_size[depth] != size - 2)
2515 if (chartab_size [depth] != size)
2516 error ("Invalid size char-table"); 2518 error ("Invalid size char-table");
2517 XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE); 2519 XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
2518 return tmp; 2520 return tmp;