# New Ticket Created by Paul Cochrane # Please include the string: [perl #46225] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=46225 >
In Coverity CID 22 there is a warning about potentially passing a negative index to an array. The attached patch corrects the issue, and 'make test' passes. If noone complains I'll apply the patch in about 3 days, or if approved, as soon as I can. Paul Files affected: src/pmc.c Index: src/pmc.c =================================================================== --- src/pmc.c (revision 21951) +++ src/pmc.c (working copy) @@ -380,9 +380,16 @@ return type; } if (type < enum_type_undef) { - real_exception(interp, NULL, 1, "native type with name '%s' already exists - " - "can't register PMC", data_types[type].name); - return 0; + char *type_name; + if (type < 0) { + strcpy(type_name, "undefined type"); + } + else { + strcpy(type_name, data_types[type].name); + } + real_exception(interp, NULL, 1, + "native type with name '%s' already exists - " + "can't register PMC", type_name); } classname_hash = interp->class_hash;