I am using some DLL files in my Java application using JNI library.
The dlls are not written by me and I do not have access to their source codes. They are so buggy and throw lots of exceptions. Needless to say that they are making my java application unstable since unhandled exceptions in native side crash the java application.
I was thinking to reverse engineer the dll files and add some try
and catch
clause there or maybe just find the culprit line and add some prevention there.
The exceptions are mainly due to dereferencing a null pointer which I believe I can fix them by a couple of instructions (cmp
and jmp
)
So what I am trying to ask are as follow:
- Is it practically doable?
- Is IDA the right tool to do so?
Edit : Another solution that I am guessing could fix the problem is to write a new native class and wrap all native functions that i am using in the new functions with error handling. But I have a lot of native functions and this solution could be tedious and cumbersome. So, still, reverse engineering DLLs is my number one solution. Comments are really welcome. Please share your views.