Testing 9.1beta: select format('Hello %s, %2147483648$s', 'World'); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed.
The problem is that the test for overflow of the arg position doesn't catch all cases. The simplest solution is to just tweak the comparison at varlena.c:3840 (patch attached) although maybe there are neater ways... Regards, Dean
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c new file mode 100644 index 9d96013..a479905 *** a/src/backend/utils/adt/varlena.c --- b/src/backend/utils/adt/varlena.c *************** text_format(PG_FUNCTION_ARGS) *** 3837,3843 **** do { /* Treat overflowing arg position as unterminated. */ ! if (arg > INT_MAX / 10) break; arg = arg * 10 + (*cp - '0'); ++cp; --- 3837,3843 ---- do { /* Treat overflowing arg position as unterminated. */ ! if (arg >= INT_MAX / 10) break; arg = arg * 10 + (*cp - '0'); ++cp;
-- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs