summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-01-22 23:43:29 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2020-01-22 23:44:34 -0800
commit6f580542c1796d3e7ba4d1dd40b2fe73fe00e5db (patch)
treeed853d4d27a2f231d7fe13a4affb723d0ce28eeb /test
parent5715eb94e90b33ace59dd4c4ccb6e2122bc6db72 (diff)
downloademacs-6f580542c1796d3e7ba4d1dd40b2fe73fe00e5db.tar.gz
Fix crash when sending Gnus message (Bug#39207)
* src/alloc.c (resize_string_data): The string must be multibyte. When not bothering to reallocate, do bother to change the byte count. * test/src/alloc-tests.el (aset-nbytes-change) New test.
Diffstat (limited to 'test')
-rw-r--r--test/src/alloc-tests.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el
index 4eb776a0555..aa1ab1648f8 100644
--- a/test/src/alloc-tests.el
+++ b/test/src/alloc-tests.el
@@ -51,3 +51,10 @@
(should-not (eq x y))
(dotimes (i 4)
(should (eql (aref x i) (aref y i))))))
+
+;; Bug#39207
+(ert-deftest aset-nbytes-change ()
+ (let ((s (make-string 1 ?a)))
+ (dolist (c (list 10003 ?b 128 ?c ?d (max-char) ?e))
+ (aset s 0 c)
+ (should (equal s (make-string 1 c))))))