[ITP] rebase
Jason Tishler
jason@tishler.net
Tue Feb 11 23:02:00 GMT 2003
Ralf,
On Mon, Feb 10, 2003 at 08:27:08PM +0100, Ralf Habacker wrote:
> > I can reproduce it now. I will debug and try to fix it myself. If
> > I'm unsuccessful, then I will ask Ralf for help.
> >
> Jason, your rebase depends on the ms imagehelp library, isn't it.
Not anymore:
$ rebase -V
rebase version 2.1
Copyright (c) 2001, 2002, 2003 Ralf Habacker and Jason Tishler
We are partners in crime now. :,)
The attached patch solves the SEGV problem.
Your guard:
(char *)relocp < (char *)relocs + size
wasn't tight enough.
My version:
(char *)&relocp->SizeOfBlock < (char *)relocs + size
seems to be.
Did I break anything with this patch?
Thanks,
Jason
--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
Index: sections.cc
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/rebase/sections.cc,v
retrieving revision 1.9
diff -u -p -r1.9 sections.cc
--- sections.cc 4 Jan 2003 12:43:00 -0000 1.9
+++ sections.cc 11 Feb 2003 13:23:34 -0000
@@ -270,7 +270,7 @@ bool Relocations::check(void)
if (!relocs)
return false;
- for (; (char *)relocp < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock )
+ for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock)
{
int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof (WORD);
int va = relocp->VirtualAddress;
@@ -302,7 +302,7 @@ bool Relocations::fix(void)
if (debug)
std::cerr << "warning: fixing bad relocations .... ";
- for (; (char *)relocp < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock )
+ for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock)
{
int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof (WORD);
int va = relocp->VirtualAddress;
@@ -337,7 +337,7 @@ bool Relocations::relocate(int differenc
if (!relocs)
return false;
- for (; (char *)relocp < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock )
+ for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock)
{
int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof (WORD);
int va = relocp->VirtualAddress;
More information about the Cygwin-apps
mailing list