From 70698339f62e96a2729d87970755a9546df2aed1 Mon Sep 17 00:00:00 2001 From: "qsr@chromium.org" Date: Thu, 20 Oct 2011 15:39:57 +0000 Subject: [PATCH] Correct incorrect bounds checking. Review URL: http://breakpad.appspot.com/319002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@874 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/mac/macho_walker.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/mac/macho_walker.cc b/src/common/mac/macho_walker.cc index 00fde03e..26535bc2 100644 --- a/src/common/mac/macho_walker.cc +++ b/src/common/mac/macho_walker.cc @@ -107,11 +107,11 @@ bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) { if (memory_) { bool result = true; if (offset + size > memory_size_) { + if (offset >= memory_size_) + return false; size = memory_size_ - offset; result = false; } - if (size < 0) - return false; memcpy(buffer, static_cast(memory_) + offset, size); return result; } else {