Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
45cd3ec4
Commit
45cd3ec4
authored
5 years ago
by
q3k
Committed by
Serge Bazanski
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
l0der: fix relocation check
parent
4b203cac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!45
l0dables: implement l0der
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/l0der/l0der.c
+6
-2
6 additions, 2 deletions
epicardium/l0der/l0der.c
with
6 additions
and
2 deletions
epicardium/l0der/l0der.c
+
6
−
2
View file @
45cd3ec4
...
...
@@ -273,6 +273,9 @@ static int _run_relocations(FIL *fp, void *load_addr, uint32_t image_start, uint
Elf32_Shdr
shdr
;
Elf32_Rel
rel
;
uint32_t
load_start
=
image_start
+
(
uint32_t
)
load_addr
;
uint32_t
load_limit
=
image_limit
+
(
uint32_t
)
load_addr
;
// Go through all relocation sections.
for
(
int
i
=
0
;
i
<
hdr
->
e_shnum
;
i
++
)
{
uint32_t
shdr_addr
=
hdr
->
e_shoff
+
(
i
*
hdr
->
e_shentsize
);
...
...
@@ -321,8 +324,9 @@ static int _run_relocations(FIL *fp, void *load_addr, uint32_t image_start, uint
return
-
ENOEXEC
;
}
volatile
uint32_t
*
addr
=
(
uint32_t
*
)(
rel
.
r_offset
+
load_addr
);
if
((
uint32_t
)
addr
<
image_start
||
(
uint32_t
)
addr
>=
image_limit
)
{
LOG_ERR
(
"l0der"
,
"_run_relocations: R_ARM_RELATIVE address is outside image boundaries"
);
if
((
uint32_t
)
addr
<
load_start
||
(
uint32_t
)
addr
>=
load_limit
)
{
LOG_ERR
(
"l0der"
,
"_run_relocations: R_ARM_RELATIVE address (%08lx) is outside image boundaries"
,
(
uint32_t
)
addr
);
return
-
ENOEXEC
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment