File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
cdm/core/src/main/java/ucar/nc2 Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ public byte[] encode(byte[] dataIn) throws IOException {
6969
7070 @ Override
7171 public byte [] decode (byte [] dataIn ) throws IOException {
72- int len = Math .min (8 * dataIn .length , MAX_ARRAY_LEN );
72+ long approxLen = (long ) 8 * dataIn .length ;
73+ int len = approxLen > MAX_ARRAY_LEN ? MAX_ARRAY_LEN : (int ) approxLen ;
7374 try (ByteArrayInputStream in = new ByteArrayInputStream (dataIn );
7475 InflaterInputStream iis = new InflaterInputStream (in , new Inflater (), dataIn .length );
7576 ByteArrayOutputStream os = new ByteArrayOutputStream (len )) {
Original file line number Diff line number Diff line change @@ -252,7 +252,8 @@ private byte[] inflate(byte[] compressed) throws IOException {
252252
253253 java .util .zip .InflaterInputStream inflatestream =
254254 new java .util .zip .InflaterInputStream (in , inflater , inflatebuffersize );
255- int len = Math .min (8 * compressed .length , MAX_ARRAY_LEN );
255+ long approxLen = (long ) 8 * compressed .length ;
256+ int len = approxLen > MAX_ARRAY_LEN ? MAX_ARRAY_LEN : (int ) approxLen ;
256257 ByteArrayOutputStream out = new ByteArrayOutputStream (len ); // Fixes KXL-349288
257258 IO .copyB (inflatestream , out , len );
258259
You can’t perform that action at this time.
0 commit comments