format: aborting if flag size is 0

References #6. If flag size is 0 (invalid) it gets stuck in an infinite loop.