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

Unified Diff: courgette/disassembler_win32_x86.cc

Issue 8501023: Fix two pointer arithmetic errors. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix another < versus <= Created 9 years, 1 month 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_elf_32_x86_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_win32_x86.cc
diff --git a/courgette/disassembler_win32_x86.cc b/courgette/disassembler_win32_x86.cc
index 39cb695225fe8919fe746f4d3002411e4655ed1c..ed5785f439b9ece0bc4e6b6d16827035b37284c9 100644
--- a/courgette/disassembler_win32_x86.cc
+++ b/courgette/disassembler_win32_x86.cc
@@ -466,12 +466,12 @@ void DisassemblerWin32X86::ParseRel32RelocsFromSection(const Section* section) {
// addressing mode?
const uint8* rel32 = NULL;
- if (p + 5 < end_pointer) {
+ if (p + 5 <= end_pointer) {
if (*p == 0xE8 || *p == 0xE9) { // jmp rel32 and call rel32
rel32 = p + 1;
}
}
- if (p + 6 < end_pointer) {
+ if (p + 6 <= end_pointer) {
if (*p == 0x0F && (*(p+1) & 0xF0) == 0x80) { // Jcc long form
if (p[1] != 0x8A && p[1] != 0x8B) // JPE/JPO unlikely
rel32 = p + 2;
@@ -503,7 +503,7 @@ void DisassemblerWin32X86::ParseRel32RelocsFromSection(const Section* section) {
#if COURGETTE_HISTOGRAM_TARGETS
++rel32_target_rvas_[target_rva];
#endif
- p += 4;
+ p = rel32 + 4;
continue;
}
}
« no previous file with comments | « courgette/disassembler_elf_32_x86_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698