From 4e1ce2534c23a51a67cd3e56fe389e207bdcf3b3 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Sat, 14 Aug 2021 12:12:44 +0100 Subject: [PATCH] obj/btf: Fix size of Unknown variant The size of Unknown should be ty_size, otherwise when it is encountered, we never advance the cursor and it creates an infinite loop. Signed-off-by: Dave Tucker --- aya/src/obj/btf/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aya/src/obj/btf/types.rs b/aya/src/obj/btf/types.rs index 9c789314..87639767 100644 --- a/aya/src/obj/btf/types.rs +++ b/aya/src/obj/btf/types.rs @@ -154,7 +154,7 @@ impl BtfType { use BtfType::*; match self { - Unknown => 0, + Unknown => ty_size, Fwd(_) | Const(_) | Volatile(_) | Restrict(_) | Ptr(_) | Typedef(_) | Func(_) | Float(_) => ty_size, Int(_, _) => ty_size + mem::size_of::(),