Bug 65592 - WebSocket could not handle zero length text frame.
Summary: WebSocket could not handle zero length text frame.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-02 21:08 PDT by Takashi Toyoshima
Modified: 2011-08-03 00:07 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.81 KB, patch)
2011-08-02 21:13 PDT, Takashi Toyoshima
no flags Details | Formatted Diff | Diff
Patch (8.07 KB, patch)
2011-08-02 22:33 PDT, Takashi Toyoshima
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Toyoshima 2011-08-02 21:08:57 PDT
In current implement, WebSocket cause UTF-8 decode frame error on zero length text frame.

cf.) Chromium side issue report: http://code.google.com/p/chromium/issues/detail?id=91193
Comment 1 Takashi Toyoshima 2011-08-02 21:13:21 PDT
Created attachment 102737 [details]
Patch
Comment 2 Kent Tamura 2011-08-02 21:17:16 PDT
Comment on attachment 102737 [details]
Patch

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

> Source/WebCore/websockets/WebSocketChannel.cpp:560
>                  String message = String::fromUTF8(continuousFrameData.data(), continuousFrameData.size());
> -                if (message.isNull())
> +                if (message.isNull() && continuousFrameData.size())

Can we avoid String::fromUTF8() when continuousFrameData.size() == 0?

> Source/WebCore/websockets/WebSocketChannel.cpp:575
>              String message = String::fromUTF8(frame.payload, frame.payloadLength);
>              skipBuffer(frame.frameEnd - m_buffer);
> -            if (message.isNull())
> +            if (message.isNull() && frame.payloadLength)

ditto.
Comment 3 Takashi Toyoshima 2011-08-02 22:33:24 PDT
Created attachment 102740 [details]
Patch
Comment 4 Kent Tamura 2011-08-02 22:53:32 PDT
Comment on attachment 102740 [details]
Patch

ok
Comment 5 WebKit Review Bot 2011-08-03 00:07:09 PDT
Comment on attachment 102740 [details]
Patch

Clearing flags on attachment: 102740

Committed r92262: <http://trac.webkit.org/changeset/92262>
Comment 6 WebKit Review Bot 2011-08-03 00:07:14 PDT
All reviewed patches have been landed.  Closing bug.