mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
Previously filesrc would segfault when fed with the name of a directory.
Original commit message from CVS: Previously filesrc would segfault when fed with the name of a directory. Added check to ensure that the given file is a regular file.
This commit is contained in:
parent
f1e89caecd
commit
7b1d5c7abd
2 changed files with 20 additions and 0 deletions
|
@ -555,6 +555,16 @@ gst_filesrc_open_file (GstFileSrc *src)
|
|||
src->filename, strerror (errno), NULL);
|
||||
return FALSE;
|
||||
} else {
|
||||
/* check if it is a regular file, otherwise bail out */
|
||||
struct stat stat_results;
|
||||
fstat(src->fd, &stat_results);
|
||||
if (!S_ISREG(stat_results.st_mode)) {
|
||||
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
|
||||
src->filename, NULL);
|
||||
close(src->fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* find the file length */
|
||||
src->filelen = lseek (src->fd, 0, SEEK_END);
|
||||
lseek (src->fd, 0, SEEK_SET);
|
||||
|
|
|
@ -555,6 +555,16 @@ gst_filesrc_open_file (GstFileSrc *src)
|
|||
src->filename, strerror (errno), NULL);
|
||||
return FALSE;
|
||||
} else {
|
||||
/* check if it is a regular file, otherwise bail out */
|
||||
struct stat stat_results;
|
||||
fstat(src->fd, &stat_results);
|
||||
if (!S_ISREG(stat_results.st_mode)) {
|
||||
gst_element_error (GST_ELEMENT (src), "opening file \"%s\" failed. it isn't a regular file",
|
||||
src->filename, NULL);
|
||||
close(src->fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* find the file length */
|
||||
src->filelen = lseek (src->fd, 0, SEEK_END);
|
||||
lseek (src->fd, 0, SEEK_SET);
|
||||
|
|
Loading…
Reference in a new issue