The container class could in principle do bounds checking in its [ ] operator, but that has performance implications if it is done for each access. (Some C++ standard library implementations do that kind of bounds checking for debug builds for example in std::vector but that can significantly reduce performance which already isn’t that great in debug builds.)
Also, the Juce HeapBlock is a very simple wrapper for a pointer, it doesn’t even store the size of the allocation that has been done, so the bounds checking couldn’t be done in that.
