Skip to content

Use of uninitialized memory in sparc disassembler #877

Closed
@radare

Description

@radare

Reproducer:

valgrind rasm2 -a sparc -d bb400000
...

also it can be reproduced with cstool:

$ ./cstool sparc bb400000
Segmentation fault: 11

This issue was iniitally reported in radareorg/radare2#7068 by @mtowalski

$ valgrind ./cstool sparc bb400000
==13568== Memcheck, a memory error detector
==13568== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==13568== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==13568== Command: ./cstool sparc bb400000
==13568==
--13568-- run: /usr/bin/dsymutil "./cstool"
==13568== Conditional jump or move depends on uninitialised value(s)
==13568==    at 0x100104CFE: printOperand (SparcInstPrinter.c:171)
==13568==    by 0x1001044BF: printInstruction (SparcGenAsmWriter.inc:851)
==13568==    by 0x1000E8F9B: Sparc_printInst (SparcInstPrinter.c:445)
==13568==    by 0x100006075: cs_disasm (cs.c:664)
==13568==    by 0x100001426: main (in ./cstool)
==13568==
==13568== Use of uninitialised value of size 8
==13568==    at 0x10010534F: getRegisterName (SparcGenAsmWriter.inc:1205)
==13568==    by 0x1001052E3: printRegName (SparcInstPrinter.c:96)
==13568==    by 0x100104D20: printOperand (SparcInstPrinter.c:173)
==13568==    by 0x1001044BF: printInstruction (SparcGenAsmWriter.inc:851)
==13568==    by 0x1000E8F9B: Sparc_printInst (SparcInstPrinter.c:445)
==13568==    by 0x100006075: cs_disasm (cs.c:664)
==13568==    by 0x100001426: main (in ./cstool)
==13568==
==13568== Conditional jump or move depends on uninitialised value(s)
==13568==    at 0x100105F30: Sparc_map_register (SparcMapping.c:565)
==13568==    by 0x100104D28: printOperand (SparcInstPrinter.c:174)
==13568==    by 0x1001044BF: printInstruction (SparcGenAsmWriter.inc:851)
==13568==    by 0x1000E8F9B: Sparc_printInst (SparcInstPrinter.c:445)
==13568==    by 0x100006075: cs_disasm (cs.c:664)
==13568==    by 0x100001426: main (in ./cstool)
==13568==
0  bb400000  rd	%y, %f10
==13568==
==13568== HEAP SUMMARY:
==13568==     in use at exit: 26,370 bytes in 185 blocks
==13568==   total heap usage: 277 allocs, 92 frees, 42,006 bytes allocated
==13568==

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions