1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-06-20 01:17:49 +02:00

Add assertions to satisfy Coverity about possible underflows.

Coverity complained about possible underflows so add assertions to demonstrate that the values in question are greater than zero.
This commit is contained in:
David Steele
2025-01-28 18:48:11 -05:00
parent e46374dc7d
commit d50b01b485
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -485,7 +485,7 @@ blockMapWrite(const BlockMap *const this, IoWrite *const output, const size_t bl
{
ASSERT(
superBlock == blockMapGet(this, blockIdx) ||
blockMapGet(this, blockIdx)->block == blockMapGet(this, blockIdx - 1)->block + 1);
(blockIdx > 0 && (blockMapGet(this, blockIdx)->block == blockMapGet(this, blockIdx - 1)->block + 1)));
ioWrite(output, BUF(blockMapGet(this, blockIdx)->checksum, checksumSize));
}
+2
View File
@@ -206,6 +206,8 @@ ioFilterGroupOpen(IoFilterGroup *const this)
// If this is not the last output filter then create a new output buffer for it. The output buffer for the last filter
// will be provided to the process function.
ASSERT(ioFilterGroupSize(this) != 0);
if (ioFilterOutput(filterData->filter) && filterIdx < ioFilterGroupSize(this) - 1)
{
filterData->output = bufNew(ioBufferSize());