shravanrn / rlbox_api

API implementation for RLBox
1 stars 1 forks source link

getFunctionPointerFromCache uses a bunch of casting #2

Open froydnj opened 6 years ago

froydnj commented 6 years ago

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 commented 6 years ago

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