Skip to content

Commit

Permalink
LuPng: miniz: Catch most failed assertions instead of aborting
Browse files Browse the repository at this point in the history
Note: To make it easier I flattened tdefl_compress and tdefl_compress_block
  • Loading branch information
ducalex authored and kbeckmann committed Nov 13, 2021
1 parent 8d83e25 commit b5d0dff
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 233 deletions.
8 changes: 7 additions & 1 deletion components/lupng/lupng.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,12 @@ static LU_INLINE int processPixels(PngInfoStruct *info)
{
status = deflate(&info->stream, flush);

if (status < 0)
{
LUPNG_WARN(info, "PNG: deflate failed (%d)!", status);
goto _error;
}

if (info->stream.avail_out < BUF_SIZE)
{
writeIdat(info, idatBuf, BUF_SIZE-info->stream.avail_out+4);
Expand Down Expand Up @@ -1292,7 +1298,7 @@ void luUserContextInitDefault(LuUserContext *userCtx)

userCtx->writeProc=NULL;
userCtx->writeProcUserPtr=NULL;
userCtx->compressionLevel=Z_DEFAULT_COMPRESSION;
userCtx->compressionLevel=0;

userCtx->allocProc=internalMalloc;
userCtx->allocProcUserPtr=NULL;
Expand Down
Loading

0 comments on commit b5d0dff

Please sign in to comment.