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
16322ab3
Commit
16322ab3
authored
Nov 03, 2021
by
Chaosmaster
Committed by
John Wu
Nov 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use full gzip-signature to find gzip-data.
Fall back to raw image if gzip is not found. Fixes #4849
parent
56829173
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
bootimg.cpp
native/jni/magiskboot/bootimg.cpp
+3
-5
No files found.
native/jni/magiskboot/bootimg.cpp
View file @
16322ab3
...
@@ -335,7 +335,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
...
@@ -335,7 +335,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
if
(
k_fmt
==
ZIMAGE
)
{
if
(
k_fmt
==
ZIMAGE
)
{
z_hdr
=
reinterpret_cast
<
zimage_hdr
*>
(
kernel
);
z_hdr
=
reinterpret_cast
<
zimage_hdr
*>
(
kernel
);
uint32_t
end
=
z_hdr
->
end_offset
;
uint32_t
end
=
z_hdr
->
end_offset
;
if
(
void
*
gzip_offset
=
memmem
(
kernel
,
hdr
->
kernel_size
(),
GZIP1_MAGIC
,
2
))
{
if
(
void
*
gzip_offset
=
memmem
(
kernel
,
hdr
->
kernel_size
(),
GZIP1_MAGIC
"
\x08\x00
"
,
4
))
{
fprintf
(
stderr
,
"ZIMAGE_KERNEL
\n
"
);
fprintf
(
stderr
,
"ZIMAGE_KERNEL
\n
"
);
z_info
.
hdr_sz
=
(
uint8_t
*
)
gzip_offset
-
kernel
;
z_info
.
hdr_sz
=
(
uint8_t
*
)
gzip_offset
-
kernel
;
uint8_t
*
end_addr
=
kernel
+
z_hdr
->
end_offset
;
uint8_t
*
end_addr
=
kernel
+
z_hdr
->
end_offset
;
...
@@ -347,8 +347,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
...
@@ -347,8 +347,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
}
}
}
}
if
(
end
==
z_hdr
->
end_offset
)
{
if
(
end
==
z_hdr
->
end_offset
)
{
fprintf
(
stderr
,
"Could not find end of zImage gzip data
\n
"
);
fprintf
(
stderr
,
"Could not find end of zImage gzip data, keeping raw kernel
\n
"
);
exit
(
1
);
}
else
{
}
else
{
flags
[
ZIMAGE_KERNEL
]
=
true
;
flags
[
ZIMAGE_KERNEL
]
=
true
;
z_info
.
tail
=
kernel
+
end
;
z_info
.
tail
=
kernel
+
end
;
...
@@ -358,8 +357,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
...
@@ -358,8 +357,7 @@ void boot_img::parse_image(uint8_t *addr, format_t type) {
k_fmt
=
check_fmt_lg
(
kernel
,
hdr
->
kernel_size
());
k_fmt
=
check_fmt_lg
(
kernel
,
hdr
->
kernel_size
());
}
}
}
else
{
}
else
{
fprintf
(
stderr
,
"Could not find zImage gzip data
\n
"
);
fprintf
(
stderr
,
"Could not find zImage gzip data, keeping raw kernel
\n
"
);
exit
(
1
);
}
}
}
}
fprintf
(
stderr
,
"%-*s [%s]
\n
"
,
PADDING
,
"KERNEL_FMT"
,
fmt2name
[
k_fmt
]);
fprintf
(
stderr
,
"%-*s [%s]
\n
"
,
PADDING
,
"KERNEL_FMT"
,
fmt2name
[
k_fmt
]);
...
...
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