Re: [PATCH v3 13/15] git_config_set: make use of the config parser's event stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 09, 2018 at 10:32:20AM +0200, Johannes Schindelin wrote:

> +static int store_aux_event(enum config_event_t type,
> +			   size_t begin, size_t end, void *data)
> +{
> +	struct config_store_data *store = data;
> +
> +	ALLOC_GROW(store->parsed, store->parsed_nr + 1, store->parsed_alloc);
> +	store->parsed[store->parsed_nr].begin = begin;
> +	store->parsed[store->parsed_nr].end = end;
> +	store->parsed[store->parsed_nr].type = type;
> +	store->parsed_nr++;
> +
> +	if (type == CONFIG_EVENT_SECTION) {
> +		if (cf->var.len < 2 || cf->var.buf[cf->var.len - 1] != '.')
> +			BUG("Invalid section name '%s'", cf->var.buf);

I triggered this BUG today while playing around. Here's a minimal
reproduction:

  echo '[broken' >config
  git config --file=config a.b c

I'm not sure if it should simply be a die() and not a BUG(), since
it depends on the input. Or if it is a BUG and we expected an earlier
part of the code (like the event generator) to catch this broken case
before we get to this function.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux