Skip to content

Null pointer passed to memcpy in print_key when JSON key is empty string #84

@AhmedShAli24

Description

@AhmedShAli24

Found a null pointer dereference in json_prettify when processing objects with empty string keys.

What's happening

When json_prettify hits an empty string key inside a nested structure, it goes through prettify_cbprint_keyjson_printer_buf. At frozen.c:476, print_key passes a null pointer as the second argument to json_printer_buf, which calls memcpy on it. Passing null to memcpy is UB regardless of the length argument.

Crash Input:
[[[[[[[[[[[[[[[[[[[[[[[[{"":[[[[[[[[[[[[[[[[[[[[[...

Crashes with SIGILL (UBSan abort).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions