Skip to content

Explicitly reject length(NAME) with typemaps other than T_PV #23479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: blead
Choose a base branch
from

Conversation

Leont
Copy link
Contributor

@Leont Leont commented Jul 27, 2025

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, ExtUtils::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.

  • This contains a changelog entry for ExtUtils::ParseXS instead of a perldelta

@Leont Leont requested a review from iabyn July 27, 2025 07:57
@Leont
Copy link
Contributor Author

Leont commented Jul 27, 2025

This one caused my a bunch of grief related to #23150 before I figured out what was going on.

@iabyn
Copy link
Contributor

iabyn commented Jul 27, 2025

It needs test(s) for the new error message. Other than that, I approve.

@jkeenan
Copy link
Contributor

jkeenan commented Jul 27, 2025

It needs test(s) for the new error message. Other than that, I approve.

Currently, in dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm's lookup_input_typemap(), there already exists one error condition at the point where the p.r. proposes to insert a new die. That existing die itself appears to be unexercised in the test suite.

$ ack 'default value not supported' dist/ExtUtils-ParseXS/
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Node.pm
1411:            die "default value not supported with length(NAME) supplied"

Could we write tests for both conditions in this p.r.?

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.
@Leont Leont force-pushed the parsexs-length-t_pv branch from bdf5a3f to e214089 Compare July 27, 2025 20:23
@Leont
Copy link
Contributor Author

Leont commented Jul 27, 2025

It needs test(s) for the new error message. Other than that, I approve.

Added that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants