From 3da3815a674c922c520e013b30eb96c7491a5e85 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 30 Jul 2021 00:11:27 +0200 Subject: err when an address contains a sum $a+$b (afl) Reported by Alessandro Mantovani. These addresses are likely bogus, but they triggered an unwarranted assertion failure. We now raise a civilized error. --- util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 0123e27..a28176d 100644 --- a/util.c +++ b/util.c @@ -362,19 +362,21 @@ getcon(int64_t val, Fn *fn) return CON(c); } -void +int addcon(Con *c0, Con *c1) { if (c0->type == CUndef) *c0 = *c1; else { if (c1->type == CAddr) { - assert(c0->type != CAddr && "adding two addresses"); + if (c0->type == CAddr) + return 0; c0->type = CAddr; c0->label = c1->label; } c0->bits.i += c1->bits.i; } + return 1; } void -- cgit 1.4.1