diff options
author | Tom Lane | 2009-03-12 00:53:41 +0000 |
---|---|---|
committer | Tom Lane | 2009-03-12 00:53:41 +0000 |
commit | 14e504b57bdf197df80225f1ee2a1be33f2ac92f (patch) | |
tree | f9820f6f9b0fc8a9b8225f687b4b3c0a7a4b9f62 | |
parent | 9424b22b5e9c538f9c57cd03f0a16a560b18864b (diff) |
Fix core dump due to null-pointer dereference in to_char() when datetime
format codes are misapplied to a numeric argument. (The code still produces
a pretty bogus error message in such cases, but I'll settle for stopping the
crash for now.) Per bug #4700 from Sergey Burladyan.
Problem exists in all supported branches, so patch all the way back.
In HEAD, also clean up some ugly coding in the nearby cache management
code.
-rw-r--r-- | src/backend/utils/adt/formatting.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 0e7c9ddff42..5af4788d0f2 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * formatting.c * - * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.116.2.3 2007/06/29 01:51:49 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.116.2.4 2009/03/12 00:53:41 tgl Exp $ * * * Portions Copyright (c) 1999-2006, PostgreSQL Global Development Group @@ -356,7 +356,7 @@ static int DCHCounter = 0; /* global cache for --- number part */ static NUMCacheEntry NUMCache[NUM_CACHE_FIELDS + 1]; -static NUMCacheEntry *last_NUMCacheEntry; +static NUMCacheEntry *last_NUMCacheEntry = NUMCache + 0; static int n_NUMCache = 0; /* number of entries */ static int NUMCounter = 0; |