Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Unified Diff: courgette/disassembler.cc

Issue 1031513002: Robust ELF header parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace uint32_t with Elf32_Off and add CHECK in ReduceLength Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/disassembler.h ('k') | courgette/disassembler_elf_32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler.cc
diff --git a/courgette/disassembler.cc b/courgette/disassembler.cc
index 1b7b16e225d0c8fd03acfb70321a901a5bf60da0..f146b4eb71146b91fe4252061762146bba28889c 100644
--- a/courgette/disassembler.cc
+++ b/courgette/disassembler.cc
@@ -125,8 +125,9 @@ bool Disassembler::Bad(const char* reason) {
}
void Disassembler::ReduceLength(size_t reduced_length) {
- if (reduced_length < length_)
- length_ = reduced_length;
+ CHECK_LE(reduced_length, length_);
+ length_ = reduced_length;
+ end_ = start_ + length_;
}
} // namespace courgette
« no previous file with comments | « courgette/disassembler.h ('k') | courgette/disassembler_elf_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698