mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user