summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorClyybber <darkmine956@gmail.com>2020-10-23 03:26:50 +0200
committerGitHub <noreply@github.com>2020-10-23 03:26:50 +0200
commit01a62320f03ebd3282a7def231351c4f84c319d2 (patch)
tree13f2747e3c8101f44d20f82255b51a7a36b38511 /lib/pure
parent2cb484cefb13e4663afd8e0eb2ad81d43f097803 (diff)
downloadNim-01a62320f03ebd3282a7def231351c4f84c319d2.tar.gz
Fix #12410 (#15685)
* Fix #12410, big thanks to @pmetras for this fix

* Add testcase
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/streams.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim
index 77f384a79..dc00271a5 100644
--- a/lib/pure/streams.nim
+++ b/lib/pure/streams.nim
@@ -242,7 +242,7 @@ proc readDataStr*(s: Stream, buffer: var string, slice: Slice[int]): int =
     result = s.readDataStrImpl(s, buffer, slice)
   else:
     # fallback
-    result = s.readData(addr buffer[0], buffer.len)
+    result = s.readData(addr buffer[slice.a], slice.b + 1 - slice.a)
 
 template jsOrVmBlock(caseJsOrVm, caseElse: untyped): untyped =
   when nimvm: