factor out checking if buffer could be complete and is valid