From c5a8d3485191d15363b9817da1afcac3fce5ddeb Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Mon, 6 Jan 2025 07:52:01 +0100 Subject: [PATCH] core/rawdb: fix panic in freezer (#30973) Fixes an issue where the node panics when an LStat fails with something other than os.ErrNotExist closes https://github.com/ethereum/go-ethereum/issues/30968 --- core/rawdb/freezer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index d6370cee33..c5a72eff7e 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -87,6 +87,10 @@ func NewFreezer(datadir string, namespace string, readonly bool, maxTableSize ui ) // Ensure the datadir is not a symbolic link if it exists. if info, err := os.Lstat(datadir); !os.IsNotExist(err) { + if info == nil { + log.Warn("Could not Lstat the database", "path", datadir) + return nil, errors.New("lstat failed") + } if info.Mode()&os.ModeSymlink != 0 { log.Warn("Symbolic link ancient database is not supported", "path", datadir) return nil, errSymlinkDatadir