1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/c129b2eb4cf9/
Changeset: c129b2eb4cf9
User: kehoea
Date: 2017-11-23 03:49:37+00:00
Summary: Correct the bit-width of xemacs_c_alloca()'s SIZE argument.
src/ChangeLog addition:
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* alloca.c (xemacs_c_alloca):
If this is going to take an unsigned argument, as it always has,
that unsigned argument needs to have the bit width of a
size_t. Use it explicitly.
Do some overflow checking, too, calling memory_full() if we find
it.
* lisp.h:
Updatte the declaration of xemacs_c_alloca().
tests/ChangeLog addition:
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/format-tests.el (args-out-of-range):
We can give out-of-memory errors too with
(format (concat "%" (number-to-string most-positive-fixnum) "d"),
and that's appropriate.
Affected #: 5 files
diff -r da34f595fb4e9234454846ec33da1d2c274998c2 -r
c129b2eb4cf991ce0b541b0490b86f9fbe55f56e src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * alloca.c (xemacs_c_alloca):
+ If this is going to take an unsigned argument, as it always has,
+ that unsigned argument needs to have the bit width of a
+ size_t. Use it explicitly.
+ Do some overflow checking, too, calling memory_full() if we find
+ it.
+ * lisp.h:
+ Updatte the declaration of xemacs_c_alloca().
+
2017-11-17 Aidan Kehoe <kehoea(a)parhasard.net>
* specifier.c (error_or_quit_failed_instantiator_in_domain): New.
diff -r da34f595fb4e9234454846ec33da1d2c274998c2 -r
c129b2eb4cf991ce0b541b0490b86f9fbe55f56e src/alloca.c
--- a/src/alloca.c
+++ b/src/alloca.c
@@ -129,7 +129,7 @@
implementations of C, for example under Gould's UTX/32. */
pointer
-xemacs_c_alloca (unsigned int size)
+xemacs_c_alloca (size_t size)
{
char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
@@ -177,7 +177,15 @@
{
#ifdef emacs
- register pointer new_ = xmalloc (sizeof (header) + size);
+ size_t total_size = sizeof (header) + size;
+ register pointer new_;
+
+ if (total_size < size || ((Bytecount) (total_size) < 0))
+ {
+ memory_full ();
+ }
+
+ new_ = xmalloc ((Bytecount) total_size);
#else
register pointer new_ = malloc (sizeof (header) + size);
#endif
diff -r da34f595fb4e9234454846ec33da1d2c274998c2 -r
c129b2eb4cf991ce0b541b0490b86f9fbe55f56e src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1492,7 +1492,7 @@
MULTIUSE_ALLOCA (size, sizeagain)
#endif /* (not) BROKEN_ALLOCA_IN_FUNCTION_CALLS */
-MODULE_API void *xemacs_c_alloca (unsigned int size) ATTRIBUTE_MALLOC;
+MODULE_API void *xemacs_c_alloca (size_t size) ATTRIBUTE_MALLOC;
MODULE_API int record_unwind_protect_freeing (void *ptr);
diff -r da34f595fb4e9234454846ec33da1d2c274998c2 -r
c129b2eb4cf991ce0b541b0490b86f9fbe55f56e tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/format-tests.el (args-out-of-range):
+ We can give out-of-memory errors too with
+ (format (concat "%" (number-to-string most-positive-fixnum) "d"),
+ and that's appropriate.
+
2017-11-14 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/case-tests.el (downcase1):
diff -r da34f595fb4e9234454846ec33da1d2c274998c2 -r
c129b2eb4cf991ce0b541b0490b86f9fbe55f56e tests/automated/format-tests.el
--- a/tests/automated/format-tests.el
+++ b/tests/automated/format-tests.el
@@ -707,12 +707,8 @@
;; This used to crash with bignum builds.
(Check-Error (wrong-type-argument syntax-error) (format "%n" pi))
-(unless (featurep 'mule)
- ;; This might work (not error) on a non-mule build. On my 11 year old 32
- ;; bit machine, I don't have enough RAM for it to succeed, whence the
- ;; conditional. It's unlikely to work on a 64 bit build.
- (Check-Error args-out-of-range (format (concat "%" (number-to-string
- most-positive-fixnum)
- "d") 1)))
+(Check-Error (args-out-of-range out-of-memory)
+ (format (concat "%" (number-to-string most-positive-fixnum)
"d")
+ 1))
;; end of format-tests.el
Repository URL:
https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.