From a089f55c1c4305273b0a792ec79f15088ad820c3 Mon Sep 17 00:00:00 2001 From: Ryo Fukumuro Date: Wed, 23 Mar 2022 11:46:49 +0900 Subject: [PATCH] Fix offset overflow in multipart download (#871) --- .../scala/monix/connect/s3/MultipartDownloadObservable.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/s3/src/main/scala/monix/connect/s3/MultipartDownloadObservable.scala b/s3/src/main/scala/monix/connect/s3/MultipartDownloadObservable.scala index d2fd4a166..2fb68f478 100644 --- a/s3/src/main/scala/monix/connect/s3/MultipartDownloadObservable.scala +++ b/s3/src/main/scala/monix/connect/s3/MultipartDownloadObservable.scala @@ -64,7 +64,7 @@ private[s3] class MultipartDownloadObservable( totalSize: Long, chunkSize: Long, getRequest: GetObjectRequest, - offset: Int): Task[Unit] = { + offset: Long): Task[Unit] = { for { chunk <- { @@ -77,7 +77,7 @@ private[s3] class MultipartDownloadObservable( nextChunk <- { ack match { case Ack.Continue => { - val nextOffset = offset + chunk.size + val nextOffset = offset + chunk.length if (nextOffset < totalSize) { val nextRange = s"bytes=${nextOffset}-${nextOffset + chunkSize}" val nextRequest = getRequest.toBuilder.range(nextRange).build()