Skip to content

Commit

Permalink
fix(deparse): potential sigsegv
Browse files Browse the repository at this point in the history
Fix potential sigsegv when passing an invalid protobuf (RawStmt without Stmt) for deparsing.
  • Loading branch information
wesselvdv authored and Wessel van der Veen committed Apr 17, 2022
1 parent d1d0186 commit 58dfd21
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pg_query_deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,9 @@ static void deparseRangeVar(StringInfo str, RangeVar *range_var, DeparseNodeCont

static void deparseRawStmt(StringInfo str, RawStmt *raw_stmt)
{
if (raw_stmt->stmt == NULL)
elog(ERROR, "deparse error in deparseRawStmt: RawStmt with empty Stmt");

deparseStmt(str, raw_stmt->stmt);
}

Expand Down

0 comments on commit 58dfd21

Please sign in to comment.