Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Unified Diff: snapshot/mac/mach_o_image_segment_reader.cc

Issue 1283243004: ubsan: Don’t call v[0] on empty vectors (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | snapshot/minidump/process_snapshot_minidump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/mac/mach_o_image_segment_reader.cc
diff --git a/snapshot/mac/mach_o_image_segment_reader.cc b/snapshot/mac/mach_o_image_segment_reader.cc
index 5c74d80dd1815ac10a9a6202e003abd1679ec727..9b07e904ea87c6cd47c44bba36d657ae9ae22e6c 100644
--- a/snapshot/mac/mach_o_image_segment_reader.cc
+++ b/snapshot/mac/mach_o_image_segment_reader.cc
@@ -95,7 +95,8 @@ bool MachOImageSegmentReader::Initialize(ProcessReader* process_reader,
}
sections_.resize(segment_command_.nsects);
- if (!process_types::section::ReadArrayInto(
+ if (!sections_.empty() &&
+ !process_types::section::ReadArrayInto(
process_reader,
load_command_address + segment_command_.Size(),
segment_command_.nsects,
« no previous file with comments | « no previous file | snapshot/minidump/process_snapshot_minidump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698