aboutsummaryrefslogtreecommitdiff
path: root/bfd/tekhex.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2014-10-31 18:00:55 +0000
committerNick Clifton <nickc@redhat.com>2014-10-31 18:00:55 +0000
commit690725fa0d98ae52c991f4b3ea58b6b47b4fbc80 (patch)
treebf814edbe98ad8ecce2cec83644efe9b8af7acf0 /bfd/tekhex.c
parentf54498b45795194df671207c6ef3d6cd6d0c0ebb (diff)
downloadgdb-690725fa0d98ae52c991f4b3ea58b6b47b4fbc80.zip
gdb-690725fa0d98ae52c991f4b3ea58b6b47b4fbc80.tar.gz
gdb-690725fa0d98ae52c991f4b3ea58b6b47b4fbc80.tar.bz2
Fix an (almost) infinite loop in the tekhex parser.
PR binutils/17512 * tekhex.c (first_phase): Check that the section range is sane.
Diffstat (limited to 'bfd/tekhex.c')
-rw-r--r--bfd/tekhex.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 2220d50..85f5593 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -403,6 +403,9 @@ first_phase (bfd *abfd, int type, char *src)
if (!getvalue (&src, &val))
return FALSE;
section->size = val - section->vma;
+ /* PR binutils/17512: Make sure that the size is sane. */
+ if (section->size > (bfd_size_type) bfd_get_size (abfd))
+ return FALSE;
section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
break;
case '0':