Skip to content

Commit

Permalink
[CVE-2018-0937] Edge - Use after free of LdFld instruction in prePass…
Browse files Browse the repository at this point in the history
…InstrMap - Google, Inc

Run TryReplaceLdLen only when not in loop prepass

Found by OSSFuzz
  • Loading branch information
meg-gupta authored and akroshg committed Mar 12, 2018
1 parent 7087c31 commit 069c3fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,8 +2481,11 @@ GlobOpt::OptInstr(IR::Instr *&instr, bool* isInstrRemoved)
CurrentBlockData()->KillStateForGeneratorYield();
}

// Change LdFld on arrays, strings, and 'arguments' to LdLen when we're accessing the .length field
this->TryReplaceLdLen(instr);
if (!IsLoopPrePass())
{
// Change LdFld on arrays, strings, and 'arguments' to LdLen when we're accessing the .length field
this->TryReplaceLdLen(instr);
}

// Consider: Do we ever get post-op bailout here, and if so is the FillBailOutInfo call in the right place?
if (instr->HasBailOutInfo() && !this->IsLoopPrePass())
Expand Down

0 comments on commit 069c3fb

Please sign in to comment.