Commit aa2666f9 by Alexis Hetu Committed by Alexis Hétu

Properly initializing image's memory

MSAN detected uninitialized memory which caused many test failures. This can be easily fixed by zeroing out the memory before calling XCreateImage. Change-Id: I913c818ef38446055af7fd6aa885028e5f3f8bfb Reviewed-on: https://swiftshader-review.googlesource.com/12388Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent aa8239a5
...@@ -85,8 +85,11 @@ namespace sw ...@@ -85,8 +85,11 @@ namespace sw
if(!mit_shm) if(!mit_shm)
{ {
buffer = new char[width * height * 4]; int bytes_per_line = width * 4;
x_image = libX11->XCreateImage(x_display, visual, depth, ZPixmap, 0, buffer, width, height, 32, width * 4); int bytes_per_image = height * bytes_per_line;
buffer = new char[bytes_per_image];
memset(buffer, 0, bytes_per_image);
x_image = libX11->XCreateImage(x_display, visual, depth, ZPixmap, 0, buffer, width, height, 32, bytes_per_line);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment