From 78484b5f5bc93b6ea2f554c371872eed16236d6d Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 22 Jan 2020 13:43:08 +1030 Subject: [PATCH] codec/h264/lex.go: fixed handling of errors from ScanUntil --- codec/h264/lex.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/codec/h264/lex.go b/codec/h264/lex.go index 633d3f53..6159a15e 100644 --- a/codec/h264/lex.go +++ b/codec/h264/lex.go @@ -72,7 +72,13 @@ func Lex(dst io.Writer, src io.Reader, delay time.Duration) error { var err error buf, b, err = c.ScanUntil(buf, 0x00) if err != nil { - return err + if err != io.EOF { + return err + } + if len(buf) != 0 { + return io.ErrUnexpectedEOF + } + return io.EOF } for n := 1; b == 0x0 && n < 4; n++ {