diff options
| author | Paul Eggert | 2011-07-07 15:45:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-07 15:45:25 -0700 |
| commit | b312a4929d4ed7bc900a54f506905801f860ce7c (patch) | |
| tree | 4611760e16c6f7c937376960795c688e12cc2f2d /src | |
| parent | dfd153ae803962a5eaffe8a65e77f749c0574edf (diff) | |
| download | emacs-b312a4929d4ed7bc900a54f506905801f860ce7c.tar.gz emacs-b312a4929d4ed7bc900a54f506905801f860ce7c.zip | |
* emacs.c: Integer overflow minor fix.
(heap_bss_diff): Now uprintmax_t, not unsigned long. All used changed.
Define only if GNU_LINUX.
(main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/emacs.c | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e2cf24fc173..0265828c60e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2011-07-07 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-07-07 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * emacs.c: Integer overflow minor fix. | ||
| 4 | (heap_bss_diff): Now uprintmax_t, not unsigned long. All used changed. | ||
| 5 | Define only if GNU_LINUX. | ||
| 6 | (main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX. | ||
| 7 | |||
| 3 | * dispnew.c: Integer signedness and overflow fixes. | 8 | * dispnew.c: Integer signedness and overflow fixes. |
| 4 | Remove unnecessary forward decls, that were a maintenance hassle. | 9 | Remove unnecessary forward decls, that were a maintenance hassle. |
| 5 | (history_tick): Now uprintmax_t, so it's more likely to avoid overflow. | 10 | (history_tick): Now uprintmax_t, so it's more likely to avoid overflow. |
diff --git a/src/emacs.c b/src/emacs.c index e4b3a68a6c1..6f6d1babd03 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -166,8 +166,10 @@ char *stack_bottom; | |||
| 166 | /* The address where the heap starts (from the first sbrk (0) call). */ | 166 | /* The address where the heap starts (from the first sbrk (0) call). */ |
| 167 | static void *my_heap_start; | 167 | static void *my_heap_start; |
| 168 | 168 | ||
| 169 | #ifdef GNU_LINUX | ||
| 169 | /* The gap between BSS end and heap start as far as we can tell. */ | 170 | /* The gap between BSS end and heap start as far as we can tell. */ |
| 170 | static unsigned long heap_bss_diff; | 171 | static uprintmax_t heap_bss_diff; |
| 172 | #endif | ||
| 171 | 173 | ||
| 172 | /* Nonzero means running Emacs without interactive terminal. */ | 174 | /* Nonzero means running Emacs without interactive terminal. */ |
| 173 | int noninteractive; | 175 | int noninteractive; |
| @@ -713,6 +715,7 @@ main (int argc, char **argv) | |||
| 713 | setenv ("G_SLICE", "always-malloc", 1); | 715 | setenv ("G_SLICE", "always-malloc", 1); |
| 714 | #endif | 716 | #endif |
| 715 | 717 | ||
| 718 | #ifdef GNU_LINUX | ||
| 716 | if (!initialized) | 719 | if (!initialized) |
| 717 | { | 720 | { |
| 718 | extern char my_endbss[]; | 721 | extern char my_endbss[]; |
| @@ -723,6 +726,7 @@ main (int argc, char **argv) | |||
| 723 | 726 | ||
| 724 | heap_bss_diff = (char *)my_heap_start - max (my_endbss, my_endbss_static); | 727 | heap_bss_diff = (char *)my_heap_start - max (my_endbss, my_endbss_static); |
| 725 | } | 728 | } |
| 729 | #endif | ||
| 726 | 730 | ||
| 727 | #ifdef RUN_TIME_REMAP | 731 | #ifdef RUN_TIME_REMAP |
| 728 | if (initialized) | 732 | if (initialized) |
| @@ -2131,7 +2135,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2131 | { | 2135 | { |
| 2132 | fprintf (stderr, "**************************************************\n"); | 2136 | fprintf (stderr, "**************************************************\n"); |
| 2133 | fprintf (stderr, "Warning: Your system has a gap between BSS and the\n"); | 2137 | fprintf (stderr, "Warning: Your system has a gap between BSS and the\n"); |
| 2134 | fprintf (stderr, "heap (%lu bytes). This usually means that exec-shield\n", | 2138 | fprintf (stderr, "heap (%"pMu" bytes). This usually means that exec-shield\n", |
| 2135 | heap_bss_diff); | 2139 | heap_bss_diff); |
| 2136 | fprintf (stderr, "or something similar is in effect. The dump may\n"); | 2140 | fprintf (stderr, "or something similar is in effect. The dump may\n"); |
| 2137 | fprintf (stderr, "fail because of this. See the section about\n"); | 2141 | fprintf (stderr, "fail because of this. See the section about\n"); |