summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2022-07-15 15:42:54 +0800
committerGitHub <noreply@github.com>2022-07-15 09:42:54 +0200
commit286fcef68ef6f0e3a20ab5b25307c9b4705ce54d (patch)
tree8be4c27651f1dca9c08f3ebe4d17a67f19043b6f /lib
parent800cb006e74f8c52bde69cfc1eb9e55fcc439633 (diff)
downloadNim-286fcef68ef6f0e3a20ab5b25307c9b4705ce54d.tar.gz
[Orc] fixes "streams.readDataStr segafaults" when accepting a string literal (#20019) [backport]
fixes streams.readDataStr accept a string literal
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/streams.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim
index f58273ee8..50b3085d2 100644
--- a/lib/pure/streams.nim
+++ b/lib/pure/streams.nim
@@ -1197,6 +1197,11 @@ else: # after 1.3 or JS not defined
 
   proc ssReadDataStr(s: Stream, buffer: var string, slice: Slice[int]): int =
     var s = StringStream(s)
+    when nimvm:
+      discard
+    else:
+      when declared(prepareMutation):
+        prepareMutation(buffer) # buffer might potentially be a CoW literal with ARC
     result = min(slice.b + 1 - slice.a, s.data.len - s.pos)
     if result > 0:
       jsOrVmBlock: