util: abort construction of zero-sized bit arrays

This commit is contained in:
Christian Helmuth 2014-06-19 12:14:48 +02:00 committed by Norman Feske
parent 963551877f
commit 7abc1733c5
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ namespace Genode {
_word_cnt(_bit_cnt / _BITS_PER_WORD), _word_cnt(_bit_cnt / _BITS_PER_WORD),
_words(addr) _words(addr)
{ {
if (bits % _BITS_PER_WORD) throw Invalid_bit_count(); if (!bits || bits % _BITS_PER_WORD) throw Invalid_bit_count();
memset(_words, 0, sizeof(addr_t)*_word_cnt); memset(_words, 0, sizeof(addr_t)*_word_cnt);
} }