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

Commita3faebd

Browse files
committed
Ensure ParseTzFile() closes the input file after failing.
We hadn't noticed this because (a) few people feed invalidtimezone abbreviation files to the server, and (b) in typicalscenarios guc.c would throw ereport(ERROR) and then transactionabort handling would silently clean up the leaked file reference.However, it was possible to observe file leakage warnings if onebreaks an already-active abbreviation file, because guc.c doesnot throw ERROR when loading supposedly-validated settings duringsession start or SIGHUP processing.Report and fix by Kyotaro Horiguchi (cosmetic adjustments by me)Discussion:https://postgr.es/m/20220530.173740.748502979257582392.horikyota.ntt@gmail.com
1 parentfa70c9e commita3faebd

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

‎src/backend/utils/misc/tzparser.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ ParseTzFile(const char *filename, int depth,
365365
{
366366
GUC_check_errmsg("could not read time zone file \"%s\": %m",
367367
filename);
368-
return-1;
368+
n=-1;
369+
break;
369370
}
370371
/* else we're at EOF after all */
371372
break;
@@ -375,7 +376,8 @@ ParseTzFile(const char *filename, int depth,
375376
/* the line is too long for tzbuf */
376377
GUC_check_errmsg("line is too long in time zone file \"%s\", line %d",
377378
filename,lineno);
378-
return-1;
379+
n=-1;
380+
break;
379381
}
380382

381383
/* skip over whitespace */
@@ -398,12 +400,13 @@ ParseTzFile(const char *filename, int depth,
398400
{
399401
GUC_check_errmsg("@INCLUDE without file name in time zone file \"%s\", line %d",
400402
filename,lineno);
401-
return-1;
403+
n=-1;
404+
break;
402405
}
403406
n=ParseTzFile(includeFile,depth+1,
404407
base,arraysize,n);
405408
if (n<0)
406-
return-1;
409+
break;
407410
continue;
408411
}
409412

@@ -414,12 +417,18 @@ ParseTzFile(const char *filename, int depth,
414417
}
415418

416419
if (!splitTzLine(filename,lineno,line,&tzentry))
417-
return-1;
420+
{
421+
n=-1;
422+
break;
423+
}
418424
if (!validateTzEntry(&tzentry))
419-
return-1;
425+
{
426+
n=-1;
427+
break;
428+
}
420429
n=addToArray(base,arraysize,n,&tzentry,override);
421430
if (n<0)
422-
return-1;
431+
break;
423432
}
424433

425434
FreeFile(tzFile);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp