Skip to content

Commit 45d146a

Browse files
committed
Fix 'Q' format char parsing in the new to_timestamp() code. Used to crash.
1 parent 6462e7b commit 45d146a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.149 2008/10/06 05:03:27 tgl Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.150 2008/11/10 17:36:53 heikki Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2008, PostgreSQL Global Development Group
@@ -1771,7 +1771,7 @@ from_char_set_int(int *dest, const int value, const FormatNode *node)
17711771

17721772
/*
17731773
* Read a single integer from the source string, into the int pointed to by
1774-
* 'dest'.
1774+
* 'dest'. If 'dest' is NULL, the result is discarded.
17751775
*
17761776
* In fixed-width mode (the node does not have the FM suffix), consume at most
17771777
* 'len' characters.
@@ -1862,7 +1862,8 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node)
18621862
errdetail("Value must be in the range %d to %d.",
18631863
INT_MIN, INT_MAX)));
18641864

1865-
from_char_set_int(dest, (int) result, node);
1865+
if (dest != NULL)
1866+
from_char_set_int(dest, (int) result, node);
18661867
return *src - init;
18671868
}
18681869

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy