Fixes off-by-one error when finding missing endstream
Merge pull request #4404 from timvandermeij/invalid-number-e

Fixes off-by-one error when finding missing endstream