mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.33 2000/02/21 03:36:48 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.34 2000/03/07 23:58:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -288,6 +288,9 @@ text_int2(text *string)
|
|||||||
int len;
|
int len;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
|
if (!string)
|
||||||
|
return 0;
|
||||||
|
|
||||||
len = (VARSIZE(string) - VARHDRSZ);
|
len = (VARSIZE(string) - VARHDRSZ);
|
||||||
|
|
||||||
str = palloc(len + 1);
|
str = palloc(len + 1);
|
||||||
@ -329,6 +332,9 @@ text_int4(text *string)
|
|||||||
int len;
|
int len;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
|
if (!string)
|
||||||
|
return 0;
|
||||||
|
|
||||||
len = (VARSIZE(string) - VARHDRSZ);
|
len = (VARSIZE(string) - VARHDRSZ);
|
||||||
|
|
||||||
str = palloc(len + 1);
|
str = palloc(len + 1);
|
||||||
|
Reference in New Issue
Block a user