[PATCH][BUG FIX] Potential uninitialized vars used.

From: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH][BUG FIX] Potential uninitialized vars used.
Date: 2019-11-12 15:53:07
Message-ID: MN2PR18MB2927B2E9D8A29761195FB5EFE3770@MN2PR18MB2927.namprd18.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
Var TargetEntry *tle;
Have several paths where can it fail.

Can anyone check this bug fix?

--- \dll\postgresql-12.0\a\backend\parser\parse_expr.c Mon Sep 30 17:06:55 2019
+++ parse_expr.c Tue Nov 12 12:43:07 2019
@@ -349,6 +349,7 @@
errmsg("DEFAULT is not allowed in this context"),
parser_errposition(pstate,
((SetToDefault *) expr)->location)));
+ result = NULL; /* keep compiler quiet */
break;

/*
@@ -1637,11 +1638,13 @@
pstate->p_multiassign_exprs = lappend(pstate->p_multiassign_exprs,
tle);
}
- else
+ else {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"),
parser_errposition(pstate, exprLocation(maref->source))));
+ return NULL;
+ }
}
else
{
@@ -1653,6 +1656,10 @@
Assert(pstate->p_multiassign_exprs != NIL);
tle = (TargetEntry *) llast(pstate->p_multiassign_exprs);
}
+ if (tle == NULL) {
+ elog(ERROR, "unexpected expr type in multiassign list");
+ return NULL; /* keep compiler quiet */
+ }

/*
* Emit the appropriate output expression for the current column

Attachment Content-Type Size
parse_expr.c.patch application/octet-stream 1.1 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2019-11-12 15:59:20 Re: Built-in connection pooler
Previous Message Daniel Gustafsson 2019-11-12 15:38:36 Re: Option to dump foreign data in pg_dump