[Patch, libstdc++/63497] Avoid dereferencing invalid iterator in regex_executor
Tim Shen
timshen@google.com
Tue Oct 21 16:45:00 GMT 2014
On Tue, Oct 21, 2014 at 3:25 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> Did you manage to produce a testcase that crashed on trunk?
Oh I forgot to mention that I've tried my best to make a testcase that
crash the trunk, but failed :).
I'm not sure if I should directly put an assert in the code and make a
testcase to explode it. Now I think it's better to do it.
> Is it really necessary to modify _M_current here?
> Couldn't you do:
>
> auto __pre = _M_current;
> if (_M_is_word(*--__pre))
> __left_is_word = true;
>
> Then the function could remain const, couldn't it?
That's exactly what I did in the early version of this patch. But
later I changed because I assume that copying an iterator is
potentially expensive, but mutating is cheaper.
Making this function const may bring some optimization, doesn't it?
But I have no idea how much it will bring and if it's worthy.
--
Regards,
Tim Shen
More information about the Libstdc++
mailing list