summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-02-13 13:28:57 +0100
committerNicolas George <nicolas.george@normalesup.org>2013-02-24 11:51:16 +0100
commit3d7f4f87267cf260795f28de1f669c3f45e05a28 (patch)
treeae2097404a00e7cab1e578565011c0a5d0dff832 /libavformat
parentbf0712c2f8efe9731ff354870e57653badc07ef6 (diff)
downloadffmpeg-3d7f4f87267cf260795f28de1f669c3f45e05a28.tar.gz
lavf/avio: check that the protocol supports the open mode.
Fix trac ticket #2139.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 6d8a8bb92a..b00cc9d349 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -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())
return AVERROR(EIO);
#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);
if (!uc) {
err = AVERROR(ENOMEM);