mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-06-10 13:30:49 +00:00
Fix opaque panic when ingesting an invalid tar file.
Use PUT to upload the following tar file (`unzstd | base64 -d`): KLUv/QRY7QIAcoQOFLCnDQ0QaaURkYASyN1LJveuZAKkXivfoQMXZ5MhIGJAXHUWHclJufKB PLvNDSbmD81Htf9W1f/3BgsA/QPwwAuojAHiDA8mpAEqhsJB8IUcTATEusLVn0AbU7ZnkA== After this commit it should no longer crash the handler. V12-Ref: F-77219
This commit is contained in:
+2
-2
@@ -124,10 +124,10 @@ func ExtractTar(ctx context.Context, reader io.Reader, oldManifest *Manifest) (*
|
||||
dataBytesTransferred += int64(len(header.Linkname)) // actual symlink
|
||||
}
|
||||
case tar.TypeLink:
|
||||
if entry, found := hardLinks[header.Linkname]; found {
|
||||
if entry, found := hardLinks[header.Linkname]; found && entry != nil {
|
||||
manifest.Contents[fileName] = entry
|
||||
} else {
|
||||
AddProblem(manifest, fileName, "tar: invalid hardlink %q", header.Linkname)
|
||||
AddProblem(manifest, fileName, "tar: invalid hardlink to %q", header.Linkname)
|
||||
}
|
||||
case tar.TypeDir:
|
||||
AddDirectory(manifest, fileName)
|
||||
|
||||
Reference in New Issue
Block a user