Fix a backwards disasm bug which stomps on the depth option

This commit is contained in:
bannedit 2013-05-15 22:08:50 -04:00
parent b7dfb9b922
commit f05ef5630e
1 changed files with 1 additions and 7 deletions

8
rop.rb
View File

@ -197,14 +197,13 @@ class RopCollect < RopBase
def process_gadgets(rets, num) def process_gadgets(rets, num)
ret = {} ret = {}
gadgets = [] gadgets = []
tmp = []
rets.each do |ea| rets.each do |ea|
insn = @disassembler.disassemble_instruction(ea) insn = @disassembler.disassemble_instruction(ea)
next if not insn next if not insn
xtra = insn.bin_length xtra = insn.bin_length
1.upto(num) do |x| num.step(0, -1) do |x|
addr = ea - x addr = ea - x
# get the disassembled instruction at this address # get the disassembled instruction at this address
@ -229,11 +228,6 @@ class RopCollect < RopBase
addr = addr + di.bin_length addr = addr + di.bin_length
end end
if not tmp.include?(ea)
tmp << ea
else
next
end
# otherwise, we create a new tailchunk and add it to the list # otherwise, we create a new tailchunk and add it to the list
ret = {:file => @file, :address => ("0x%08x" % (ea - x)), :raw => buf, :disasm => dasm} ret = {:file => @file, :address => ("0x%08x" % (ea - x)), :raw => buf, :disasm => dasm}
gadgets << ret gadgets << ret