[perl-Glib] Avoid misusing PL_na
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib] Avoid misusing PL_na
- Date: Tue, 24 Sep 2013 17:56:41 +0000 (UTC)
commit c62c3e47cea5c3945fde58e858c78ae1334192cc
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Tue Sep 24 19:56:05 2013 +0200
Avoid misusing PL_na
We used to do "newSVpv (string, PL_na)" when we didn't know the string's
length. That's not correct, and breaks if other XS modules write to PL_na,
which is what PL_na is intended for. Simply use "newSVpv (string, 0)" instead.
GOption.xs | 2 +-
GType.xs | 2 +-
Glib.xs | 2 +-
NEWS | 8 ++++++++
4 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/GOption.xs b/GOption.xs
index c20cbb4..0c7defe 100644
--- a/GOption.xs
+++ b/GOption.xs
@@ -547,7 +547,7 @@ sv_from_filenames (gchar **filenames)
av = newAV ();
for (i = 0; filenames[i] != NULL; i++) {
/* FIXME: Is this the correct converter? */
- av_push (av, newSVpv (filenames[i], PL_na));
+ av_push (av, newSVpv (filenames[i], 0));
}
return newRV_noinc ((SV *) av);
diff --git a/GType.xs b/GType.xs
index d59ee18..6f9c1dd 100644
--- a/GType.xs
+++ b/GType.xs
@@ -1505,7 +1505,7 @@ install_overrides (GType type)
PUSHMARK (SP);
if (!name)
name = gperl_object_package_from_type (type);
- XPUSHs (sv_2mortal (newSVpv (name, PL_na)));
+ XPUSHs (sv_2mortal (newSVpv (name, 0)));
PUTBACK;
call_sv ((SV *)GvCV (*slot), G_VOID|G_DISCARD);
FREETMPS;
diff --git a/Glib.xs b/Glib.xs
index dac2c47..a709050 100644
--- a/Glib.xs
+++ b/Glib.xs
@@ -285,7 +285,7 @@ gperl_argv_update (GPerlArgv *pargv)
SV *sv;
const char *arg = pargv->argv[i];
gboolean utf8_flag = !!g_hash_table_lookup (priv->utf8_flags, arg);
- sv = newSVpv (arg, PL_na);
+ sv = newSVpv (arg, 0);
if (utf8_flag)
SvUTF8_on (sv);
av_push (ARGV, sv);
diff --git a/NEWS b/NEWS
index 28a0855..379d957 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Overview of changes in Glib <next>
+==========================================
+
+* Avoid misusing the macro PL_na, thus preventing issues when Glib is used in
+ conjunction with certain XS modules, among them XML::Parser and
+ String::Approx.
+* Avoid memory corruption when registering boxed synonyms repeatedly.
+
Overview of changes in Glib 1.301 (stable)
==========================================
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]