Just a bit of an update. It turns out that the fact that the code was working before was just a fluke.
It was just a lucky coincidence like before.
The real culprit was Boost.Foreach.
For some reason, something like this:
const char LETTERS[] = { 'A', 'B' };
BOOST_FOREACH( char letter, LETTERS ) {
// ...
}
was not iterating the correct number of times and that was the result of the segfault. I'm trying to figure out if it was a bug in my code (which ATM seems unlikely) or a bug with Boost.Foreach and arrays.
In any case, your suspicion that the code was falling off the end of an array was correct.