MCHSL / extools

Various extensions for the BYOND game engine.
MIT License
29 stars 41 forks source link

TFFI crashes when using byondcrypt #28

Closed ghost closed 4 years ago

ghost commented 4 years ago

Tested Versions: 512.1488, 513.1508
Extools Version: latest master(44a2afb3942d1af6c8e18ce6d7a933396d0019b3) - 513 had a modified signature OS: Windows 10, version 1909, build 18363.592
DLL being used: https://github.com/steamp0rt/byond-crypt
DM code: call_wait(BYONDCRYPT, "bcrypt_hash", data["password"])
DM branch: https://github.com/steamp0rt/HippieStation-1/tree/external-auth

(below stuff is for 512.1488 test) VS exception:

Exception thrown at 0x00242F0A in dreamdaemon.exe: 0xC0000005: Access violation reading location 0x00000030.

Thrown at tffi.cpp, line 60.

VS Autos:


  | Name | Value | Type
-- | -- | -- | --
  | StartTiming | byondcore.dll!0x77b9bb90 (load symbols for additional information) | void(*)(SuspendedProc *)
  | internal_id | 0.000000000 | float
◢ | lk | {_Pmtx=0x79f7e7e8 {byond-extools.dll!std::mutex unsuspend_ready_mutex} {...} _Owns=true } | std::unique_lock<std::mutex>
  | ▶ _Pmtx | 0x79f7e7e8 {byond-extools.dll!std::mutex unsuspend_ready_mutex} {...} | std::mutex *
  | _Owns | true | bool
◢ | suspended_procs | { size=1 } | std::map<float,SuspendedProc *,std::less<float>,std::allocator<std::pair<float const ,SuspendedProc *>>>
  | ▶ [comparator] | less | std::_Compressed_pair<std::less<float>,std::_Compressed_pair<std::allocator<std::_Tree_node<std::pair<float const ,SuspendedProc *>,void *>>,std::_Tree_val<std::_Tree_simple_types<std::pair<float const ,SuspendedProc *>>>,1>,1>
  | ▶ [allocator] | allocator | std::_Compressed_pair<std::allocator<std::_Tree_node<std::pair<float const ,SuspendedProc *>,void *>>,std::_Tree_val<std::_Tree_simple_types<std::pair<float const ,SuspendedProc *>>>,1>
  | ▶ [0.000000000] | 0x1b62aa48 {unknown=0x1b62aa48 "÷," time_to_resume=0 } | std::pair<float const ,SuspendedProc *>
  | ▶ [Raw View] | {...} | std::map<float,SuspendedProc *,std::less<float>,std::allocator<std::pair<float const ,SuspendedProc *>>>
◢ | unsuspend_ready_cv | {_Cnd_storage={_Val=2045799156 _Pad=0x79f7e880 "ôjðy" } } | std::condition_variable
  | ▶ _Cnd_storage | {_Val=2045799156 _Pad=0x79f7e880 "ôjðy" } | std::_Align_type<int,40>
◢ | unsuspend_ready_mutex | {...} | std::mutex
  | ▶ std::_Mutex_base | {_Mtx_storage={_Val=2 _Pad=0x79f7e7e8 "\x2" } } | std::_Mutex_base

VS Locals:


  | Name | Value | Type
-- | -- | -- | --
◢ | a | { size=1 } | std::vector<char const *,std::allocator<char const *>>
  | [capacity] | 1 | int
  | ▶ [allocator] | allocator | std::_Compressed_pair<std::allocator<char const *>,std::_Vector_val<std::_Simple_types<char const *>>,1>
  | ▶ [0] | 0x235795fc "poopword" | const char *
  | ▶ [Raw View] | {_Mypair=allocator } | std::vector<char const *,std::allocator<char const *>>
◢ | args | { size=1 } | std::vector<std::string,std::allocator<std::string>>
  | [capacity] | 1 | int
  | ▶ [allocator] | allocator | std::_Compressed_pair<std::allocator<std::string>,std::_Vector_val<std::_Simple_types<std::string>>,1>
  | ▶ [0] | "poopword" | std::string
  | ▶ [Raw View] | {_Mypair=allocator } | std::vector<std::string,std::allocator<std::string>>
  | internal_id | 0.000000000 | float
◢ | lk | {_Pmtx=0x79f7e7e8 {byond-extools.dll!std::mutex unsuspend_ready_mutex} {...} _Owns=true } | std::unique_lock<std::mutex>
  | ▶ _Pmtx | 0x79f7e7e8 {byond-extools.dll!std::mutex unsuspend_ready_mutex} {...} | std::mutex *
  | _Owns | true | bool
  | n_args | 1 | int
  | proc | 0x7a1d1530 {byondcrypt.dll!_bcrypt_hash} | const char *(*)(int, const char * *)
  | promise_id | 156884 | int
◢ | res | 0x2357d760 "$2b$12$rYynn2eUZUJl1Po8GcSWyuzYfYfPTuRp6zIS5.8cDlhCyWCltrG1y" | const char *
  |   | 36 '$' | const char

VS Call Stack:

    dreamdaemon.exe!00242f0a()  Unknown
    dreamdaemon.exe![Frames below may be incorrect and/or missing, no symbols loaded for dreamdaemon.exe]   Unknown
    [External Code] 
>   byond-extools.dll!ffi_thread(const char *(*)(int, const char * *) proc, int promise_id, int n_args, std::vector<std::string,std::allocator<std::string>> args) Line 60  C++
    [External Code] 
    byond-extools.dll!thread_start<unsigned int (__stdcall*)(void *),1>(void * const parameter) Line 97 C++
    [External Code] 
ThatLing commented 4 years ago

Ah yes, I see the problem. Your module is made in rust.

ghost commented 4 years ago

@ThatLing Please explain how this is a problem. Normal BYOND can execute Rust modules (how do you think rust-g works?!), and TFFI attempts to replicate the BYOND call()() behavior.

MCHSL commented 4 years ago

better nate than lever