Skip to content

NameHashSet #1529

@Kailo97

Description

@Kailo97

https://crash.limetech.org/7txceegvqyfk
I was traking the crash and find that NameHashSet is weird.
For example:
key declarated but not used.

bool retrieve(const char *aKey, T *value)
{
CharsAndLength key(aKey);
Result r = table_.find(aKey);
if (!r.found())
return false;
*value = *r;
return true;
}

bool contains(const char *aKey)
{
CharsAndLength key(aKey);
Result r = table_.find(aKey);
return r.found();
}

I'm not sure that find all problems in class.
Crash may not to be connected with bad code.

Crash results:
Coruppted entry in HashTable, whitch may cause by:

  1. Whole entry is incorrect (coruppted table)
  2. Wrong entry's payload (pointer)
  3. Pointer correct but virtual table pointer was coruppted
    For cases 1 and 2 need to looking in SM code for reason, in case 3 it's external problem.
    How to figure it out that exactly, no idea yet.
    SM version 1.10-6502, but upstream 1.10-dev (0b468f2) and master (38eecd5) same in this part.
    Crash tracing:
sourcemod.2.csgo.so!CommandFlagsHelper::ConCommandPolicy::matches												INLINED	https://github.com/alliedmodders/sourcemod/blob/617fb77ea02076cc70be84c6092ebcfc81d54cc2/core/smn_console.cpp#L185
sourcemod.2.csgo.so!ke::HashTable<SourceMod::NameHashSet::Policy<ConCommandBase *, CommandFlagsHelper::ConCommandPolicy>, ke::SystemAllocatorPolicy>::lookup	INLINED	https://github.com/alliedmodders/amtl/blob/e00a845c6bc415995ddc4b7ec538d1704fdd0122/amtl/am-hashtable.h#L304
sourcemod.2.csgo.so!ke::HashTable<SourceMod::NameHashSet::Policy<ConCommandBase *, CommandFlagsHelper::ConCommandPolicy>, ke::SystemAllocatorPolicy>::find	INLINED	https://github.com/alliedmodders/amtl/blob/e00a845c6bc415995ddc4b7ec538d1704fdd0122/amtl/am-hashtable.h#L430
sourcemod.2.csgo.so!SourceMod::NameHashSet<ConCommandBase *, CommandFlagsHelper::ConCommandPolicy>::retrieve								https://github.com/alliedmodders/sourcemod/blob/617fb77ea02076cc70be84c6092ebcf/public/sm_namehashset.h#L133
sourcemod.2.csgo.so!CommandFlagsHelper::GetFlags														INLINED	https://github.com/alliedmodders/sourcemod/blob/617fb77ea02076cc70be84c6092ebcfc81d54cc2/core/smn_console.cpp#L141
sourcemod.2.csgo.so!GetCommandFlags																	https://github.com/alliedmodders/sourcemod/blob/617fb77ea02076cc70be84c6092ebcfc81d54cc2/core/smn_console.cpp#L1070
sm_command_eater.smx::.2960.CommandExists

Here is a lot inline optimizations. Crashed on line 79 on virtual call of ConCommandBase::GetName referenced to

return strcmp(name, base->GetName()) == 0;

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions