[Webkit-unassigned] [Bug 19690] New: SharedBuffer::buffer() fails with platform data
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jun 20 07:58:08 PDT 2008
https://bugs.webkit.org/show_bug.cgi?id=19690
Summary: SharedBuffer::buffer() fails with platform data
Product: WebKit
Version: 525.x (Safari 3.1)
Platform: Macintosh
OS/Version: Mac OS X 10.5
Status: UNCONFIRMED
Severity: Normal
Priority: P2
Component: Platform
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: avi at drissman.com
SharedBuffer has the ability (on the Mac) to have a "platform data" member, so
that if we want to have a SharedBuffer created from, say, an NSData object, we
can do so, and all the member functions treat it as if the data were actually
in m_buffer.
This is achieved in data() and size() by checking with hasPlatformData(), and
in append() by calling maybeTransferPlatformData(). However,
SharedBuffer::buffer() does not properly wrap the platform data's existence.
This failure is an accident waiting to happen.
To repro:
- Create a SharedBuffer with an NSData
- Call data()
-- result: the correct data pointer
- Call size()
-- result: the correct data size
- Call buffer()
-- result: an empty buffer
A reasonable patch would be:
- const Vector<char> &buffer() { return m_buffer; }
+ const Vector<char> &buffer() { maybeTransferPlatformData(); return
m_buffer; }
Perhaps it could be optimized if buffer() must be on the fast path, but
correctness is always preferable to speed.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list