public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Hideki IWAMOTO <h-iwamoto@kit.hi-ho.ne.jp>
To: binutils@sources.redhat.com
Subject: [PATCH] objcopy Segmentation fault
Date: Tue, 02 Apr 2002 05:48:00 -0000	[thread overview]
Message-ID: <200204021348.AA00056@k7.kit.hi-ho.ne.jp> (raw)


iwamoto@alpha:/tmp>objcopy -O srec --srec-len=121 a a.srec
Segmentation fault (core dumped)

Index: srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.15
diff -u -r1.15 srec.c
--- srec.c	2002/01/06 07:30:35	1.15
+++ srec.c	2002/04/02 13:24:37
@@ -1013,6 +1013,7 @@
 {
   unsigned int octets_written = 0;
   bfd_byte *location = list->data;
+  unsigned int chunk_limit = MAXCHUNK / 2 - 5 - tdata->type;
 
   while (octets_written < list->size)
     {
@@ -1021,6 +1022,10 @@
 
       if (octets_this_chunk > Chunk)
 	octets_this_chunk = Chunk;
+
+      /* avoid buffer overflow */
+      if (octets_this_chunk > chunk_limit)
+	octets_this_chunk = chunk_limit;
 
       address = list->where + octets_written / bfd_octets_per_byte (abfd);
 

----
Hideki IWAMOTO  h-iwamoto@kit.hi-ho.ne.jp

             reply	other threads:[~2002-04-02 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-02  5:48 Hideki IWAMOTO [this message]
2002-04-03 19:05 ` Alan Modra

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=200204021348.AA00056@k7.kit.hi-ho.ne.jp \
    --to=h-iwamoto@kit.hi-ho.ne.jp \
    --cc=binutils@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).