breakpad/src/processor
Peter Boström 7b981b2135 Replace unsigned int with size_t for ModuleSerializer
This is a speculative fix for a memory bug where our symbol files are
looking like they've grown enough that serializing them will outgrow
UINT_MAX. Before this change a size_t is implicitly cast to a size_t in
unsigned int, allocate a buffer of that size and then continue to write
module data out of bounds.

I have not been able to reproduce the OOB write locally as the original
uploaded symbol data is gone, but I have been able to reproduce builds
where, if we enable inline frames and CFI dumping, the size grows to
3.6GB when serializing it, which is close enough to 4.2GB that the
wrapping theory seems reasonable on another board or build.

No effort is made here to prevent wrapping behavior on 32-bit systems.

Bug: b/237242489, chromium:1410232
Change-Id: I3d7ec03c51c298f10df3d5b1e5306433875c7919
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4477821
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-04-26 20:22:23 +00:00
..
proto Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
testdata Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
address_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
address_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
address_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
basic_code_module.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
basic_code_modules.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
basic_code_modules.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
basic_source_line_resolver.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
basic_source_line_resolver_types.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
basic_source_line_resolver_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
call_stack.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
cfi_frame_info-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
cfi_frame_info.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
cfi_frame_info.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
cfi_frame_info_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
contained_range_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
contained_range_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
contained_range_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
convert_old_arm64_context.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
convert_old_arm64_context.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
disassembler_objdump.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
disassembler_objdump.h Add DisassemblerObjdump. 2022-10-12 17:19:44 +00:00
disassembler_objdump_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
disassembler_x86.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
disassembler_x86.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
disassembler_x86_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
dump_context.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
dump_object.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
exploitability.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
exploitability_linux.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
exploitability_linux.h Add DisassemblerObjdump. 2022-10-12 17:19:44 +00:00
exploitability_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
exploitability_win.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
exploitability_win.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
fast_source_line_resolver.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
fast_source_line_resolver_types.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
fast_source_line_resolver_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
linked_ptr.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
logging.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
logging.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
map_serializers-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
map_serializers.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
map_serializers_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
microdump.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
microdump_processor.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
microdump_processor_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
microdump_stackwalk.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
microdump_stackwalk_machine_readable_test Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
microdump_stackwalk_test Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
microdump_stackwalk_test_vars Microdumps: support aarch64 and lib mapping from APK 2014-12-02 15:31:25 +00:00
minidump.cc Add maxsize for xstate areas 2023-04-01 01:52:18 +00:00
minidump_dump.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
minidump_dump_test Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
minidump_processor.cc Convert RISC-V numeric identifiers to strings 2023-04-11 21:51:18 +00:00
minidump_processor_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
minidump_stackwalk.cc Remove extra comma in minidump_stackwalk.cc 2023-03-16 16:13:59 +00:00
minidump_stackwalk_machine_readable_test Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
minidump_stackwalk_test Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
minidump_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
module_comparer.cc Replace unsigned int with size_t for ModuleSerializer 2023-04-26 20:22:23 +00:00
module_comparer.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
module_factory.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
module_serializer.cc Replace unsigned int with size_t for ModuleSerializer 2023-04-26 20:22:23 +00:00
module_serializer.h Replace unsigned int with size_t for ModuleSerializer 2023-04-26 20:22:23 +00:00
pathname_stripper.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
pathname_stripper.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
pathname_stripper_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
postfix_evaluator-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
postfix_evaluator.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
postfix_evaluator_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
proc_maps_linux.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
proc_maps_linux_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
process_state.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
range_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
range_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
range_map_truncate_lower_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
range_map_truncate_upper_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
range_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
simple_serializer-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
simple_serializer.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
simple_symbol_supplier.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
simple_symbol_supplier.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
source_line_resolver_base.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
source_line_resolver_base_types.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stack_frame_cpu.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stack_frame_symbolizer.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalk_common.cc Fix alignment of the brief output of minidump_stackwalk 2023-04-24 15:41:17 +00:00
stackwalk_common.h Add brief flag to minidump_stackwalk 2023-03-15 18:04:57 +00:00
stackwalker.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_address_list.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_address_list.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_address_list_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_amd64.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_amd64.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_amd64_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_arm.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_arm.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_arm64.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_arm64.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_arm64_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_arm_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_mips.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_mips.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_mips64_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_mips_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_ppc.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_ppc.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_ppc64.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_ppc64.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_riscv.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_riscv.h Added riscv and riscv64 support for Linux 2022-09-09 08:44:46 +00:00
stackwalker_riscv64.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_riscv64.h Added riscv and riscv64 support for Linux 2022-09-09 08:44:46 +00:00
stackwalker_riscv64_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_riscv_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_selftest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_selftest_sol.s Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_sparc.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_sparc.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_unittest_utils.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_x86.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
stackwalker_x86.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
stackwalker_x86_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
static_address_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_address_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_address_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
static_contained_range_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_contained_range_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_contained_range_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
static_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_map_iterator-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_map_iterator.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
static_range_map-inl.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_range_map.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
static_range_map_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
symbolic_constants_win.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
symbolic_constants_win.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
synth_minidump.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
synth_minidump.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
synth_minidump_unittest.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
synth_minidump_unittest_data.h Use stdint types everywhere 2013-03-06 14:04:42 +00:00
tokenize.cc Add #include <config.h> to the beginning of all cc files 2023-02-27 19:31:32 +00:00
tokenize.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00
windows_frame_info.h Update copyright boilerplate, 2022 edition (Breakpad) 2022-09-07 16:59:53 +00:00