mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-30 14:01:27 +02:00
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.
This commit is contained in:
parent
8cf82ac53e
commit
2abefd9a92
@ -50,8 +50,14 @@ sv2cstr(SV *sv)
|
||||
|
||||
/*
|
||||
* get a utf8 encoded char * out of perl. *note* it may not be valid utf8!
|
||||
*
|
||||
* SvPVutf8() croaks nastily on certain things, like typeglobs and
|
||||
* readonly object such as $^V. That's a perl bug - it's not supposed to
|
||||
* happen. To avoid crashing the backend, we make a mortal copy of the
|
||||
* sv before passing it to SvPVutf8(). The copy will be garbage collected
|
||||
* very soon (see perldoc perlguts).
|
||||
*/
|
||||
val = SvPVutf8(sv, len);
|
||||
val = SvPVutf8(sv_mortalcopy(sv), len);
|
||||
|
||||
/*
|
||||
* we use perls length in the event we had an embedded null byte to ensure
|
||||
|
Loading…
Reference in New Issue
Block a user