Skip to content

Fragmented text frame treated as invalid if it contains partial utf-8 #122

@airPenetration

Description

@airPenetration

fastwebsockets/src/lib.rs

Lines 647 to 650 in 7d53d01

}
OpCode::Text => {
if frame.fin && !frame.is_utf8() {
(Err(WebSocketError::InvalidUTF8), None)

A single utf-8 character may contain multiple bytes and fragmentation may lead to the last segment having partial utf-8.

rfc 6455 has already suggested this.

I can guess that this is relatively unlikely to happen, fragmentation of a text segment from the middle of a non ascii character, but is not impossible. Specially if the text contains 4-byte emojis or is a non English text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions