[LLVMbugs] [Bug 21496] New: string_view::remove_prefix, remove_suffix should leave n > size() UB

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 5 18:34:49 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21496

            Bug ID: 21496
           Summary: string_view::remove_prefix, remove_suffix should leave
                    n > size() UB
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lichray at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

They have explicit narrow contract:

  Requires: n <= size()

, but the libc++ made them work same as n == size(), which creates portability
problems.  For reference, libstdc++'s remove_prefix is guarded by assertion,
remove_suffix is just `this->_M_len -= __n;` (which may worth to be guarded as
well, but that's their problem).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141106/2d357f5d/attachment.html>


More information about the llvm-bugs mailing list