mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 14:07:42 +00:00
LibJS: Avoid potential signed integer overflow in CyclicModule.cpp
`auto count = 0;` will declare `count` as a `signed int`. We don't want that since `count` is used to count the occurence of an element in an `AK::Vector` that can have up to `SIZE_MAX` elements; `SIZE_MAX` can overflow a `signed int` more than 4 billion times.
This commit is contained in:
parent
065525aba0
commit
191566fc97
1 changed files with 1 additions and 1 deletions
|
@ -126,7 +126,7 @@ ThrowCompletionOr<u32> CyclicModule::inner_module_linking(VM& vm, Vector<Module*
|
||||||
(void)TRY(initialize_environment(vm));
|
(void)TRY(initialize_environment(vm));
|
||||||
|
|
||||||
// 11. Assert: module occurs exactly once in stack.
|
// 11. Assert: module occurs exactly once in stack.
|
||||||
auto count = 0;
|
size_t count = 0;
|
||||||
for (auto* module : stack) {
|
for (auto* module : stack) {
|
||||||
if (module == this)
|
if (module == this)
|
||||||
count++;
|
count++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue