Fix zstd decompression buffer corruption #4278
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 250 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4278"
general
weight: 0.35
akalenyu
Fixes data corruption issue when trying to import a zst image.
Essentially the issue boils down to how cdi finds out which compressed
format the data is inside matchHeaders.
1)
matchHeaderreads 512 bytes from the raw network reader into fr.buf2) It detects zst and pushes a zst reader to the reader stack
3)
matchHeaderuses the zst reader to read the first zstd block whichin the case of my image was only 100b long. It then saves the decompressed data of 512 bytes back into
fr.bufbut we only read part of the original fr.buf.This causes us to overwrite compressed data with decompressed data.
4) The next read from the zst reader then tries reading decompressed
data as a zst header and sees a very high window size leading to the
error
failed to pull image: window size exceededThis issue can also technically arrive with xz since it has block headers that can get clobbered, but gz cannot since it uses fixed size windows.
What this PR does / why we need it:
This PR is needed to fix a data corruption crash in the importer pod experienced when trying to import a variable window size compressed image
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #4277
Special notes for your reviewer:
Release note:
<!-- Write your release note:
1. Enter your extended release note in the below block. If the PR requires additional action from users switching to the new release, include the string "action required".
2. If no release note is required, just write "NONE".
-->
``
release-note
``NONE