Skip to content
Permalink
Browse files

Prevent a use after free in memop

  • Loading branch information...
zenparsing authored and Kevin Smith committed Sep 4, 2019
1 parent e1f5b03 commit fb4a653442ebe6c8586412fc8d94a4b3e489cfac
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/Backend/GlobOpt.cpp
RemoveMemOpSrcInstr(memopInstr, emitData->stElemInstr, emitData->block);
if (!isMemset)
{
if (((MemCopyEmitData*)emitData)->ldElemInstr->GetSrc1()->IsIndirOpnd())
IR::Instr* ldElemInstr = ((MemCopyEmitData*)emitData)->ldElemInstr;
if (ldElemInstr->GetSrc1()->IsIndirOpnd())
{
baseOpnd = ((MemCopyEmitData*)emitData)->ldElemInstr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd();
baseOpnd = ldElemInstr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd();
isLikelyJsArray = baseOpnd->GetValueType().IsLikelyArrayOrObjectWithArray();
ProcessNoImplicitCallArrayUses(baseOpnd, baseOpnd->IsArrayRegOpnd() ? baseOpnd->AsArrayRegOpnd() : nullptr, emitData->stElemInstr, isLikelyJsArray, true);
ProcessNoImplicitCallArrayUses(baseOpnd, baseOpnd->IsArrayRegOpnd() ? baseOpnd->AsArrayRegOpnd() : nullptr, ldElemInstr, isLikelyJsArray, true);
}
RemoveMemOpSrcInstr(memopInstr, ((MemCopyEmitData*)emitData)->ldElemInstr, emitData->block);
RemoveMemOpSrcInstr(memopInstr, ldElemInstr, emitData->block);
}
InsertNoImplicitCallUses(memopInstr);
noImplicitCallUsesToInsert->Clear();

0 comments on commit fb4a653

Please sign in to comment.
You can’t perform that action at this time.