File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
lldb/source/Plugins/ObjectFile/Minidump Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -972,8 +972,8 @@ Status MinidumpFileBuilder::DumpDirectories() const {
972
972
Status MinidumpFileBuilder::ReadWriteMemoryInChunks (
973
973
const lldb_private::CoreFileMemoryRange &range, uint64_t *bytes_read) {
974
974
Log *log = GetLog (LLDBLog::Object);
975
- lldb::addr_t addr = range.range .start ();
976
- lldb::addr_t size = range.range .size ();
975
+ const lldb::addr_t addr = range.range .start ();
976
+ const lldb::addr_t size = range.range .size ();
977
977
// First we set the byte tally to 0, so if we do exit gracefully
978
978
// the caller doesn't think the random garbage on the stack is a
979
979
// success.
@@ -1024,7 +1024,13 @@ Status MinidumpFileBuilder::ReadWriteMemoryInChunks(
1024
1024
if (error.Fail ())
1025
1025
return error;
1026
1026
1027
- // This check is so we don't overflow when the error code above sets the
1027
+ // If the bytes read in this chunk would cause us to overflow, set the
1028
+ // remaining bytes to 0 so we exit. This is a safety check so we don't
1029
+ // get stuck building a bigger file forever.
1030
+ if (bytes_read_for_chunk > bytes_remaining)
1031
+ bytes_remaining = 0 ;
1032
+
1033
+ // This check is so we don't overflow when the error above sets the
1028
1034
// bytes to read to 0 (the graceful exit condition).
1029
1035
if (bytes_remaining > 0 )
1030
1036
bytes_remaining -= bytes_read_for_chunk;
You can’t perform that action at this time.
0 commit comments