Opened 6 years ago

Closed 6 years ago

#12300 closed Bugs (invalid)

boost::smatch::suffix() bug

Reported by: Pascal Séguy <pascal.seguy@…> Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.58.0 Severity: Showstopper
Keywords: Cc:

Description

Hello,

regex are broken in my app after a compil on Ubuntu Xenial (libboost_regex1.58.0). The app was working fine on Ubuntu trusty (libboost_regex1.54).

Here follows the minimal code snippet (boostrebug.cpp).

compile:

g++ -g boostrebug.cpp -l boost_regex

run: ./a.out

The assertion fails on Ubuntu Xenial.

Attachments (1)

boostrebug.cpp (522 bytes ) - added by Pascal Séguy <pascal.seguy@…> 6 years ago.

Download all attachments as: .zip

Change History (2)

by Pascal Séguy <pascal.seguy@…>, 6 years ago

Attachment: boostrebug.cpp added

comment:1 by John Maddock, 6 years ago

Resolution: invalid
Status: newclosed

There's a nasty bug in your program - it's referencing dangling iterators.

Remember that boost::smatch holds iterators into the string that you're matching against, as soon as you assign a new value to variable "comm" then all the iterators stored in "match" are now invalid. Your program is now entitled to crash in any way it chooses.

This is not new behaviour: it has always been this, and is by design as holding iterators is so much efficient than strings.

Note: See TracTickets for help on using tickets.