WerWolv / WerWolv/PatternLanguage
Crash when calculating addressof(self)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 275
- Forks
- 75
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 10
Description
I have a recursive data structure which contains (among other things) a field for the size of the embedded array; reading that array consists of reading elements from the start address of the array until the index pointer matches the data size. Here’s a minimized example of what seemed like the natural way to achieve this:
struct Element {
u8 child_len;
Element children[while($ != addressof(children) + child_len)];
};
Element root @0;
However, with the example data 05 01 00 02 00 00, this reliably crashes in ImHex 0.33.1, and also seems to crash (at least it produces no data) on the current version of pl.werwolv.net.
Workaround: use addressof+sizeof the previous field, but this looks clunky and is hard to keep track of when there are several fields in play:
struct Element {
u8 child_len;
Element children[while($ != addressof(child_len) + sizeof(child_len) + child_len)];
};
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimized HexPat example in the issue and compare the behavior of addressof(children) with the stated addressof+sizeof workaround. Reproduce the crash or missing data in ImHex 0.33.1 or the current web version; done means the recursive example no longer crashes and produces the expected elements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100