mirror of
https://github.com/postgres/postgres.git
synced 2025-05-20 05:13:53 +03:00
Prevent overflow for block number in buffile.c
As coded, the start block calculated by BufFileAppend() would overflow once more than 16k files are used with a default block size. This issue existed before b1e5c9fa9ac4, but there's no reason not to be clean about it. Per report from Coverity, with a fix suggested by Tom Lane.
This commit is contained in:
parent
28f84f72fb
commit
3650e7a393
@ -904,7 +904,7 @@ BufFileSize(BufFile *file)
|
|||||||
int64
|
int64
|
||||||
BufFileAppend(BufFile *target, BufFile *source)
|
BufFileAppend(BufFile *target, BufFile *source)
|
||||||
{
|
{
|
||||||
int64 startBlock = target->numFiles * BUFFILE_SEG_SIZE;
|
int64 startBlock = (int64) target->numFiles * BUFFILE_SEG_SIZE;
|
||||||
int newNumFiles = target->numFiles + source->numFiles;
|
int newNumFiles = target->numFiles + source->numFiles;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user