Skip to content

Commit c0ba3a9

Browse files
committed
Explicitly length(NAME) with typemaps other than T_PV
Previously, the length operator on typemaps other than T_PV would lead to that length value not being initialized, leading to segfaults and worse. Worse yet, parsexs would silently emit this erroneous code. For now it will at least give a clear error, in the future we should perhaps consider eliminating this limitation altogether.
1 parent 3ea9ab0 commit c0ba3a9

File tree

1 file changed

+3
-1
lines changed
  • dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS

1 file changed

+3
-1
lines changed

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,9 @@ sub lookup_input_typemap {
14071407
# as a pseudo-parameter, then override the normal typedef - which
14081408
# would emit SvPV_nolen(...) - and instead, emit SvPV(...,
14091409
# STRLEN_length_of_foo)
1410-
if ($xstype eq 'T_PV' and $self->{has_length}) {
1410+
if ($self->{has_length}) {
1411+
die "length(NAME) unsupported with typemaps other than T_PV"
1412+
if $xstype ne 'T_PV';
14111413
die "default value not supported with length(NAME) supplied"
14121414
if defined $default;
14131415
return "($type)SvPV($arg, STRLEN_length_of_$var);",

0 commit comments

Comments
 (0)