detect tag/length overflows

shoutout to @andreas23