This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Don't look at uninitialized value
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Fri, 08 Jan 2010 14:35:39 -0800
- Subject: gold patch committed: Don't look at uninitialized value
While investigating another bug, I noticed that some code in gold was
looking at an uninitialized variable. If Layout::layout_eh_frame
returns NULL, it does not set *offset. I committed this patch to fix
the problem.
Ian
2010-01-08 Ian Lance Taylor <iant@google.com>
* object.cc (Sized_relobj::do_layout): Don't get confused if
layout_eh_frame returns NULL.
Index: object.cc
===================================================================
RCS file: /cvs/src/src/gold/object.cc,v
retrieving revision 1.116
diff -p -u -r1.116 object.cc
--- object.cc 7 Jan 2010 18:42:03 -0000 1.116
+++ object.cc 8 Jan 2010 22:33:07 -0000
@@ -1390,7 +1390,7 @@ Sized_relobj<size, big_endian>::do_layou
reloc_type[i],
&offset);
out_sections[i] = os;
- if (offset == -1)
+ if (os == NULL || offset == -1)
{
// An object can contain at most one section holding exception
// frame information.
@@ -1404,7 +1404,7 @@ Sized_relobj<size, big_endian>::do_layou
// If this section requires special handling, and if there are
// relocs that apply to it, then we must do the special handling
// before we apply the relocs.
- if (offset == -1 && reloc_shndx[i] != 0)
+ if (os != NULL && offset == -1 && reloc_shndx[i] != 0)
this->set_relocs_must_follow_section_writes();
}