diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-07-07 15:57:30 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-07-07 15:57:30 -0700 |
commit | 229a3652bffe37b3d9074294ff069a7d9f58e434 (patch) | |
tree | 710a2861e64979849ece41e09c2eee17842192da | |
parent | 5e103887e3335559b6407e58ec1103de8340b173 (diff) | |
download | txr-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) { |