bug-gawk
[Top][All Lists]
Advanced

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

Re: Internal error with gawk-5.3.0


From: arnold
Subject: Re: Internal error with gawk-5.3.0
Date: Mon, 08 Jan 2024 00:51:10 -0700
User-agent: Heirloom mailx 12.5 7/5/10

This looks good. I will push this eventually.

Thanks,

Arnold

"Miguel Pineiro Jr." <mpj@pineiro.cc> wrote:

> On Sun, Jan 7, 2024, at 2:34 PM, arnold@skeeve.com wrote:
> > Hi.
> >
> > The attached patch seems to do the trick for me.
> >
> > Arnold
>
> Alternatively, the allocation of the array can be done at the top. ezalloc 
> leaves it properly initialized for the Nnull_string and Null_field cases. 
>
> diff --git a/node.c b/node.c
> index de12f05d..59c0b98e 100644
> --- a/node.c
> +++ b/node.c
> @@ -815,6 +815,18 @@ str2wstr(NODE *n, size_t **ptr)
>  
>       assert((n->flags & (STRING|STRCUR)) != 0);
>  
> +     /*
> +      * For use by do_match, create and fill in an array.
> +      * For each byte `i' in n->stptr (the original string),
> +      * a[i] is equal to `j', where `j' is the corresponding wchar_t
> +      * in the converted wide string.
> +      *
> +      * Create the array.
> +      */
> +     if (ptr != NULL) {
> +             ezalloc(*ptr, size_t *, sizeof(size_t) * (n->stlen + 1), 
> "str2wstr");
> +     }
> +
>       /*
>        * Don't convert global null string or global null field
>        * variables to a wide string. They are both zero-length anyway.
> @@ -848,18 +860,6 @@ str2wstr(NODE *n, size_t **ptr)
>       emalloc(n->wstptr, wchar_t *, sizeof(wchar_t) * (n->stlen + 1), 
> "str2wstr");
>       wsp = n->wstptr;
>  
> -     /*
> -      * For use by do_match, create and fill in an array.
> -      * For each byte `i' in n->stptr (the original string),
> -      * a[i] is equal to `j', where `j' is the corresponding wchar_t
> -      * in the converted wide string.
> -      *
> -      * Create the array.
> -      */
> -     if (ptr != NULL) {
> -             ezalloc(*ptr, size_t *, sizeof(size_t) * (n->stlen + 1), 
> "str2wstr");
> -     }
> -
>       sp = n->stptr;
>       src_count = n->stlen;
>       memset(& mbs, 0, sizeof(mbs));



reply via email to

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