bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Special Comparisons: uninitialized array index


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Special Comparisons: uninitialized array index
Date: Mon, 7 Aug 2017 11:59:29 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Aug 07, 2017 at 11:07:13AM -0400, Andrew J. Schorr wrote:
> The fix is less obvious to me. One could patch str_array.c:str_lookup as
> follows:
> 
> --- a/str_array.c
> +++ b/str_array.c
> @@ -165,7 +165,7 @@ str_lookup(NODE *symbol, NODE *subs)
>          * "Array indices are always strings."
>          * ....
>          */
> -       if (subs->stfmt != STFMT_UNUSED) {
> +       if (subs->stfmt != STFMT_UNUSED || subs == Nnull_string) {
>                 /* The string was generated using CONVFMT. */
>                 NODE *tmp;
> 
> But I'm not sure that's the best solution. Perhaps it should be attacked
> on the extraction side in the str_list function, but that would probably
> lead to memory leaks. Arnold -- what do you think?

Sorry -- I read the code too fast. We could certainly fix this in str_list, but
str_lookup seems more conceptually correct and consistent.

-Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]