You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2022/11/28 08:04:09 UTC

[pulsar] branch branch-2.8 updated: [fix][offload] Fix numerical overflow bug while reading data from tiered storage (#18595)

This is an automated email from the ASF dual-hosted git repository.

lhotari pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.8 by this push:
     new 5543882f488 [fix][offload] Fix numerical overflow bug while reading data from tiered storage (#18595)
5543882f488 is described below

commit 5543882f488f12087211b1bf88e2284508d691a7
Author: Shen Liu <li...@126.com>
AuthorDate: Mon Nov 28 15:53:32 2022 +0800

    [fix][offload] Fix numerical overflow bug while reading data from tiered storage (#18595)
    
    Co-authored-by: druidliu <dr...@tencent.com>
    (cherry picked from commit 5c34e846561efc26ba7fc8b64383fefad4f1072a)
---
 .../mledger/offload/jcloud/impl/BlobStoreBackedInputStreamImpl.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedInputStreamImpl.java b/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedInputStreamImpl.java
index e3fc68ab7e2..c5fda387c73 100644
--- a/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedInputStreamImpl.java
+++ b/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedInputStreamImpl.java
@@ -144,6 +144,7 @@ public class BlobStoreBackedInputStreamImpl extends BackedInputStream {
 
     @Override
     public int available() throws IOException {
-        return (int)(objectLen - cursor) + buffer.readableBytes();
+        long available = objectLen - cursor + buffer.readableBytes();
+        return available > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) available;
     }
 }