Closed p5pRT closed 8 years ago
* /(?[(\c]) / panics: Read past end of '(?[ ])'. It should report a syntax error.
* /(?[\c#])/\, /(?[\c[])/\, /(?[\c\])/ and /(?[\c]])/ all report a syntax error. They should each match a single control character.
* /(?[(\c])/ matches a single "\c]". It should report a syntax error.
* /(?[(\c]) ]\b/ behaves like /\c]b/. It should report a syntax error.
* /(?[\c[]](])/ behaves like /\c[\]/. It should report a syntax error.
* /(?[\c#] ])/ (literal newline inside) panics: reg_node overrun trying to emit 0\, 171b5f4>=171b5f0 It should report a syntax error.
All of these bugs were found on the current blead (2d9b5f101563ac9fee41e6ca496f79db6222d2e3). All but the last one were also present in 5.20.2.
The attached patch works-for-meā¢. Should I add new tests checking for this bug in another patch?
On Wed Sep 30 09:15:21 2015\, victor@drawall.cc wrote:
The attached patch works-for-meā¢. Should I add new tests checking for this bug in another patch?
It appears that the patch did not get attached. Can you re-try?
Thank you very much.
-- James E Keenan (jkeenan@cpan.org)
The RT System itself - Status changed from 'new' to 'open'
Sorry for the mess-up. Hereās the patch again. Iām also including it in the body of the email\, just in case the attachment fails again.
From 96cb469f3930a276be8cedac7d23e9a26899be08 Mon Sep 17 00:00:00 2001 From: Victor Adam \victor@​drawall\.cc Date: Sun\, 27 Sep 2015 10:22:08 +0200 Subject: [PATCH] regex: handle \cX inside (?[])
The \cX notation for control characters used to cause panics and unexpected behavior when used insed an extended character class. See bug #126181.
The solution is to ignore the byte following \c during the first parsing pass of a (?[]) construct.
AUTHORS | 1 + regcomp.c | 4 ++++ 2 files changed\, 5 insertions(+)
*pRExC_state, SV* return_invlist, * default: case next time and keep on incrementing until * we find one of the invariants we do handle. */ RExC_parse++; + if (*RExC_parse == 'c') { + /* Skip the \cX notation for control characters \/ + RExC_parse++; + } break; case '[': { -- 2.4.5
On 09/30/2015 02:21 AM\, Victor ADAM wrote:
The attached patch works-for-meā¢. Should I add new tests checking for this bug in another patch?
Yes\, please. The easiest place to put them is in t/re/re_tests. Traditionally\, people have just added them towards the end. It can handle things that don't compile. It would be nice if you included a test for every one in your ticket. There may be a problem in placing them there\, though\, in that there may be warnings about this being an experimental feature. Then it might be best to put them in t/re/regex_sets.t. I haven't looked.
Your patch looks good to me. I would split the author portion into its own patch so that in the unlikely event that the other one should ever be reverted\, your name will stay as a contributor. The tests can go in the code patch. Theoretically they should be in a separate patch marked as TODO and then changed to not-TODO in the code patch. But hardly anyone bothers to do that\, as the gain in my opinion is not worth the extra work\, and apparently others agree.
Karl Williamson
As discussed\, Iāve split my patch in two : 0001*.patch adds my name to the AUTHORS file\, while 0003*.patch is the actual code change. Iām also attaching 0002*.patch that adds tests for RT #126177\, #126178\, #126179\, #126180\, #126181\, #126185\, #126186\, #126187\, #126222 and #126253.
Thanks for the pointers! I already love re_tests\, it makes it really easy to add new tests.
Unfortunately\, it doesnāt look like I can test the last example using re_tests. A literal newline will be interpreted as a pattern separator\, and the panic doesnāt occur with a "\n".
Anyway\, Iām working right now on adding tests for this and the other bugs I reported (#126141\, #126177\, #126178\, #126179\, #126180\, #126185\, #126186\, #126187\, #126222). I was thinking about making a single patch with all new tests\, and then separate code patches for each bug; is that a good idea?
As discussed\, Iāve split my patch in two : 0001*.patch adds my name to the AUTHORS file\, while 0003*.patch is the actual code change. Iām also attaching 0002*.patch that adds tests for RT #126177\, #126178\, #126179\, #126180\, #126181\, #126185\, #126186\, #126187\, #126222 and #126253.
On 10/03/2015 12:25 AM\, Victor ADAM wrote:
As discussed\, Iāve split my patch in two : 0001*.patch adds my name to the AUTHORS file\, while 0003*.patch is the actual code change. Iām also attaching 0002*.patch that adds tests for RT #126177\, #126178\, #126179\, #126180\, #126181\, #126185\, #126186\, #126187\, #126222 and #126253.
One of our rules is that individual patches can't break blead on a major platform. When I test your 2nd patch\, but not the third\, I get the following error:
Syntax error in (?[...]) in regex m/(?[\c#])/ at re/regex_sets.t line 155. re/regex_sets.t ................................................... Dubious\, test returned 255 (wstat 65280\, 0xff00) No subtests run
I'm afraid this patch was problematic to apply\, as you had the misfortune to have someone else be modifying re_tests\, so that your patch no longer works as-is because the context surrounding it has changed. This happens occasionally\, and it's unfortunate it happened to you on the first try. Before submitting again\, you should rebase your patch to the latest blead. You'll get conflicts that you need to resolve\, but this shouldn't be too hard. If you need help the #p5p irc channel will have people who can guide you.
And thanks for doing all this.
Sorry for the long delay. Iāve rebased my work on top of the current blead. I also merged the test and code commit into a single one. All tests are successful. The resulting patches are attached.
Thanks\, applied as 4a84d6e89d52b8921090805085871e6cca66924d -- Karl Williamson
@khwilliamson - Status changed from 'open' to 'pending release'
@mauke - Status changed from 'pending release' to 'resolved'
Migrated from rt.perl.org#126181 (status was 'resolved')
Searchable as RT126181$