Commit ec0e66e5 authored by Austin Yuan's avatar Austin Yuan

Added a "magic" number to VADisplayContext in case an illeal VA dpy passed in

Signed-off-by: default avatarAustin Yuan <shengquan.yuan@intel.com>
parent 2135de7e
...@@ -58,7 +58,7 @@ static int va_debug_trace = 0; ...@@ -58,7 +58,7 @@ static int va_debug_trace = 0;
static int vaDisplayIsValid(VADisplay dpy) static int vaDisplayIsValid(VADisplay dpy)
{ {
VADisplayContextP pDisplayContext = (VADisplayContextP)dpy; VADisplayContextP pDisplayContext = (VADisplayContextP)dpy;
return pDisplayContext && pDisplayContext->vaIsValid(pDisplayContext); return pDisplayContext && (pDisplayContext->vadpy_magic == 0x789abcde) && pDisplayContext->vaIsValid(pDisplayContext);
} }
static void va_errorMessage(const char *msg, ...) static void va_errorMessage(const char *msg, ...)
......
...@@ -398,6 +398,8 @@ struct VADriverContext ...@@ -398,6 +398,8 @@ struct VADriverContext
struct VADisplayContext struct VADisplayContext
{ {
int vadpy_magic;
VADisplayContextP pNext; VADisplayContextP pNext;
VADriverContextP pDriverContext; VADriverContextP pDriverContext;
......
...@@ -189,6 +189,8 @@ VADisplay vaGetDisplay ( ...@@ -189,6 +189,8 @@ VADisplay vaGetDisplay (
dri_state = calloc(1, sizeof(*dri_state)); dri_state = calloc(1, sizeof(*dri_state));
if (pDisplayContext && pDriverContext && dri_state) if (pDisplayContext && pDriverContext && dri_state)
{ {
pDisplayContext->vadpy_magic = 0x789abcde;
pDriverContext->x11_dpy = native_dpy; pDriverContext->x11_dpy = native_dpy;
pDisplayContext->pNext = pDisplayContexts; pDisplayContext->pNext = pDisplayContexts;
pDisplayContext->pDriverContext = pDriverContext; pDisplayContext->pDriverContext = pDriverContext;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment