Update: UltraVNC 1.4.3.6 and UltraVNC SC 1.4.3.6: https://forum.uvnc.com/viewtopic.php?t=37885
Important: Please update to latest version before to create a reply, a topic or an issue: https://forum.uvnc.com/viewtopic.php?t=37864

Join us on social networks and share our announcements:
- Website: https://uvnc.com/
- GitHub: https://github.com/ultravnc
- Mastodon: https://mastodon.social/@ultravnc
- Facebook: https://www.facebook.com/ultravnc1
- X/Twitter: https://x.com/ultravnc1
- Reddit community: https://www.reddit.com/r/ultravnc
- OpenHub: https://openhub.net/p/ultravnc

Racecondition deteced which leads to crash of vncviewer.exe

Post Reply
kamik-aze
Posts: 1
Joined: 2009-09-23 14:59

Racecondition deteced which leads to crash of vncviewer.exe

Post by kamik-aze »

This problem is reproducible on different machines and different Operating Systems - it occurs in the released version 1.0.8.2 and also with earlier versions. Tested with WinXP 32Bit and Win2008 Server R2 64Bit (both directions server running one one machine and then on the other).

You can reproduce it by trying to connect with a wrong password - but its quite hard to reproduce.

The crash occurs in ClientConnection.cpp svn revision 495 on line 5574 looks like that: if (_this->m_nStatusTimer != 0)

Sometimes the local variable _this seems to be already destroyed, probably by another thread.

Because I didn't want to change a lot of code I inserted a try/ catch block around that region. As long as the exception is just caught and not rethrown the error doesn't occur anymore. I just did that for me because thats not critical, it only happens when an user provided a wrong password. Maybe you can implement a better solution.

Here is what I did, maybe you want to keep that until a better solution is implemented:

Code: Select all

	case WM_DESTROY:
		{
			try
			{
				// sf@2002 - Destroy the status timer... TODO: improve this
				if (_this->m_nStatusTimer != 0) 
				{
					KillTimer(hwnd, _this->m_nStatusTimer);			
					_this->m_nStatusTimer = 0;
				}
				_this->OldEncodingStatusWindow = -1;
				_this->m_fStatusOpen = false;
			}
			catch( ... )
			{
			}
			return TRUE;
		}

But you need to enable C++ Exception with the /EHa compiler flag in the project file in order to catch these kind of exceptions.
Post Reply