# New Ticket Created by NotFound
# Please include the string: [perl #55640]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=55640 >
I've found a bug in oo_get_class, it segfaults when calling pmc_type
with a NULL STIRNG *
This short pir code shows the problem:
.sub main
$P0= get_root_namespace
$P1= get_class $P0
.end
The attached patch fixes it.
--
Salu2
Index: src/oo.c
===================================================================
--- src/oo.c (revisión: 28239)
+++ src/oo.c (copia de trabajo)
@@ -236,15 +236,21 @@
if (PMC_IS_NULL(classobj)) {
/* Look up a low-level class and create a proxy */
- const INTVAL type = pmc_type(interp, VTABLE_get_string(interp, key));
-
- /* Reject invalid type numbers */
- if (type > interp->n_vtable_max || type <= 0)
+ STRING * tname = VTABLE_get_string(interp, key);
+ if (! tname) {
return PMCNULL;
+ }
else {
- PMC * const type_num = pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, type_num, type);
- classobj = pmc_new_init(interp, enum_class_PMCProxy, type_num);
+ const INTVAL type = pmc_type(interp, tname);
+
+ /* Reject invalid type numbers */
+ if (type > interp->n_vtable_max || type <= 0)
+ return PMCNULL;
+ else {
+ PMC * const type_num = pmc_new(interp, enum_class_Integer);
+ VTABLE_set_integer_native(interp, type_num, type);
+ classobj = pmc_new_init(interp, enum_class_PMCProxy, type_num);
+ }
}
}