forked from FFmpeg/FFmpeg
avio: Fix sanity checks in ffurl_read*
This fixes e.g. reading data over HTTP, where the underlying socket is set to read/write. Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
7bbb67d580
commit
26f6b8c571
1 changed files with 2 additions and 2 deletions
|
@ -289,14 +289,14 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
|
||||||
|
|
||||||
int ffurl_read(URLContext *h, unsigned char *buf, int size)
|
int ffurl_read(URLContext *h, unsigned char *buf, int size)
|
||||||
{
|
{
|
||||||
if (h->flags & AVIO_FLAG_WRITE)
|
if (!(h->flags & AVIO_FLAG_READ))
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
|
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
|
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
|
||||||
{
|
{
|
||||||
if (h->flags & AVIO_FLAG_WRITE)
|
if (!(h->flags & AVIO_FLAG_READ))
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
|
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue