Better boundary checks when reading payloads.