Loading libunwindstack/DwarfMemory.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ namespace unwindstack { bool DwarfMemory::ReadBytes(void* dst, size_t num_bytes) { if (!memory_->Read(cur_offset_, dst, num_bytes)) { if (!memory_->ReadFully(cur_offset_, dst, num_bytes)) { return false; } cur_offset_ += num_bytes; Loading libunwindstack/DwarfOp.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ bool DwarfOp<AddressType>::op_deref() { // Read the address and dereference it. AddressType addr = StackPop(); AddressType value; if (!regular_memory()->Read(addr, &value, sizeof(value))) { if (!regular_memory()->ReadFully(addr, &value, sizeof(value))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading @@ -159,7 +159,7 @@ bool DwarfOp<AddressType>::op_deref_size() { // Read the address and dereference it. AddressType addr = StackPop(); AddressType value = 0; if (!regular_memory()->Read(addr, &value, bytes_to_read)) { if (!regular_memory()->ReadFully(addr, &value, bytes_to_read)) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading libunwindstack/DwarfSection.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me return false; } if (loc->type == DWARF_LOCATION_EXPRESSION) { if (!regular_memory->Read(value, &cfa, sizeof(AddressType))) { if (!regular_memory->ReadFully(value, &cfa, sizeof(AddressType))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading Loading @@ -175,7 +175,8 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me const DwarfLocation* loc = &entry.second; switch (loc->type) { case DWARF_LOCATION_OFFSET: if (!regular_memory->Read(cfa + loc->values[0], &(*cur_regs)[reg], sizeof(AddressType))) { if (!regular_memory->ReadFully(cfa + loc->values[0], &(*cur_regs)[reg], sizeof(AddressType))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading Loading @@ -210,7 +211,7 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me return false; } if (loc->type == DWARF_LOCATION_EXPRESSION) { if (!regular_memory->Read(value, &(*cur_regs)[reg], sizeof(AddressType))) { if (!regular_memory->ReadFully(value, &(*cur_regs)[reg], sizeof(AddressType))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading libunwindstack/Elf.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ bool Elf::IsValidElf(Memory* memory) { // Verify that this is a valid elf file. uint8_t e_ident[SELFMAG + 1]; if (!memory->Read(0, e_ident, SELFMAG)) { if (!memory->ReadFully(0, e_ident, SELFMAG)) { return false; } Loading @@ -156,7 +156,7 @@ void Elf::GetInfo(Memory* memory, bool* valid, uint64_t* size) { // Now read the section header information. uint8_t class_type; if (!memory->Read(EI_CLASS, &class_type, 1)) { if (!memory->ReadFully(EI_CLASS, &class_type, 1)) { return; } if (class_type == ELFCLASS32) { Loading @@ -174,12 +174,12 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { } std::unique_ptr<ElfInterface> interface; if (!memory->Read(EI_CLASS, &class_type_, 1)) { if (!memory->ReadFully(EI_CLASS, &class_type_, 1)) { return nullptr; } if (class_type_ == ELFCLASS32) { Elf32_Half e_machine; if (!memory->Read(EI_NIDENT + sizeof(Elf32_Half), &e_machine, sizeof(e_machine))) { if (!memory->ReadFully(EI_NIDENT + sizeof(Elf32_Half), &e_machine, sizeof(e_machine))) { return nullptr; } Loading @@ -200,7 +200,7 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { } } else if (class_type_ == ELFCLASS64) { Elf64_Half e_machine; if (!memory->Read(EI_NIDENT + sizeof(Elf64_Half), &e_machine, sizeof(e_machine))) { if (!memory->ReadFully(EI_NIDENT + sizeof(Elf64_Half), &e_machine, sizeof(e_machine))) { return nullptr; } if (e_machine != EM_AARCH64 && e_machine != EM_X86_64) { Loading libunwindstack/ElfInterface.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ Memory* ElfInterface::CreateGnuDebugdataMemory() { Crc64GenerateTable(); std::vector<uint8_t> src(gnu_debugdata_size_); if (!memory_->Read(gnu_debugdata_offset_, src.data(), gnu_debugdata_size_)) { if (!memory_->ReadFully(gnu_debugdata_offset_, src.data(), gnu_debugdata_size_)) { gnu_debugdata_offset_ = 0; gnu_debugdata_size_ = static_cast<uint64_t>(-1); return nullptr; Loading Loading @@ -131,7 +131,7 @@ void ElfInterface::InitHeadersWithTemplate() { template <typename EhdrType, typename PhdrType, typename ShdrType> bool ElfInterface::ReadAllHeaders(uint64_t* load_bias) { EhdrType ehdr; if (!memory_->Read(0, &ehdr, sizeof(ehdr))) { if (!memory_->ReadFully(0, &ehdr, sizeof(ehdr))) { return false; } Loading Loading @@ -242,7 +242,7 @@ bool ElfInterface::ReadSectionHeaders(const EhdrType& ehdr) { } if (shdr.sh_type == SHT_SYMTAB || shdr.sh_type == SHT_DYNSYM) { if (!memory_->Read(offset, &shdr, sizeof(shdr))) { if (!memory_->ReadFully(offset, &shdr, sizeof(shdr))) { return false; } // Need to go get the information about the section that contains Loading Loading @@ -324,7 +324,7 @@ bool ElfInterface::GetSonameWithTemplate(std::string* soname) { uint64_t offset = dynamic_offset_; uint64_t max_offset = offset + dynamic_size_; for (uint64_t offset = dynamic_offset_; offset < max_offset; offset += sizeof(DynType)) { if (!memory_->Read(offset, &dyn, sizeof(dyn))) { if (!memory_->ReadFully(offset, &dyn, sizeof(dyn))) { return false; } Loading Loading @@ -388,7 +388,7 @@ bool ElfInterface::Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* f template <typename EhdrType> void ElfInterface::GetMaxSizeWithTemplate(Memory* memory, uint64_t* size) { EhdrType ehdr; if (!memory->Read(0, &ehdr, sizeof(ehdr))) { if (!memory->ReadFully(0, &ehdr, sizeof(ehdr))) { return; } if (ehdr.e_shnum == 0) { Loading Loading
libunwindstack/DwarfMemory.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ namespace unwindstack { bool DwarfMemory::ReadBytes(void* dst, size_t num_bytes) { if (!memory_->Read(cur_offset_, dst, num_bytes)) { if (!memory_->ReadFully(cur_offset_, dst, num_bytes)) { return false; } cur_offset_ += num_bytes; Loading
libunwindstack/DwarfOp.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ bool DwarfOp<AddressType>::op_deref() { // Read the address and dereference it. AddressType addr = StackPop(); AddressType value; if (!regular_memory()->Read(addr, &value, sizeof(value))) { if (!regular_memory()->ReadFully(addr, &value, sizeof(value))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading @@ -159,7 +159,7 @@ bool DwarfOp<AddressType>::op_deref_size() { // Read the address and dereference it. AddressType addr = StackPop(); AddressType value = 0; if (!regular_memory()->Read(addr, &value, bytes_to_read)) { if (!regular_memory()->ReadFully(addr, &value, bytes_to_read)) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading
libunwindstack/DwarfSection.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me return false; } if (loc->type == DWARF_LOCATION_EXPRESSION) { if (!regular_memory->Read(value, &cfa, sizeof(AddressType))) { if (!regular_memory->ReadFully(value, &cfa, sizeof(AddressType))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading Loading @@ -175,7 +175,8 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me const DwarfLocation* loc = &entry.second; switch (loc->type) { case DWARF_LOCATION_OFFSET: if (!regular_memory->Read(cfa + loc->values[0], &(*cur_regs)[reg], sizeof(AddressType))) { if (!regular_memory->ReadFully(cfa + loc->values[0], &(*cur_regs)[reg], sizeof(AddressType))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading Loading @@ -210,7 +211,7 @@ bool DwarfSectionImpl<AddressType>::Eval(const DwarfCie* cie, Memory* regular_me return false; } if (loc->type == DWARF_LOCATION_EXPRESSION) { if (!regular_memory->Read(value, &(*cur_regs)[reg], sizeof(AddressType))) { if (!regular_memory->ReadFully(value, &(*cur_regs)[reg], sizeof(AddressType))) { last_error_ = DWARF_ERROR_MEMORY_INVALID; return false; } Loading
libunwindstack/Elf.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ bool Elf::IsValidElf(Memory* memory) { // Verify that this is a valid elf file. uint8_t e_ident[SELFMAG + 1]; if (!memory->Read(0, e_ident, SELFMAG)) { if (!memory->ReadFully(0, e_ident, SELFMAG)) { return false; } Loading @@ -156,7 +156,7 @@ void Elf::GetInfo(Memory* memory, bool* valid, uint64_t* size) { // Now read the section header information. uint8_t class_type; if (!memory->Read(EI_CLASS, &class_type, 1)) { if (!memory->ReadFully(EI_CLASS, &class_type, 1)) { return; } if (class_type == ELFCLASS32) { Loading @@ -174,12 +174,12 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { } std::unique_ptr<ElfInterface> interface; if (!memory->Read(EI_CLASS, &class_type_, 1)) { if (!memory->ReadFully(EI_CLASS, &class_type_, 1)) { return nullptr; } if (class_type_ == ELFCLASS32) { Elf32_Half e_machine; if (!memory->Read(EI_NIDENT + sizeof(Elf32_Half), &e_machine, sizeof(e_machine))) { if (!memory->ReadFully(EI_NIDENT + sizeof(Elf32_Half), &e_machine, sizeof(e_machine))) { return nullptr; } Loading @@ -200,7 +200,7 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { } } else if (class_type_ == ELFCLASS64) { Elf64_Half e_machine; if (!memory->Read(EI_NIDENT + sizeof(Elf64_Half), &e_machine, sizeof(e_machine))) { if (!memory->ReadFully(EI_NIDENT + sizeof(Elf64_Half), &e_machine, sizeof(e_machine))) { return nullptr; } if (e_machine != EM_AARCH64 && e_machine != EM_X86_64) { Loading
libunwindstack/ElfInterface.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ Memory* ElfInterface::CreateGnuDebugdataMemory() { Crc64GenerateTable(); std::vector<uint8_t> src(gnu_debugdata_size_); if (!memory_->Read(gnu_debugdata_offset_, src.data(), gnu_debugdata_size_)) { if (!memory_->ReadFully(gnu_debugdata_offset_, src.data(), gnu_debugdata_size_)) { gnu_debugdata_offset_ = 0; gnu_debugdata_size_ = static_cast<uint64_t>(-1); return nullptr; Loading Loading @@ -131,7 +131,7 @@ void ElfInterface::InitHeadersWithTemplate() { template <typename EhdrType, typename PhdrType, typename ShdrType> bool ElfInterface::ReadAllHeaders(uint64_t* load_bias) { EhdrType ehdr; if (!memory_->Read(0, &ehdr, sizeof(ehdr))) { if (!memory_->ReadFully(0, &ehdr, sizeof(ehdr))) { return false; } Loading Loading @@ -242,7 +242,7 @@ bool ElfInterface::ReadSectionHeaders(const EhdrType& ehdr) { } if (shdr.sh_type == SHT_SYMTAB || shdr.sh_type == SHT_DYNSYM) { if (!memory_->Read(offset, &shdr, sizeof(shdr))) { if (!memory_->ReadFully(offset, &shdr, sizeof(shdr))) { return false; } // Need to go get the information about the section that contains Loading Loading @@ -324,7 +324,7 @@ bool ElfInterface::GetSonameWithTemplate(std::string* soname) { uint64_t offset = dynamic_offset_; uint64_t max_offset = offset + dynamic_size_; for (uint64_t offset = dynamic_offset_; offset < max_offset; offset += sizeof(DynType)) { if (!memory_->Read(offset, &dyn, sizeof(dyn))) { if (!memory_->ReadFully(offset, &dyn, sizeof(dyn))) { return false; } Loading Loading @@ -388,7 +388,7 @@ bool ElfInterface::Step(uint64_t pc, Regs* regs, Memory* process_memory, bool* f template <typename EhdrType> void ElfInterface::GetMaxSizeWithTemplate(Memory* memory, uint64_t* size) { EhdrType ehdr; if (!memory->Read(0, &ehdr, sizeof(ehdr))) { if (!memory->ReadFully(0, &ehdr, sizeof(ehdr))) { return; } if (ehdr.e_shnum == 0) { Loading