Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2473cc1 authored by Tom Cherry's avatar Tom Cherry
Browse files

DropBoxManager: use BufferedInputStream when using GZIPInputStream

GZIPInputStream has a bug (b/195554062) where it uses unbuffered IO
when reading the gzip header.  This triggers the UnbufferedIoViolation
strict mode violation for apps that target API level 28+.

Independently of fixing GZIPInputStream, DropBoxManager can use
BufferedInputStream to take a proactive step against this and future
bugs.

Bug: 195554712
Test: Successfully read gzip dropbox entries from API level 28+ app.
Change-Id: Id539efcb366b3e3d53513a098975b25866ed16ff
parent 05201409
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.util.Log;

import com.android.internal.os.IDropBoxManagerService;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
@@ -234,7 +235,8 @@ public class DropBoxManager {
            } else {
                return null;
            }
            return (mFlags & IS_GZIPPED) != 0 ? new GZIPInputStream(is) : is;
            return (mFlags & IS_GZIPPED) != 0
                ? new GZIPInputStream(new BufferedInputStream(is)) : is;
        }

        public static final @android.annotation.NonNull Parcelable.Creator<Entry> CREATOR = new Parcelable.Creator() {