Skip to content

signrawtransaction crashes bitcoind when given the zero private key #5454

@dooglus

Description

@dooglus
bitcoind signrawtransaction $(bitcoind createrawtransaction '[{"txid":"deadbeef","vout":1}]' '{}') '[]' '["5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAbuatmU"]'
error: no response from server

A fix appears to be to insert:

        if (!key.IsValid()) {
            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
        }

before:

        tempKeystore.AddKey(key);

in src/rpcrawtransaction.cpp

But maybe the

        bool fGood = vchSecret.SetString(k.get_str());

a few lines above shouldn't have fGood be true for the zero private key?

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