mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 15:44:14 +00:00
[Orc] fixes "streams.readDataStr segafaults" when accepting a string literal (#20019) [backport]
fixes streams.readDataStr accept a string literal
(cherry picked from commit 286fcef68e)
This commit is contained in:
@@ -1194,6 +1194,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:
|
||||
|
||||
Reference in New Issue
Block a user