Closed irssibot closed 12 years ago
register_theme_segv.diff
Index: src/perl/ui/Themes.xs
===================================================================
--- src/perl/ui/Themes.xs (revision 5213)
+++ src/perl/ui/Themes.xs (working copy)
@@ -90,8 +90,12 @@
CODE:
if (!SvROK(formats))
- croak("formats is not a reference to list");
+ croak("formats is not a reference");
+
av = (AV *) SvRV(formats);
+ if(SvTYPE(av) != SVt_PVAV)
+ croak("formats is not a reference to a list");
+
len = av_len(av)+1;
if (len == 0 || (len & 1) != 0)
croak("formats list is invalid - not divisible by 2 (%d)", len);
Oops, I mean theme_register of course. Sorry :-).
Fixed in r5214.
When passing a reference that isn't an arrayref to register_theme in the Perl API, the process segfaults. This is caused by insufficent validation of the passed argument. The proposed patch verifies that "formats" is an array reference before continuing.