Skip to content
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

Correct the PUSHDATA4 minimal encoding test in script_invalid.json. #6074

Merged
merged 1 commit into from Apr 29, 2015

Conversation

@davecgh
Copy link
Contributor

@davecgh davecgh commented Apr 28, 2015

The test which is intended to prove that the script engine is properly rejecting non-minimally encoded PUSHDATA4 data is using the wrong opcode and value. The test is using 0x4f, which is OP_1NEGATE instead of the desired 0x4e, which is OP_PUSHDATA4. Further, the push of data is intended to be 256 bytes, but the value the test is using is 0x00100000 (4096), instead of the desired 0x00010000 (256).

This pull request fixes both issues.

This was found while examining the branch coverage in btcd against only these tests to help find missing branch coverage.

The test which is intended to prove that the script engine is properly
rejecting non-minimally encoded PUSHDATA4 data is using the wrong
opcode and value.  The test is using 0x4f, which is OP_1NEGATE instead
of the desired 0x4e, which is OP_PUSHDATA4.  Further, the push of data
is intended to be 256 bytes, but the value the test is using is
0x00100000 (4096), instead of the desired 0x00010000 (256).

This commit fixes both issues.

This was found while examining the branch coverage in btcd against only
these tests to help find missing branch coverage.
@davecgh davecgh force-pushed the davecgh:correct_pushdata4_test branch from f1a6606 to d8f4cc3 Apr 28, 2015
@davecgh davecgh changed the title Correct the PUSHDATA4 minimal encoding test. Correct the PUSHDATA4 minimal encoding test in script_invalid.json. Apr 28, 2015
@sipa
Copy link
Member

@sipa sipa commented Apr 28, 2015

ACK, nice catch.

@laanwj laanwj added the Tests label Apr 29, 2015
@laanwj laanwj merged commit d8f4cc3 into bitcoin:master Apr 29, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
laanwj added a commit that referenced this pull request Apr 29, 2015
d8f4cc3 Correct the PUSHDATA4 minimal encoding test. (Dave Collins)
@davecgh davecgh deleted the davecgh:correct_pushdata4_test branch Apr 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants