layers: Prevent reading uninitialized "count" when validating array parameters
authorJózef Kucia <joseph.kucia@gmail.com>
Fri, 23 Sep 2016 10:45:04 +0000 (12:45 +0200)
committerTobin Ehlis <tobine@google.com>
Fri, 23 Sep 2016 16:26:32 +0000 (10:26 -0600)
layers/parameter_validation_utils.h

index a1d2e1f..5084d5a 100644 (file)
@@ -174,7 +174,7 @@ bool validate_array(debug_report_data *report_data, const char *apiName, const P
     bool skip_call = false;
 
     // Count parameters not tagged as optional cannot be 0
-    if ((count == 0) && countRequired) {
+    if (countRequired && (count == 0)) {
         skip_call |= log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
                             REQUIRED_PARAMETER, LayerName, "%s: parameter %s must be greater than 0", apiName,
                             countName.get_name().c_str());