From af2d2db5d3d158042520aa38d511e0f7135ba3d0 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Thu, 12 May 2022 20:56:29 +0800 Subject: [PATCH] fix(wal): int overflow --- source/libs/wal/src/walRead.c | 4 ++-- source/libs/wal/src/walWrite.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index 38c14895d8..a0c65c8ed6 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -75,7 +75,7 @@ static int32_t walReadSeekFilePos(SWalReadHandle *pRead, int64_t fileFirstVer, i wError("failed to read idx file, since %s", terrstr()); } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; - wError("read idx file incompletely, read bytes %d, bytes should be %lu", ret, sizeof(SWalIdxEntry)); + wError("read idx file incompletely, read bytes %ld, bytes should be %lu", ret, sizeof(SWalIdxEntry)); } return -1; } @@ -187,7 +187,7 @@ int32_t walFetchHead(SWalReadHandle *pRead, int64_t ver, SWalHead *pHead) { } int32_t walSkipFetchBody(SWalReadHandle *pRead, const SWalHead *pHead) { - int32_t code; + int64_t code; ASSERT(pRead->curVersion == pHead->head.version); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 2e43997584..2ddcb27835 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -30,8 +30,8 @@ int32_t walCommit(SWal *pWal, int64_t ver) { } int32_t walRollback(SWal *pWal, int64_t ver) { - int code; - char fnameStr[WAL_FILE_LEN]; + int64_t code; + char fnameStr[WAL_FILE_LEN]; if (ver > pWal->vers.lastVer || ver < pWal->vers.commitVer) { terrno = TSDB_CODE_WAL_INVALID_VER; return -1; -- GitLab