From 6f77f190f2893ce2f6f25faeb763b25d5b6dbeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E9=A1=B5?= Date: Wed, 30 Aug 2023 23:44:24 +0800 Subject: [PATCH] Fix processPayload --- .../java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt index feef679cdab5..d220cdbe3125 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt @@ -322,7 +322,8 @@ abstract class MagiskInstallImpl protected constructor( val fd = Os.open(fifo.path, O_WRONLY, 0) try { - val buf = ByteBuffer.allocate(1024 * 1024) + val bufSize = 1024 * 1024 + val buf = ByteBuffer.allocate(bufSize) buf.position(input.read(buf.array()).coerceAtLeast(0)).flip() while (buf.hasRemaining()) { try { @@ -334,6 +335,7 @@ abstract class MagiskInstallImpl protected constructor( break } if (!buf.hasRemaining()) { + buf.limit(bufSize) buf.position(input.read(buf.array()).coerceAtLeast(0)).flip() } }