fix: check err returned by newGenericDecompressor

There is a couple of newGenericDecompressor function usages, where
returned possibly non-nil `err` is not checked before dereferencing
returned decompressor. It may lead to nil ptr dereferencing.

This commit adds check for `err` to prevent dereferencing potentially
nullable decompressor.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
This commit is contained in:
Mikhail Dmitrichenko
2025-11-20 12:07:33 +03:00
parent 6541fc4fb2
commit fdc738b0df
2 changed files with 6 additions and 0 deletions

View File

@@ -10,6 +10,9 @@ type uncompressedDecompressor struct {
func newUncompressedDecompressor(compressedFilePath string) (*uncompressedDecompressor, error) {
d, err := newGenericDecompressor(compressedFilePath)
if err != nil {
return nil, err
}
return &uncompressedDecompressor{*d}, err
}

View File

@@ -16,6 +16,9 @@ type zipDecompressor struct {
func newZipDecompressor(compressedFilePath string) (*zipDecompressor, error) {
d, err := newGenericDecompressor(compressedFilePath)
if err != nil {
return nil, err
}
return &zipDecompressor{*d, nil, nil}, err
}