← 输入框|github.com|刷新
Skip to content

Correct block_buffer affected range for GHSA-qwgh-2vcv-g2f7 - #10698

Open
fwhskr wants to merge 1 commit into
github:fwhskr/advisory-improvement-10698from
fwhskr:main
Open

fwhskr wants to merge 1 commit into
github:fwhskr/advisory-improvement-10698from
fwhskr:main

Conversation

@fwhskr

@fwhskr fwhskr commented Oct 27, 2026

Copy link
Copy Markdown

What this changes

For block_buffer (crates.io), affected[0].ranges[0].events[0].introduced moves from "0" to "0.11.0-pre". The "fixed": "0.12.1" event is unchanged, so this only narrows the lower bound.

Why

The advisory's impact depends on the cursor position living inside the block that caller-provided callbacks can reach: EagerBuffer keeps its cursor in the last byte of the internal block, and ReadBuffer keeps it in buffer[0]. Neither the inline cursor nor the ReadBuffer type exists in the 0.10.x line.

0.10.4 stores the cursor in a separate field (https://docs.rs/crate/block-buffer/0.10.4/source/src/lib.rs):

  • pub struct BlockBuffer<BlockSize, Kind> { buffer: Block<BlockSize>, pos: u8, _pd: PhantomData<Kind> } (lines 55-64). set_pos_unchecked writes only self.pos (lines 236-240), and every call site derives the value internally.
  • digest_blocks gives the callback an immutable &Block reference to the internal buffer (line 165) or block slices derived from the caller's input; pos is only updated after the callbacks return (line 175). digest_pad passes &self.buffer immutably and resets afterwards (lines 307-315). In set_data, process_blocks receives the caller's data blocks, not the internal cursor (line 271).
  • A caught panic therefore leaves pos at its previous, valid value: no callback path can overwrite the cursor from input.

The separate pos field is also present in the 0.10.0-pre line (https://docs.rs/crate/block-buffer/0.10.0-pre/source/src/lib.rs).

The inline layout starts at 0.11.0-pre (published 2022-12-19):

So the affected mechanism first appears in 0.11.0-pre, and "introduced": "0" additionally flags 0.10.x and earlier, which have no inline cursor and no ReadBuffer.

Scope

Versions 0.11.0-pre through 0.12.0 remain affected. This PR does not claim that 0.10.x is free of unrelated issues; it only states that the cursor-corruption path described in this advisory cannot occur there because the cursor is not stored in the block.

@github-actions
github-actions Bot changed the base branch from main to fwhskr/advisory-improvement-10698 October 27, 2026 08:34
@rldyourmnd

Copy link
Copy Markdown

Upstream review is now available: the RustCrypto maintainer confirms that v0.10 is not affected, because it stores the position separately. The published repository advisory API, updated2026-10-27T10:55:47Z, now lists >=0.11.0,<0.12.1.

At2026-10-27T11:30Z, the central GitHub advisory and OSV still listed the old introduced0 range; OSV returned GHSA-qwgh-2vcv-g2f7 for block-buffer0.10.4. The public query is reproducible:

{"package":{"ecosystem":"crates.io","name":"block-buffer"},"version":"0.10.4"}

POST that JSON to https://api.osv.dev/v1/query.

Could you review/reconcile this proposed correction with the accepted upstream record and update the central entry? I am not asserting the first affected prerelease: this PR's prerelease bound and the maintainer's published stable bound differ, so that detail needs its own verification.

@MethodWhite

Copy link
Copy Markdown

I independently verified the exact block-buffer-v0.10.4 source/tag. In 0.10.4, BlockBuffer stores pos: u8 separately from buffer; its callback paths cannot write that field, so a caught callback panic cannot corrupt the cursor invariant described by GHSA-qwgh-2vcv-g2f7. This agrees with the RustCrypto maintainer's response in RustCrypto/utils#1579.

One range detail to reconcile before merge: this PR changes introduced to 0.11.0-pre, while the now-updated upstream advisory API reports >=0.11.0, <0.12.1. Could you confirm whether prereleases should be included and align this GHSA record with the upstream range? The current 0 bound is why OSV still flags Synapsis's block-buffer 0.10.4 lock entry.

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.

3 participants