Skip to content
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

Handle undefined in a returned array. #31

Merged

Conversation

FGasper
Copy link
Contributor

@FGasper FGasper commented Nov 17, 2021

Issue #30: JS “undefined” causes Duktape’s duk_get_prop_index()
to return false, even though the value does exist. (This is an
apparent bug either in Duktape or its documentation, which suggests
that any existent property should cause a truthy return from that
function.) In that case pl_duk_to_perl_impl() was neglecting to
duk_pop(ctx), which caused the next read on the array to be an attempt
to read index 1 from undefined, which triggered an abort().

This fixes that by ensuring that we always duk_pop(ctx) in the relevant
piece of code.

@FGasper FGasper force-pushed the issue_30_undef_in_eval_returned_array branch 2 times, most recently from ced61fd to dc0110d Compare November 17, 2021 14:11
@FGasper FGasper force-pushed the issue_30_undef_in_eval_returned_array branch from dc0110d to 76bd2e3 Compare December 3, 2021 03:08
Issue gonzus#30: Missing JS array items cause Duktape’s duk_get_prop_index()
to return false. In that case pl_duk_to_perl_impl() was neglecting to
duk_pop(ctx), which caused the next read on the array to be an attempt
to read index 1 from undefined, which triggered an abort().

This fixes that by ensuring that we always duk_pop(ctx) in the relevant
piece of code and return Perl undef to represent missing array items.
@FGasper FGasper force-pushed the issue_30_undef_in_eval_returned_array branch from 76bd2e3 to 1ac30c3 Compare December 3, 2021 03:08
@gonzus gonzus merged commit 36d6576 into gonzus:master Dec 3, 2021
@gonzus
Copy link
Owner

gonzus commented Dec 3, 2021

Merged more or less blindly -- let me know if anything broke. Thanks!

@gflohr
Copy link
Contributor

gflohr commented Jun 21, 2023

Can this be closed?

@FGasper FGasper deleted the issue_30_undef_in_eval_returned_array branch June 21, 2023 13:46
@FGasper
Copy link
Contributor Author

FGasper commented Jun 21, 2023

@gflohr I think the merge of the PR constitutes a “close” of the request.

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