Commit 73633b1
committed
stream_curl: don't set initial stream pos to > 0 if it's not seekable
Stream creation happens before calling `demux_open_url()` which calls
`demux_open()` which goes through a demuxer list and calls
`open_given_type()` until success.
`open_given_type()` has an unconditional seek back to pos=0. This works
with non-seekable streams because if we start with pos=0, these calls
buffer the stream, and seeking back happens within the buffer.
But if we start with pos > 0, a seek back will fail as we have no
filled buffer yet. And to make matters worse, the failure is not
communicated between `stream_curl` and `stream`. So subsequent demuxers
tried will assume whatever non-zero position the stream is at, as if
it's actually 0, and parse based on that. Which leads to weird
brokenness at best, and potential security issues at worst.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>1 parent e5486b9 commit 73633b1
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | | - | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1005 | 1012 | | |
1006 | 1013 | | |
1007 | 1014 | | |
| |||
0 commit comments