diff options
| author | Paul Eggert | 2011-03-22 02:08:11 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-22 02:08:11 -0700 |
| commit | a2d26660368fbe4cc7d103aad6f565e36a280fac (patch) | |
| tree | 26311d3ed436cbc03d1a3acede09dde609c21512 /src | |
| parent | 916c72e97a711e6d0f571a507634e4f795fbaf6c (diff) | |
| download | emacs-a2d26660368fbe4cc7d103aad6f565e36a280fac.tar.gz emacs-a2d26660368fbe4cc7d103aad6f565e36a280fac.zip | |
* lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow
leading to a memory leak, possible in functions like
load_charset_map_from_file that can allocate an unbounded number
of objects.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/lisp.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c8fa1e55695..a341d1b4678 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2011-03-22 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-03-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow | ||
| 4 | leading to a memory leak, possible in functions like | ||
| 5 | load_charset_map_from_file that can allocate an unbounded number | ||
| 6 | of objects. | ||
| 7 | |||
| 3 | * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes | 8 | * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes |
| 4 | that could (at least in theory) be that large. | 9 | that could (at least in theory) be that large. |
| 5 | 10 | ||
diff --git a/src/lisp.h b/src/lisp.h index 645b82c80cf..e98172ec104 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3602,7 +3602,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3602 | else \ | 3602 | else \ |
| 3603 | { \ | 3603 | { \ |
| 3604 | buf = (type) xmalloc (size); \ | 3604 | buf = (type) xmalloc (size); \ |
| 3605 | sa_must_free++; \ | 3605 | sa_must_free = 1; \ |
| 3606 | record_unwind_protect (safe_alloca_unwind, \ | 3606 | record_unwind_protect (safe_alloca_unwind, \ |
| 3607 | make_save_value (buf, 0)); \ | 3607 | make_save_value (buf, 0)); \ |
| 3608 | } \ | 3608 | } \ |
| @@ -3632,7 +3632,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3632 | buf = (Lisp_Object *) xmalloc (size_); \ | 3632 | buf = (Lisp_Object *) xmalloc (size_); \ |
| 3633 | arg_ = make_save_value (buf, nelt); \ | 3633 | arg_ = make_save_value (buf, nelt); \ |
| 3634 | XSAVE_VALUE (arg_)->dogc = 1; \ | 3634 | XSAVE_VALUE (arg_)->dogc = 1; \ |
| 3635 | sa_must_free++; \ | 3635 | sa_must_free = 1; \ |
| 3636 | record_unwind_protect (safe_alloca_unwind, arg_); \ | 3636 | record_unwind_protect (safe_alloca_unwind, arg_); \ |
| 3637 | } \ | 3637 | } \ |
| 3638 | } while (0) | 3638 | } while (0) |