Skip to content

Fix index out of bounds bug#130

Merged
apoelstra merged 2 commits intorust-bitcoin:masterfrom
tcharding:09-19-index-bug
Sep 19, 2023
Merged

Fix index out of bounds bug#130
apoelstra merged 2 commits intorust-bitcoin:masterfrom
tcharding:09-19-index-bug

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Sep 18, 2023

Noob bug here, I accessed an array without first checking that it was non-empty :(

Adds unit test as a separate patch, re-arrange to verify the bug.

Discovered while fuzzing #128.

Currently we index into the data field without first checking it is not
empty. For context, the indexing is done _before_ we do segwit validity
checks which check for correct data lengths.

This is a real noob bug , bad Tobin - no biscuit.

Add a check for the empty array before indexing into it.
Add a unit test that checks various invalid segwit addresses.
@apoelstra
Copy link
Copy Markdown
Member

Nice, win for fuzzing. I guess I should've caught this in review -- though it's tough with big PRs like this, especially with lots of iteration.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ea644f0

@apoelstra
Copy link
Copy Markdown
Member

Will go ahead and merge this without @clarkmoody since it's small and purely a bugfix.

@apoelstra apoelstra merged commit 175df94 into rust-bitcoin:master Sep 19, 2023
@apoelstra apoelstra deleted the 09-19-index-bug branch September 19, 2023 01:54
apoelstra added a commit that referenced this pull request Sep 29, 2023
79918f6 Re-write crate level API (Tobin C. Harding)

Pull request description:

  Now includes updates to fuzzing and is on top of #130 (bug fix).

  Now we have all the new `primitives` pieces in place we can re-write the public API to take advantage of them - WIN!

  Close: #126

ACKs for top commit:
  apoelstra:
    ACK 79918f6
  clarkmoody:
    ACK 79918f6

Tree-SHA512: 00b575e9bbd0f3768cbea561a6f72425ff4052e88d624e99f1773f61835d104f52c841fa21f9e5cda1347f83e1d8ada75d9c314b9e16fef9f68091fbf1f53b6a
apoelstra added a commit that referenced this pull request Oct 9, 2023
8279efa Bump version to 0.10.0-beta (Tobin C. Harding)

Pull request description:

  In preparation for doing the next dev release add a changelog entry and bump the version number to `0.10.0-beta`.

  We need to release the bug fix in #130 because fuzzing is hitting it in `rust-bitcoin`. This release would be better to use in `rust-miniscript` as well gearing up for the real 0.10.0 release.

ACKs for top commit:
  clarkmoody:
    ACK 8279efa
  apoelstra:
    ACK 8279efa

Tree-SHA512: d2fdac35717b06bd79a5ae18e897fcaf39a570b2998b8f51ab86e46f4405b7f77284c164ff4ad19c80aafc26e8433526cd20276ef485cbbf573d032037d7a49b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants