зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1317319: Account imported globals when checking against the maximum number of globals; r=luke
MozReview-Commit-ID: EfaQKNWHqVw --HG-- extra : rebase_source : fbe8402289635451a09adb65ea036c5b634dcbe6
This commit is contained in:
Родитель
5de8b7cc2d
Коммит
9e832f6dff
|
@ -632,14 +632,18 @@ DecodeGlobalSection(Decoder& d, GlobalDescVector* globals)
|
||||||
if (sectionStart == Decoder::NotStarted)
|
if (sectionStart == Decoder::NotStarted)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
uint32_t numGlobals;
|
uint32_t numDefs;
|
||||||
if (!d.readVarU32(&numGlobals))
|
if (!d.readVarU32(&numDefs))
|
||||||
return d.fail("expected number of globals");
|
return d.fail("expected number of globals");
|
||||||
|
|
||||||
|
uint32_t numGlobals = globals->length() + numDefs;
|
||||||
if (numGlobals > MaxGlobals)
|
if (numGlobals > MaxGlobals)
|
||||||
return d.fail("too many globals");
|
return d.fail("too many globals");
|
||||||
|
|
||||||
for (uint32_t i = 0; i < numGlobals; i++) {
|
if (!globals->reserve(numGlobals))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < numDefs; i++) {
|
||||||
ValType type;
|
ValType type;
|
||||||
bool isMutable;
|
bool isMutable;
|
||||||
if (!DecodeGlobalType(d, &type, &isMutable))
|
if (!DecodeGlobalType(d, &type, &isMutable))
|
||||||
|
@ -649,8 +653,7 @@ DecodeGlobalSection(Decoder& d, GlobalDescVector* globals)
|
||||||
if (!DecodeInitializerExpression(d, *globals, type, &initializer))
|
if (!DecodeInitializerExpression(d, *globals, type, &initializer))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!globals->append(GlobalDesc(initializer, isMutable)))
|
globals->infallibleAppend(GlobalDesc(initializer, isMutable));
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d.finishSection(sectionStart, sectionSize, "global"))
|
if (!d.finishSection(sectionStart, sectionSize, "global"))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче