va: validate inputs in vaSetDriverName() before use Add CHECK_DISPLAY(dpy) before CTX(dpy) to validate the display handle, and add a NULL check for driver_name before calling strlen(). Without these guards, passing NULL for either argument causes a null-pointer dereference instead of returning a proper error status. This aligns vaSetDriverName() with the validation pattern used by other public APIs in va.c. Signed-off-by: Carl.Zhang <carl.zhang@intel.com>
diff --git a/va/va.c b/va/va.c index d87661a..15b3e52 100644 --- a/va/va.c +++ b/va/va.c
@@ -627,9 +627,10 @@ VADriverContextP ctx; VAStatus vaStatus = VA_STATUS_SUCCESS; char *override_driver_name = NULL; + CHECK_DISPLAY(dpy); ctx = CTX(dpy); - if (strlen(driver_name) == 0 || strlen(driver_name) >= 256) { + if (!driver_name || strlen(driver_name) == 0 || strlen(driver_name) >= 256) { vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER; va_errorMessage(dpy, "vaSetDriverName returns %s\n", vaErrorStr(vaStatus));