Skip to content

Conversation

@1seal
Copy link

@1seal 1seal commented Jan 26, 2026

This fixes a mismatch between the size returned by docker/internal/tarfile.Source.GetBlob and the bytes returned when reading docker-archive layers that are stored as symlink entries
(e.g. produced by docker save for duplicate layers).

Previously, prepareLayerData recorded the symlink header size (often 0), while GetBlob followed the symlink and returned the target file bytes.

Changes:

  • Resolve a single symlink when determining a layer's size (matching the Reader behavior used by GetBlob).
  • Add a regression test ensuring "reported size == bytes returned" for a symlink-referenced layer.

Tests:

  • go test ./...
  • go vet ./...

When a layer path in a docker-archive points at a symlink header, prepareLayerData recorded the symlink header size (often 0) while GetBlob followed the symlink and returned the target file bytes.

Resolve a single symlink when determining the layer size so the reported size matches the bytes returned by GetBlob, and add a regression test.

Signed-off-by: 1seal <security@1seal.org>
@github-actions
Copy link

This repository has been migrated to https://github.com/containers/container-libs. Please open your PR there.

@github-actions github-actions bot closed this Jan 26, 2026
@1seal
Copy link
Author

1seal commented Jan 26, 2026

this repo has been migrated to containers/container-libs; i re-opened the same change there: https://github.com/containers/container-libs/pull/605\n\nclosing this PR in favor of the new location.

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.

1 participant