tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 15534cd66b12e26180b85773e2b8c3e5649d51a3
parent 0a847dc74237bf0b2bae9e778fc2efe0c7909290
Author: Mike Hommey <mh+mozilla@glandium.org>
Date:   Wed, 26 Nov 2025 20:10:39 +0000

Bug 2002415 - Handle K32EnumProcessModules not returning an error when the buffer is not large enough. r=gsvelto

Apparently, what happens when the buffer given to K32EnumProcessModules
is not large enough is that it doesn't return an error code, but gives
the size it would need for the full list.

Differential Revision: https://phabricator.services.mozilla.com/D274067

Diffstat:
Mtoolkit/crashreporter/process_reader/src/platform/windows.rs | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/toolkit/crashreporter/process_reader/src/platform/windows.rs b/toolkit/crashreporter/process_reader/src/platform/windows.rs @@ -98,12 +98,10 @@ impl ProcessReader { module_num = required_buffer_size as usize / size_of::<HMODULE>(); - if res == 0 { - if required_buffer_size > buffer_size { - module_array = Vec::<HMODULE>::with_capacity(module_num); - } else { - return Err(ProcessReaderError::EnumProcessModulesError); - } + if required_buffer_size > buffer_size { + module_array = Vec::<HMODULE>::with_capacity(module_num); + } else if res == 0 { + return Err(ProcessReaderError::EnumProcessModulesError); } else { break; }