Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
38129c26
Commit
38129c26
authored
Dec 16, 2014
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmdutils: check file access functions return values
CC: libav-stable@libav.org Bug-Id: CID 703706
parent
c63dd3f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
cmdutils.c
cmdutils.c
+23
-5
No files found.
cmdutils.c
View file @
38129c26
...
...
@@ -1397,14 +1397,31 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
strerror
(
errno
));
return
AVERROR
(
errno
);
}
fseek
(
f
,
0
,
SEEK_END
);
*
size
=
ftell
(
f
);
fseek
(
f
,
0
,
SEEK_SET
);
ret
=
fseek
(
f
,
0
,
SEEK_END
);
if
(
ret
==
-
1
)
{
ret
=
AVERROR
(
errno
);
goto
out
;
}
ret
=
ftell
(
f
);
if
(
ret
<
0
)
{
ret
=
AVERROR
(
errno
);
goto
out
;
}
*
size
=
ret
;
ret
=
fseek
(
f
,
0
,
SEEK_SET
);
if
(
ret
==
-
1
)
{
ret
=
AVERROR
(
errno
);
goto
out
;
}
*
bufptr
=
av_malloc
(
*
size
+
1
);
if
(
!*
bufptr
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Could not allocate file buffer
\n
"
);
fclose
(
f
);
return
AVERROR
(
ENOMEM
)
;
ret
=
AVERROR
(
ENOMEM
);
goto
out
;
}
ret
=
fread
(
*
bufptr
,
1
,
*
size
,
f
);
if
(
ret
<
*
size
)
{
...
...
@@ -1420,6 +1437,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size)
(
*
bufptr
)[(
*
size
)
++
]
=
'\0'
;
}
out:
fclose
(
f
);
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment