Skip to content

Conversation

@jnewbery
Copy link
Contributor

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.

awemany and others added 3 commits March 30, 2017 15:35
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()
@jnewbery
Copy link
Contributor Author

Replaces #10106. @gmaxwell @instagibbs @laanwj @jtimon

@fanquake fanquake added this to the 0.14.1 milestone Mar 30, 2017
@jnewbery
Copy link
Contributor Author

@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.

@laanwj
Copy link
Member

laanwj commented Mar 31, 2017

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.

@laanwj
Copy link
Member

laanwj commented Mar 31, 2017

utACK 19ecd1e

@gmaxwell
Copy link
Contributor

@awemany Fix moved over here, your review/testing would be very welcome!

Copy link
Contributor

@gmaxwell gmaxwell left a 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).

@theuni
Copy link
Member

theuni commented Mar 31, 2017

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

@maflcko maflcko changed the title bitcoin-tx input verification bitcoin-tx input verification (awemany, jnewbery) Mar 31, 2017
@laanwj laanwj merged commit 19ecd1e into bitcoin:master Mar 31, 2017
laanwj added a commit that referenced this pull request Mar 31, 2017
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
laanwj pushed a commit that referenced this pull request Mar 31, 2017
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()

Github-Pull: #10130
Rebased-From: eb66bf9
laanwj pushed a commit that referenced this pull request Mar 31, 2017
laanwj pushed a commit that referenced this pull request Mar 31, 2017
codablock pushed a commit to codablock/dash that referenced this pull request Jan 26, 2018
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
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
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
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 27, 2019
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants