Fix address violation parsing a corrupt texhex format file.

PR binutils/21670
	* tekhex.c (getvalue): Check for the source pointer exceeding the
	end pointer before the first byte is read.
This commit is contained in:
Nick Clifton 2017-06-26 15:46:34 +01:00
parent cfd14a500e
commit 04e15b4a94
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-06-26 Nick Clifton <nickc@redhat.com>
PR binutils/21670
* tekhex.c (getvalue): Check for the source pointer exceeding the
end pointer before the first byte is read.
2017-06-26 Nick Clifton <nickc@redhat.com>
PR binutils/21665

View File

@ -273,6 +273,9 @@ getvalue (char **srcp, bfd_vma *valuep, char * endp)
bfd_vma value = 0;
unsigned int len;
if (src >= endp)
return FALSE;
if (!ISHEX (*src))
return FALSE;
@ -514,9 +517,10 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *, char *))
/* To the front of the file. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return FALSE;
while (! is_eof)
{
char src[MAXCHUNK];
static char src[MAXCHUNK];
char type;
/* Find first '%'. */