trailofbits / multiplier

Code auditing productivity multiplier.
Apache License 2.0
437 stars 27 forks source link

Assert on looking for EnumDecl inside Entity provider #555

Open kumarak opened 5 months ago

kumarak commented 5 months ago

Entity provider hit assert on testing OGharness with debug build of multiplier

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737352515584) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737352515584) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737352515584, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff7c42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7c287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff7c2871b in __assert_fail_base (fmt=0x7ffff7ddd130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7ffff2fa23db "false", 
    file=0x7ffff256f748 "/home/akkumar/workspace/multiplier/lib/SQLiteEntityProvider.cpp", line=1082, function=<optimized out>) at ./assert/assert.c:92
#6  0x00007ffff7c39e96 in __GI___assert_fail (assertion=0x7ffff2fa23db "false", 
    file=0x7ffff256f748 "/home/akkumar/workspace/multiplier/lib/SQLiteEntityProvider.cpp", line=1082, 
    function=0x7ffff2570a45 "virtual DeclImplPtr mx::SQLiteEntityProvider::DeclFor(const Ptr &, RawEntityId)") at ./assert/assert.c:101
#7  0x00007fffe9ee1c6d in mx::SQLiteEntityProvider::DeclFor (this=0x555556100f30, 
    self=std::shared_ptr<mx::EntityProvider> (use count 265, weak count 1) = {...}, raw_id=9417026824299347968)
    at /home/akkumar/workspace/multiplier/lib/SQLiteEntityProvider.cpp:1075
#8  0x00007fffe9c79945 in mx::CachingEntityProvider::DeclFor (this=0x5555561ec3a0, 
    self=std::shared_ptr<mx::EntityProvider> (use count 265, weak count 1) = {...}, raw_id=9417026824299347968)
    at /home/akkumar/workspace/multiplier/lib/CachingEntityProvider.cpp:279
#9  0x00007fffe9d0d6f5 in mx::EntityProvider::DeclsFor(std::shared_ptr<mx::EntityProvider> const&, mx::DeclKind, mx::SpecificEntityId<mx::FragmentId>) & (
    self=std::shared_ptr<mx::EntityProvider> (use count 265, weak count 1) = {...}, kind=mx::DeclKind::ENUM, frag_id=...)
    at /home/akkumar/workspace/multiplier/lib/EntityProvider.cpp:386
pgoodman commented 5 months ago
(lldb) p mx::EntityId(9417026824299347968).Unpack()
(mx::VariantId)  Active Type = mx::DeclId  {
  Value = (fragment_id = 1051883, kind = ACCESS_SPEC, offset = 0, is_definition = false)
}
(lldb) p mx::EntityId(mx::DeclId{1051883, mx::DeclKind::ACCESS_SPEC, 0, true})
(mx::EntityId)  (opaque = 9223372040322416640)

@kumarak can you try the following with the same database:

mx-highlight-entity --db /path/to/db --entity_id 9223372040322416640
pgoodman commented 5 months ago

It is a bit bizarre that it is finding an ACCESS_SPEC for an ENUM.