Branch: Tag:

2018-08-10

2018-08-10 09:00:18 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Cpp: Improved argument checking in macro expansion.

Survive omitted arguments.

Fixes [CID 1438384] and [CID 1438385].

226:    {    struct pike_string *a = NULL;    -  if (d->args > 0) { +  if (arguments && (d->args > 0)) {    a = ITEM(arguments)[0].u.string;    }    d->magic(context_obj, d, a, &s);
297:    int save_flags = d->flags;    d->flags |= CPP_MACRO_IN_USE;    +  if (context_obj) {    ref_push_string(str);    push_int(flags & ~(CPP_EXPECT_ENDIF | CPP_EXPECT_ELSE));    safe_apply(context_obj, "cpp", 2);    string_builder_shared_strcat(&s, Pike_sp[-1].u.string);    pop_stack(); -  +  } else { +  string_builder_shared_strcat(&s, str); +  }       d->flags = save_flags;