From 4fce4d02b5962ad38b966db94e3af3c676ed7b9c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 28 Oct 2026 11:26:36 +0000 Subject: [PATCH 1/2] refactor: use as_chunks for u32 cell walks Walk fixed-size u32 cells with as_chunks instead of chunks_exact. A short tail is still rejected by the multiple-of-four check. Use assert_ne! for a nonempty error Display check. Co-authored-by: Nathaniel McCallum --- src/fdt.rs | 11 +++++++---- src/overlay.rs | 5 ++--- tests/error_display.rs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/fdt.rs b/src/fdt.rs index bfb1070..12caed9 100644 --- a/src/fdt.rs +++ b/src/fdt.rs @@ -328,10 +328,13 @@ pub(crate) fn value_as_u32s(value: &[u8]) -> Option + if !value.len().is_multiple_of(4) { return None; } - Some(value.chunks_exact(4).map(|c| { - let arr: [u8; 4] = c.try_into().unwrap_or([0; 4]); - u32::from_be_bytes(arr) - })) + Some( + value + .as_chunks::<4>() + .0 + .iter() + .map(|c| u32::from_be_bytes(*c)), + ) } /// NUL-separated UTF-8 stringlist (FDT `stringlist` encoding). Strict: must diff --git a/src/overlay.rs b/src/overlay.rs index 84b7e53..6c9ac72 100644 --- a/src/overlay.rs +++ b/src/overlay.rs @@ -525,9 +525,8 @@ fn walk_local_fixups<'a>( if !raw.len().is_multiple_of(4) { return Err(MalformedKind::BadFixupEntry.into()); } - for chunk in raw.chunks_exact(4) { - let arr: [u8; 4] = chunk.try_into().map_err(|_| MalformedKind::BadFixupEntry)?; - let byte_offset = u32::from_be_bytes(arr); + for chunk in raw.as_chunks::<4>().0 { + let byte_offset = u32::from_be_bytes(*chunk); check_rewrite_in_bounds(byte_offset, target_len)?; push_rewrite( rewrites, diff --git a/tests/error_display.rs b/tests/error_display.rs index 3204f6a..61a3b21 100644 --- a/tests/error_display.rs +++ b/tests/error_display.rs @@ -35,7 +35,7 @@ fn every_limit_variant_renders_nonempty() { #[test] fn buffer_too_small_renders_nonempty() { let s = render(Error::BufferTooSmall { needed: 0 }); - assert!(!s.is_empty()); + assert_ne!(s, ""); assert!(s.starts_with("destination buffer"), "{s:?}"); } From daf5d485bd23fc7c5185087e2b8db185f02319ee Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 28 Oct 2026 11:26:37 +0000 Subject: [PATCH 2/2] ci: stop publishing rustdoc to pages Keep building rustdoc on pushes to main so the docs still get checked. This repo no longer publishes them to GitHub Pages. Only pichi-vm.github.io publishes to pichi.dev. Co-authored-by: Nathaniel McCallum --- .github/workflows/docs.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2637d52..706693f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,11 +10,9 @@ env: permissions: contents: read - pages: write - id-token: write concurrency: - group: pages + group: docs cancel-in-progress: true jobs: @@ -29,19 +27,3 @@ jobs: run: cargo doc --no-deps --all-features env: RUSTDOCFLAGS: --cfg docsrs - - name: redirect root to crate - run: echo '' > target/doc/index.html - - uses: actions/upload-pages-artifact@v3 - with: - path: target/doc - - deploy: - name: deploy to pages - needs: build - runs-on: ubuntu-24.04 - environment: - name: github-pages - url: ${{ steps.deploy.outputs.page_url }} - steps: - - id: deploy - uses: actions/deploy-pages@v4