verify the bounds before allocation