Skip to content

Parse bare BT_UNK and harden function dirtree dump#56

Open
ChrisKader wants to merge 2 commits into
Vector35:mainfrom
ChrisKader:main
Open

Parse bare BT_UNK and harden function dirtree dump#56
ChrisKader wants to merge 2 commits into
Vector35:mainfrom
ChrisKader:main

Conversation

@ChrisKader

Copy link
Copy Markdown

A type byte of 0x00 (BT_UNK with BTMT_SIZE0) is IDA's unknown type of
unspecified size and appears in real databases as function argument/return
types, but it was rejected with "forbidden use of BT_UNK", aborting type
parsing for any function that used it. Parse it like BT_UNKNOWN (unknown,
unspecified size) instead.

Also harden dump-dirtree-funcs: a single function whose label or type fails
to parse no longer panics the whole dump (it previously .unwrap()ed
print_function). Per-function parse errors are tolerated, and an entry that
still fails to print is emitted with an inline error note.

This let a full function-dirtree dump of a large arm64 database complete with
all ~150k functions instead of aborting after the first unparsable type.

A type byte of 0x00 (BT_UNK with BTMT_SIZE0) is IDA's unknown type of
unspecified size, which appears in real databases as function argument and
return types. It was being rejected with "forbidden use of BT_UNK", which
aborted type parsing for any function that used it. Treat it like BT_UNKNOWN
(unknown, unspecified size) instead.

Also harden dump-dirtree-funcs so a single function whose label or type fails
to parse no longer panics the whole dump: per-function parse errors are
tolerated and, if printing a function still fails, the entry is emitted with
an inline error note rather than unwrapping.
Some databases carry extra bytes after the IDBParam structure. Erroring on
that aborted root-info parsing (and therefore the whole import) for those
files. Gate the "Data left after the IDBParam" check behind the `restrictive`
feature, matching how other strictness checks are handled, so normal parsing
tolerates the trailing data.
@plafosse plafosse requested a review from emesare June 5, 2026 12:00
@plafosse

plafosse commented Jun 5, 2026

Copy link
Copy Markdown
Member

This is great thank for the PR @ChrisKader !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants