Opened 16 years ago

Closed 16 years ago

#686 closed Bugs (Fixed)

regex_token_iterator can segfault

Reported by: dakkar Owned by: John Maddock
Milestone: Component: regex
Version: None Severity:
Keywords: Cc:

Description

regex_token_iterator and u32regex_token_iterator can
dereference a 0 pointer in the following case:
- iterating over a string with no matches for the split
regexp
- asking for non-matches (the submatches array starts
with -1)
- incrementing the iterator the first time

in the non-unicode version, nothing happens; but in the
unicode version, the underlying u8_to_u32_iterator
causes a segfault.

I'm attaching a small test case, and a (seems working)
patch.

Change History (1)

comment:1 by nobody, 16 years ago

Status: assignedclosed
Logged In: NO 

Confirmed.

Your patch is correct too.

I've applied the patch and updated the test suite accordingly.

Thanks, John Maddock.
Note: See TracTickets for help on using tickets.