Merge pull request #6134 from taosdata/hotfix/TD-4100

[TD-4100]<fix>:The server will crash when compressMsgSize is changed to 0
This commit is contained in:
Shengliang Guan 2021-05-15 23:35:42 +08:00 committed by GitHub
commit 1c1cbb3d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1471,7 +1471,7 @@ static int32_t rpcCompressRpcMsg(char* pCont, int32_t contLen) {
* only the compressed size is less than the value of contLen - overhead, the compression is applied * only the compressed size is less than the value of contLen - overhead, the compression is applied
* The first four bytes is set to 0, the second four bytes are utilized to keep the original length of message * The first four bytes is set to 0, the second four bytes are utilized to keep the original length of message
*/ */
if (compLen < contLen - overhead) { if (compLen > 0 && compLen < contLen - overhead) {
SRpcComp *pComp = (SRpcComp *)pCont; SRpcComp *pComp = (SRpcComp *)pCont;
pComp->reserved = 0; pComp->reserved = 0;
pComp->contLen = htonl(contLen); pComp->contLen = htonl(contLen);