lamuguo / re2

Automatically exported from code.google.com/p/re2
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Bitstate fails to match optional empty character classes #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

  RE2 re("((((()))))[^\\S\\s]?");
  StringPiece group[6];
  CHECK(re.Match("", 0, 0, RE2::UNANCHORED, group, 6));

What version of the product are you using? On what operating system?

Rev b49abcd41429, 64-bit Linux.

Please provide any additional information below.

BitState::TrySearch appears to make the faulty assumption that alternations and 
capture groups will never produce kInstFail, resulting in false negatives when 
it shows up on an optional path. I've attached a patch that makes this 
assumption valid by adding checks for NoMatch fragments in Compiler::Quest and 
Compiler::Capture.

Original issue reported on code.google.com by dhaf...@gmail.com on 21 Oct 2011 at 3:03

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the suggested fix.  Could you please complete a CLA
so that I can accept the patch?  See
http://code.google.com/p/re2/wiki/Contribute#Copyright

Original comment by rsc@swtch.com on 23 Oct 2011 at 9:58

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 82887e1c546c.

Original comment by rsc@swtch.com on 10 Jan 2014 at 3:31