[FFmpeg-cvslog] qt-faststart: Check the ftello() return codes

Michael Niedermayer git at videolan.org
Mon Mar 3 22:50:33 CET 2014


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 25 00:39:33 2012 +0200| [b3f106cb1f0036ce54ead5b59120fed7d7aa11d7] | committer: Reinhard Tartler

qt-faststart: Check the ftello() return codes

This silences a warning in the coverity static analyzer.

Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 63848854256a024a19435e87d6bc76fffa65e81e)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3f106cb1f0036ce54ead5b59120fed7d7aa11d7
---

 tools/qt-faststart.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index 2b2e00c..5c511a0 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -137,11 +137,11 @@ int main(int argc, char *argv[])
                 goto error_out;
             }
             if (fseeko(infile, -ATOM_PREAMBLE_SIZE, SEEK_CUR) ||
-                fread(ftyp_atom, atom_size, 1, infile) != 1) {
+                fread(ftyp_atom, atom_size, 1, infile) != 1 ||
+                (start_offset = ftello(infile)) < 0) {
                 perror(argv[1]);
                 goto error_out;
             }
-            start_offset = ftello(infile);
         } else {
             int ret;
             /* 64-bit special case */
@@ -202,6 +202,10 @@ int main(int argc, char *argv[])
         goto error_out;
     }
     last_offset    = ftello(infile);
+    if (last_offset < 0) {
+        perror(argv[1]);
+        goto error_out;
+    }
     moov_atom_size = atom_size;
     moov_atom      = malloc(moov_atom_size);
     if (!moov_atom) {



More information about the ffmpeg-cvslog mailing list