Summary: | mapi_stub->name points to caller memory leads heap-use-after-free bug | ||
---|---|---|---|
Product: | Mesa | Reporter: | comicfans44 <comicfans44> |
Component: | GLX | Assignee: | mesa-dev |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
comicfans44
2014-08-01 05:46:28 UTC
Qt OpenGL use dynamic allocated memory to test GL extensions. this bug makes every Qt OpenGL app memory corrupted. I'm not sure a simple strdup is the correct way (maybe leak instead of memory corrupt). with this patch, use-heap-after-free didn't happen anyway. diff -Npru mesa-20150314.orig/src/mapi/stub.c mesa-20150314/src/mapi/stub.c --- mesa-20150314.orig/src/mapi/stub.c 2015-03-14 07:32:12.000000000 +0800 +++ mesa-20150314/src/mapi/stub.c 2015-03-16 10:02:46.860273804 +0800 @@ -110,7 +110,7 @@ stub_add_dynamic(const char *name) if (!stub->addr) return NULL; - stub->name = (const void *) name; + stub->name = strdup(name); /* to be fixed later */ stub->slot = -1; A similar commit landed recently in master and is in mesa 10.5.2. Don't think that we'll be doing any more 10.3 or 10.4 releases, but if we do this commit will be in there. commit 1110113a7f0b6f9b21dd26dee8e95a021041c71c Author: Mario Kleiner <mario.kleiner.de@gmail.com> Date: Thu Mar 12 23:34:12 2015 +0100 mapi: Make private copies of name strings provided by client. glXGetProcAddress("glFoo") ends up in stub_add_dynamic() to |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.