ld: trap more obvious symbol errors
authorAlan Cox <alan@linux.intel.com>
Wed, 15 Nov 2017 21:07:54 +0000 (21:07 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 15 Nov 2017 21:07:54 +0000 (21:07 +0000)
Applications/MWC/cmd/asz80/ld.c

index 657486f..032c6ff 100644 (file)
@@ -409,7 +409,7 @@ static struct object *load_object(FILE * fp, off_t off, int lib, const char *pat
        compatible_obj(&o->oh);
        /* Load up the symbols */
        nsym = (o->oh.o_dbgbase - o->oh.o_symbase) / S_SIZE;
-       if (nsym < 0)
+       if (nsym < 0||nsym > 65535)
                error("bad object file");
        /* Allocate the symbol entries */
        o->syment = (struct symbol **) xmalloc(sizeof(struct symbol *) * nsym);