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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Ranier Vilela
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

parse_expr.c.patch (1K) Download Attachment