harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 20743b3ab5e588b45436215460441476b47d03ac
parent af04c6acf5f2a825e584f120b9cd4d77132f3827
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Mon, 25 Apr 2022 23:49:34 +0000

Limit object allocation to defined sizes > 0

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Msrc/check.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -321,6 +321,10 @@ check_expr_alloc_init(struct context *ctx, objtype = hint; } expr->result = type_store_lookup_pointer(ctx->store, objtype, ptrflags); + if (expr->result->size == 0 || expr->result->size == SIZE_UNDEFINED) { + error(ctx, aexpr->loc, expr, + "Cannot allocate object of zero or undefined size"); + } } static void