Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3977bd2

Browse files
committed
In fmtIdEnc(), handle failure of enlargePQExpBuffer().
Coverity complained that we weren't doing that, and it's right.This fix just makes fmtIdEnc() honor the general convention that OOMcauses a PQExpBuffer to become marked "broken", without any immediateerror. In the pretty-unlikely case that we actually did hit OOM here,the end result would be to return an empty string to the caller,probably resulting in invalid SQL syntax in an issued command (ifnothing else went wrong, which is even more unlikely). It's temptingto throw an "out of memory" error if the buffer becomes broken, butthere's not a lot of point in doing that only here and not in hundredsof other PQExpBuffer-using places in pg_dump and similar callers.The whole issue could do with some non-time-crunched redesign, perhaps.This is a followup to the fixes forCVE-2025-1094, and should beincluded if cherry-picking those fixes.
1 parent3abe6e0 commit3977bd2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎src/fe_utils/string_utils.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,13 @@ fmtIdEnc(const char *rawid, int encoding)
200200
* easier for users to find the invalidly encoded portion of a
201201
* larger string.
202202
*/
203-
enlargePQExpBuffer(id_return,2);
204-
pg_encoding_set_invalid(encoding,
205-
id_return->data+id_return->len);
206-
id_return->len+=2;
207-
id_return->data[id_return->len]='\0';
203+
if (enlargePQExpBuffer(id_return,2))
204+
{
205+
pg_encoding_set_invalid(encoding,
206+
id_return->data+id_return->len);
207+
id_return->len+=2;
208+
id_return->data[id_return->len]='\0';
209+
}
208210

209211
/*
210212
* Handle the following bytes as if this byte didn't exist.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp