Merge "composer: add check for color metadata length" into display.lnx.9.0
diff --git a/composer/hwc_layers.cpp b/composer/hwc_layers.cpp
index 842269f..497b219 100644
--- a/composer/hwc_layers.cpp
+++ b/composer/hwc_layers.cpp
@@ -24,7 +24,7 @@
 /*
 * Changes from Qualcomm Innovation Center are provided under the following license:
 *
-* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted (subject to the limitations in the
@@ -1261,6 +1261,7 @@
         layer_->update_mask.set(kMetadataUpdate);
       }
       if (new_metadata.dynamicMetaDataValid &&
+          new_metadata.dynamicMetaDataLen < HDR_DYNAMIC_META_DATA_SZ &&
           ((new_metadata.dynamicMetaDataLen != layer_buffer->color_metadata.dynamicMetaDataLen) ||
             !SameConfig(layer_buffer->color_metadata.dynamicMetaDataPayload,
                         new_metadata.dynamicMetaDataPayload, new_metadata.dynamicMetaDataLen))) {