We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1199

Summary: crash inside X11_GetWindowTitle: SDL_strdup called with a NULL pointer.
Product: SDL Reporter: gregory.hainaut
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2    
Version: HG 1.2   
Hardware: x86_64   
OS: Linux   

Description gregory.hainaut 2011-05-02 11:55:30 UTC
Dear SDL developers,

I got a crash inside the function X11_GetWindowTitle.
First XGetWindowProperty -> return a NULL pointer for propdata
Then SDL_strdup will be called with a null pointer which it cause a crash.

I look at the X11 code, I got the reply.propertyType = None so prop is only NULL assigned and the function XGetWindowProperty return Success.

I do not know if X11 behavior is correct my application has multiple thread, the access to X11 function are probably not thread-safe. Nevertheless I think SDL must handle this special case gracefully without crashing the entire application.

Maybe a check on propdata could be added.

Best Regards,
Gregory
Comment 1 Sam Lantinga 2012-01-06 22:40:30 UTC
Can you retest with the latest snapshot?
http://www.libsdl.org/tmp/SDL-1.3.zip

Looking at the code, it checks for propdata not being NULL after each call.  It sounds like this is fixed already?

Thanks!
Comment 2 gregory.hainaut 2012-02-03 10:26:51 UTC
(In reply to comment #1)
> Can you retest with the latest snapshot?
> http://www.libsdl.org/tmp/SDL-1.3.zip
> 
> Looking at the code, it checks for propdata not being NULL after each call.  It
> sounds like this is fixed already?
> 
> Thanks!

Yes that good for me. I close the bug report.

Thanks you very much.