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:
parent
0fd2f1ae21
commit
cadc8ddde9
4 changed files with 4 additions and 4 deletions
|
@ -759,7 +759,7 @@ bool DumpSymbols::WriteSymbolFile(const std::string &obj_file,
|
||||||
return false;
|
return false;
|
||||||
void *obj_base = mmap(NULL, st.st_size,
|
void *obj_base = mmap(NULL, st.st_size,
|
||||||
PROT_READ | PROT_WRITE, MAP_PRIVATE, obj_fd, 0);
|
PROT_READ | PROT_WRITE, MAP_PRIVATE, obj_fd, 0);
|
||||||
if (!obj_base)
|
if (obj_base == MAP_FAILED)
|
||||||
return false;
|
return false;
|
||||||
MmapWrapper map_wrapper(obj_base, st.st_size);
|
MmapWrapper map_wrapper(obj_base, st.st_size);
|
||||||
ElfW(Ehdr) *elf_header = reinterpret_cast<ElfW(Ehdr) *>(obj_base);
|
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,
|
void *base = mmap(NULL, st.st_size,
|
||||||
PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||||
if (!base) {
|
if (base == MAP_FAILED) {
|
||||||
close(fd);
|
close(fd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,7 +650,7 @@ bool DumpSymbols::WriteSymbolFile(const std::string &obj_file, int sym_fd) {
|
||||||
return false;
|
return false;
|
||||||
void *obj_base = mmap(NULL, st.st_size,
|
void *obj_base = mmap(NULL, st.st_size,
|
||||||
PROT_READ, MAP_PRIVATE, obj_fd, 0);
|
PROT_READ, MAP_PRIVATE, obj_fd, 0);
|
||||||
if (!obj_base)
|
if (obj_base == MAP_FAILED))
|
||||||
return false;
|
return false;
|
||||||
MmapWrapper map_wrapper(obj_base, st.st_size);
|
MmapWrapper map_wrapper(obj_base, st.st_size);
|
||||||
GElf_Ehdr elf_header;
|
GElf_Ehdr elf_header;
|
||||||
|
|
|
@ -151,7 +151,7 @@ bool FileID::ElfFileIdentifier(unsigned char identifier[16]) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
void *base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
void *base = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
if (!base)
|
if (base == MAP_FAILED)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
Loading…
Reference in a new issue