null pointer safeguards
authorMichael Wallner <mike@php.net>
Tue, 5 Sep 2017 06:52:07 +0000 (08:52 +0200)
committerMichael Wallner <mike@php.net>
Tue, 5 Sep 2017 06:52:07 +0000 (08:52 +0200)
src/types/decl_struct.c

index cc7cc69871700fdb7313ce511858573cdbedbcdd..9ba53e97348a3856dc0d98e806b140a889068bd7 100644 (file)
@@ -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);
        }