Define bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME.
[deliverable/binutils-gdb.git] / bfd / srec.c
index d979bf55564250c59597e7254ae92a767038bc27..9ed2080e7dabfef7d48c66cfef5ceb3f95e33135 100644 (file)
@@ -453,7 +453,7 @@ srec_scan (bfd *abfd)
          {
            file_ptr pos;
            char hdr[3];
-           unsigned int bytes;
+           unsigned int bytes, min_bytes;
            bfd_vma address;
            bfd_byte *data;
            unsigned char check_sum;
@@ -476,6 +476,19 @@ srec_scan (bfd *abfd)
              }
 
            check_sum = bytes = HEX (hdr + 1);
+           min_bytes = 3;
+           if (hdr[0] == '2' || hdr[0] == '8')
+             min_bytes = 4;
+           else if (hdr[0] == '3' || hdr[0] == '7')
+             min_bytes = 5;
+           if (bytes < min_bytes)
+             {
+               (*_bfd_error_handler) (_("%B:%d: byte count %d too small\n"),
+                                      abfd, lineno, bytes);
+               bfd_set_error (bfd_error_bad_value);
+               goto error_return;
+             }
+
            if (bytes * 2 > bufsize)
              {
                if (buf != NULL)
@@ -486,8 +499,7 @@ srec_scan (bfd *abfd)
                bufsize = bytes * 2;
              }
 
-           if (bytes == 0
-               || bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
+           if (bfd_bread (buf, (bfd_size_type) bytes * 2, abfd) != bytes * 2)
              goto error_return;
 
            /* Ignore the checksum byte.  */
@@ -1243,6 +1255,7 @@ srec_print_symbol (bfd *abfd,
 #define srec_bfd_is_local_label_name              bfd_generic_is_local_label_name
 #define srec_get_lineno                           _bfd_nosymbols_get_lineno
 #define srec_find_nearest_line                    _bfd_nosymbols_find_nearest_line
+#define srec_find_line                            _bfd_nosymbols_find_line
 #define srec_find_inliner_info                    _bfd_nosymbols_find_inliner_info
 #define srec_make_empty_symbol                    _bfd_generic_make_empty_symbol
 #define srec_bfd_make_debug_symbol                _bfd_nosymbols_bfd_make_debug_symbol
This page took 0.026728 seconds and 4 git commands to generate.