Adding out-of-bounds checks to AIGER readers.

This commit is contained in:
Alan Mishchenko 2014-09-28 12:17:02 -07:00
parent 98e377bdff
commit 0c070a35e5
2 changed files with 2 additions and 2 deletions

View File

@ -369,7 +369,7 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
// read signal names if they are of the special type // read signal names if they are of the special type
pCur = pSymbols; pCur = pSymbols;
if ( *pCur != 'c' ) if ( pCur < (unsigned char *)pContents + nFileSize && *pCur != 'c' )
{ {
int fBreakUsed = 0; int fBreakUsed = 0;
unsigned char * pCurOld = pCur; unsigned char * pCurOld = pCur;

View File

@ -477,7 +477,7 @@ Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck )
// read the names if present // read the names if present
pCur = pSymbols; pCur = pSymbols;
if ( *pCur != 'c' ) if ( pCur < pContents + nFileSize && *pCur != 'c' )
{ {
int Counter = 0; int Counter = 0;
while ( pCur < pContents + nFileSize && *pCur != 'c' ) while ( pCur < pContents + nFileSize && *pCur != 'c' )