Open krichprollsch opened 8 months ago
getNativeObject doesn't check if the given js object corresponds to the expected native type.
getNativeObject
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.
Car
Brand
See https://github.com/lightpanda-io/jsruntime-lib/blob/main/src/engines/v8/generate.zig#L727
To ways are possible to do the check:
getNativeObject
doesn't check if the given js object corresponds to the expected native type.Indeed, if we pass
Car
js object instead of aBrand
,getNativeObject
casts a nativeCar
pointer as aBrand
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: