Commit 0c070a35 by Alan Mishchenko

Adding out-of-bounds checks to AIGER readers.

parent 98e377bd
...@@ -369,7 +369,7 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -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;
......
...@@ -477,7 +477,7 @@ Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck ) ...@@ -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' )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment