status-im / nim-faststreams

Nearly zero-overhead input/output streams for Nim
Apache License 2.0
124 stars 11 forks source link

avoid UB writing nothing to outputs #45

Closed tersec closed 1 year ago

tersec commented 1 year ago

Example gcc 12.3.0 UBSAN output:

Nim/lib/system/memory.nim:10:24: runtime error: null pointer passed as argument 2, which is declared to never be null

Example clang 14.0.6 output:

Nim/lib/system/memory.nim:10:40: runtime error: null pointer passed as argument 2, which is declared to never be null
/usr/include/string.h:44:28: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior Nim/lib/system/memory.nim:10:40