aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/comp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/comp')
-rw-r--r--lib/sqfs/comp/zstd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c
index 3fac85f..a850033 100644
--- a/lib/sqfs/comp/zstd.c
+++ b/lib/sqfs/comp/zstd.c
@@ -12,6 +12,7 @@
#include <string.h>
#include <zstd.h>
+#include <zstd_errors.h>
#include "internal.h"
@@ -63,8 +64,12 @@ static sqfs_s32 zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
ret = ZSTD_compressCCtx(zstd->zctx, out, outsize, in, size,
zstd->level);
- if (ZSTD_isError(ret))
+ if (ZSTD_isError(ret)) {
+ if (ZSTD_getErrorCode(ret) == ZSTD_error_dstSize_tooSmall)
+ return 0;
+
return SQFS_ERROR_COMPRESSOR;
+ }
return ret < size ? ret : 0;
}