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

Unified Diff: chrome/common/safe_browsing/mach_o_image_reader_mac.cc

Issue 1763443002: Protect against recursive processing of the fat header in MachOImageReader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | chrome/common/safe_browsing/mach_o_image_reader_mac_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/safe_browsing/mach_o_image_reader_mac.cc
diff --git a/chrome/common/safe_browsing/mach_o_image_reader_mac.cc b/chrome/common/safe_browsing/mach_o_image_reader_mac.cc
index 8d1c946d8f663cd0df15a04895881e07cc7b185c..3ce37516c723e9390373a607536df48e9c402b5b 100644
--- a/chrome/common/safe_browsing/mach_o_image_reader_mac.cc
+++ b/chrome/common/safe_browsing/mach_o_image_reader_mac.cc
@@ -122,6 +122,11 @@ bool MachOImageReader::Initialize(const uint8_t* image, size_t image_size) {
uint32_t arch_offset = do_swap ? OSSwapInt32(arch->offset) : arch->offset;
uint32_t arch_size = do_swap ? OSSwapInt32(arch->size) : arch->size;
+ // Cannot refer back to headers of previous arches to cause
+ // recursive processing.
+ if (arch_offset < offset)
+ return false;
+
ByteSlice slice = data_->Slice(arch_offset, arch_size);
if (!slice.IsValid())
return false;
« no previous file with comments | « no previous file | chrome/common/safe_browsing/mach_o_image_reader_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698