Skip to content

Return error on invalid hex for io::Read on HexToBytesIter#178

Merged
apoelstra merged 1 commit intorust-bitcoin:masterfrom
stevenroose:iter-error
Jun 23, 2025
Merged

Return error on invalid hex for io::Read on HexToBytesIter#178
apoelstra merged 1 commit intorust-bitcoin:masterfrom
stevenroose:iter-error

Conversation

@stevenroose
Copy link
Copy Markdown

@stevenroose stevenroose commented Jun 22, 2025

Fixes #177

@apoelstra
Copy link
Copy Markdown
Member

Should backport to the 1.x branch. (You don't have to do this @stevenroose; @tcharding or I can do it.)

@apoelstra
Copy link
Copy Markdown
Member

On this branch we probably want to release a 0.3.1 to get the bugfix out.

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 b67244c; successfully ran local tests

Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK b67244c

@tcharding
Copy link
Copy Markdown
Member

Backported in #182

@stevenroose
Copy link
Copy Markdown
Author

I understand you guys will merge and do 0.2.x and 0.3.x releases?

@apoelstra
Copy link
Copy Markdown
Member

@stevenroose no, we will do a 0.3.x release and a 1.0-rc.2 release.

@apoelstra apoelstra merged commit f1c66ed into rust-bitcoin:master Jun 23, 2025
14 checks passed
apoelstra added a commit that referenced this pull request Jun 23, 2025
…ToBytesIter

102a77e Return error on invalid hex for io::Read on HexToBytesIter (Steven Roose)

Pull request description:

  Backport the bugfix in #178 
  
  Currently this test passes, and it should not.
  
  ```rust
  fn main() {
  let good_hex = "deadbeef00deadbeef";
  let bad_hex = "deadbeefXX00XXdeadbeef";
  
  let mut buf = vec![];
  let mut iter = HexToBytesIter::new(good_hex).unwrap();
  iter.read_to_end(&mut buf).unwrap();
  assert_eq!(buf.as_hex().to_string(), good_hex);
  
  let mut buf = vec![];
  let mut iter = HexToBytesIter::new(bad_hex).unwrap();
  iter.read_to_end(&mut buf).unwrap();
  assert_eq!(buf.as_hex().to_string(), good_hex);
  }
  ```
  
  Created using: git cherry-pick b67244c


ACKs for top commit:
  apoelstra:
    ACK 102a77e; successfully ran local tests


Tree-SHA512: 605c29bb2dbca90b41a2eaabe814464521bbbdee4ebc116b9260163252a084426f886c50ba601c184e8ed4bdc0fad21a07eb31a99445d693853abd7fee659761
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.

Non-intuitive HexToBytesIter behavior

3 participants