[Webkit-unassigned] [Bug 146129] New: CheckedArithmetic's operator bool() and operator==() is broken.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 18 16:30:56 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=146129

            Bug ID: 146129
           Summary: CheckedArithmetic's operator bool() and operator==()
                    is broken.
    Classification: Unclassified
           Product: WebKit
           Version: 528+ (Nightly build)
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mark.lam at apple.com

The existing operator UnspecifiedBoolType*() in CheckedArithmetic is erroneously allowing the Checked value to be implicitly casted into any integer and pointer types.  This is because it is doing a reinterpret_cast<UnspecifiedBoolType*>(1) whereas the idiom relies on the cast of a member e.g. reinterpret_cast<UnspecifiedBoolType*>(&Checked::m_value).  As a result, ImageBufferData::putData() was getting an implicit cast of a Checked value to 1.

Also, 2 of CheckedArithmetic's operator==() will crash if used on an overflowed value, while a 3rd one does not.  The 3rd one should be consistent and also crash if used on an overflowed Checked value.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150618/b03df9fa/attachment-0001.html>


More information about the webkit-unassigned mailing list