From 22bc6db52ad7e9cb9e56a791b48ee9f4e2798c12 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 2 Feb 2015 17:13:51 +0100 Subject: Chunk: zero data buffers to avoid using unitialized data --- src/World/Chunk.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp index 17b5406..cdc2806 100644 --- a/src/World/Chunk.cpp +++ b/src/World/Chunk.cpp @@ -117,7 +117,10 @@ void Chunk::analyzeChunk() { blockSkyLight.reset(new uint8_t[maxY * SIZE * SIZE / 2]); blockBlockLight.reset(new uint8_t[maxY * SIZE * SIZE / 2]); + std::memset(blockIDs.get(), 0, maxY * SIZE * SIZE); + std::memset(blockData.get(), 0, maxY * SIZE * SIZE / 2); std::memset(blockSkyLight.get(), 0xff, maxY * SIZE * SIZE / 2); + std::memset(blockBlockLight.get(), 0, maxY * SIZE * SIZE / 2); for (auto §ion : *sections) { -- cgit v1.2.3