shithub: cstory

Download patch

ref: 752b4cee3f9dd968e9129b185fca90bb76b9dede
parent: befb5f7fb5b7f7d046e0a0b931b1fbfbb31ce06e
author: Gabriel Ravier <gabravier@gmail.com>
date: Mon Jan 6 05:53:43 EST 2020

Correct bug in which Backend_LockSurface would not initialize surface->pixels, leaving a bug in which Backend_UnlockSurface used uninitialized values in certain scenarios (such as in ScaleAndUploadSurface)

Signed-off-by: Gabriel Ravier <gabravier@gmail.com>

--- a/src/Backends/Rendering/SDLTexture.cpp
+++ b/src/Backends/Rendering/SDLTexture.cpp
@@ -154,7 +154,7 @@
 
 	*pitch = surface->width * 3;
 
-	surface->pixels = (unsigned char*)malloc(surface->width * surface->height * 3);
+	surface->pixels = (unsigned char*)calloc(surface->width * surface->height * 3, 1);	// Make sure these are initialized
 
 	return surface->pixels;
 }
--