fix: check the length of remaining content for computing CRC32 chksum of WAL record body

This commit is contained in:
Benguang Zhao 2022-10-09 11:52:06 +08:00
parent 63b13db10f
commit 948fa60ef0
1 changed files with 4 additions and 2 deletions

View File

@ -94,8 +94,10 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal) {
break;
}
SWalCkHead* logContent = (SWalCkHead*)candidate;
if (walValidHeadCksum(logContent) == 0 && walValidBodyCksum(logContent) == 0) {
found = candidate;
if (walValidHeadCksum(logContent) == 0 &&
walCkHeadSz + logContent->head.bodyLen <= len &&
walValidBodyCksum(logContent) == 0) {
found = candidate;
}
haystack = candidate + 1;
}