Skip to content

pkg/types: tolerate nil entries in Result version converters - #1191

Open
thc1006 wants to merge 1 commit into
containernetworking:mainfrom
thc1006:fix-nil-result-converters
Open

pkg/types: tolerate nil entries in Result version converters#1191
thc1006 wants to merge 1 commit into
containernetworking:mainfrom
thc1006:fix-nil-result-converters

Conversation

@thc1006

@thc1006 thc1006 commented Aug 17, 2026

Copy link
Copy Markdown

A result with a JSON null element, for example an "ips" list that contains null, unmarshals to a slice holding a nil pointer. The 0.4.0 and 1.0.0 IP and interface converters, and the 0.2.0 downgrade loop, dereferenced that element with no nil check and panicked, while the sibling paths already go through the nil-safe Copy().

Guard the four converter helpers the way IPConfig.Copy and Interface.Copy do, and skip nil entries when downgrading to 0.2.0. Routes were already fine because they use the nil-safe Route.Copy(). The panic was reachable on ADD via GetAsVersion and on CHECK/DEL/GC when a cached result is re-read, so it could surface inside the runtime that called the plugin.

A result with a JSON null element, for example an "ips" list that
contains null, unmarshals to a slice holding a nil pointer. The 0.4.0
and 1.0.0 IP and interface converters, and the 0.2.0 downgrade loop,
dereferenced that element with no nil check and panicked, while the
sibling paths already go through the nil-safe Copy().

Guard the four converter helpers the way IPConfig.Copy and Interface.Copy
do, and skip nil entries when downgrading to 0.2.0. Routes were already
fine because they use the nil-safe Route.Copy(). The panic was reachable
on ADD via GetAsVersion and on CHECK/DEL/GC when a cached result is
re-read, so it could surface inside the runtime that called the plugin.

Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
@thc1006
thc1006 force-pushed the fix-nil-result-converters branch from cfce860 to bb01c09 Compare August 17, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant