Opened 6 years ago
Closed 6 years ago
#12300 closed Bugs (invalid)
boost::smatch::suffix() bug
Reported by: | 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)
Change History (2)
by , 6 years ago
Attachment: | boostrebug.cpp added |
---|
comment:1 by , 6 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.