diff options
| author | practicalswift <[email protected]> | 2017-01-14 20:40:35 +0100 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2017-01-21 10:57:00 +0100 |
| commit | 8455e367fe79ff53ea81d283f3435e74b1633c88 (patch) | |
| tree | 52ddf8ed1beeb7d53a6307acf42adb2f7ba0988f /src/test/transaction_tests.cpp | |
| parent | Merge #9525: test: Include tx data in EXTRA_DIST (diff) | |
| download | discoin-8455e367fe79ff53ea81d283f3435e74b1633c88.tar.xz discoin-8455e367fe79ff53ea81d283f3435e74b1633c88.zip | |
[test] Avoid reading a potentially uninitialized variable in tx_invalid-test
Prior to this commit the err variable was not guaranteed to be set before
the check ...
BOOST_CHECK_MESSAGE(err != SCRIPT_ERR_OK, ScriptErrorString(err));
Diffstat (limited to 'src/test/transaction_tests.cpp')
| -rw-r--r-- | src/test/transaction_tests.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 8c9aaef02..18decf72a 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -189,7 +189,9 @@ BOOST_AUTO_TEST_CASE(tx_invalid) // verifyFlags is a comma separated list of script verification flags to apply, or "NONE" UniValue tests = read_json(std::string(json_tests::tx_invalid, json_tests::tx_invalid + sizeof(json_tests::tx_invalid))); - ScriptError err; + // Initialize to SCRIPT_ERR_OK. The tests expect err to be changed to a + // value other than SCRIPT_ERR_OK. + ScriptError err = SCRIPT_ERR_OK; for (unsigned int idx = 0; idx < tests.size(); idx++) { UniValue test = tests[idx]; std::string strTest = test.write(); |