mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-02-19 08:42:59 +00:00
Issue 294: mmap error checking is not correct.
R=Liu git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@312 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
@@ -759,7 +759,7 @@ bool DumpSymbols::WriteSymbolFile(const std::string &obj_file,
|
||||
return false;
|
||||
void *obj_base = mmap(NULL, st.st_size,
|
||||
PROT_READ | PROT_WRITE, MAP_PRIVATE, obj_fd, 0);
|
||||
if (!obj_base)
|
||||
if (obj_base == MAP_FAILED)
|
||||
return false;
|
||||
MmapWrapper map_wrapper(obj_base, st.st_size);
|
||||
ElfW(Ehdr) *elf_header = reinterpret_cast<ElfW(Ehdr) *>(obj_base);
|
||||
|
||||
@@ -101,7 +101,7 @@ bool FileID::ElfFileIdentifier(unsigned char identifier[16]) {
|
||||
}
|
||||
void *base = mmap(NULL, st.st_size,
|
||||
PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||
if (!base) {
|
||||
if (base == MAP_FAILED) {
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user