Fix regression from CL-9387 to handle empty cache properly

The new program cache code from CL-9387 didn't handle the case where
cacheSearch() is called with an empty cache. It would look at the
first node key regardless, which is uninitialized data, and
attempt to follow the left/right node pointers, which were
also uninitialized. This could result in crash or worse.

This CL simply checks if the cache is empty, and if so doesn't
attempt to read the invalid first node.

Affects:
* (all tests with shaders)

VK-GL-CTS issue: 3565

Components: Vulkan, Framework
Change-Id: Ia813d8caf3170b0c1995bdc43a5f345b578ab615
diff --git a/external/vulkancts/framework/vulkan/vkPrograms.cpp b/external/vulkancts/framework/vulkan/vkPrograms.cpp
index 2b06e79..1653ded 100644
--- a/external/vulkancts/framework/vulkan/vkPrograms.cpp
+++ b/external/vulkancts/framework/vulkan/vkPrograms.cpp
@@ -234,8 +234,14 @@
 
 cacheNode* cacheSearch (deUint32 key)
 {
-	cacheNode*		r = (cacheNode*)(cacheMempool + 1);
-	unsigned int	p = 0;
+	cacheNode*		r		= (cacheNode*)(cacheMempool + 1);
+	int*			tail	= (int*)cacheMempool;
+	unsigned int	p		= 0;
+
+	if (!*tail) {
+		// Cache is empty.
+		return 0;
+	}
 
 	while (1)
 	{