Update to do_postgres 0.10.14

Include patches committed upstream to fix a couple of use-after-frees
exposed by malloc junking.
This commit is contained in:
jeremy 2014-06-19 20:25:49 +00:00
parent 265c257981
commit 2d5943f4f9
5 changed files with 67 additions and 5 deletions

View File

@ -1,10 +1,9 @@
# $OpenBSD: Makefile,v 1.15 2014/01/15 02:13:57 jeremy Exp $
# $OpenBSD: Makefile,v 1.16 2014/06/19 20:25:49 jeremy Exp $
COMMENT= DataObjects driver for PostgreSQL
V= 0.10.12
V= 0.10.14
DISTNAME= do_postgres-${V}
REVISION = 2
CATEGORIES= databases
# MIT

View File

@ -1,2 +1,2 @@
SHA256 (do_postgres-0.10.12.gem) = l1+tTLwyBWEuxT1sgidnZPTn4mfjbtDxVFJKoPLxsgw=
SIZE (do_postgres-0.10.12.gem) = 30720
SHA256 (do_postgres-0.10.14.gem) = oi4jWHhimr5ctuk7m2KRRkZiJeVn1iSNELJxAVelO9Y=
SIZE (do_postgres-0.10.14.gem) = 31744

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-ext_do_postgres_do_common_c,v 1.1 2014/06/19 20:25:49 jeremy Exp $
Fix use-after-free, upstream commit 23cea14f4576acea9d53df3358280ba8db7b9e5b.
--- ext/do_postgres/do_common.c.orig Thu Feb 13 02:59:50 2014
+++ ext/do_postgres/do_common.c Mon Jun 16 11:08:01 2014
@@ -63,7 +63,7 @@ void data_objects_debug(VALUE connection, VALUE string
rb_funcall(connection, DO_ID_LOG, 1, message);
}
-void data_objects_raise_error(VALUE self, const struct errcodes *errors, int errnum, const char *message, VALUE query, VALUE state) {
+void data_objects_raise_error(VALUE self, const struct errcodes *errors, int errnum, VALUE message, VALUE query, VALUE state) {
const char *exception_type = "SQLError";
const struct errcodes *e;
VALUE uri, exception;
@@ -82,7 +82,7 @@ void data_objects_raise_error(VALUE self, const struct
data_objects_const_get(mDO, exception_type),
DO_ID_NEW,
5,
- rb_str_new2(message),
+ message,
INT2NUM(errnum),
state,
query,

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-ext_do_postgres_do_common_h,v 1.1 2014/06/19 20:25:49 jeremy Exp $
Fix use-after-free, upstream commit 23cea14f4576acea9d53df3358280ba8db7b9e5b.
--- ext/do_postgres/do_common.h.orig Thu Feb 13 02:59:50 2014
+++ ext/do_postgres/do_common.h Mon Jun 16 11:08:01 2014
@@ -123,7 +123,7 @@ static inline void data_objects_define_errors(VALUE sc
}
}
-extern void data_objects_raise_error(VALUE self, const struct errcodes *errors, int errnum, const char *message, VALUE query, VALUE state);
+extern void data_objects_raise_error(VALUE self, const struct errcodes *errors, int errnum, VALUE message, VALUE query, VALUE state);
extern VALUE data_objects_typecast(const char *value, long length, const VALUE type, int encoding);

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-ext_do_postgres_do_postgres_c,v 1.1 2014/06/19 20:25:49 jeremy Exp $
Fix use-after-free, upstream commits 5cec3c5b723d14b210eada26519258255a175c05
and 23cea14f4576acea9d53df3358280ba8db7b9e5b.
--- ext/do_postgres/do_postgres.c.orig Thu Feb 13 02:59:50 2014
+++ ext/do_postgres/do_postgres.c Mon Jun 16 11:11:55 2014
@@ -99,13 +99,14 @@ VALUE do_postgres_typecast(const char *value, long len
}
void do_postgres_raise_error(VALUE self, PGresult *result, VALUE query) {
- const char *message = PQresultErrorMessage(result);
+ VALUE message = rb_str_new2(PQresultErrorMessage(result));
char *sql_state = PQresultErrorField(result, PG_DIAG_SQLSTATE);
int postgres_errno = MAKE_SQLSTATE(sql_state[0], sql_state[1], sql_state[2], sql_state[3], sql_state[4]);
+ VALUE str = rb_str_new2(sql_state);
PQclear(result);
- data_objects_raise_error(self, do_postgres_errors, postgres_errno, message, query, rb_str_new2(sql_state));
+ data_objects_raise_error(self, do_postgres_errors, postgres_errno, message, query, str);
}
/* ====== Public API ======= */