Skip to content

Content length of client response is assumed to fit within integer but may not #340

Open
@RutledgePaulV

Description

@RutledgePaulV

Hello!

I discovered that the content length parsing in the decoder assumes that the value can be read into an integer. It's actually quite easy to pass the bounds of an integer when dealing with bytes since Integer.MAX_VALUE translates to ~2.15gb. I reached this limit in one my own apps when attempting a large download. From some of the other issues ( #90 | #202 ) it looks like large downloads have a number of problems (buffering completely, etc).

Sun Jun 11 20:18:35 CDT 2017 [client-loop] ERROR - should not happen
java.lang.NumberFormatException: For input string: "4262924399"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:583)
	at java.lang.Integer.parseInt(Integer.java:615)
	at org.httpkit.client.Decoder.readHeaders(Decoder.java:167)

For reference:
JDK 1.8.0_102
lein 2.7.1
[http-kit "2.2.0"]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions