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

Unified Diff: util/mac/mach_o_image_symbol_table_reader.cc

Issue 558313002: Add a MappedMemory interface to TaskMemory and use it in MachOImageSymbolTableReader (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Use vm_region_64() instead of mach_vm_region() Created 6 years, 3 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 | util/mach/task_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mac/mach_o_image_symbol_table_reader.cc
diff --git a/util/mac/mach_o_image_symbol_table_reader.cc b/util/mac/mach_o_image_symbol_table_reader.cc
index 51e1261e71c99910c0287bbba2110430deac796a..0b64fd460cf6a929421c1200c085343a4784856a 100644
--- a/util/mac/mach_o_image_symbol_table_reader.cc
+++ b/util/mac/mach_o_image_symbol_table_reader.cc
@@ -104,6 +104,7 @@ class MachOImageSymbolTableReaderInitializer {
return false;
}
+ scoped_ptr<TaskMemory::MappedMemory> string_table;
for (size_t symbol_index = 0; symbol_index < symbol_count; ++symbol_index) {
const process_types::nlist& symbol = symbols[symbol_index];
std::string symbol_info = base::StringPrintf(", symbol index %zu%s",
@@ -121,11 +122,17 @@ class MachOImageSymbolTableReaderInitializer {
return false;
}
+ if (!string_table) {
+ string_table = process_reader_->Memory()->ReadMapped(
+ strtab_address, strtab_size);
+ if (!string_table) {
+ LOG(WARNING) << "could not read string table" << module_info_;
+ return false;
+ }
+ }
+
std::string name;
- if (!process_reader_->Memory()->ReadCStringSizeLimited(
- strtab_address + symbol.n_strx,
- strtab_size - symbol.n_strx,
- &name)) {
+ if (!string_table->ReadCString(symbol.n_strx, &name)) {
LOG(WARNING) << "could not read string" << symbol_info;
return false;
}
« no previous file with comments | « no previous file | util/mach/task_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698