Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdac7a37

Browse files
committed
Use SvROK(sv) rather than directly checking SvTYPE(sv) == SVt_RV in plperl.
The latter is considered unwarranted chumminess with the implementation,and can lead to crashes with recent Perl versions.Report and fix by Tim Bunce. Back-patch to all versions containing thequestionable coding pattern.
1 parentff5ab91 commitdac7a37

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/pl/plperl/plperl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.170 2010/03/0902:48:33 adunstan Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.171 2010/03/0922:34:38 tgl Exp $
55
*
66
**********************************************************************/
77

@@ -976,7 +976,7 @@ plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup)
976976
ereport(ERROR,
977977
(errcode(ERRCODE_UNDEFINED_COLUMN),
978978
errmsg("$_TD->{new} does not exist")));
979-
if (!SvOK(*svp)||SvTYPE(*svp)!=SVt_RV||SvTYPE(SvRV(*svp))!=SVt_PVHV)
979+
if (!SvOK(*svp)||!SvROK(*svp)||SvTYPE(SvRV(*svp))!=SVt_PVHV)
980980
ereport(ERROR,
981981
(errcode(ERRCODE_DATATYPE_MISMATCH),
982982
errmsg("$_TD->{new} is not a hash reference")));
@@ -1549,7 +1549,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
15491549
* value is an error, except undef which means return an empty set.
15501550
*/
15511551
if (SvOK(perlret)&&
1552-
SvTYPE(perlret)==SVt_RV&&
1552+
SvROK(perlret)&&
15531553
SvTYPE(SvRV(perlret))==SVt_PVAV)
15541554
{
15551555
inti=0;
@@ -1594,7 +1594,7 @@ plperl_func_handler(PG_FUNCTION_ARGS)
15941594
AttInMetadata*attinmeta;
15951595
HeapTupletup;
15961596

1597-
if (!SvOK(perlret)||SvTYPE(perlret)!=SVt_RV||
1597+
if (!SvOK(perlret)||!SvROK(perlret)||
15981598
SvTYPE(SvRV(perlret))!=SVt_PVHV)
15991599
{
16001600
ereport(ERROR,
@@ -2220,7 +2220,7 @@ plperl_return_next(SV *sv)
22202220
errmsg("cannot use return_next in a non-SETOF function")));
22212221

22222222
if (prodesc->fn_retistuple&&
2223-
!(SvOK(sv)&&SvTYPE(sv)==SVt_RV&&SvTYPE(SvRV(sv))==SVt_PVHV))
2223+
!(SvOK(sv)&&SvROK(sv)&&SvTYPE(SvRV(sv))==SVt_PVHV))
22242224
ereport(ERROR,
22252225
(errcode(ERRCODE_DATATYPE_MISMATCH),
22262226
errmsg("SETOF-composite-returning PL/Perl function "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp