Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d481b3

Browse files
committed
Fix plperl crash with list value return for an array result type.
Reported by Michael Fuhr, fixed by Andrew Dunstan.
1 parent 807bbe6 commit 2d481b3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pl/plperl/plperl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.85 2005/07/12 01:16:21 tgl Exp $
36+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.86 2005/07/12 20:35:42 tgl Exp $
3737
*
3838
**********************************************************************/
3939

@@ -1020,8 +1020,8 @@ plperl_func_handler(PG_FUNCTION_ARGS)
10201020
/* Return a perl string converted to a Datum */
10211021
char *val;
10221022

1023-
1024-
if (prodesc->fn_retisarray && SvTYPE(SvRV(perlret)) == SVt_PVAV)
1023+
if (prodesc->fn_retisarray && SvROK(perlret) &&
1024+
SvTYPE(SvRV(perlret)) == SVt_PVAV)
10251025
{
10261026
array_ret = plperl_convert_to_pg_array(perlret);
10271027
SvREFCNT_dec(perlret);

0 commit comments

Comments
 (0)