From: Michael Wallner Date: Tue, 5 Sep 2017 06:52:07 +0000 (+0200) Subject: null pointer safeguards X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=30e27081b0307e5ae76dcdcce674a7c272c91b30;p=m6w6%2Fext-psi null pointer safeguards --- diff --git a/src/types/decl_struct.c b/src/types/decl_struct.c index cc7cc69..9ba53e9 100644 --- a/src/types/decl_struct.c +++ b/src/types/decl_struct.c @@ -84,6 +84,9 @@ bool psi_decl_struct_validate(struct psi_data *data, struct psi_decl_struct *s, size_t i, pos, len, size, align; struct psi_decl_arg *darg, *prev_arg; + if (!s) { + return false; + } if (psi_validate_stack_has_struct(type_stack, s->name)) { return true; } @@ -198,6 +201,9 @@ bool psi_decl_struct_validate(struct psi_data *data, struct psi_decl_struct *s, size_t psi_decl_struct_get_align(struct psi_decl_struct *s) { + if (!s) { + return 0; + } if (!s->align) { s->align = psi_decl_type_get_args_align(s->args); }