Skip to content

Commit 0c54229

Browse files
committed
Protects you from coredumps if you do eg. str::int4 where str is a text
field. cf. Tom Lane's <19021.950544016@sss.pgh.pa.us> 14 Feb hackers message. Cheers, Patrick Welche
1 parent 8fa8f80 commit 0c54229

File tree

1 file changed

+7
-1
lines changed
  • src/backend/utils/adt

1 file changed

+7
-1
lines changed

src/backend/utils/adt/int.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.33 2000/02/21 03:36:48 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.34 2000/03/07 23:58:38 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -288,6 +288,9 @@ text_int2(text *string)
288288
int len;
289289
char *str;
290290

291+
if (!string)
292+
return 0;
293+
291294
len = (VARSIZE(string) - VARHDRSZ);
292295

293296
str = palloc(len + 1);
@@ -329,6 +332,9 @@ text_int4(text *string)
329332
int len;
330333
char *str;
331334

335+
if (!string)
336+
return 0;
337+
332338
len = (VARSIZE(string) - VARHDRSZ);
333339

334340
str = palloc(len + 1);

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