From 115143f6bc5a90ff19c3af2bee68f3077fc5f1a3 Mon Sep 17 00:00:00 2001 From: Peter Zmanovsky <48548636+peter15914@users.noreply.github.com> Date: Mon, 6 Jan 2025 01:37:11 +0500 Subject: [PATCH] Fix possible null dereference (#4578) The return value of the function ```viewpoint_lower()``` is always checked for NULL. On the other hand, the check ```if(a == NULL)``` was meaningless because the pointer ```a``` was previously dereferenced in ```viewpoint_lower(a)```. --- src/libponyc/type/compattype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libponyc/type/compattype.c b/src/libponyc/type/compattype.c index 2e04529e10..ab8a706530 100644 --- a/src/libponyc/type/compattype.c +++ b/src/libponyc/type/compattype.c @@ -46,7 +46,7 @@ static bool is_arrow_compat_nominal(ast_t* a, ast_t* b) // T1->T2 ~ N k ast_t* a_lower = viewpoint_lower(a); - if(a == NULL) + if(a_lower == NULL) return false; bool ok = is_compat_type(a_lower, b);