-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem regarding r2ghidra installation on Windows #141
Comments
I also get the same issue on Windows 10 |
Is there still no workaround/solution to this? R2Ghidra has been broken a good month now on windows |
I am the only one maintaining the whole r2 and didnt had a chance to fire up a windows yet. It’s in my infinite todo list but if anyone had a chance to take a look i would appreciate it |
Ok, I've figured out the problem, but as for a fix I only got a workaround (I've never worked on public repos before so I apologize). Lines 403 to 463 in a167eaf
This function is the culprit. First of all, if you are on Windows and have compiled Radare2 yourself, you need to manually set a SLEIGHHOME environment variable since none of the folders checked in this function will exist. Second, both of the free calls at line 422 and line 441 cause a crash. Why? I didn't have time to figure out (again, sorry). Line 422 in a167eaf
Line 441 in a167eaf
Since the second free is only reached if SLEIGHHOME isn't set, you only have to care about the first one. I couldn't be bothered recompiling it so I just filled the free call bytes at offset 0x509f3 with NOPs in core_r2ghidra.dll. I don't know if this causes a memory leak but at least it works now, so hopefully this helps out somewhat at least |
r2ai helped here: [r2ai:0x100003a84]> !cat /tmp/a.txt std::string foo() {
char *path = strdup ("/bin/ls");
// const char *path = "/bin/ls";
std::string res (path);
// free (path);
return res;
} [r2ai:0x100003a84]> -i /tmp/a.txt is std::string messing with the heaped value passed as argument that can cause a double free only on windows? A classic C++ gotcha! Yes, you are correct. The The reason for this is that On Windows, the heap implementation used by Visual Studio (and possibly other compilers) does not handle To avoid this issue, you can use std::string foo() { By using a char path[] = "/bin/ls"; This approach avoids the slicing issue altogether and ensures that the original string is not modified. [r2ai:0x100003a84]> |
thanks for digging in the bug, now it makes sense, but it's a bit fuckedup by c++ standards, it's now fixed in master :) will release 5.9.4 soon |
Wait. I’ll dig a bit more because this doesn’t seems to be the correct fix and i’ll see if i can make a small reproducer |
Yeah, I noticed today as well, there are some other frees causing heap corruption. Don't know if NOP:ing all of them out is a good idea... Line 308 in 11d3ba7
This line in core ghidra also caused a crash earlier today and it too was caused by heap corruption, specifically after trying to free the char* code in the RCodeMeta struct. Since multiple free calls are causing this issue, I assume the heap corruption must sometime before the getSleighhome call (since the crash occurs there first), and windows doesn't recognize it until a call to free is made. |
I'm using r2ghidra 5.9.4 but the issue seems not resolved. |
Hello,
I am having an issue regarding the installation of the plugin on Windows 11 x64 machines. I downloaded the latest release of radare2 from the github for w64 and extracted the binaries on the system. The tool worked as expected when I tried it on a sample binary file.
Then I tried installing the r2ghidra plugin using the latest pre-compiled dll for w64 and, as instructed in the readme of the plugin, I ran the command
r2 -hh
in order to find theR2_USER_PLUGINS
(output of the command provided in screenshot).I then copied the dll to
C:\Users\<user>\.local\share\radare2\plugins
.But now, when I try to use the radare2 tool, I get the following error.
Note: I tried installing the plugin using the r2pm also, but the command did not work.
Please help!
Thank you!
The text was updated successfully, but these errors were encountered: