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

Commit 60f5711d authored by Pinyao Ting's avatar Pinyao Ting Committed by Android (Google) Code Review
Browse files

Merge "Resize WireBuffer before System.arraycopy" into main

parents 71358656 660fb7c3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ public class RemoteComposeBuffer {
        try {
            byte[] bytes = readAllBytes(fd);
            buffer.reset();
            buffer.mBuffer.resize(bytes.length);
            System.arraycopy(bytes, 0, buffer.mBuffer.mBuffer, 0, bytes.length);
            buffer.mBuffer.mSize = bytes.length;
        } catch (Exception e) {
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public class WireBuffer {
        this(BUFFER_SIZE);
    }

    private void resize(int need) {
    public void resize(int need) {
        if (mSize + need >= mMaxSize) {
            mMaxSize = Math.max(mMaxSize * 2, mSize + need);
            mBuffer = Arrays.copyOf(mBuffer, mMaxSize);