http://bugs.winehq.org/show_bug.cgi?id=29041
--- Comment #22 from Erik Weatherwax erik.weatherwax@gmail.com 2011-11-15 15:17:10 CST --- Bruno,
The issue I see with your patch is that color is only set to nonzero at line 2121 in an "if(iconinfo->hbmColor)" block immediately above. I can't comment on the *correctness* of your change, since I'm far from familiar enough with the Win32 API to know what these functions are actually *doing* on a high level, but I do know that, logically, we can't be referencing a null iconinfo->hbmColor in the code you patched.
There is another unchecked reference to iconinfo->hbmColor at line 2163 which I think is where the crash is triggered. Ahmed's patch, by short-circuiting out of the function when iconinfo->hbmColor is null, avoids that reference.
Again, I can comment on the logic of the program flow all day, but since I don't really know what this code is supposed to accomplish, I don't know the best way to fix it. Is it acceptable to return 0 from CreateIconIndirect when iconinfo->hbmColor is null, or does there need to be a test for that around the call to create_alpha_bitmap on line 2163?