Closed tersec closed 1 year ago
macOS Nim 2.0/devel failure are separate, and at least it gets farther than in master
:
[Suite] randomized tests
[OK] randomized cursor test [memoryOutput(4064);writes=FixedSize,variance=0]
[OK] randomized cursor test [memoryOutput(4064);writes=VarSize,variance=100]
[OK] randomized cursor test [memoryOutput(10);writes=Mixed,variance=10]
[OK] randomized file roundtrip
[OK] ensureRunway
[SKIPPED] pipelines
Traceback (most recent call last)
/Users/runner/work/nim-faststreams/nim-faststreams/nim/lib/std/exitprocs.nim(49) callClosures
/Users/runner/.nimble/pkgs2/unittest2-0.0.7-b6d4a5cbe28b43c166d6442ba6804aafd4abe368/unittest2.nim(632) cleanupFormatters
/Users/runner/.nimble/pkgs2/unittest2-0.0.7-b6d4a5cbe28b43c166d6442ba6804aafd4abe368/unittest2.nim(311) testRunEnded
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
and when running the new -d:useMalloc
test, which tends to be stricter/hide fewer bugs.
Thanks for catching this nasty one :)
This is easier to see with
-d:useMalloc
, but the ARC/ORC semantics are the same regardless, just typically a bit obscured by the pool memory allocations:One can also use ASAN in a repro of this (attached reduced repro from the `nim-faststreams mixed ASCII reading) to see this, a bit more in situ:
The reason it was in a
block
to begin with was, as stated, to work around some template redefinition issue, but Nim 1.6 doesn't warn or error at all and later versions of Nim have options to specify that it's acceptable, courtesy of https://github.com/nim-lang/Nim/pull/20211.ptrops.txt is slightly more
faststream
-realistic repro code showing the above UAF via ASAN.