Skip to content

Commit

Permalink
Fix pointer arithmetic on s390x.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Jan 8, 2025
1 parent e9dbd57 commit b400014
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/backend/linux_raw/vdso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,23 @@ impl Vdso {

let mut i = *self
.bucket
.cast::<u32>()
.add((ElfHashEntry::from(h1) % self.nbucket) as usize);
if i == 0 {
return null_mut();
}
h1 |= 1;
let mut hashval = self
.bucket
.cast::<u32>()
.add(self.nbucket as usize)
.add((i - ElfHashEntry::from(*self.gnu_hash.add(1))) as usize);
.add((i - *self.gnu_hash.add(1)) as usize);
loop {
let sym: &Elf_Sym = &*self.symtab.add(i as usize);
let h2 = *hashval;
hashval = hashval.add(1);
if ElfHashEntry::from(h1) == (h2 | 1)
&& self.check_sym(sym, i, name, version, ver_hash)
if h1 == (h2 | 1)
&& self.check_sym(sym, ElfHashEntry::from(i), name, version, ver_hash)
{
let sum = self.addr_from_elf(sym.st_value).unwrap();
assert!(
Expand Down

0 comments on commit b400014

Please sign in to comment.