From 7aeabf23b57487dca5cd254e09e47e00712f0e5d Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Sun, 6 Jan 2019 14:29:44 +0000 Subject: [PATCH] Do not crash if the minidump is missing a module list --- extension/extension.cpp | 17 ++++++++++++++++- test/test.cpp | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/extension/extension.cpp b/extension/extension.cpp index ee39e60..65b4c3d 100644 --- a/extension/extension.cpp +++ b/extension/extension.cpp @@ -743,6 +743,21 @@ class UploadThread: public IThread return kPRLocalError; } + // Minidumps missing a module list are basically useless + if (!processState.modules()) { + return kPRLocalError; + } + + std::string os_short = ""; + std::string cpu_arch = ""; + if (processState.system_info()) { + os_short = processState.system_info()->os_short; + if (os_short.empty()) { + os_short = processState.system_info()->os; + } + cpu_arch = processState.system_info()->cpu; + } + int requestingThread = processState.requesting_thread(); if (requestingThread == -1) { requestingThread = 0; @@ -759,7 +774,7 @@ class UploadThread: public IThread } std::ostringstream summaryStream; - summaryStream << 2 << "|" << processState.time_date_stamp() << "|" << processState.system_info()->os_short << "|" << processState.system_info()->cpu << "|" << processState.crashed() << "|" << processState.crash_reason() << "|" << std::hex << processState.crash_address() << std::dec << "|" << requestingThread; + summaryStream << 2 << "|" << processState.time_date_stamp() << "|" << os_short << "|" << cpu_arch << "|" << processState.crashed() << "|" << processState.crash_reason() << "|" << std::hex << processState.crash_address() << std::dec << "|" << requestingThread; std::map moduleMap; diff --git a/test/test.cpp b/test/test.cpp index 4c0b0ee..ece2a4e 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -175,6 +175,21 @@ int main(int argc, char *argv[]) continue; } + // Minidumps missing a module list are basically useless + if (!processState.modules()) { + continue; + } + + std::string os_short = ""; + std::string cpu_arch = ""; + if (processState.system_info()) { + os_short = processState.system_info()->os_short; + if (os_short.empty()) { + os_short = processState.system_info()->os; + } + cpu_arch = processState.system_info()->cpu; + } + int requestingThread = processState.requesting_thread(); if (requestingThread == -1) { requestingThread = 0; @@ -191,7 +206,7 @@ int main(int argc, char *argv[]) } std::ostringstream summaryStream; - summaryStream << 2 << "|" << processState.time_date_stamp() << "|" << processState.system_info()->os_short << "|" << processState.system_info()->cpu << "|" << processState.crashed() << "|" << processState.crash_reason() << "|" << std::hex << processState.crash_address() << std::dec << "|" << requestingThread; + summaryStream << 2 << "|" << processState.time_date_stamp() << "|" << os_short << "|" << cpu_arch << "|" << processState.crashed() << "|" << processState.crash_reason() << "|" << std::hex << processState.crash_address() << std::dec << "|" << requestingThread; std::map moduleMap;