From 6f0f6b7e3d3a28df29577f7da93f8e3837386ab1 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Fri, 19 Oct 2018 14:22:35 -0500
Subject: [PATCH 2/3] winepulse: Fix local buffer offset wrapping
To: wine-devel <wine-devel@winehq.org>
Reply-To: wine-devel <wine-devel@winehq.org>,Andrew Eikum <aeikum@codeweavers.com>

---
 dlls/winepulse.drv/mmdevdrv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 6b994ada4e..fb2e3678f8 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -1148,6 +1148,7 @@ static DWORD WINAPI pulse_timer_cb(void *user)
                     /* regardless of what PA does, advance one period */
                     adv_bytes = min(This->period_bytes, This->held_bytes);
                     This->lcl_offs_bytes += adv_bytes;
+                    This->lcl_offs_bytes %= This->real_bufsize_bytes;
                     This->held_bytes -= adv_bytes;
                 }else if(This->dataflow == eCapture){
                     pulse_read(This);
-- 
2.19.2

