Bug 77718 - SharedBuffer::getSomeData() must support m_dataArray if NETWORK_CFDATA_ARRAY_CALLBACK is defined
Summary: SharedBuffer::getSomeData() must support m_dataArray if NETWORK_CFDATA_ARRAY_...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords: EasyFix, InRadar
Depends on:
Blocks: 77799
  Show dependency treegraph
 
Reported: 2012-02-02 22:58 PST by Benjamin Poulain
Modified: 2012-02-13 17:29 PST (History)
5 users (show)

See Also:


Attachments
Patch (4.74 KB, patch)
2012-02-03 14:48 PST, Benjamin Poulain
ddkilzer: review+
ddkilzer: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2012-02-02 22:58:00 PST
We ignore the data of m_dataArray at the moment, which causes crashes in many tests.

Radar: <rdar://problem/10786745>
Related to https://bugs.webkit.org/show_bug.cgi?id=77715

Patch coming after I get some sleep :)
Comment 1 Benjamin Poulain 2012-02-03 14:48:11 PST
Created attachment 125422 [details]
Patch
Comment 2 Benjamin Poulain 2012-02-03 16:40:43 PST
Comment on attachment 125422 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=125422&action=review

Thinking about it...here is a couple more ASSERT() to avoid future problems. Tell me if you can think of useful additional ones.

> Source/WebCore/platform/SharedBuffer.cpp:261
> +        someData = m_segments[segment] + positionInSegment;

ASSERT(segment < m_segments.size());

> Source/WebCore/platform/SharedBuffer.cpp:265
> +    position -= maxSegmentedSize;

ASSERT(maxSegmentedSize <= position);

> Source/WebCore/platform/cf/SharedBufferCF.cpp:125
> +        unsigned localOffset = position - totalOffset;

ASSERT(totalOffset <= position);
Comment 3 Pratik Solanki 2012-02-03 18:01:49 PST
Comment on attachment 125422 [details]
Patch

Patch looks fine to me. But yeah, we should really fix bug 77715. I'm surprised this was all working so far with this bug.
Comment 4 David Kilzer (:ddkilzer) 2012-02-11 21:41:48 PST
Comment on attachment 125422 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=125422&action=review

r=me

>> Source/WebCore/platform/SharedBuffer.cpp:261
>> +        someData = m_segments[segment] + positionInSegment;
> 
> ASSERT(segment < m_segments.size());

This is a redundant ASSERT().  It will always be true inside this if statement because it's already checking (segment < segments) and segments = m_segments.size().

> Source/WebCore/platform/SharedBuffer.cpp:269
> +#endif
> +    ASSERT_NOT_REACHED();
> +    return 0;

The last part of this method should be in an #else/#endif clause:

#else
    ASSERT_NOT_REACHED();
    return 0;
#endif

> Source/WebCore/platform/cf/SharedBufferCF.cpp:121
> +    Vector<RetainPtr<CFDataRef> >::const_iterator end = m_dataArray.end();

Nit: Might be nice to have a typedef for Vector<RetainPtr<CFDataRef> >.
Comment 5 Benjamin Poulain 2012-02-11 22:09:35 PST
It is <rdar://problem/10801705>
Sorry David.
Comment 6 Benjamin Poulain 2012-02-13 17:28:16 PST
Committed r107648: <http://trac.webkit.org/changeset/107648>
Comment 7 Benjamin Poulain 2012-02-13 17:29:17 PST
> > Source/WebCore/platform/cf/SharedBufferCF.cpp:121
> > +    Vector<RetainPtr<CFDataRef> >::const_iterator end = m_dataArray.end();
> 
> Nit: Might be nice to have a typedef for Vector<RetainPtr<CFDataRef> >.

This is a good idea for the whole class.

I'll fix that separately: https://bugs.webkit.org/show_bug.cgi?id=78552