Skip to content

fix: validate structure block boundaries - #131

Closed
Daiyuanranfeng wants to merge 1 commit into
google:mainfrom
Daiyuanranfeng:fix/validate-structure-block-size
Closed

Daiyuanranfeng wants to merge 1 commit into
google:mainfrom
Daiyuanranfeng:fix/validate-structure-block-size

Conversation

@Daiyuanranfeng

Copy link
Copy Markdown

Summary

  • reject FDT blobs whose parsed structure block extends beyond size_dt_struct
  • retain acceptance for a structure walk that ends exactly at the declared boundary
  • add regression tests for truncated and valid structure block declarations

Fixes #110

Validation

  • cargo fmt --all -- --check
  • cargo test --locked --all-features (145 tests passed)
  • cargo clippy --locked --all-features --all-targets (passes with existing warnings outside this change)
  • git diff --check

@Daiyuanranfeng

Copy link
Copy Markdown
Author

The Rust CI run completed successfully for all code-related jobs: Cargo check, formatting, Clippy, dependency checks, all platform builds/tests, and Miri. The only failed step is the existing Code coverage -> Upload coverage to Codecov step on the fork push, matching the earlier fork-only coverage upload failure.

The new structure-boundary tests pass locally and in the CI build/test jobs. This does not indicate a failure in the implementation; the Codecov upload requires repository-side credentials for fork runs.

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.92%. Comparing base (b2c3a79) to head (f733e1f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   93.91%   93.92%   +0.01%     
==========================================
  Files          27       27              
  Lines        3503     3509       +6     
==========================================
+ Hits         3290     3296       +6     
  Misses        213      213              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qwandor

qwandor commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Does this partially duplicate #112?

@Daiyuanranfeng

Copy link
Copy Markdown
Author

Thanks for pointing this out. I checked #112 and it covers the same FDT_END / size_dt_struct validation issue. I’ll close #131 to avoid duplicating the existing PR. The local implementation and tests are still recorded for reference.

@Daiyuanranfeng

Copy link
Copy Markdown
Author

Closing as a duplicate of #112, per maintainer feedback.

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.

Fdt::new does not check that the structure block ends within size_dt_struct

2 participants