Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.67/5 (3 votes)
See more:
Hi All,

I have a dll , of which an API I am using in my app , I am expecting a crash in DLL when a large data is fed to the API , will this also crash my app ?

What I have tried:

I am trying to write a fuzzer to detect crashes in DLLs
Posted
Updated 21-Jun-23 1:55am

Yes. The DLL code is mapped in the process memory space, see, for instance: About Dynamic-Link Libraries - Win32 apps | Microsoft Learn[^].
 
Share this answer
 
A DLL becomes part of your process once loaded. If every action you take related to the DLL (including loading/unloading, if applicable) is wrapped in a try...catch() block, any exceptions that escape from the DLL will be trapped by your process and you can manage them as best you can. Some classes of error might not be amenable to this approach, though, like resource errors. If your computer is forced to reboot itself, well, there's not much you can do except try to find and fix the problem.
 
Share this answer
 
Comments
Bruno van Dooren 21-Jun-23 17:13pm    
using try ... catch across dll boundaries is a bad idea though. There are no guarantees that this will work properly unless everything is built against the same runtime version with compatible compiler and linker settings.
Either the DLL should catch everything before the exception leaves the dll, and properly terminate, or the app should be allowed to crash. Undefined behavior is often worse than a crash.
YrthWyndAndFyre 21-Jun-23 17:19pm    
Oh, fully aware, but given that the alternative is a blind crash, even the opportunity to gain a controlled shut-down and gather a little intelligence along the way has to be an improvement, wouldn't you say? Far from perfect, certainly - no argument. But on the other hand, under the circumstances, anything is an improvement over nothing. After all, if you can gain any kind of intelligence, you can always proceed to the blind crash with a simple "throw;".
Bruno van Dooren 22-Jun-23 1:48am    
Fair point. Gather what info you can, log some state and then continue the crash.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900