changeset 111756:0e4f6aed76c8

* editfns.c (Fbyte_to_string): Signal an error if arg is not a byte.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 21 Nov 2010 13:16:19 -0500
parents 350f17da7963
children e9a44a85f427
files src/ChangeLog src/editfns.c
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Nov 21 13:07:47 2010 -0500
+++ b/src/ChangeLog	Sun Nov 21 13:16:19 2010 -0500
@@ -1,3 +1,7 @@
+2010-11-21  Chong Yidong  <cyd@stupidchicken.com>
+
+	* editfns.c (Fbyte_to_string): Signal an error arg is not a byte.
+
 2010-11-20  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (menubar_map_cb): New function (Bug#7425).
--- a/src/editfns.c	Sun Nov 21 13:07:47 2010 -0500
+++ b/src/editfns.c	Sun Nov 21 13:16:19 2010 -0500
@@ -222,12 +222,14 @@
 }
 
 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
-       doc: /* Convert arg BYTE to a string containing that byte.  */)
+       doc: /* Convert arg BYTE to a unibyte string containing that byte.  */)
      (byte)
      Lisp_Object byte;
 {
   unsigned char b;
   CHECK_NUMBER (byte);
+  if (XINT (byte) < 0 || XINT (byte) > 255)
+    error ("Invalid byte");
   b = XINT (byte);
   return make_string_from_bytes (&b, 1, 1);
 }