mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-11 20:58:16 +03: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
Notes:
sideshowbarker
2024-07-17 20:27:28 +09:00
Author: https://github.com/emanuele6 Commit: https://github.com/SerenityOS/serenity/commit/191566fc97e Pull-request: https://github.com/SerenityOS/serenity/pull/12062
@ -126,7 +126,7 @@ ThrowCompletionOr<u32> CyclicModule::inner_module_linking(VM& vm, Vector<Module*
|
||||
(void)TRY(initialize_environment(vm));
|
||||
|
||||
// 11. Assert: module occurs exactly once in stack.
|
||||
auto count = 0;
|
||||
size_t count = 0;
|
||||
for (auto* module : stack) {
|
||||
if (module == this)
|
||||
count++;
|
||||
|
Loading…
Reference in New Issue
Block a user