joebxu / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

MinidumpGenerator destructor crash #595

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build crash_generation.sln in Visual Studio (2013) after converting via gyp.
2. Run, and hit Client->Request Dump button

Here, we will call MinidumpGenerator::WriteMinidump() - and there are 6 places 
where this calls CloseHandle(): 3 with the dump_file_ HANDLE, and 3 with 
full_dump_file_. Note that neither of these are set to INVALID_HANDLE_VALUE 
after they are closed.

Fast-forward to the destructor of MinidumpGenerator:

 if (dump_file_is_internal_ && dump_file_ != INVALID_HANDLE_VALUE) {
    CloseHandle(dump_file_);
  }

 if (full_dump_file_is_internal_ && full_dump_file_ != INVALID_HANDLE_VALUE) {
    CloseHandle(full_dump_file_);
  }

It will attempt to close these handles again, and crash when doing so.

The fix is of course just to set these handles to INVALID_HANDLE_VALUE after 
calling CloseHandle() in WriteMinidump().

I haven't yet worked out why I am getting a failure condition(since I've only 
just started looking at this today), so I'm not sure exactly how reproducible 
this crash is.

Original issue reported on code.google.com by graeme.k...@gmail.com on 17 Jun 2014 at 1:23