Github user sansanichfb commented on a diff in the pull request:
https://github.com/apache/incubator-hawq/pull/959#discussion_r83110356
--- Diff: src/bin/psql/describe.c ---
@@ -4316,10 +4316,10 @@ describePxfTable(const char *profile, const char
*pattern, bool verbose)
if (verbose)
{
sourcefieldtype = PQgetvalue(res, i, 4);
- total_fields = PQgetvalue(res, i, 5);
+ total_fields = atoi(PQgetvalue(res, i, 5));
--- End diff --
PQgetvalue returns char* and if you assign it directly to int variable, it
will be just some random int value. When this value happened to be positive, it
would just allocate enormous chunk of memory but in case of negative
value(mostly when you just started psql, so heap is small) it would fail with
oom.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---