libmseed: Fix infinite loop with corrupt files.

See https://seiscode.iris.washington.edu/issues/617 for more
information.