Validation of malformed address fails with a peculiar message #27723

issue CryptoManiac openend this issue on May 23, 2023
  1. CryptoManiac commented at 5:10 am on May 23, 2023: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    Open RPC console and execute this command:

    validateaddress bc1qqrq69gfzvvqcxs6rgg3crqjzcw369sxzyp3v9sspursx9gmzyv32x7xa5z

    Following message is the result:

    0Internal bug detected: 'isValid == error_msg.empty()'
    1rpc/misc.cpp:75 (operator())
    2You may report this issue here: https://github.com/bitcoin/bitcoin/issues
    3 (code -1)
    

    Expected behaviour

    Well it should tell me something, like what is wrong exactly. Though I believe that too much is wrong with this particular address.

    Steps to reproduce

    Run validateaddress method using bc1qqrq69gfzvvqcxs6rgg3crqjzcw369sxzyp3v9sspursx9gmzyv32x7xa5z as its argument.

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    /Satoshi:23.0.0/

    Operating system and version

    MacOS Ventura 13.4 (22F66)

    Machine specifications

    MacBook Pro 13-inch, M1, 2020 With 16GB of RAM

  2. CryptoManiac renamed this:
    Validation of malformed address fails with peculiar message
    Validation of malformed address fails with a peculiar message
    on May 23, 2023
  3. maflcko added the label Bug on May 23, 2023
  4. maflcko added the label RPC/REST/ZMQ on May 23, 2023
  5. maflcko commented at 6:35 am on May 23, 2023: member

    Thank you for the bug report. I think what happens is:

    • The function ConvertBits<5, 8, false> fails, however
    • the function bech32::LocateErrors also fails to locate any errors.

    Thus the CHECK_NONFATAL(isValid == error_msg.empty()) added in commit 8f0b64fb513e8c6cdd1f115856100a4ef5afe23e will be hit.

  6. maflcko added this to the milestone 25.0 on May 23, 2023
  7. maflcko commented at 11:10 am on May 23, 2023: member
    Fun fact, this also happens with the BIP 173 and BIP 350 test vectors. Proposed fix in #https://github.com/bitcoin/bitcoin/pull/27727
  8. achow101 referenced this in commit a13f3746dc on May 24, 2023
  9. fanquake removed this from the milestone 25.0 on May 25, 2023
  10. fanquake added this to the milestone 25.1 on May 25, 2023
  11. willcl-ark commented at 1:31 pm on May 25, 2023: member

    Does #27727 not fix this, otherwise I think we can close it? Or does it get kept open for the milestone

    Running the example malformed address on master I now see a specific error:

    0$ /home/will/src/bitcoin/src/bitcoin-cli validateaddress bc1qqrq69gfzvvqcxs6rgg3crqjzcw369sxzyp3v9sspursx9gmzyv32x7xa5z
    1{
    2  "isvalid": false,
    3  "error_locations": [
    4  ],
    5  "error": "Invalid padding in Bech32 data section"
    6}
    
  12. fanquake commented at 1:33 pm on May 25, 2023: member
    This can be closed given it’s fixed in master, and the change will be backported to multiple branches.
  13. maflcko closed this on May 25, 2023

  14. bitcoin locked this on May 24, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-06-29 07:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me