aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-05 13:22:53 -0700
committerPaul Eggert2011-04-05 13:22:53 -0700
commitda09ccce7ac9eca4e19f409215cc2897866e0a50 (patch)
tree71ba69a43a7e5559b60a168b3b48c1ea11b2f78c /src
parent1e973bc79daedde5ae088ddb54700e15c79ae518 (diff)
downloademacs-da09ccce7ac9eca4e19f409215cc2897866e0a50.tar.gz
emacs-da09ccce7ac9eca4e19f409215cc2897866e0a50.zip
* fns.c (Fstring_to_unibyte): Don't rely on undefined behavior
by passing a long int to a printf format expecting an int.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/fns.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 185d611ea6e..fd864a460f4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,9 @@
2 2
3 Fix more problems found by GCC 4.6.0's static checks. 3 Fix more problems found by GCC 4.6.0's static checks.
4 4
5 * fns.c (Fstring_to_unibyte): Don't rely on undefined behavior
6 by passing a long int to a printf format expecting an int.
7
5 * lisp.h (message, message_nolog, doprint, error, verror, fatal): 8 * lisp.h (message, message_nolog, doprint, error, verror, fatal):
6 Mark as printf-like functions. 9 Mark as printf-like functions.
7 10
diff --git a/src/fns.c b/src/fns.c
index c45d9e31ef2..ca18dbfc100 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1076,7 +1076,10 @@ an error is signaled. */)
1076 EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0); 1076 EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0);
1077 1077
1078 if (converted < chars) 1078 if (converted < chars)
1079 error ("Can't convert the %dth character to unibyte", converted); 1079 {
1080 long lconverted = converted;
1081 error ("Can't convert the %ldth character to unibyte", lconverted);
1082 }
1080 string = make_unibyte_string ((char *) str, chars); 1083 string = make_unibyte_string ((char *) str, chars);
1081 xfree (str); 1084 xfree (str);
1082 } 1085 }