This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ia32 Linux objdump 001228 seg faults on sparc solaris binary
On Fri, Dec 29, 2000 at 10:23:36PM +0000, Erik de Castro Lopo wrote:
> H . J . Lu wrote:
> >
> > On Fri, Dec 29, 2000 at 11:07:00AM +0000, Erik de Castro Lopo wrote:
> > > Hi all,
> > >
> > > I new to this list and the binutils development effort.
> > >
> > > I've grabbed binutils-001228 from the ftp site and configured it
> > > for linux using:
> > >
> > > ./configure --enable-shared --disable-static --enable-targets=all \
> > > --enable-commonbfdlib --host=i686-pc-linux-gnu
> > >
> > > This binary works correctly for elf32-i386 and pei-i386 binaries but
> > > any Sparc Solaris binary causes objdump to segfault. The same bnutils
> > > source code compiled for the Solaris machine works correctly for this
> > > binary.
> > >
> > > erikd@coltrane > objdump -a target1
> > > Segmentation fault (core dumped)
> > >
> > > The binary (7k) can be obtained here:
> > >
> > > http://www.zip.com.au/~erikd/objdump/target1
> > >
> >
> > I am using
> >
> > ..../configure --host=i686-pc-linux --prefix=/usr --enable-shared --enable-targets=all --enable-64-bit-bfd
> >
> > with binutils from CVS on 1229 under RedHat 7.0. I have no problems
> > with your testcase.
>
> Thanks, the added "--enable-64-bit-bfd" configure option fixed it.
>
This patch seems to work for me. But I don't think it catches all
possible cases.
H.J.
---
2000-12-29 H.J. Lu <hjl@gnu.org>
* vms-misc.c (_bfd_vms_next_record): Return -1 if PRIV(vms_buf)
is NULL or PRIV(vms_rec) is outside of the buffer.
Index: vms-misc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/vms-misc.c,v
retrieving revision 1.4
diff -u -p -r1.4 vms-misc.c
--- vms-misc.c 2000/12/29 20:37:43 1.4
+++ vms-misc.c 2000/12/29 23:14:58
@@ -455,7 +455,8 @@ _bfd_vms_next_record (abfd)
return -1;
}
- if (!PRIV(vms_rec))
+ if (!PRIV(vms_rec) || !PRIV(vms_buf)
+ || PRIV(vms_rec) >= (PRIV(vms_buf) + PRIV(buf_size)))
return -1;
if (PRIV(is_vax))