[FFmpeg-trac] #1904(avformat:new): image2: cannot open files not readable by owner

FFmpeg trac at avcodec.org
Fri Nov 9 17:49:52 CET 2012

#1904: image2: cannot open files not readable by owner
             Reporter:  robert    |                     Type:  defect
               Status:  new       |                 Priority:  critical
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
 Summary of the bug:

 file_check() in libavformat/file.c makes loading of image2 sequences fail
 (not tried with other types of files but I guess it afects all users of
 this function). The problem is that it checks if the owner has read
 permissions, but a file can be readable even when the owner has no read
 permissions if "others" have read permission. This tipically happens on
 Android systems, for example in the removable sdcard mounted as

 How to reproduce:

 Call avformat_open_input() with an image filename in a directory that is
 not readable by the owner. For example, in a directory with the following
 permissions: ----r-xr-x

 Proposed fix:

 divVerent in #ffmpeg at irc.freenode.net proposed this fix:

 static int file_check(URLContext *h, int mask)
     int ret = 0;
         if(access(h->filename, R_OK) >= 0)
             ret |= AVIO_FLAG_READ;
         if(access(h->filename, W_OK) >= 0)
             ret |= AVIO_FLAG_WRITE;
     return ret;
 i.e use access() instead of stat(). But he says access() has issues on

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1904>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list