mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
parent
dda8cc85c9
commit
8a88d8465a
@ -181,8 +181,10 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
return TarEntry(TarHeader.createHeader(name, size, 0, false, 420 /* 0644 */))
|
return TarEntry(TarHeader.createHeader(name, size, 0, false, 420 /* 0644 */))
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LZ4InputStream(s: InputStream) : LZ4FrameInputStream(s) {
|
private class NoAvailableStream(s: InputStream) : FilterInputStream(s) {
|
||||||
// Workaround bug in LZ4FrameInputStream
|
// Make sure available is never called on the actual stream and always return 0
|
||||||
|
// 1. Workaround bug in LZ4FrameInputStream
|
||||||
|
// 2. Reduce max buffer size to prevent OOM
|
||||||
override fun available() = 0
|
override fun available() = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +196,8 @@ abstract class MagiskInstallImpl protected constructor(
|
|||||||
lateinit var entry: TarEntry
|
lateinit var entry: TarEntry
|
||||||
|
|
||||||
fun decompressedStream(): InputStream {
|
fun decompressedStream(): InputStream {
|
||||||
return if (entry.name.endsWith(".lz4")) LZ4InputStream(tarIn) else tarIn
|
val stream = if (entry.name.endsWith(".lz4")) LZ4FrameInputStream(tarIn) else tarIn
|
||||||
|
return NoAvailableStream(stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (tarIn.nextEntry?.let { entry = it } != null) {
|
while (tarIn.nextEntry?.let { entry = it } != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user