You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavf/avio: check that the protocol supports the open mode.
Fix trac ticket #2139.
This commit is contained in:
@@ -119,6 +119,16 @@ static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
|
|||||||
if (up->flags & URL_PROTOCOL_FLAG_NETWORK && !ff_network_init())
|
if (up->flags & URL_PROTOCOL_FLAG_NETWORK && !ff_network_init())
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
#endif
|
#endif
|
||||||
|
if ((flags & AVIO_FLAG_READ) && !up->url_read) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
|
"Impossible to open the '%s' protocol for reading\n", up->name);
|
||||||
|
return AVERROR(EIO);
|
||||||
|
}
|
||||||
|
if ((flags & AVIO_FLAG_WRITE) && !up->url_write) {
|
||||||
|
av_log(NULL, AV_LOG_ERROR,
|
||||||
|
"Impossible to open the '%s' protocol for writing\n", up->name);
|
||||||
|
return AVERROR(EIO);
|
||||||
|
}
|
||||||
uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1);
|
uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1);
|
||||||
if (!uc) {
|
if (!uc) {
|
||||||
err = AVERROR(ENOMEM);
|
err = AVERROR(ENOMEM);
|
||||||
|
Reference in New Issue
Block a user