diff options
| author | Paul Eggert | 2011-04-06 20:34:05 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-06 20:34:05 -0700 |
| commit | 5fdb398c4b75b0c834aff7132f90b0ce5317a25a (patch) | |
| tree | 29ebb8fc5700fefdd867fa497eac27fb7d0bcfe0 /src/m | |
| parent | b189fa667ed7ac7b17f9665cd8a0c26316b3c521 (diff) | |
| download | emacs-5fdb398c4b75b0c834aff7132f90b0ce5317a25a.tar.gz emacs-5fdb398c4b75b0c834aff7132f90b0ce5317a25a.zip | |
error: Print 32- and 64-bit integers portably (Bug#8435).
Without this change, on typical 64-bit hosts error ("...%d...", N)
was used to print both 32- and 64-bit integers N, which relied on
undefined behavior.
* lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
New macro.
* lisp.h (error, verror): Mark as printf-like functions.
* eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
Report overflow in size calculations when allocating printf buffer.
Do not truncate output string at its first null byte.
* xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
Truncate the output at a character boundary, since vsnprintf does not
do that.
* charset.c (check_iso_charset_parameter): Convert internal
character to string before calling 'error', since %c now has the
printf meaning.
* coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
overflow when computing char to be passed to 'error'. Do not
pass Lisp_Object to 'error'; pass the integer instead.
* nsfns.m (Fns_do_applescript): Use int, not long, since it's
formatted with plain %d.
Diffstat (limited to 'src/m')
| -rw-r--r-- | src/m/amdx86-64.h | 1 | ||||
| -rw-r--r-- | src/m/ia64.h | 1 | ||||
| -rw-r--r-- | src/m/ibms390x.h | 2 |
3 files changed, 3 insertions, 1 deletions
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 441f41b4444..dbca9b5b838 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h | |||
| @@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | 28 | ||
| 29 | /* Define the type to use. */ | 29 | /* Define the type to use. */ |
| 30 | #define EMACS_INT long | 30 | #define EMACS_INT long |
| 31 | #define pEd "ld" | ||
| 31 | #define EMACS_UINT unsigned long | 32 | #define EMACS_UINT unsigned long |
| 32 | 33 | ||
| 33 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ | 34 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ |
diff --git a/src/m/ia64.h b/src/m/ia64.h index 101d56e648b..a1374d7c224 100644 --- a/src/m/ia64.h +++ b/src/m/ia64.h | |||
| @@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | 28 | ||
| 29 | /* Define the type to use. */ | 29 | /* Define the type to use. */ |
| 30 | #define EMACS_INT long | 30 | #define EMACS_INT long |
| 31 | #define pEd "ld" | ||
| 31 | #define EMACS_UINT unsigned long | 32 | #define EMACS_UINT unsigned long |
| 32 | 33 | ||
| 33 | #ifdef REL_ALLOC | 34 | #ifdef REL_ALLOC |
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index d4ef5c291ef..14228b61e56 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h | |||
| @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 24 | 24 | ||
| 25 | /* Define the type to use. */ | 25 | /* Define the type to use. */ |
| 26 | #define EMACS_INT long | 26 | #define EMACS_INT long |
| 27 | #define pEd "ld" | ||
| 27 | #define EMACS_UINT unsigned long | 28 | #define EMACS_UINT unsigned long |
| 28 | 29 | ||
| 29 | /* On the 64 bit architecture, we can use 60 bits for addresses */ | 30 | /* On the 64 bit architecture, we can use 60 bits for addresses */ |
| @@ -31,4 +32,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | 32 | ||
| 32 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ | 33 | /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */ |
| 33 | #define XPNTR(a) XUINT (a) | 34 | #define XPNTR(a) XUINT (a) |
| 34 | |||