diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-06-25 23:15:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-25 17:15:47 +0200 |
commit | 942c37865976e1535855e9206860d7db1c18b2a0 (patch) | |
tree | 90ae2cad4eeecc9a8e0989b39c476770318b7799 /tests | |
parent | 20037a47499ea183afb0e8d2a3f68c2b2952aa5d (diff) | |
download | Nim-942c37865976e1535855e9206860d7db1c18b2a0.tar.gz |
fixes #22148; std/memfiles.memSlices nesting now fails with memory sa… (#22154)
* fixes #22148; std/memfiles.memSlices nesting now fails with memory safety capture violation * adds a test case
Diffstat (limited to 'tests')
-rw-r--r-- | tests/iter/t22148.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/iter/t22148.nim b/tests/iter/t22148.nim new file mode 100644 index 000000000..9954eed87 --- /dev/null +++ b/tests/iter/t22148.nim @@ -0,0 +1,15 @@ +discard """ + action: compile +""" + +import std/memfiles + +# bug #22148 +proc make*(input: string) = + var inp = memfiles.open(input) + for line in memSlices(inp): + let lineF = MemFile(mem: line.data, size: line.size) + for word in memSlices(lineF, ','): + discard + +make("") # Must call to trigger |