[master] 2bc56a4b7 vcc: Add missing ERRCHK to vcc_expr5()
Dridi Boukelmoune
dridi at varni.sh
Wed Jun 2 15:30:06 UTC 2021
On Wed, Jun 2, 2021 at 3:22 PM Nils Goroll <nils.goroll at uplex.de> wrote:
>
>
> commit 2bc56a4b789fb770548aa6d528c8c8d6d296d4a1
> Author: Nils Goroll <nils.goroll at uplex.de>
> Date: Wed Jun 2 17:09:27 2021 +0200
>
> vcc: Add missing ERRCHK to vcc_expr5()
>
> VCC_SymbolGet() could fail, e,g, if the token is reserved
That's not supposed to happen, just before the symbol creation we
probed the symbol table and a reserved symbol should have been
returned.
It would have then failed to satisfy the expression type.
> Ref cf396384595ef47cc66f1eedcf0b6730d5b1b659
Actually, since 9b1f1d170781ffa8a881b46455327ca9d7d5c514 we should
actively be removing lots of ERRCHK() now that vcc_PeekToken*() and
vcc_NextToken() functions are fail-safe.
> diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
> index 55d311ea8..b41395aff 100644
> --- a/lib/libvcc/vcc_expr.c
> +++ b/lib/libvcc/vcc_expr.c
> @@ -745,6 +745,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
> if (sym == NULL && fmt->global_pfx != NULL && t1->tok != '.') {
> sym = VCC_SymbolGet(tl, SYM_MAIN, SYM_NONE,
> SYMTAB_CREATE, XREF_REF);
> + ERRCHK(tl);
We should rather AZ(tl->err) here, or do nothing. Trying to create a
symbol that already exists should fail.
> AN(sym);
> VCC_GlobalSymbol(sym, fmt);
> }
> _______________________________________________
> varnish-commit mailing list
> varnish-commit at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
More information about the varnish-commit
mailing list