Opened 10 years ago
Closed 5 years ago
#7048 closed Bugs (invalid)
Iterator's value is not checked properly in range_run class.
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | spirit |
Version: | Boost 1.50.0 | Severity: | Problem |
Keywords: | Cc: | yogen.saini@… |
Description
In File boost/spirit/home/classic/utility/impl/chset/range_run.ipp
if (iter != run.end() && iter->includes(v)) return true; if (iter != run.begin()) return (--iter)->includes(v); } return false;
Here iter = run.end() condition is not checked.
So, attached patch is the fix for it.
Attachments (1)
Change History (4)
by , 10 years ago
Attachment: | range_run.ipp_patch added |
---|
comment:1 by , 10 years ago
Do you have a minimal test case exhibiting this edge case problem? I'll need one. I think the logic is just fine as it is. If iter is at the end, it gets decremented before dereferencing it (but only if it's not at begin already).
comment:2 by , 5 years ago
There is no problem to decrement an end iterator, C++ Standard allows it. So it is preferably valid code and I see no reason to check add a check for end iter != run.end()
before decrementing --iter
.
comment:3 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Patch file for the reported Bug.