Skip to content

Commit b5b758b

Browse files
committed
Fix 2 bugs in the API code
1 parent 308d018 commit b5b758b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/api/Compressor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ int CDECL initCompressor(struct cData* pData, FILE* dst, struct cContext** pCtx)
159159

160160
int CDECL compress(struct cContext* pCtx, const unsigned char* src, int* inSize, int* outSize)
161161
{
162-
if ((pCtx == nullptr) || (inSize == nullptr) || (outSize == nullptr) || (*inSize > int(pCtx->blockSize))) {
163-
*inSize = 0;
162+
if ((pCtx == nullptr) || (inSize == nullptr) || (outSize == nullptr) ||
163+
(*inSize < 0) || (*inSize > int(pCtx->blockSize))) {
164164
return Error::ERR_INVALID_PARAM;
165165
}
166166

src/api/Decompressor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ int CDECL decompress(struct dContext* pCtx, unsigned char* dst, int* inSize, int
164164
{
165165
if ((pCtx == nullptr) || (inSize == nullptr) || (outSize == nullptr) ||
166166
(*outSize < 0) || (*outSize > int(pCtx->bufferSize))) {
167-
*outSize = 0;
168167
return Error::ERR_INVALID_PARAM;
169168
}
170169

0 commit comments

Comments
 (0)