[PATCH 6/7] wined3d: Validate stream_idx in wined3d_device_set_stream_source_freq().

Józef Kucia jkucia at codeweavers.com
Wed Jan 27 17:17:51 CST 2016


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
This and the following patch are just to prevent a potential memory corruption.
---
 dlls/wined3d/device.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e937abc..f41f043 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1412,6 +1412,12 @@ HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *devic
         return WINED3DERR_INVALIDCALL;
     }
 
+    if (stream_idx >= MAX_STREAMS)
+    {
+        FIXME("Stream index %u out of range.\n", stream_idx);
+        return WINED3DERR_INVALIDCALL;
+    }
+
     stream = &device->update_state->streams[stream_idx];
     old_flags = stream->flags;
     old_freq = stream->frequency;
-- 
2.4.10




More information about the wine-patches mailing list