summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-28 06:30:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-28 06:30:46 -0700
commit41db431321741fd89391278cddbf8b7a665eb6ba (patch)
treef03eb7c48f8e16dea6ca950682e03d56febefbc4
parent05c12f824123b05f934d43cb6035a1f4dbec7d7f (diff)
downloadtxr-41db431321741fd89391278cddbf8b7a665eb6ba.tar.gz
txr-41db431321741fd89391278cddbf8b7a665eb6ba.tar.bz2
txr-41db431321741fd89391278cddbf8b7a665eb6ba.zip
streams: bugfix in string input seek error diagnostic.
* stream.c (string_in_seek): Update the value of len with the calculated value so that the out-of-bounds seek diagnostic diagnostic shows the string length rather than nil.
-rw-r--r--stream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stream.c b/stream.c
index 0ae38153..e58ead71 100644
--- a/stream.c
+++ b/stream.c
@@ -2092,7 +2092,7 @@ static val string_in_seek(val stream, val off, enum strm_whence whence)
lit("~a: ~s: negative position ~s disallowed"),
self, stream, pos, nao);
- if (gt(pos, len ? len : length_str(s->string)))
+ if (gt(pos, len ? len : (len = length_str(s->string))))
uw_throwf(file_error_s,
lit("~a: ~s: position ~s lies beyond string length ~s"),
self, stream, pos, len, nao);