Skip to content

Commit 0c7758a

Browse files
ziggurat29marcelstoer
authored andcommitted
Fix occasional luac.cross crash (#2661)
A block of memory is accessed after having been freed. This was obscured by the fact that 'oBuf' is a pointer into the middle of the block 'dynamicTables', so when dynamicTables is freed, oBuf is pointing to freed memory. Occasionally, luac.cross would crash because of this.
1 parent f0a240a commit 0c7758a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/uzlib/uzlib_deflate.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ int uzlib_compress (uchar **dest, uint *destLen, const uchar *src, uint srcLen)
568568
status = UZLIB_OK;
569569
}
570570

571-
FREE(dynamicTables);
572571
for (i=0; i<20;i++) DBG_PRINT("count %u = %u\n",i,debugCounts[i]);
573572

574573
if (status == UZLIB_OK) {
@@ -581,5 +580,7 @@ int uzlib_compress (uchar **dest, uint *destLen, const uchar *src, uint srcLen)
581580
FREE(oBuf->buffer);
582581
}
583582

583+
FREE(dynamicTables);
584+
584585
return status;
585586
}

0 commit comments

Comments
 (0)