status-im / nim-drchaos

A powerful and easy-to-use fuzzing framework in Nim for C/C++/Obj-C targets
Other
68 stars 3 forks source link

Tests fail with the default GC in drchaos/common.nim:304:243 and mutator.nim:464:28 #8

Closed planetis-m closed 2 years ago

planetis-m commented 2 years ago

Both are caused by nil pointers. For the first one I made a bug report in https://github.com/nim-lang/Nim/issues/20278

planetis-m commented 2 years ago

Case object transitions are actually the culprit for the second. The only way to fix this is:

  var kindTmp = tmpSym.kindSym
  mFunc(kindTmp)
  when defined(gcDestructors):
    {.cast(uncheckedAssign).}:
      tmpSym.kindSym = kindTmp
  else:
    tmpSym = (typeof tmpSym)(kindSym: kindTmp)

The test run but the default gc may report misaligned address errors, i.e:

Nim/lib/system/gc_common.nim:394:33: runtime error: load of misaligned address 0x7ffd3bd64404 for type 'void *', which requires 8 byte alignment

It's also incorrect (previous fields are ignored). -d:nimOldCaseObjects caused even more errors. The only thing that works is --mm:arc/orc.

planetis-m commented 2 years ago

Documented in the readme.

ba0f3 commented 2 years ago

I also getting this error with Nim 1.6.6: /nim-drchaos/drchaos/common.nim(88, 32) Error: expression has no address; maybe use 'unsafeAddr'

planetis-m commented 2 years ago

Thanks for reporting this is fixed in v0.1.4