Skip to content

Crash in visual assembler on Windows due to incorrect rbuf URI parsing #23966

@fietensen

Description

@fietensen

Environment

The current date is: 17/02/2025

radare2 5.9.8 1 @ windows-x86-64
birth: git.5.9.8 Tue 11/19/2024__11:46:03.42
commit: 4eb49d5ad8c99eaecc8850a2f10bad407067c898
options: gpl -O? cs:5 cl:1 meson

CYGWIN_NT-10.0-26100 x86_64

also tested on latest:
birth: git.5.9.8-366-gf7c3e892cf 17/02/2025__15:25:06,51
commit: f7c3e892cf21e8e91f62fde2d2ce36fbd30e0a5b
options: gpl -O? cs:5 cl:2 meson

Description

Radare2 crashes without notice when starting the visual assembler from visual mode on Windows.

Issue Breakdown:

  1. Trigger:
    • Starting visual assembler calls r_core_cmd_strf in vasm.c#L98.
  2. Buffer Construction:
  3. Problematic URI Construction (in io.c#L54 using r_str_newf):
    • Linux: Generates valid URI: rbuf://0xdeadbeef.
    • Windows: Omits the 0xprefix, producing rbuf://DEADBEEF.
  4. Faulty Address Parsing (in io_rbuf.c#L40 with r_num_get):
    • Linux: r_num_get(NULL, "0xdeadbeef") correctly parses 0xdeadbeef $\rightarrow$ 3735928559.
    • Windows: r_num_get(NULL, "DEADBEEF") misinterprets it, returning 0, causing an access violation.

Expected Behavior:

  • The rbuf:// schema should be consistent across platforms.
  • On Windows, the URI should retain the 0x prefix (rbuf://0xdeadbeef)
  • This will ensure that r_num_get correctly decodes the address, preventing crashes

Test

Steps To Reproduce

  1. Open Radare2 on Windows (radare2 -w -).
  2. Enter visual mode with V.
  3. Start the visual assembler (A).
  4. Radare2 crashes immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions