mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-07-06 17:20:47 +00:00
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
This commit is contained in:
parent
446616ee22
commit
70698339f6
|
@ -107,11 +107,11 @@ bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) {
|
||||||
if (memory_) {
|
if (memory_) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
if (offset + size > memory_size_) {
|
if (offset + size > memory_size_) {
|
||||||
|
if (offset >= memory_size_)
|
||||||
|
return false;
|
||||||
size = memory_size_ - offset;
|
size = memory_size_ - offset;
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (size < 0)
|
|
||||||
return false;
|
|
||||||
memcpy(buffer, static_cast<char *>(memory_) + offset, size);
|
memcpy(buffer, static_cast<char *>(memory_) + offset, size);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue