Commit graph

10 commits

Author SHA1 Message Date
MarcoFalke 210b533a11
Merge #18447: test: Add coverage for script parse error in ParseScript
dcda81c471 test: add coverage for script parse error in ParseScript (pierrenn)

Pull request description:

  Follow up on this suggestion :  https://github.com/bitcoin/bitcoin/pull/18416#issuecomment-603966799

  This adds a test case to raise the `script parse error` in `ParseScript`.

ACKs for top commit:
  instagibbs:
    utACK dcda81c471

Tree-SHA512: ae0ef2c00f34cee818c83582f190d5f4043159e922862f2b442b7b895b8ff3ca421533699247c12c367be77813b5205830a771cd47a18e8932807ccace2d6a1c
2020-03-27 09:58:12 -04:00
pierrenn 9ab14e4d21 Limit decimal range of numbers ParseScript accepts 2020-03-27 15:51:05 +09:00
pierrenn dcda81c471
test: add coverage for script parse error in ParseScript 2020-03-27 12:10:31 +09:00
Ben Woosley 9c5af58d51
Consolidate redundant implementations of ParseHashStr
This change:
* adds a length check to ParseHashStr, appropriate given its use to populate
  a 256-bit number from a hex str.
* allows the caller to handle the failure, which allows for the more
  appropriate JSONRPCError on failure in prioritisetransaction rpc
2018-09-25 09:14:52 -07:00
Daniel Kraft 57889e688d bitcoin-tx: Stricter check for valid integers
Just calling atoi to convert strings to integers does not check for
valid integers very thoroughly; in particular, it just ignores
everything starting from the first non-numeral character.  Even a string
like "foo" is fine and silently returns 0.

This meant that bitcoin-tx would not fail if such a string was passed in
various places where an integer is expected (like the locktime or an
input/output index); this means that it would, for instance, silently
accept a typo and interpret it in an unexpected way.

In this change, we use ParseInt64 for parsing strings to integers,
which actually verifies that the full string is valid as number.
New tests in the bitcoin-util-test cover the new error paths.
2018-07-07 14:25:09 +02:00
practicalswift d27327c79a Fix typos 2018-03-21 10:54:17 +01:00
Matt Corallo 28d4542a0a Disallow uncompressed pubkeys in bitcoin-tx [multisig] output adds 2017-09-20 23:29:59 -04:00
John Newbery 19ecd1e2e1 Add tests for bitcoin-tx input checking 2017-03-30 16:37:53 -04:00
John Newbery 21704f6334 Check stderr when testing bitcoin-tx 2017-03-30 16:37:53 -04:00
John Newbery 63d66ba20a Move src/test/bitcoin-util-test.py to test/util/bitcoin-util-test.py 2017-03-20 10:40:31 -04:00
Renamed from src/test/data/bitcoin-util-test.json (Browse further)