1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Tigthen binary receive functions so that they reject values that the text

input functions don't accept either. While the backend can handle such
values fine, they can cause trouble in clients and in pg_dump/restore.

This is followup to the original issue on time datatype reported by Andrew
McNamara a while ago. Like that one, none of these seem worth
back-patching.
This commit is contained in:
Heikki Linnakangas
2009-09-04 11:20:23 +00:00
parent 237859e4fb
commit 7be39bb0be
7 changed files with 63 additions and 17 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.147 2009/07/29 22:19:18 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/date.c,v 1.148 2009/09/04 11:20:22 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -203,8 +203,17 @@ Datum
date_recv(PG_FUNCTION_ARGS)
{
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
DateADT result;
PG_RETURN_DATEADT((DateADT) pq_getmsgint(buf, sizeof(DateADT)));
result = (DateADT) pq_getmsgint(buf, sizeof(DateADT));
/* Limit to the same range that date_in() accepts. */
if (result < 0 || result > JULIAN_MAX)
ereport(ERROR,
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
errmsg("date out of range")));
PG_RETURN_DATEADT(result);
}
/*