mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
Fix crash in Pattern Language syntax highlighting for self-inheriting structs (#2546)
``` rust
struct Rec : Rec {
};
```
Prevent infinite recursion in appendInheritances by erasing processed
inheritance entries during traversal, and safely iterate over
m_inheritances in appendInheritances to avoid
modification-during-iteration issues.
Co-authored-by: paxcut <53811119+paxcut@users.noreply.github.com>
This commit is contained in:
@@ -1858,10 +1858,13 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
void TextHighlighter::recurseInheritances(std::string name) {
|
||||
void TextHighlighter::recurseInheritances(std::string name, size_t depth) {
|
||||
if (depth > m_inheritances.size())
|
||||
return;
|
||||
if (m_inheritances.contains(name)) {
|
||||
for (const auto &inheritance: m_inheritances[name]) {
|
||||
recurseInheritances(inheritance);
|
||||
recurseInheritances(inheritance, depth + 1);
|
||||
|
||||
auto definitions = m_UDTVariables[inheritance];
|
||||
if (definitions.empty())
|
||||
definitions = m_ImportedUDTVariables[inheritance];
|
||||
|
||||
Reference in New Issue
Block a user