Skip to content

Commit 1521e9e

Browse files
authored
Merge pull request #10611 from ethereum/fix-10609
AsmAnalysis: Fix out of bounds read due to incorrect bounds checking …
2 parents 4e86390 + 9b38176 commit 1521e9e

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

libyul/AsmAnalysis.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,11 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
332332
for (size_t i = _funCall.arguments.size(); i > 0; i--)
333333
{
334334
Expression const& arg = _funCall.arguments[i - 1];
335-
if (auto literalArgumentKind = literalArguments ? literalArguments->at(i - 1) : std::nullopt)
335+
if (
336+
auto literalArgumentKind = (literalArguments && i <= literalArguments->size()) ?
337+
literalArguments->at(i - 1) :
338+
std::nullopt
339+
)
336340
{
337341
if (!holds_alternative<Literal>(arg))
338342
m_errorReporter.typeError(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
function f(a,b) {}
3+
f(x,1)
4+
}
5+
// ----
6+
// DeclarationError 8198: (27-28): Identifier not found.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
let x
3+
function f(a,b) {}
4+
f(x,1)
5+
}
6+
// ----

0 commit comments

Comments
 (0)