New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix in the baze-core/util/IdentityWriter causing upload failure #2922
Bugfix in the baze-core/util/IdentityWriter causing upload failure #2922
Conversation
…f chunked upload of data when Content-Length % Int32.Max > Int32.Max
@@ -38,7 +38,7 @@ private[http4s] class IdentityWriter[F[_]](size: Int, out: TailStage[ByteBuffer] | |||
|
|||
logger.warn(msg) | |||
|
|||
val reducedChunk = chunk.take(size - bodyBytesWritten) | |||
val reducedChunk = chunk.take((size - bodyBytesWritten).toInt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conversion to Int on this place is safe as long as chunk.size is also Int.
…f chunked upload of data when Content-Length (Long) converted to Int32 overflows to a positive number.
Please review this PR @rossabaker | @bryce-anderson | @ChristopherDavenport | @aeons This bug is causing us errors in production. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. We could release it on 0.20.x if it's on the series/0.20 branch.
Thank you. |
I can cherry pick it back tonight and get a release.going. |
That would be perfect. So I will leave on the master branch. |
This is cherry-picked and released as 0.20.12. |
Backport #2922: chunked upload of long Content-Lengths
Bug causes failure of a chunked upload in case when Content-Length (Long) converted to Int32 overflows to a positive number.
Test case: chunked upload of file with a content length 4,294,967,300 bytes.
Result:
IllegalArgumentException("Will not write more bytes than what was indicated by the Content-Length header 4")