mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
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.
This commit is contained in:
parent
2723d927e6
commit
6578c68207
@ -1,7 +1,7 @@
|
|||||||
/* -----------------------------------------------------------------------
|
/* -----------------------------------------------------------------------
|
||||||
* formatting.c
|
* formatting.c
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.101.2.4 2007/06/29 01:51:56 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.101.2.5 2009/03/12 00:53:48 tgl Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
|
||||||
@ -347,7 +347,7 @@ static int DCHCounter = 0;
|
|||||||
|
|
||||||
/* global cache for --- number part */
|
/* global cache for --- number part */
|
||||||
static NUMCacheEntry NUMCache[NUM_CACHE_FIELDS + 1];
|
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 n_NUMCache = 0; /* number of entries */
|
||||||
static int NUMCounter = 0;
|
static int NUMCounter = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user