Content-Length: 269871 | pFad | http://github.com/postgrespro/postgres_cluster/commit/2abefd9a92f3c02ad4f6030ac1578bbf314db368

0A Work around perl bug in SvPVutf8(). · postgrespro/postgres_cluster@2abefd9 · GitHub
Skip to content

Commit 2abefd9

Browse files
committed
Work around perl bug in SvPVutf8().
Certain things like typeglobs or readonly things like $^V cause perl's SvPVutf8() to die nastily and crash the backend. To avoid that bug we make a copy of the object, which will subsequently be garbage collected. Back patched to 9.1 where we first started using SvPVutf8(). Per -hackers discussion. Original problem reported by David Wheeler.
1 parent 8cf82ac commit 2abefd9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pl/plperl/plperl_helpers.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@ sv2cstr(SV *sv)
5050

5151
/*
5252
* get a utf8 encoded char * out of perl. *note* it may not be valid utf8!
53+
*
54+
* SvPVutf8() croaks nastily on certain things, like typeglobs and
55+
* readonly object such as $^V. That's a perl bug - it's not supposed to
56+
* happen. To avoid crashing the backend, we make a mortal copy of the
57+
* sv before passing it to SvPVutf8(). The copy will be garbage collected
58+
* very soon (see perldoc perlguts).
5359
*/
54-
val = SvPVutf8(sv, len);
60+
val = SvPVutf8(sv_mortalcopy(sv), len);
5561

5662
/*
5763
* we use perls length in the event we had an embedded null byte to ensure

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/2abefd9a92f3c02ad4f6030ac1578bbf314db368

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy