Skip to content

Commit

Permalink
Patched the rebase bug
Browse files Browse the repository at this point in the history
In Object::rebase(Offset off)

if offset is equal to imageBase the method returns,
but as it happens, offset is usually 0 and imageBase is non
zero  , so the subesequent substraction results in an integer
overflow causing all sorts of trouble.

Smallest patch ever.
  • Loading branch information
ea committed Feb 23, 2015
1 parent bd91b20 commit 4badeb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dyninst-8.2.1/symtabAPI/src/Object-nt.C
Expand Up @@ -2429,7 +2429,7 @@ void Object::applyRelocs(Region* relocs, Offset delta)
}
void Object::rebase(Offset off)
{
if(off == imageBase) return;
if(off <= imageBase) return;
Region* relocs = findRegionByName(".reloc");
if(!relocs) {
fprintf(stderr, "rebase found no .reloc section, bailing\n");
Expand All @@ -2438,4 +2438,4 @@ void Object::rebase(Offset off)
Offset delta = off - imageBase;
applyRelocs(relocs, delta);
imageBase = off;
}
}

0 comments on commit 4badeb1

Please sign in to comment.