Hi,

It seems there is a type conversion issue in sem_GetTicks. tv_sec is only
"long", and on i386-linux the long arithmetic makes the function return a
very large value after ~2148 seconds.
After that it appears the frame rate limiting code just keeps calling
SDL_SemPost, until it gets to MAX_INT and hangs.

You can systematically add 2140 to now.tv_sec in sem_GetTicks to reproduce
the bug without waiting 35mn.

I generated a patch using the Ubuntu (14.04) package sources, as that's
what I have, but the issue comes from one of the debian patches, and I
think it should apply cleanly.

Regards,
--
Cédric
diff -ru zsnes-1.510+bz2.orig/src/linux/sdllink.c zsnes-1.510+bz2/src/linux/sdllink.c
--- zsnes-1.510+bz2.orig/src/linux/sdllink.c	2014-04-26 18:41:55.564178138 +0200
+++ zsnes-1.510+bz2/src/linux/sdllink.c	2014-04-26 18:42:33.383702707 +0200
@@ -1300,7 +1300,7 @@
   unsigned long long ticks;
 
   gettimeofday(&now, NULL);
-  ticks = (now.tv_sec - sem_start.tv_sec) * 1000000 +
+  ticks = ((unsigned long long)(now.tv_sec - sem_start.tv_sec)) * 1000000 +
 	  (now.tv_usec - sem_start.tv_usec);
   return(ticks);
 }

Reply via email to