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

getNativeObject: ensure the js object corresponds to the expected native type #189

Open
krichprollsch opened this issue Jan 19, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@krichprollsch
Copy link
Member

krichprollsch commented Jan 19, 2024

getNativeObject doesn't check if the given js object corresponds to the expected native type.

Indeed, if we pass Car js object instead of a Brand, getNativeObject casts a native Car pointer as a Brand native object, leading to unknown behavior.

See https://github.com/lightpanda-io/jsruntime-lib/blob/main/src/engines/v8/generate.zig#L727

To ways are possible to do the check:

  • use a C++ function to check if the js object prototype corresponds to the expected native type
  • add a second internal field with an integer identifying the native type
@krichprollsch krichprollsch added the bug Something isn't working label Jan 19, 2024
@krichprollsch krichprollsch changed the title getNativeObject: ensure the js value corresponds to the expected type getNativeObject: ensure the js objest corresponds to the expected native type Jan 19, 2024
@krichprollsch krichprollsch changed the title getNativeObject: ensure the js objest corresponds to the expected native type getNativeObject: ensure the js object corresponds to the expected native type Jan 26, 2024
@francisbouvier francisbouvier added this to the Invite Beta milestone Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants