diff --git a/CHANGELOG.md b/CHANGELOG.md index d37f06ca..b2294956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Level zero loader changelog -## v1.15.7 +## v1.15.8 * Fix build when using clang-cl on Windows * set RUNTIME DESTINATION in install for layer libraries * added github actions runs on latest windows * Windows.h replaced with windows.h * Added support for enabling/disabling tracing layer during runtime +* check in DriverGet to verify the dditable pointer is valid ## v1.15.1 * Fix Windows build for Control Flow Guard Mitigation. ## v1.15.0 diff --git a/scripts/templates/libapi.cpp.mako b/scripts/templates/libapi.cpp.mako index 1506b3e6..a0d071cb 100644 --- a/scripts/templates/libapi.cpp.mako +++ b/scripts/templates/libapi.cpp.mako @@ -113,7 +113,7 @@ ${th.make_func_name(n, tags, obj)}( return ${X}_RESULT_ERROR_UNINITIALIZED; } -%if re.match("DriverGet", obj['name']): +%if re.match(r"\w+DriverGet$", th.make_func_name(n, tags, obj)): if (${x}_lib::context->${n}DdiTable == nullptr) { return ${X}_RESULT_ERROR_UNINITIALIZED; } diff --git a/source/lib/ze_libapi.cpp b/source/lib/ze_libapi.cpp index 264be8d2..e3bfede5 100644 --- a/source/lib/ze_libapi.cpp +++ b/source/lib/ze_libapi.cpp @@ -114,6 +114,10 @@ zeDriverGet( return ZE_RESULT_ERROR_UNINITIALIZED; } + if (ze_lib::context->zeDdiTable == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGet = ze_lib::context->zeDdiTable.load()->Driver.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) diff --git a/source/lib/zes_libapi.cpp b/source/lib/zes_libapi.cpp index 37cefd7b..1596b0b7 100644 --- a/source/lib/zes_libapi.cpp +++ b/source/lib/zes_libapi.cpp @@ -109,6 +109,10 @@ zesDriverGet( return ZE_RESULT_ERROR_UNINITIALIZED; } + if (ze_lib::context->zesDdiTable == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGet = ze_lib::context->zesDdiTable.load()->Driver.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized)