Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
7fcb6323
Commit
7fcb6323
authored
Feb 11, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support lz4_legacy archive with multiple magic
Multiple lz4_legacy archives can be directly concatenated
parent
12093a3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
compress.cpp
native/jni/magiskboot/compress.cpp
+8
-6
No files found.
native/jni/magiskboot/compress.cpp
View file @
7fcb6323
...
@@ -454,7 +454,7 @@ private:
...
@@ -454,7 +454,7 @@ private:
class
LZ4_decoder
:
public
chunk_out_stream
{
class
LZ4_decoder
:
public
chunk_out_stream
{
public
:
public
:
explicit
LZ4_decoder
(
stream_ptr
&&
base
)
:
explicit
LZ4_decoder
(
stream_ptr
&&
base
)
:
chunk_out_stream
(
std
::
move
(
base
),
LZ4_COMPRESSED
,
sizeof
(
block_sz
)
+
4
),
chunk_out_stream
(
std
::
move
(
base
),
LZ4_COMPRESSED
,
sizeof
(
block_sz
)
),
out_buf
(
new
char
[
LZ4_UNCOMPRESSED
]),
block_sz
(
0
)
{}
out_buf
(
new
char
[
LZ4_UNCOMPRESSED
]),
block_sz
(
0
)
{}
~
LZ4_decoder
()
override
{
~
LZ4_decoder
()
override
{
...
@@ -471,12 +471,14 @@ protected:
...
@@ -471,12 +471,14 @@ protected:
auto
in
=
reinterpret_cast
<
const
char
*>
(
buf
);
auto
in
=
reinterpret_cast
<
const
char
*>
(
buf
);
if
(
block_sz
==
0
)
{
if
(
block_sz
==
0
)
{
if
(
chunk_sz
==
sizeof
(
block_sz
)
+
4
)
{
memcpy
(
&
block_sz
,
in
,
sizeof
(
block_sz
));
// Skip the first 4 bytes, which is magic
if
(
block_sz
==
0x184C2102
)
{
memcpy
(
&
block_sz
,
in
+
4
,
sizeof
(
block_sz
));
// This is actually the lz4 magic, read the next 4 bytes
}
else
{
block_sz
=
0
;
memcpy
(
&
block_sz
,
in
,
sizeof
(
block_sz
));
chunk_sz
=
sizeof
(
block_sz
);
return
true
;
}
}
// Read the next block chunk
chunk_sz
=
block_sz
;
chunk_sz
=
block_sz
;
return
true
;
return
true
;
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment