Skip to content

Commit db94419

Browse files
committed
pgbench: fix segfault with empty sql file
Commit 1d0c3b3 introduced a bug that causes pgbench to crash if an empty script file is specified. Fix it by rejecting such files at startup, which is the historical and intended behavior. Reported-By: Jeff Janes Discussion: https://www.postgresql.org/message-id/CAMkU=1zxKUbLPOt9hQWFp14pTc=V0cGo2GQBbn2GsK2Pu+8ZfA@mail.gmail.com
1 parent d03130d commit db94419

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2686,7 +2686,8 @@ findBuiltin(const char *name, char **desc)
26862686
static void
26872687
addScript(const char *name, Command **commands)
26882688
{
2689-
if (commands == NULL)
2689+
if (commands == NULL ||
2690+
commands[0] == NULL)
26902691
{
26912692
fprintf(stderr, "empty command list for script \"%s\"\n", name);
26922693
exit(1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy