From 4df642e94119afbadcdca5142ad05ea2af6230d1 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 11 Sep 2023 15:12:55 +0300 Subject: [PATCH] [#162] netmap: Fix possible panic Placement policy is unvalidated external input. Under no circumstances should we panic here. Signed-off-by: Evgenii Stratonikov --- netmap/netmap.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netmap/netmap.go b/netmap/netmap.go index 3e8d680d..37f5caba 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -258,6 +258,9 @@ func (m NetMap) ContainerNodes(p PlacementPolicy, pivot []byte) ([][]NodeInfo, e } if p.unique { + if c.processedSelectors[sName] == nil { + return nil, fmt.Errorf("selector not found: '%s'", sName) + } nodes, err := c.getSelection(*c.processedSelectors[sName]) if err != nil { return nil, err