summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-07 15:57:30 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-07 15:57:30 -0700
commit229a3652bffe37b3d9074294ff069a7d9f58e434 (patch)
tree710a2861e64979849ece41e09c2eee17842192da
parent5e103887e3335559b6407e58ec1103de8340b173 (diff)
downloadtxr-229a3652bffe37b3d9074294ff069a7d9f58e434.tar.gz
txr-229a3652bffe37b3d9074294ff069a7d9f58e434.tar.bz2
txr-229a3652bffe37b3d9074294ff069a7d9f58e434.zip
streams: put-string, put-char: missing type check.
* stream.c (put_string, put_char): Use cobj_handle to validate the object, rather than directly accessing stream->co.handle. This was reported as a (put-line "foo" nil) crash reported by Paul A. Patience.
-rw-r--r--stream.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/stream.c b/stream.c
index e72c7e1c..338a1e8e 100644
--- a/stream.c
+++ b/stream.c
@@ -3855,7 +3855,8 @@ val put_string(val string, val stream_in)
{
val self = lit("put-string");
val stream = default_arg_strict(stream_in, std_output);
- struct strm_base *s = coerce(struct strm_base *, stream->co.handle);
+ struct strm_base *s = coerce(struct strm_base *,
+ cobj_handle(self, stream, stream_s));
if (lazy_stringp(string)) {
return lazy_str_put(string, stream_in, s);
@@ -3900,7 +3901,8 @@ val put_char(val ch, val stream_in)
val stream = default_arg_strict(stream_in, std_output);
struct strm_ops *ops = coerce(struct strm_ops *,
cobj_ops(self, stream, stream_s));
- struct strm_base *s = coerce(struct strm_base *, stream->co.handle);
+ struct strm_base *s = coerce(struct strm_base *,
+ cobj_handle(self, stream, stream_s));
wint_t cch = c_chr(ch);
switch (cch) {