Add test for buffer overun in encoding buffer

This commit is contained in:
Tarn W. Burton 2024-05-10 06:38:21 -04:00
parent f106f8b8ad
commit e439bb5fdd
No known key found for this signature in database
GPG key ID: B4E3D65DE1CE325A

View file

@ -561,3 +561,19 @@
(is (equal (multiple-value-list (read-line (make-instance 'character-input-stream :value "a
")))
'("a" nil))))
;;;; Author: Tarn W. Burton
;;;; Created: 2024-05-19
;;;; Description:
;;;; Test to ensure that write-char returns the correct value. An
;;;; incorrect value or stack smashing indicated a buffer overrun
;;;; caused by an encoding buffer that is too small.
(test mix.0030.write-char-encode-buffer
(is (equal (with-open-file (s "/tmp/whatever.txt"
:if-does-not-exist :create
:if-exists :supersede
:external-format :ucs-4
:direction :output)
(write-char #\a s))
#\a)))