forked from M-Labs/artiq-zynq
dyld: more fine grained errors
This commit is contained in:
parent
e1190ec76c
commit
c0aa4f78c2
@ -233,9 +233,11 @@ impl<'a> Library<'a> {
|
|||||||
|
|
||||||
match phdr.p_type {
|
match phdr.p_type {
|
||||||
PT_LOAD => {
|
PT_LOAD => {
|
||||||
if (phdr.p_vaddr + phdr.p_filesz) as usize > image.len() ||
|
if (phdr.p_vaddr + phdr.p_filesz) as usize > image.len() {
|
||||||
(phdr.p_offset + phdr.p_filesz) as usize > data.len() {
|
return Err("program header requests an out of bounds load (in image)")?
|
||||||
return Err("program header requests an out of bounds load")?
|
}
|
||||||
|
if (phdr.p_offset + phdr.p_filesz) as usize > data.len() {
|
||||||
|
return Err("program header requests an out of bounds load (in data)")?
|
||||||
}
|
}
|
||||||
let dst = image.get_mut(phdr.p_vaddr as usize..
|
let dst = image.get_mut(phdr.p_vaddr as usize..
|
||||||
(phdr.p_vaddr + phdr.p_filesz) as usize)
|
(phdr.p_vaddr + phdr.p_filesz) as usize)
|
||||||
|
Loading…
Reference in New Issue
Block a user