#9274: avio_open_dir / avio_close_dir seems to be broken
-------------------------------------+-------------------------------------
Reporter: | Type: defect
rudolfs.bundulis |
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
when using avio_open_dir / avio_close_dir, avio_close_dir manages to close
fd 0, thus messing up further open calls. Found this while making a video
filter that was enumerating a directory and used these functions for the
enumeration. Further open() calls returned 0 and I was not able to
understand why. Removing a call to avio_close_dir() fixed that, and then
when debugging found that this is what happens:
1) avio_close_dir() calls ffurl_close()
2) ffurl_close() calls ffurl_closep()
3) ffurl_closep() does
if (h->is_connected && h->prot->url_close)
ret = h->prot->url_close(h);
where for file protocol url_close is set to file_close, which
when invoked will call close on c->fd which has never been set in case
of a
directory
For me I'll just fallback to plain POSIX calls for this and seems that
ffmpeg code base is not using these calls anywhere, but then at least to
save others some amount of gray hair this should either be fixed (not sure
what is the best approach) or at least calls marked as unsafe?
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9274>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker_______________________________________________
FFmpeg-trac mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".