public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: Dave Brolley <brolley@redhat.com>
To: sid@sources.redhat.com
Subject: [patch] Check Section Table in Loader component
Date: Tue, 27 Apr 2004 20:48:00 -0000	[thread overview]
Message-ID: <408EC72F.2030102@redhat.com> (raw)

[-- 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;

                 reply	other threads:[~2004-04-27 20:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=408EC72F.2030102@redhat.com \
    --to=brolley@redhat.com \
    --cc=sid@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).