From: msnyder@sonic.net
To: binutils@sourceware.org
Subject: [PATCH] srec_scan, check for EOF
Date: Thu, 26 Jul 2007 00:21:00 -0000 [thread overview]
Message-ID: <13765.12.7.175.2.1185408386.squirrel@webmail.sonic.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 88 bytes --]
If we miss an EOF here, it'll be used as an array index and probably
cause a segfault.
[-- Attachment #2: eof.txt --]
[-- Type: text/plain, Size: 814 bytes --]
2007-07-25 Michael Snyder <msnyder@access-company.com>
* srec.c (srec_scan): Check for EOF (critical because return value
will be used as array index).
Index: srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.42
diff -p -5 -r1.42 srec.c
*** srec.c 3 Jul 2007 14:26:42 -0000 1.42
--- srec.c 26 Jul 2007 00:03:57 -0000
*************** srec_scan (bfd *abfd)
*** 426,435 ****
--- 426,440 ----
while (ISHEX (c))
{
symval <<= 4;
symval += NIBBLE (c);
c = srec_get_byte (abfd, &error);
+ if (c == EOF)
+ {
+ srec_bad_byte (abfd, lineno, c, error);
+ goto error_return;
+ }
}
if (! srec_new_symbol (abfd, symname, symval))
goto error_return;
}
next reply other threads:[~2007-07-26 0:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 0:21 msnyder [this message]
2007-07-26 13:05 ` Alan Modra
2007-07-26 18:52 ` msnyder
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=13765.12.7.175.2.1185408386.squirrel@webmail.sonic.net \
--to=msnyder@sonic.net \
--cc=binutils@sourceware.org \
/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).