pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedLack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
7+ messages / 3 participants
[nested] [flat]
* Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
@ 2015-06-11 19:11 Bill Parker <wp02855@gmail.com>
2015-06-12 06:53 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
0 siblings, 2 replies; 7+ messages in thread
From: Bill Parker @ 2015-06-11 19:11 UTC (permalink / raw)
To: pgsql-bugs
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Bill Parker
Your email address : wp02855 at gmail dot com
System Configuration:
---------------------
Architecture (example: Intel Pentium) : x86/x86-64/AMD
Operating System (example: Linux 2.4.18) : Linux 3.11.6-4
PostgreSQL version (example: PostgreSQL 9.4.3): PostgreSQL 9.4.x
Compiler used (example: gcc 3.3.5) : gcc version 4.8.1
Please enter a FULL description of your problem:
------------------------------------------------
Hello All,
In reviewing some code, in directory
'postgresql-9.4.3/src/interfaces/ecpg/ecpglib',
file 'misc.c', there are several instances where a call to malloc()
is made, but no check for a return value of NULL is made, which
would indicate failure. Additionally, if sqlca = malloc() fails,
ecpg_init_sqlca would be called with variable 'sqlca' equal to NULL?
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
The patch file below addresses these issues:
inline patch 1: misc.c (+1/-0 lines) download inline-1.patch
--- misc.c.orig 2015-06-11 09:23:13.807020490 -0700
+++ misc.c 2015-06-11 09:32:10.077177669 -0700
@@ -143,6 +143,9 @@
if (sqlca == NULL)
{
sqlca = malloc(sizeof(struct sqlca_t));
+ if (sqlca == NULL) { /* malloc() failed, now what
should we do? */
+ ecpg_log("Unable to allocate memory in
ECPGget_sqlca()\n");
+ }
ecpg_init_sqlca(sqlca);
pthread_setspecific(sqlca_key, sqlca);
}
Please feel free to review and comment on the above patch file...
I am attaching the patch file to this bug report
Bill Parker (wp02855 at gmail dot com)
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Patches and attachments: download all (2 files, .tar.gz)
misc.c.patch (application/octet-stream, 403B) download
--- misc.c.orig 2015-06-11 09:23:13.807020490 -0700
+++ misc.c 2015-06-11 09:32:10.077177669 -0700
@@ -143,6 +143,9 @@
if (sqlca == NULL)
{
sqlca = malloc(sizeof(struct sqlca_t));
+ if (sqlca == NULL) { /* malloc() failed, now what should we do? */
+ ecpg_log("Unable to allocate memory in ECPGget_sqlca()\n");
+ }
ecpg_init_sqlca(sqlca);
pthread_setspecific(sqlca_key, sqlca);
}
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
@ 2015-06-12 06:53 ` Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
1 sibling, 1 reply; 7+ messages in thread
From: Michael Paquier @ 2015-06-12 06:53 UTC (permalink / raw)
To: Bill Parker <wp02855@gmail.com>; +Cc: pgsql-bugs; Michael Meskes <meskes@postgresql.org>
(Adding Michael Meskes in CC:)
On Fri, Jun 12, 2015 at 4:11 AM, Bill Parker <wp02855@gmail.com> wrote:
> --- misc.c.orig 2015-06-11 09:23:13.807020490 -0700
> +++ misc.c 2015-06-11 09:32:10.077177669 -0700
> @@ -143,6 +143,9 @@
> if (sqlca == NULL)
> {
> sqlca = malloc(sizeof(struct sqlca_t));
> + if (sqlca == NULL) { /* malloc() failed, now what should
> we do? */
> + ecpg_log("Unable to allocate memory in
> ECPGget_sqlca()\n");
> + }
> ecpg_init_sqlca(sqlca);
> pthread_setspecific(sqlca_key, sqlca);
> }
>
> Please feel free to review and comment on the above patch file...
>
> I am attaching the patch file to this bug report
>
> Bill Parker (wp02855 at gmail dot com)
Nice catch. Regarding your patch, it seems to me that this is not
enough. I think that we should return NULL with ECPGget_sqlca in case
of an OOM instead of logging a message with ecpg_log and let each code
path decide what to do when sqlca is NULL. Some code paths can
directly use ecpg_raise with ECPG_OUT_OF_MEMORY. Other code paths,
like the ones in error.c will need to show up with appropriate error
messages.
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
2015-06-12 06:53 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
@ 2015-06-12 13:06 ` Michael Meskes <meskes@postgresql.org>
2015-06-15 07:35 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Meskes @ 2015-06-12 13:06 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Bill Parker <wp02855@gmail.com>; pgsql-bugs; Michael Meskes <meskes@postgresql.org>
On Fri, Jun 12, 2015 at 03:53:43PM +0900, Michael Paquier wrote:
> (Adding Michael Meskes in CC:)
Thanks.
> Nice catch. Regarding your patch, it seems to me that this is not
> enough. I think that we should return NULL with ECPGget_sqlca in case
> of an OOM instead of logging a message with ecpg_log and let each code
> path decide what to do when sqlca is NULL. Some code paths can
> directly use ecpg_raise with ECPG_OUT_OF_MEMORY. Other code paths,
> like the ones in error.c will need to show up with appropriate error
> messages.
Agreed on all accounts.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
2015-06-12 06:53 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
@ 2015-06-15 07:35 ` Michael Paquier <michael.paquier@gmail.com>
2015-06-15 12:34 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Paquier @ 2015-06-15 07:35 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: Bill Parker <wp02855@gmail.com>; pgsql-bugs
On Fri, Jun 12, 2015 at 10:06 PM, Michael Meskes <meskes@postgresql.org> wrote:
> On Fri, Jun 12, 2015 at 03:53:43PM +0900, Michael Paquier wrote:
>> (Adding Michael Meskes in CC:)
>
> Thanks.
>
>> Nice catch. Regarding your patch, it seems to me that this is not
>> enough. I think that we should return NULL with ECPGget_sqlca in case
>> of an OOM instead of logging a message with ecpg_log and let each code
>> path decide what to do when sqlca is NULL. Some code paths can
>> directly use ecpg_raise with ECPG_OUT_OF_MEMORY. Other code paths,
>> like the ones in error.c will need to show up with appropriate error
>> messages.
>
> Agreed on all accounts.
So, here is a patch implementing those ideas. In code paths where a
line number is available ecpg_raise() is called to report the error.
In other paths ecpg_log() is used to log an "out of memory" message.
Now, the routines of error.c, like ecpg_raise() can fail as well their
malloc() call, hence it seems adapted to me to fallback to ecpg_log()
and report the error to the user.
Thoughts?
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Attachments:
20150615_ecpg_fix_malloc.patch (binary/octet-stream, 7.2K) download
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index 8d81c83..9f7776e 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -1032,6 +1032,8 @@ void
ECPG_informix_reset_sqlca(void)
{
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ return;
memcpy((char *) sqlca, (char *) &sqlca_init, sizeof(struct sqlca_t));
}
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c
index 55c5680..ccc5fcc 100644
--- a/src/interfaces/ecpg/ecpglib/connect.c
+++ b/src/interfaces/ecpg/ecpglib/connect.c
@@ -223,6 +223,12 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
struct sqlca_t *sqlca = ECPGget_sqlca();
int sqlcode;
+ if (sqlca == NULL)
+ {
+ ecpg_log("out of memory");
+ return;
+ }
+
(void) arg; /* keep the compiler quiet */
if (sqlstate == NULL)
sqlstate = ECPG_SQLSTATE_ECPG_INTERNAL_ERROR;
@@ -278,6 +284,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
const char **conn_keywords;
const char **conn_values;
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ ecpg_free(dbname);
+ return false;
+ }
+
ecpg_init_sqlca(sqlca);
/*
@@ -654,6 +668,13 @@ ECPGdisconnect(int lineno, const char *connection_name)
struct sqlca_t *sqlca = ECPGget_sqlca();
struct connection *con;
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return (false);
+ }
+
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&connections_mutex);
#endif
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index c3cd946..8d36484 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -132,6 +132,13 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
int value_for_indicator = 0;
long log_offset;
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return (false);
+ }
+
/*
* If we are running in a regression test, do not log the offset variable,
* it depends on the machine's alignment.
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c
index 956c035..15fd7a0 100644
--- a/src/interfaces/ecpg/ecpglib/descriptor.c
+++ b/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -93,6 +93,13 @@ ECPGget_desc_header(int lineno, const char *desc_name, int *count)
PGresult *ECPGresult;
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return false;
+ }
+
ecpg_init_sqlca(sqlca);
ECPGresult = ecpg_result_by_descriptor(lineno, desc_name);
if (!ECPGresult)
@@ -245,6 +252,13 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
struct variable data_var;
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return false;
+ }
+
va_start(args, index);
ecpg_init_sqlca(sqlca);
ECPGresult = ecpg_result_by_descriptor(lineno, desc_name);
@@ -701,6 +715,13 @@ ECPGdeallocate_desc(int line, const char *name)
struct descriptor *prev;
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_raise(line, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return false;
+ }
+
ecpg_init_sqlca(sqlca);
for (desc = get_descriptors(), prev = NULL; desc; prev = desc, desc = desc->next)
{
@@ -740,6 +761,13 @@ ECPGallocate_desc(int line, const char *name)
struct descriptor *new;
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_raise(line, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return false;
+ }
+
ecpg_init_sqlca(sqlca);
new = (struct descriptor *) ecpg_alloc(sizeof(struct descriptor), line);
if (!new)
diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c
index 715bedb..656b2c4 100644
--- a/src/interfaces/ecpg/ecpglib/error.c
+++ b/src/interfaces/ecpg/ecpglib/error.c
@@ -14,6 +14,13 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str)
{
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_log("out of memory");
+ ECPGfree_auto_mem();
+ return;
+ }
+
sqlca->sqlcode = code;
strncpy(sqlca->sqlstate, sqlstate, sizeof(sqlca->sqlstate));
@@ -215,6 +222,13 @@ ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat)
char *sqlstate;
char *message;
+ if (sqlca == NULL)
+ {
+ ecpg_log("out of memory");
+ ECPGfree_auto_mem();
+ return;
+ }
+
if (result)
{
sqlstate = PQresultErrorField(result, PG_DIAG_SQLSTATE);
@@ -323,6 +337,12 @@ sqlprint(void)
{
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_log("out of memory");
+ return;
+ }
+
sqlca->sqlerrm.sqlerrmc[sqlca->sqlerrm.sqlerrml] = '\0';
fprintf(stderr, ecpg_gettext("SQL error: %s\n"), sqlca->sqlerrm.sqlerrmc);
}
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index bcb38d2..9a56a5c 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -1493,6 +1493,13 @@ ecpg_process_output(struct statement * stmt, bool clear_result)
ntuples,
act_field;
+ if (sqlca == NULL)
+ {
+ ecpg_raise(stmt->lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return (false);
+ }
+
var = stmt->outlist;
switch (PQresultStatus(stmt->results))
{
diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c
index 2e62260..a13aa0a 100644
--- a/src/interfaces/ecpg/ecpglib/misc.c
+++ b/src/interfaces/ecpg/ecpglib/misc.c
@@ -106,6 +106,13 @@ ecpg_init(const struct connection * con, const char *connection_name, const int
{
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY,
+ NULL);
+ return (false);
+ }
+
ecpg_init_sqlca(sqlca);
if (con == NULL)
{
@@ -143,6 +150,8 @@ ECPGget_sqlca(void)
if (sqlca == NULL)
{
sqlca = malloc(sizeof(struct sqlca_t));
+ if (sqlca == NULL)
+ return NULL;
ecpg_init_sqlca(sqlca);
pthread_setspecific(sqlca_key, sqlca);
}
@@ -286,9 +295,11 @@ ecpg_log(const char *format,...)
va_end(ap);
/* dump out internal sqlca variables */
- if (ecpg_internal_regression_mode)
+ if (ecpg_internal_regression_mode && sqlca != NULL)
+ {
fprintf(debugstream, "[NO_PID]: sqlca: code: %ld, state: %s\n",
sqlca->sqlcode, sqlca->sqlstate);
+ }
fflush(debugstream);
@@ -524,6 +535,13 @@ ECPGset_var(int number, void *pointer, int lineno)
{
struct sqlca_t *sqlca = ECPGget_sqlca();
+ if (sqlca == NULL)
+ {
+ ecpg_raise(lineno, ECPG_OUT_OF_MEMORY,
+ ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL);
+ return;
+ }
+
sqlca->sqlcode = ECPG_OUT_OF_MEMORY;
strncpy(sqlca->sqlstate, "YE001", sizeof(sqlca->sqlstate));
snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), "out of memory on line %d", lineno);
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
2015-06-12 06:53 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
2015-06-15 07:35 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
@ 2015-06-15 12:34 ` Michael Meskes <meskes@postgresql.org>
2015-06-16 00:06 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Meskes @ 2015-06-15 12:34 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Michael Meskes <meskes@postgresql.org>; Bill Parker <wp02855@gmail.com>; pgsql-bugs
On Mon, Jun 15, 2015 at 04:35:47PM +0900, Michael Paquier wrote:
> So, here is a patch implementing those ideas. In code paths where a
> line number is available ecpg_raise() is called to report the error.
> In other paths ecpg_log() is used to log an "out of memory" message.
> Now, the routines of error.c, like ecpg_raise() can fail as well their
> malloc() call, hence it seems adapted to me to fallback to ecpg_log()
> and report the error to the user.
> Thoughts?
Sounds good to me. Patch committed.
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
2015-06-12 06:53 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
2015-06-15 07:35 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Paquier <michael.paquier@gmail.com>
2015-06-15 12:34 ` Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Michael Meskes <meskes@postgresql.org>
@ 2015-06-16 00:06 ` Michael Paquier <michael.paquier@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: Michael Paquier @ 2015-06-16 00:06 UTC (permalink / raw)
To: Michael Meskes <meskes@postgresql.org>; +Cc: Bill Parker <wp02855@gmail.com>; pgsql-bugs
On Mon, Jun 15, 2015 at 9:34 PM, Michael Meskes <meskes@postgresql.org> wrote:
> On Mon, Jun 15, 2015 at 04:35:47PM +0900, Michael Paquier wrote:
>> So, here is a patch implementing those ideas. In code paths where a
>> line number is available ecpg_raise() is called to report the error.
>> In other paths ecpg_log() is used to log an "out of memory" message.
>> Now, the routines of error.c, like ecpg_raise() can fail as well their
>> malloc() call, hence it seems adapted to me to fallback to ecpg_log()
>> and report the error to the user.
>> Thoughts?
>
> Sounds good to me. Patch committed.
Thanks.
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
@ 2015-06-12 13:06 ` Michael Meskes <meskes@postgresql.org>
1 sibling, 0 replies; 7+ messages in thread
From: Michael Meskes @ 2015-06-12 13:06 UTC (permalink / raw)
To: Bill Parker <wp02855@gmail.com>; +Cc: pgsql-bugs
On Thu, Jun 11, 2015 at 12:11:37PM -0700, Bill Parker wrote:
> file 'misc.c', there are several instances where a call to malloc()
> is made, but no check for a return value of NULL is made, which
Your patch lists one such case, but where are the other "several"?
Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2015-06-16 00:06 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-06-11 19:11 Lack of Sanity Checking in file 'misc.c' for PostgreSQL 9.4.x Bill Parker <wp02855@gmail.com>
2015-06-12 06:53 ` Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Michael Meskes <meskes@postgresql.org>
2015-06-15 07:35 ` Michael Paquier <michael.paquier@gmail.com>
2015-06-15 12:34 ` Michael Meskes <meskes@postgresql.org>
2015-06-16 00:06 ` Michael Paquier <michael.paquier@gmail.com>
2015-06-12 13:06 ` Michael Meskes <meskes@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox