From 7aa1590d58b00b7e8279259cc218d5c6bdded1e8 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Thu, 14 Jul 2022 12:28:26 +0200 Subject: [PATCH 1/3] Actually make code do what the comment says --- src/mac/task_dumper.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mac/task_dumper.rs b/src/mac/task_dumper.rs index 6d9e9609..c0f01d40 100644 --- a/src/mac/task_dumper.rs +++ b/src/mac/task_dumper.rs @@ -197,7 +197,8 @@ impl TaskDumper { }; if let Ok(size_to_end) = get_region_size() { - let mut bytes = self.read_task_memory(addr, size_to_end as usize)?; + let mut bytes = + self.read_task_memory(addr, std::cmp::min(size_to_end as usize, 8 * 1024))?; // Find the null terminator and truncate our string if let Some(null_pos) = bytes.iter().position(|c| *c == 0) { From 39f78e89817a25e6686b2459e6f9b1047954605e Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Thu, 14 Jul 2022 12:34:08 +0200 Subject: [PATCH 2/3] Make file path retrieval more lenient --- src/mac/streams/module_list.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mac/streams/module_list.rs b/src/mac/streams/module_list.rs index 44213a4f..307bc053 100644 --- a/src/mac/streams/module_list.rs +++ b/src/mac/streams/module_list.rs @@ -132,7 +132,10 @@ impl MinidumpWriter { })?; let file_path = if image.file_path != 0 { - dumper.read_string(image.file_path)?.unwrap_or_default() + dumper + .read_string(image.file_path) + .unwrap_or_default() + .unwrap_or_default() } else { String::new() }; From 9315547446dc508ef91bb8b3020ef37937cd2dec Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Thu, 14 Jul 2022 12:48:29 +0200 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c38b9f..db13e868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +### Fixed +- [PR#42](https://github.com/rust-minidump/minidump-writer/pull/42) resolved [#41](https://github.com/rust-minidump/minidump-writer/issues/41) by capping the VM read of task memory to avoid a syscall failure, as well as made it so that if an error does occur when reading the module's file path, the module is still written to the minidump, as the file path is less important than the UUID. + ## [0.2.1] - 2022-05-25 ### Added - [PR#32](https://github.com/rust-minidump/minidump-writer/pull/32) resolved [#23](https://github.com/rust-minidump/minidump-writer/issues/23) by adding support for the thread names stream on MacOS.