public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* [patch] Check Section Table in Loader component
@ 2004-04-27 20:48 Dave Brolley
  0 siblings, 0 replies; only message in thread
From: Dave Brolley @ 2004-04-27 20:48 UTC (permalink / raw)
  To: sid

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

I've committed the attached patch which checks that the section table 
has been allocated in the loader before attempting to use it. This can 
happen for ports which initialize memory before the program is loaded.

Dave


[-- Attachment #2: sid-loader.ChangeLog --]
[-- Type: text/plain, Size: 186 bytes --]

2004-04-27  Dave Brolley  <brolley@redhat.com>

	* elfload.c (textSectionAddress): Check section table before accessing.
	* compLoader.cxx (loader_probe_bus): Initialize section_table.


[-- Attachment #3: sid-loader.patch.txt --]
[-- Type: text/plain, Size: 1598 bytes --]

Index: sid/component/loader/compLoader.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/loader/compLoader.cxx,v
retrieving revision 1.7
diff -c -p -r1.7 compLoader.cxx
*** sid/component/loader/compLoader.cxx	12 Feb 2004 20:30:08 -0000	1.7
--- sid/component/loader/compLoader.cxx	27 Apr 2004 20:20:27 -0000
*************** class loader_probe_bus: public sidutil::
*** 68,74 ****
    public:
      loader_probe_bus (sid::bus **t, output_pin *p) :
        sidutil::passthrough_bus (t),
!       write_to_code_address_pin (p)
      {
        assert (t);
      }
--- 68,75 ----
    public:
      loader_probe_bus (sid::bus **t, output_pin *p) :
        sidutil::passthrough_bus (t),
!       write_to_code_address_pin (p),
!       section_table (0)
      {
        assert (t);
      }
Index: sid/component/loader/elfload.c
===================================================================
RCS file: /cvs/src/src/sid/component/loader/elfload.c,v
retrieving revision 1.8
diff -c -p -r1.8 elfload.c
*** sid/component/loader/elfload.c	26 Feb 2004 16:44:40 -0000	1.8
--- sid/component/loader/elfload.c	27 Apr 2004 20:20:27 -0000
*************** newTextSection (int index)
*** 57,62 ****
--- 57,66 ----
  int
  textSectionAddress (unsigned long long address, const struct TextSection *section_table)
  {
+   // Not a text section address if there is no table.
+   if (! section_table)
+     return 0;
+ 
    /* The table begins with the given pointer and is terminated by an entry with
       zeroes for both the high and low bounds.  */
    int i;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-27 20:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 20:48 [patch] Check Section Table in Loader component Dave Brolley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).