On Tue, Jan 31, 2012 at 01:10:28PM +0100, Otto Moerbeek wrote:
> I could reproduce the bug, but I'm not 100% happy with your fix since
> it just pushes the failure to a bigger number of vars.
>
> It's better to check for the case like below,
>
> -Otto
>
> Index: table.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/table.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 table.c
> --- table.c 17 Jan 2009 22:06:44 -0000 1.13
> +++ table.c 31 Jan 2012 12:07:20 -0000
> @@ -108,7 +108,10 @@ ktenter(struct table *tp, const char *n,
> }
>
> if (tp->nfree <= 0) { /* too full */
> - texpand(tp, 2*tp->size);
> + if (tp->size <= SHRT_MAX/2)
> + texpand(tp, 2*tp->size);
> + else
> + internal_errorf(1, "too many vars");
> goto Search;
> }
Regardless of the other problem filling up the table, i think that
this should be comitted.
FWIW, the problem doesn't apply to the ffmpeg we currently have in
ports.
Ciao,
Kili