Skip to content

Utilising Swift demangler can cause hard-stop #912

@BananaIguana

Description

@BananaIguana

Firstly, I'm not entirely sure if this is a bug or user error/setup so hopefully someone more knowledgable than myself could confirm.

I wrote a tool which parses Swift symbols from a Mach-O binary. It reads __fieldmd metadata and I extract the demangled object names using this crate.

Environment

symbolic-demangle = "12.15.3"
symbolic-common = "12.15.3"

Steps to Reproduce

Demangle string $sTB, read from binary. All other strings either demangle fine or the original string is returned. (I'm not sure if this is an valid or invalid mangled name)

Expected Result

I would have expected either:

  • a Result or Option type to allow capture of the error.
  • The original string returned if failed to demangle.
  • try_demangle to at least not hard stop.

Actual Result

The code hard stops on this assert:

if (PassID < 0 || PassID >= MAX_SPECIALIZATION_PASS)
{
    assert(false && "unexpected pass id");
    return nullptr;
}

Since I cannot control the outcome when using data driven output, I can not safely use this library unless there is a workaround or an alternative configuration.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions