Skip to content

Commit

Permalink
DO NOT MERGE: Debug
Browse files Browse the repository at this point in the history
I'm being dumb.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
  • Loading branch information
mtrmac committed Apr 24, 2024
1 parent c77825b commit ff1e003
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/chunked/cache_linux.go
Expand Up @@ -822,8 +822,11 @@ func unmarshalToc(manifest []byte) (*internal.TOC, error) {

iter := jsoniter.ParseBytes(jsoniter.ConfigFastest, manifest)

logrus.Errorf("ITER START")
for field := iter.ReadObject(); field != ""; field = iter.ReadObject() {
switch strings.ToLower(field) {
x := strings.ToLower(field)
logrus.Errorf("FIELD %q", field)
switch x {
case "version":
toc.Version = iter.ReadInt()

Expand Down Expand Up @@ -899,6 +902,7 @@ func unmarshalToc(manifest []byte) (*internal.TOC, error) {

case "tarsplitdigest": // strings.ToLower("tarSplitDigest")
s := iter.ReadString()
logrus.Errorf("Got TSD %q", s)
d, err := digest.Parse(s)
if err != nil {
return nil, fmt.Errorf("Invalid tarSplitDigest %q: %w", s, err)
Expand All @@ -909,6 +913,7 @@ func unmarshalToc(manifest []byte) (*internal.TOC, error) {
iter.Skip()
}
}
logrus.Errorf("ITER END")

// validate there is no extra data in the provided input. This is a security measure to avoid
// that the digest we calculate for the TOC refers to the entire document.
Expand Down
2 changes: 2 additions & 0 deletions pkg/chunked/internal/compression.go
Expand Up @@ -15,6 +15,7 @@ import (
jsoniter "github.com/json-iterator/go"
"github.com/klauspost/compress/zstd"
"github.com/opencontainers/go-digest"
"github.com/sirupsen/logrus"
)

type TOC struct {
Expand Down Expand Up @@ -133,6 +134,7 @@ func WriteZstdChunkedManifest(dest io.Writer, outMetadata map[string]string, off
const zstdSkippableFrameHeader = 8
manifestOffset := offset + zstdSkippableFrameHeader

logrus.Errorf("WRITING %q", tarSplitData.Digest)
toc := TOC{
Version: 1,
Entries: metadata,
Expand Down

0 comments on commit ff1e003

Please sign in to comment.