dexFile_mine.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:binja_smali 作者: lucasduffey 项目源码 文件源码
def read_uleb128(data):
    # the first bit of each byte is 1, unless that's the last byte
    total = 0
    found = False

    # so technically it doesn't have to be 5...
    if len(data) != 5:
        log(3, "read_uleb128, where len(data) == %i" % len(data))
        #assert len(data) == 5


    for i in xrange(5):
        value = ord(data[i])
        high_bit = (ord(data[i]) >> 7)

        # clear the high bit
        total += (value & 0x7f) << (i * 7) | total

        # this is the last byte, so break
        if high_bit == 0:
            found = True
            break

    if not found: # redundant to also check for "i == 4"?
        log(3, "invalid ULEB128")
        assert False

    # return (value, num_of_bytes) # where num_of_bytes indicates how much space this LEB128 took up
    return total, i+1

# http://llvm.org/docs/doxygen/html/LEB128_8h_source.html
# hex => decimal
###############3
# 00 => 0
# 01 => 1
# 7f => -1
# 80 7f => -128
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号