metasm/exe_format/elf_decode.rb in metasm-1.0.2 vs metasm/exe_format/elf_decode.rb in metasm-1.0.3

- old
+ new

@@ -363,11 +363,10 @@ end # marks a symbol as @encoded.export (from s.value, using segments or sections) def decode_symbol_export(s) if s.name and s.shndx != 'UNDEF' and %w[NOTYPE OBJECT FUNC].include?(s.type) - if @header.type == 'REL' - sec = @sections[s.shndx] + if @header.type == 'REL' and s.shndx.kind_of?(::Integer) and sec = @sections[s.shndx] o = sec.offset + s.value elsif not o = addr_to_off(s.value) # allow to point to end of segment if not seg = @segments.find { |seg_| seg_.type == 'LOAD' and seg_.vaddr + seg_.memsz == s.value } # check end puts "W: Elf: symbol points to unmmaped space (#{s.inspect})" if $VERBOSE and s.shndx != 'ABS'