Skip to content

Commit

Permalink
Is. #761 - just deal with the 'uint' wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffmcl committed May 20, 2019
1 parent 0873d74 commit 7bc23f0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lexer.c
Expand Up @@ -947,12 +947,15 @@ static void AddByte( Lexer *lexer, tmbchar ch )
{
tmbstr buf = NULL;
uint allocAmt = lexer->lexlength;
uint prev = allocAmt; /* Is. #761 */
while ( lexer->lexsize + 2 >= allocAmt )
{
if ( allocAmt == 0 )
allocAmt = 8192;
else
allocAmt *= 2;
if (allocAmt < prev) /* Is. #761 - watch for wrap - and */
TidyPanic(lexer->allocator, "\nPanic: out of internal memory!\nDocument input too big!\n");
}
buf = (tmbstr) TidyRealloc( lexer->allocator, lexer->lexbuf, allocAmt );
if ( buf )
Expand Down

0 comments on commit 7bc23f0

Please sign in to comment.