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

Unified Diff: courgette/disassembler_elf_32.cc

Issue 22728002: Collapsed Courgette instructions that copy file data to the patch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved len calculation Created 7 years, 4 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/assembly_program.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/disassembler_elf_32.cc
diff --git a/courgette/disassembler_elf_32.cc b/courgette/disassembler_elf_32.cc
index fc4c3793c0fb08a53a3bba42794ea7b00c6c7ed4..bfd1ef4acdcbad747095928b07e7f906a2149c60 100644
--- a/courgette/disassembler_elf_32.cc
+++ b/courgette/disassembler_elf_32.cc
@@ -409,13 +409,13 @@ CheckBool DisassemblerElf32::ParseSimpleRegion(
const uint8* start = OffsetToPointer(start_file_offset);
const uint8* end = OffsetToPointer(end_file_offset);
- const uint8* p = start;
+ // Callers don't guarantee start < end
+ if (start >= end) return true;
- while (p < end) {
- if (!program->EmitByteInstruction(*p))
- return false;
- ++p;
- }
+ const ptrdiff_t len = end - start; // Works because vars are byte pointers
+
+ if (!program->EmitBytesInstruction(start, len))
+ return false;
return true;
}
« no previous file with comments | « courgette/assembly_program.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698