[KMS/DRM] Fix for bug #5468: corruption on dynamic cursor changing caused by wrong buffer size.

This commit is contained in:
Manuel Alfayate Corchete 2021-01-17 21:33:51 +01:00
parent 99facb1df3
commit e1d932f8b6
1 changed files with 3 additions and 5 deletions

View File

@ -242,17 +242,15 @@ KMSDRM_ShowCursor(SDL_Cursor * cursor)
/* Prepare a buffer we can dump to our GBM BO (different /* Prepare a buffer we can dump to our GBM BO (different
size, alpha premultiplication...) */ size, alpha premultiplication...) */
bo_stride = KMSDRM_gbm_bo_get_stride(dispdata->cursor_bo); bo_stride = KMSDRM_gbm_bo_get_stride(dispdata->cursor_bo);
bufsize = bo_stride * curdata->h; bufsize = bo_stride * dispdata->cursor_h;
ready_buffer = (uint32_t*)SDL_calloc(1, bufsize);
ready_buffer = (uint32_t*)SDL_malloc(bufsize);
if (!ready_buffer) { if (!ready_buffer) {
ret = SDL_OutOfMemory(); ret = SDL_OutOfMemory();
goto cleanup; goto cleanup;
} }
/* Clean the whole buffer we are preparing. */
SDL_memset(ready_buffer, 0x00, bo_stride * curdata->h);
/* Copy from the cursor buffer to a buffer that we can dump to the GBM BO, /* Copy from the cursor buffer to a buffer that we can dump to the GBM BO,
pre-multiplying by alpha each pixel as we go. */ pre-multiplying by alpha each pixel as we go. */
for (i = 0; i < curdata->h; i++) { for (i = 0; i < curdata->h; i++) {