]> git.sesse.net Git - mlt/commitdiff
riff.cc: Fail if lseek() fails
authorMikko Rapeli <mikko.rapeli@iki.fi>
Mon, 2 Jul 2012 18:44:08 +0000 (21:44 +0300)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Tue, 24 Jul 2012 13:12:06 +0000 (15:12 +0200)
Fixes Coverity CID 709362: Argument cannot be negative (NEGATIVE_RETURNS)
Function "lseek(this->fd, 0LL, 0)" returns a negative number.
Assigning: signed variable "pos" = "lseek".
...
"pos" is passed to a parameter that cannot be negative.
548                fail_if( lseek( fd, pos, SEEK_SET ) == ( off_t ) - 1 );

src/modules/kino/riff.cc

index abe4363b67c59e257892a4972aa1bf6b4c6a0ca1..fff59edb6c26299b92a41ff6dd754afa84a29002 100644 (file)
@@ -542,6 +542,7 @@ void RIFFFile::ParseRIFF( void )
        int container = AddDirectoryEntry( make_fourcc( "FILE" ), make_fourcc( "FILE" ), 0, RIFF_NO_PARENT );
 
        pos = lseek( fd, 0, SEEK_SET );
+       fail_if( pos == -1 );
 
        /* calculate file size from RIFF header instead from physical file. */