diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-11 22:53:06 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-11 22:53:06 +0000 |
commit | 1aa0e9c878374287993848ab5b04fe4e762e00d2 (patch) | |
tree | 2fdcd59eadff0b7cb556dc6c9220a477d358a016 /src | |
parent | 6c1dbc5ec1b101964b895596526dab92fac6cacc (diff) | |
download | postgresql-1aa0e9c878374287993848ab5b04fe4e762e00d2.tar.gz postgresql-1aa0e9c878374287993848ab5b04fe4e762e00d2.zip |
Fix several datatype input functions that were allowing unused bytes in their
results to contain uninitialized, unpredictable values. While this was okay
as far as the datatypes themselves were concerned, it's a problem for the
parser because occurrences of the "same" literal might not be recognized as
equal by datumIsEqual (and hence not by equal()). It seems sufficient to fix
this in the input functions since the only critical use of equal() is in the
parser's comparisons of ORDER BY and DISTINCT expressions.
Per a trouble report from Marc Cousin.
Patch all the way back. Interestingly, array_in did not have the bug before
8.2, which may explain why the issue went unnoticed for so long.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/adt/arrayfuncs.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/geo_ops.c | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 667335b5ab3..4d328d5ce1e 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.135 2006/11/08 19:24:38 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.135.2.1 2008/04/11 22:53:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -323,7 +323,7 @@ array_in(PG_FUNCTION_ARGS) dataoffset = 0; /* marker for no null bitmap */ nbytes += ARR_OVERHEAD_NONULLS(ndim); } - retval = (ArrayType *) palloc(nbytes); + retval = (ArrayType *) palloc0(nbytes); retval->size = nbytes; retval->ndim = ndim; retval->dataoffset = dataoffset; diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index aa6bb25afea..7d06a70c207 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.93.2.1 2007/12/18 00:04:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.93.2.2 2008/04/11 22:53:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1425,6 +1425,8 @@ path_in(PG_FUNCTION_ARGS) errmsg("invalid input syntax for type path: \"%s\"", str))); path->closed = (!isopen); + /* prevent instability in unused pad bytes */ + path->dummy = 0; PG_RETURN_PATH_P(path); } |