1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Fix possible segfault in page checksum error message.

The STRDEF definition of plural is out of scope in the error message just below it, which may lead to either garbage in the log message or a crash with SIGSEGV.

This is particularly visible with pg_tde, which encrypts tables: if pgbackrest is run with checksum enabled, it tries to emit this message for all encrypted files.

Fix by using simple char * constants in the error message.
This commit is contained in:
Zsolt Parragi
2025-08-25 17:51:54 +02:00
committed by GitHub
parent 779cb763af
commit adc5e5b23b
3 changed files with 21 additions and 3 deletions

View File

@@ -1,5 +1,18 @@
<release date="XXXX-XX-XX" version="2.57.0dev" title="Under Development">
<release-core-list>
<release-bug-list>
<release-item>
<github-pull-request id="2675"/>
<release-item-contributor-list>
<release-item-contributor id="zsolt.parragi"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>
<p>Fix possible segfault in page checksum error message.</p>
</release-item>
</release-bug-list>
<release-improvement-list>
<release-item>
<github-pull-request id="2661"/>

View File

@@ -1225,3 +1225,8 @@
<contributor-name-display>yummyliu</contributor-name-display>
<contributor-id type="github">yummyliu</contributor-id>
</contributor>
<contributor id="zsolt.parragi">
<contributor-name-display>Zsolt Parragi</contributor-name-display>
<contributor-id type="github">dutow</contributor-id>
</contributor>

View File

@@ -1568,12 +1568,12 @@ backupJobResult(
}
// Make message plural when appropriate
const String *const plural = errorTotalMin > 1 ? STRDEF("s") : EMPTY_STR;
const char *const plural = errorTotalMin > 1 ? "s" : "";
// ??? Update formatting after migration
LOG_WARN_FMT(
"invalid page checksum%s found in file %s at page%s %s", strZ(plural), strZ(fileLog),
strZ(plural), strZ(error));
"invalid page checksum%s found in file %s at page%s %s", plural, strZ(fileLog), plural,
strZ(error));
}
}
}