From: Francisco Jerez Date: Sat, 19 Nov 2011 20:31:28 +0000 (+0100) Subject: nv50/ir: Don't crash on zero sized BitSets. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=349cb60ed58e42341351c5f0ebd186acb8f12005;p=mesa.git nv50/ir: Don't crash on zero sized BitSets. --- diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp index 56d53b48ddd..4eaaa9602c1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_util.cpp @@ -219,6 +219,7 @@ bool BitSet::allocate(unsigned int nBits, bool zero) if (zero) memset(data, 0, (size + 7) / 8); else + if (nBits) data[(size + 31) / 32 - 1] = 0; // clear unused bits (e.g. for popCount) return data;