Skip to content

Broken multipart dataΒ #247

@headius

Description

@headius

Original issue is at ruby/strscan#92.

The problem manifested as an ArgumentError "invalid byte sequence in UTF-8" when trying to upload a PDF via Tomcat and jruby-rack to a simple application. Thanks to the simple reproduction by @jlahtinen I was able to narrow this down to a jruby-rack bug.

The code in jruby-rack has not been updated since JRuby 1.7, and as a result it was using some unsafe methods for concatenating bytes onto an existing string. Specifically, it called an old form of RubyString#cat that did not consider encoding or code range, and when it appended encoded or binary data onto an existing buffer it could break that buffer for any character operations.

Fix coming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions