diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp index e5df7bea54c..777cb4d8e0e 100755 --- a/media_driver/linux/common/ddi/media_libva.cpp +++ b/media_driver/linux/common/ddi/media_libva.cpp @@ -5615,7 +5615,15 @@ VAStatus DdiMedia_PutImage( } //Copy data from image to temp surferce - MOS_STATUS eStatus = MOS_SecureMemcpy(tempSurfData, tempMediaSurface->data_size, imageData, vaimg->data_size); + MOS_STATUS eStatus = MOS_STATUS_SUCCESS; + if (tempMediaSurface->data_size >= vaimg->data_size) + { + eStatus = MOS_SecureMemcpy(tempSurfData, tempMediaSurface->data_size, imageData, vaimg->data_size); + } + else + { + eStatus = MOS_SecureMemcpy(tempSurfData, tempMediaSurface->data_size, imageData, tempMediaSurface->data_size); + } if (eStatus != MOS_STATUS_SUCCESS) { DDI_ASSERTMESSAGE("Failed to copy image to surface buffer.");