winmm: Handle GetTickCount overflow in MIDI player.

Joerg-Cyril.Hoehle at Joerg-Cyril.Hoehle at
Thu Feb 14 05:58:03 CST 2013


after reading the SafeInt integer overflow & signedness issues paper I had very bad feelings.

I reviewed a few uses of GetTickCount in Wine
- DSound not reviewed
- winmm time -- hard to tell, involves signed integers as well
- winealsa ok (pass through to slot mTime)
- winmm & mciseq share the same bug in MIDI, here's a fix for winmm.

I feel very uncomfortable about the overflow&sign issue. I think it's something where you really
need tool support, because when reviewing code manually, an error in this class is very easily overseen.

I've not checked whether my patch actually helps with overflows. Instrumenting Wine with a GetTickCount
(and other counters) near overflow would be an interesting exercise.  Some people actually run
Wine long enough for that to happen!

Feedback is welcome.
 Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-winmm-Handle-GetTickCount-overflow-in-MIDI-player.patch
Type: application/octet-stream
Size: 1032 bytes
Desc: 0001-winmm-Handle-GetTickCount-overflow-in-MIDI-player.patch
URL: <>

More information about the wine-patches mailing list