Automatic date update in version.in
[deliverable/binutils-gdb.git] / bfd / tekhex.c
index 9444117e5ffe83a4ec8e3dce83505ff7b893912d..ccc68f92d397306fe0a38f827af77d4f33a6b0fc 100644 (file)
@@ -288,7 +288,7 @@ getvalue (char **srcp, bfd_vma *valuep, char * endp)
 
   *srcp = src;
   *valuep = value;
-  return len == 0;
+  return len == -1U;
 }
 
 static bfd_boolean
@@ -309,7 +309,7 @@ getsym (char *dstp, char **srcp, unsigned int *lenp, char * endp)
   dstp[i] = 0;
   *srcp = src + i;
   *lenp = len;
-  return TRUE;
+  return i == len;
 }
 
 static struct data_struct *
@@ -397,7 +397,7 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
            return FALSE;
        }
       alt_section = NULL;
-      while (*src)
+      while (src < src_end && *src)
        {
          switch (*src)
            {
@@ -407,7 +407,13 @@ first_phase (bfd *abfd, int type, char *src, char * src_end)
                return FALSE;
              if (!getvalue (&src, &val, src_end))
                return FALSE;
+             if (val < section->vma)
+               val = section->vma;
              section->size = val - section->vma;
+             /* PR 17512: file: objdump-s-endless-loop.tekhex.
+                Check for overlarge section sizes.  */
+             if (section->size & 0x80000000)
+               return FALSE;
              section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
              break;
            case '0':
This page took 0.024091 seconds and 4 git commands to generate.