Skip to content

Restore command with malformed serialized-value consistently crashes redis server #5255

@sripathikrishnan

Description

@sripathikrishnan

Running restore command with a malformed serialized value (but valid checksum and rdb version) crashes the redis process.

In general, serialized-value for restore command is obtained by calling the dump command. In my case, I am generating the serialized value directly as part of a tool I am building. Due to a bug in my code, I was generating an incorrect payload. The checksum and rdb version are correct, so redis server doesn't immediately return an error. But when it tries to load the object, it crashes.

Looking at the source code, it seems there are a variety of code paths that can cause server to crash if the payload is malformed.

I am not sure if this should be considered a bug, because normal users are unlikely to face this. My expectation was the restore command would return an error indicating malformed payload or something like that.

To reproduce:

cat hash_as_ziplist.bin | redis-cli --pipe

will crash redis-server with the message ziplist with dup elements dump (hexdump of 3343411 bytes):

hash_as_ziplist.bin.zip

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