diff --git a/src/linux/minidump_writer/mod.rs b/src/linux/minidump_writer/mod.rs index d7982a58..3f36cb17 100644 --- a/src/linux/minidump_writer/mod.rs +++ b/src/linux/minidump_writer/mod.rs @@ -978,6 +978,9 @@ impl MinidumpWriter { // Zero memory that is below the current stack pointer. let offset = (sp_offset + std::mem::size_of::() - 1) & !(std::mem::size_of::() - 1); + // A truncated copy (e.g. a guard page in the middle of the stack) can + // be shorter than the rounded offset; never index past the data. + let offset = offset.min(stack_copy.len()); for x in &mut stack_copy[0..offset] { *x = 0; } diff --git a/src/linux/module_reader.rs b/src/linux/module_reader.rs index a6b70bb9..6fdf1517 100644 --- a/src/linux/module_reader.rs +++ b/src/linux/module_reader.rs @@ -55,7 +55,7 @@ pub enum ModuleReaderError { "failed to calculate build id\n\ ... from program headers: {program_headers}\n\ ... from sections: {section}\n\ - ... from the text section: {section}" + ... from the text section: {generated}" )] NoBuildId { program_headers: Box,