mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
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>
22 lines
460 B
Go
22 lines
460 B
Go
package compression
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
type uncompressedDecompressor struct {
|
|
genericDecompressor
|
|
}
|
|
|
|
func newUncompressedDecompressor(compressedFilePath string) (*uncompressedDecompressor, error) {
|
|
d, err := newGenericDecompressor(compressedFilePath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &uncompressedDecompressor{*d}, err
|
|
}
|
|
|
|
func (d *uncompressedDecompressor) decompress(w io.WriteSeeker, r io.Reader) error {
|
|
return d.sparseOptimizedCopy(w, r)
|
|
}
|