fix: fix ubsan error of null argument
This commit is contained in:
parent
4348b9c51d
commit
b9aeda263c
|
@ -632,7 +632,10 @@ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) {
|
||||||
pStart += colSize;
|
pStart += colSize;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (dataSize != 0) {
|
||||||
|
// ubsan reports error if pCol->pData==NULL && dataSize==0
|
||||||
memcpy(pStart, pCol->pData, dataSize);
|
memcpy(pStart, pCol->pData, dataSize);
|
||||||
|
}
|
||||||
pStart += dataSize;
|
pStart += dataSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -684,8 +687,10 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (colLength != 0) {
|
||||||
|
// ubsan reports error if colLength==0 && pCol->pData == 0
|
||||||
memcpy(pCol->pData, pStart, colLength);
|
memcpy(pCol->pData, pStart, colLength);
|
||||||
|
}
|
||||||
pStart += colLength;
|
pStart += colLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue