Skip to content

Conversation

@xdustinface
Copy link
Collaborator

@xdustinface xdustinface commented Dec 26, 2025

Using BlockHash::hash(&[0]) causes heap buffer overflow in sanitizer step in the CI overhaul #253 because it tries to X11 hash a 1 byte input.

Summary by CodeRabbit

  • Tests
    • Updated test code to modernize dummy block header construction patterns.

Note: This release contains no user-facing changes.

✏️ Tip: You can customize this high-level summary in your review settings.

Using `BlockHash::hash(&[0])` causes heap buffer overflow in sanitizer step
in the CI overhaul #253 because it tries to X11 hash a 1 byte input.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

Test code in the bip152 module is updated to construct a dummy BlockHash using BlockHash::from_byte_array([0; 32]) instead of BlockHash::hash(&[0]). No public APIs or exported types are modified.

Changes

Cohort / File(s) Summary
Test code update
dash/src/bip152.rs
BlockHash construction in test code changed from BlockHash::hash(&[0]) to BlockHash::from_byte_array([0; 32]) for the dummy block header's previous_blockhash field

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A BlockHash reformed, from one way to another,
No breaking of APIs, just test code to recover,
From hash of an empty slice, to bytes clean and fine,
The tests now construct it in a cleaner line! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: replacing BlockHash construction method in test code from hash() to from_byte_array().
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/buffer-overflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xdustinface xdustinface changed the title fix: Use from_byte_array for dummy block hash in tests fix: use from_byte_array for dummy block hash in tests Dec 29, 2025
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