[Bug 59418] New: Potential off-by one in swapchain.c
http://bugs.winehq.org/show_bug.cgi?id=59418 Bug ID: 59418 Summary: Potential off-by one in swapchain.c Product: Wine Version: 11.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: d3d Assignee: wine-bugs@list.winehq.org Reporter: Littlefighter1996@googlemail.com Distribution: --- I'm currently trying to integrate WineD3D into a Linux project of mine, to allow rendering of a D3D8 application with OpenGL. For that, I'm using WineD3D in a modified version as of 11.0 and am building it with sanitizers enabled. For this, I'm reporting only one pixel format in GetPixelFormat. It being a hardcoded one, that will likely be present on most systems. (32-bit, 888, yada-yada). After the first frame is finished rendering, ASAN complains about line 596 being a heap use-after-free in the NVIDIA .so. Looking at what happens, in swapchain.c, the pixel_format at line 594, after "Presenting DC", is obtained from the context_gl->pixel_format field. pixel_format = &wined3d_adapter_gl(swapchain->device->adapter)->pixel_formats[context_gl->pixel_format]; This line seems suspicious to me, at the point where it gets set line 1907, the returned pixel format is directly the one from ChoosePixelFormat, which is 1 index-based according to documentation. This leads me to the assumption, that this is a mistake that has went overlooked, because most of the time more than one pixel format is returned. From my understanding, the line should read: pixel_format = &wined3d_adapter_gl(swapchain->device->adapter)->pixel_formats[context_gl->pixel_format - 1]; ASAN doesn't complain about that part anymore afterwards. I'd suggest to decrease -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59418 --- Comment #1 from Patrick <Littlefighter1996@googlemail.com> --- Created attachment 80387 --> http://bugs.winehq.org/attachment.cgi?id=80387 Suggested patch -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59418 Patrick <Littlefighter1996@googlemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Littlefighter1996@googlemai | |l.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59418 Zeb Figura <z.figura12@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |24df29db0999f4aa21bcf5f593a | |b9009a840a472 Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Keywords| |patch CC| |z.figura12@gmail.com --- Comment #2 from Zeb Figura <z.figura12@gmail.com> --- Thanks for catching that! The patch was committed as 24df29db0999f4aa21bcf5f593ab9009a840a472. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59418 Alexandre Julliard <julliard@winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #3 from Alexandre Julliard <julliard@winehq.org> --- Closing bugs fixed in 11.3. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla