Boost logo

Boost :

From: George M. Garner Jr. (gmgarner_at_[hidden])
Date: 2005-12-11 14:49:39


I think that the problem is at regex_traits_defaults.hpp line 191:

static const character_pointer_range<charT>* ranges_end = ranges +

Your algorithm doesn't allow for compiler data alignment. With 8-byte data
alignment (now the default with VC8) sizeof(ranges) == ((19*4)/8+1)*8 == 80.
The compiler warning is correct get_default_class_id() may return a value
between -1 and 20. Add 1 to this return value and you get a range of 0-21
which exceeds the size of masks in

Note that similar code at win32_regex_traits.hpp line 536 is not affected
because the size of masks is 8-byte aligned (for now at least). 64-bit
compilers require 8-byte alignment so I assume that this code will not
compile correctly on those platforms as well.

If you must use this construct ("sizeof(ranges)/sizeof(ranges[0]") then
static assert that this formula yields the same size as your array.

I see that there are a few other non-trivial warnings in my build of the
regex library. My examples were not intended to be exhaustive but to
illustrate the utility of incorporating this into boost's QA.



Boost list run by bdawes at, gregod at, cpdaniel at, john at