-
Notifications
You must be signed in to change notification settings - Fork 38.7k
bitcoin-tx input verification (awemany, jnewbery) #10130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The number of arguments is not checked MutateTxAddOutAddr(..), meaning that > ./bitcoin-tx -create outaddr= accessed the vStrInputParts vector beyond its bounds. This also includes work by jnewbery to check the inputs for MutateTxAddPubKey()
|
Replaces #10106. @gmaxwell @instagibbs @laanwj @jtimon |
|
@theuni has suggested that checking the stderr for error text may cause problems due to unicode, eols, etc, and that we'd be better off defining our own exit codes in bitcoin-tx and testing on those. I think it's ok to test for text in stderr for now, but we a future PR should define exit codes and test them in bctest.py. |
|
I don't disagree with @theuni on that in general, however checking for text in error messages is perfectly fine for tests that are supposed to test these errors. Especially for a user-facing tool. We do a similar thing for checking e.g. RPC errors where we check both the code and the message. |
|
utACK 19ecd1e |
|
@awemany Fix moved over here, your review/testing would be very welcome! |
gmaxwell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK (did not test test, e.g. by introducing a bug).
|
As mentioned in the comments: for reference, I suggested using exit codes rather than comparing text because (here specifically), Wine piles nonsense about window creation into stderr when running without DISPLAY set. For that reason, we can't test that "stderr == expected", rather we have to test "expected in stderr". That's not great, but it's not a huge deal either. utACK 19ecd1e |
19ecd1e Add tests for bitcoin-tx input checking (John Newbery) 21704f6 Check stderr when testing bitcoin-tx (John Newbery) eb66bf9 bitcoin-tx: Fix missing range check (Awemany) Tree-SHA512: 08c6153cf7dd5e0ecd23e24d81af4c0f17534d484179dd91dcd78d42df14c91284341d31cc695469a64c507bce72c34231748b7cabb7df8f1051d228fb0a62c5
19ecd1e Add tests for bitcoin-tx input checking (John Newbery) 21704f6 Check stderr when testing bitcoin-tx (John Newbery) eb66bf9 bitcoin-tx: Fix missing range check (Awemany) Tree-SHA512: 08c6153cf7dd5e0ecd23e24d81af4c0f17534d484179dd91dcd78d42df14c91284341d31cc695469a64c507bce72c34231748b7cabb7df8f1051d228fb0a62c5
19ecd1e Add tests for bitcoin-tx input checking (John Newbery) 21704f6 Check stderr when testing bitcoin-tx (John Newbery) eb66bf9 bitcoin-tx: Fix missing range check (Awemany) Tree-SHA512: 08c6153cf7dd5e0ecd23e24d81af4c0f17534d484179dd91dcd78d42df14c91284341d31cc695469a64c507bce72c34231748b7cabb7df8f1051d228fb0a62c5
19ecd1e Add tests for bitcoin-tx input checking (John Newbery) 21704f6 Check stderr when testing bitcoin-tx (John Newbery) eb66bf9 bitcoin-tx: Fix missing range check (Awemany) Tree-SHA512: 08c6153cf7dd5e0ecd23e24d81af4c0f17534d484179dd91dcd78d42df14c91284341d31cc695469a64c507bce72c34231748b7cabb7df8f1051d228fb0a62c5
Check number of arguments passed to bitcoin-tx in outaddr and outpubkey.
This PR also updates the bitcoin-tx tests to check bitcoin-tx stderr and verify that expected errors are raised.
Adds test cases for calling bitcoin-tx with wrong number of separators in outaddr and outpubkey.