Skip to content

Commit

Permalink
fix: handle missing props in control flow objects
Browse files Browse the repository at this point in the history
with dead code injection, there may be references that access arbitrary properties that shouldn't be attempted to be inlined
  • Loading branch information
j4k0xb committed Jan 29, 2024
1 parent 5c35af8 commit 9e8d53f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/webcrack/src/deobfuscate/control-flow-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ export default {
[...binding.referencePaths].reverse().forEach((ref) => {
const memberPath = ref.parentPath as NodePath<t.MemberExpression>;
const propName = getPropName(memberPath.node.property)!;
const value = props.get(propName)!;
const value = props.get(propName);
if (!value) {
ref.addComment('leading', 'webcrack:control_flow_missing_prop');
return;
}

if (t.isStringLiteral(value)) {
memberPath.replaceWith(value);
Expand Down

0 comments on commit 9e8d53f

Please sign in to comment.