diff options
| author | Brandon Miller <brandon@vector35.com> | 2025-05-06 13:48:31 -0400 |
|---|---|---|
| committer | Brandon Miller <brandon@vector35.com> | 2025-05-06 13:48:31 -0400 |
| commit | 9bd77eca3d5a0fea7b57af6252d85ab4ce4c506d (patch) | |
| tree | 3976e0328dd8f845251bbe2444ad4d7a81983bda /lang/c | |
| parent | a90cbb9ff5195b8ccc354610c17d892e84024fe5 (diff) | |
Add cast to partial var accesses in pseudo C/Rust
Add casts to HLIL_STRUCT_FIELD expressions where the size of the source
expression is greater than the size of access
Diffstat (limited to 'lang/c')
| -rw-r--r-- | lang/c/pseudoc.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lang/c/pseudoc.cpp b/lang/c/pseudoc.cpp index b91b8e71..296c2d6a 100644 --- a/lang/c/pseudoc.cpp +++ b/lang/c/pseudoc.cpp @@ -1618,6 +1618,15 @@ void PseudoCFunction::GetExprTextInternal(const HighLevelILInstruction& instr, H tokens.Append(OperationToken, "&"); } } + else if ((!settings || settings->IsOptionSet(ShowTypeCasts)) && srcExpr.operation == HLIL_VAR) + { + if (srcExpr.GetType() && srcExpr.GetType()->GetClass() != StructureTypeClass && srcExpr.size > instr.size) + { + tokens.AppendOpenParen(); + AppendSizeToken(instr.size, false, tokens); + tokens.AppendCloseParen(); + } + } GetExprTextInternal(srcExpr, tokens, settings, MemberAndFunctionOperatorPrecedence); } |
