diff options
| author | Chong Yidong | 2006-01-24 18:35:25 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-01-24 18:35:25 +0000 |
| commit | a0b08700d1a0affe59ce2428cc8d204362924ad7 (patch) | |
| tree | df2743cefaf33c990a8c0b2526f7a7557a118f8d /src | |
| parent | 0d72b43bbbf1eeb3bc8dd7d58abaaead1dc9a4ee (diff) | |
| download | emacs-a0b08700d1a0affe59ce2428cc8d204362924ad7.tar.gz emacs-a0b08700d1a0affe59ce2428cc8d204362924ad7.zip | |
* alloc.c (allocate_string_data): Update next_free immediately, to
reduce risk of memory clobberage.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/alloc.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5f3e1322395..4ee94dff693 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2006-01-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * alloc.c (allocate_string_data): Update next_free immediately, to | ||
| 4 | reduce risk of memory clobberage. | ||
| 5 | |||
| 1 | 2006-01-24 L$,1 q(Brentey K,Aa(Broly <lorentey@elte.hu> | 6 | 2006-01-24 L$,1 q(Brentey K,Aa(Broly <lorentey@elte.hu> |
| 2 | 7 | ||
| 3 | * xdisp.c (handle_invisible_prop): Set it->position to fix cursor | 8 | * xdisp.c (handle_invisible_prop): Set it->position to fix cursor |
diff --git a/src/alloc.c b/src/alloc.c index d81a9bf853b..f0c77a26710 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1978,6 +1978,8 @@ allocate_string_data (s, nchars, nbytes) | |||
| 1978 | old_nbytes = GC_STRING_BYTES (s); | 1978 | old_nbytes = GC_STRING_BYTES (s); |
| 1979 | 1979 | ||
| 1980 | data = b->next_free; | 1980 | data = b->next_free; |
| 1981 | b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA); | ||
| 1982 | |||
| 1981 | data->string = s; | 1983 | data->string = s; |
| 1982 | s->data = SDATA_DATA (data); | 1984 | s->data = SDATA_DATA (data); |
| 1983 | #ifdef GC_CHECK_STRING_BYTES | 1985 | #ifdef GC_CHECK_STRING_BYTES |
| @@ -1990,7 +1992,6 @@ allocate_string_data (s, nchars, nbytes) | |||
| 1990 | bcopy (string_overrun_cookie, (char *) data + needed, | 1992 | bcopy (string_overrun_cookie, (char *) data + needed, |
| 1991 | GC_STRING_OVERRUN_COOKIE_SIZE); | 1993 | GC_STRING_OVERRUN_COOKIE_SIZE); |
| 1992 | #endif | 1994 | #endif |
| 1993 | b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA); | ||
| 1994 | 1995 | ||
| 1995 | /* If S had already data assigned, mark that as free by setting its | 1996 | /* If S had already data assigned, mark that as free by setting its |
| 1996 | string back-pointer to null, and recording the size of the data | 1997 | string back-pointer to null, and recording the size of the data |