Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

getFunctionPointerFromCache uses a bunch of casting #2

Open
froydnj opened this issue Jul 31, 2018 · 1 comment
Open

getFunctionPointerFromCache uses a bunch of casting #2

froydnj opened this issue Jul 31, 2018 · 1 comment

Comments

@froydnj
Copy link
Contributor

froydnj commented Jul 31, 2018

The sandbox member variable fnPointerMap is declared as void*, yet is only even used as std::map<...> *. Why is the casting necessary? Shouldn't the member variable just be std::map<...>*?

https://github.com/shravanrn/rlbox_api/blob/master/rlbox.h#L1118-L1139

@shravanrn
Copy link
Owner

Good point. I originally had this as std::map. However, I changed this to the above as when using this library in Firefox, including the map header caused compilation issues. Therefore I wanted the ability to use the API without the map header

In this use case, since we don't have a map (aka the function pointer cache) we performed symbol resolution manually prior to call and then used sandbox_invoke_with_fnptr instead of sandbox_invoke. Thus getFunctionPointerFromCache is never invoked, and no code with std::map exists in the binary.

Note, that this the code has since evolved significantly and I'm not sure if the limitations that originally required this change still apply... So, its worth investigating if I can just change this back

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

No branches or pull requests

2 participants