Merge pull request #23162 from taosdata/fix/TD-26607

fix: fid overflow
This commit is contained in:
wade zhang 2023-10-08 18:24:05 +08:00 committed by GitHub
commit d3161817af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -516,10 +516,13 @@ int32_t tGetDelData(uint8_t *p, void *ph) {
}
int32_t tsdbKeyFid(TSKEY key, int32_t minutes, int8_t precision) {
int64_t fid;
if (key < 0) {
return (int)((key + 1) / tsTickPerMin[precision] / minutes - 1);
fid = ((key + 1) / tsTickPerMin[precision] / minutes - 1);
return (fid < INT32_MIN) ? INT32_MIN : (int32_t)fid;
} else {
return (int)((key / tsTickPerMin[precision] / minutes));
fid = ((key / tsTickPerMin[precision] / minutes));
return (fid > INT32_MAX) ? INT32_MAX : (int32_t)fid;
}
}