You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing native code interacting with untrusted wasm. I'm using wasm_externref_ref2obj/obj2ref to convert from my native objects to/from refs to pass to the wasm. I have multiple different object types that I convert using this API. However I find that the wasm can easily crash my code by passing a reference number to the wrong API.
For example, if I have to type font_t and buffer_t, then passing a reference belonging to a font_t to an API taking a buffer_t will successfully pass ref2obj and my native code will try to treat the returned void* object as a buffer object, whereas it's actually a font object.
Am I missing something? Or is this not possible and my native code has to have a way to know what object type it's dealing with (like eg. Javascript or Python etc would know)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm writing native code interacting with untrusted wasm. I'm using
wasm_externref_ref2obj/obj2ref
to convert from my native objects to/from refs to pass to the wasm. I have multiple different object types that I convert using this API. However I find that the wasm can easily crash my code by passing a reference number to the wrong API.For example, if I have to type font_t and buffer_t, then passing a reference belonging to a font_t to an API taking a buffer_t will successfully pass
ref2obj
and my native code will try to treat the returnedvoid*
object as a buffer object, whereas it's actually a font object.Am I missing something? Or is this not possible and my native code has to have a way to know what object type it's dealing with (like eg. Javascript or Python etc would know)?
Beta Was this translation helpful? Give feedback.
All reactions