Re: [PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-15 Thread Paul Eggert
Thanks, I installed your updated dfa.c patch into Gnulib, along with the attached cleanup patch. >From 91e8dccc3c352d56262e24f8fc8d4b736092e639 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Sep 2020 13:44:34 -0700 Subject: [PATCH] dfa: remove dfa-heap-overrun workaround * lib/dfa.c (r

Re: [PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-15 Thread Norihiro Tanaka
On Tue, 15 Sep 2020 10:43:05 -0700 Jim Meyering wrote: > One nit with the patch: this statement is duplicated: > > + position *p = firstpos - stk[-1].nfirstpos; > + for (position *p = firstpos - stk[-1].nfirstpos; I removed first declaration. > And can you clarify yo

Re: [PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-15 Thread Jim Meyering
On Mon, Sep 14, 2020 at 6:29 AM Norihiro Tanaka wrote: > On Mon, 14 Sep 2020 00:28:32 -0700 > Paul Eggert wrote: > > > On 9/14/20 12:13 AM, Norihiro Tanaka wrote: > > > > > when (i >= d->follows[i].elems[j].index), it seems that > > > map[d->follows[i].elems[j].index] has been already set a value

Re: [PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-14 Thread Norihiro Tanaka
On Mon, 14 Sep 2020 00:28:32 -0700 Paul Eggert wrote: > On 9/14/20 12:13 AM, Norihiro Tanaka wrote: > > > when (i >= d->follows[i].elems[j].index), it seems that > > map[d->follows[i].elems[j].index] has been already set a value more than 0. > > > > What case violates this assumption? > > Than

Re: [PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-14 Thread Paul Eggert
On 9/14/20 12:13 AM, Norihiro Tanaka wrote: when (i >= d->follows[i].elems[j].index), it seems that map[d->follows[i].elems[j].index] has been already set a value more than 0. What case violates this assumption? Thank you for looking into this. I ran into the problem with the dfa-heap-overru

Re: [PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-14 Thread Norihiro Tanaka
On Sun, 13 Sep 2020 18:41:49 -0700 Paul Eggert wrote: > * lib/dfa.c (reorder_tokens): When setting > map[d->follows[i].elems[j].index], instead of incorrectly assuming > that (i < d->follows[i].elems[j].index), use two loops, one to set > the map array and the other to use it. The incorrect as

[PATCH 1/3] dfa: fix dfa-heap-overrun failure

2020-09-13 Thread Paul Eggert
* lib/dfa.c (reorder_tokens): When setting map[d->follows[i].elems[j].index], instead of incorrectly assuming that (i < d->follows[i].elems[j].index), use two loops, one to set the map array and the other to use it. The incorrect assumption caused some elements to be missed, and this in turn cause