Fixes Coverty CID 710879: Uninitialized pointer field (UNINIT_CTOR)
n-static class member ""queue"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.child" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.close" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.event_listener" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.is_stopped" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.local" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.put" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.queue" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.start" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.stop" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.threads" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "consumer.worker_threads" is not initialized in this constructor nor in any functions that it calls.
Mikko Rapeli [Tue, 31 Jul 2012 12:11:13 +0000 (14:11 +0200)]
rtaudio/RtAudio.h: initialize variables
Fixes Coverity CID 710878: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""bufferSize"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""channelOffset"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""deviceFormat"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""deviceInterleaved"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""doByteSwap"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""doConvertBuffer"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""latency"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""mode"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""nBuffers"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""nDeviceChannels"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""nUserChannels"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""sampleRate"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""state"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""streamTime"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""userBuffer"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""userFormat"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""userInterleaved"" is not initialized in this constructor nor in any functions that it calls.
654 :apiHandle(0), deviceBuffer(0) { device[0] = 11111; device[1] = 11111; }
Mikko Rapeli [Tue, 31 Jul 2012 11:41:03 +0000 (13:41 +0200)]
rtaudio/RtAudio.h: initialize variable
Fixes Coverity CID 710877: Uninitialized scalar field (UNINIT_CTOR)
Class member declaration for ""thread"".
535 ThreadHandle thread;
...
Non-static class member ""thread"" is not initialized in this constructor nor in any functions that it calls.
543 :object(0), callback(0), userData(0), apiInfo(0), isRunning(false) {}
Mikko Rapeli [Tue, 31 Jul 2012 11:36:57 +0000 (13:36 +0200)]
rtaudio/RtAudio.cpp: check for null pointer
Fixes Coverity CID 710858: Dereference after null check (FORWARD_NULL)
Comparing "this->rtapi_" to null implies that "this->rtapi_" might be null.
146 if ( rtapi_ ) return;
...
Passing null variable "this->rtapi_" to function "RtApi::getDeviceCount()", which dereferences it. (The dereference happens because this is a virtual function call.)
159 if ( rtapi_->getDeviceCount() ) break;
Fixes Coverity CID 709363: Argument cannot be negative (NEGATIVE_RETURNS)
Function "ftell(f)" returns a negative number.
Assigning: signed variable "lSize" = "ftell".
37 lSize = ftell (f);
38 rewind (f);
39
40 char *infile = (char*) mlt_pool_alloc(lSize);
"lSize" is passed to a parameter that cannot be negative.
and compiler warning:
producer_kdenlivetitle.c: In function ‘read_xml’:
producer_kdenlivetitle.c:49:19: warning: ‘infile’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Mikko Rapeli [Tue, 31 Jul 2012 09:59:17 +0000 (11:59 +0200)]
qimage/kdenlivetitle_wrapper.cpp: check for division by zero
Fixes Coverity CID 709345: Division or modulo by zero (DIVIDE_BY_ZERO)
Assigning: "anim_out" = "mlt_properties_get_position(producer_props, "_animation_out")".
On this path, function call "mlt_properties_get_position(producer_props, "_animation_out")" has return value of 0
465 mlt_position anim_out = mlt_properties_get_position( producer_props, "_animation_out" );
...
Division by expression "anim_out" which may be zero has undefined behavior
475 double percentage = position / anim_out;
Mikko Rapeli [Tue, 31 Jul 2012 09:04:42 +0000 (11:04 +0200)]
linsys/sdi_generator.c: cast ints to uint64_t
Fixes Coverity CID 709367: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression "audio_format->sample_rate / (myProfile->frame_rate_num / myProfile->frame_rate_den) * sample_size / 8 * audio_format->channels" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic before being used in a context which expects an expression of type "uint64_t" (64 bits, unsigned). To avoid overflow, cast either operand to "uint64_t" before performing the multiplication.
422 value = itoa(
423 audio_format->sample_rate / (myProfile->frame_rate_num / myProfile->frame_rate_den) * sample_size / 8
424 * audio_format->channels);
Mikko Rapeli [Tue, 31 Jul 2012 09:03:27 +0000 (11:03 +0200)]
linsys/sdi_generator.c: fix printf() format
Fixes compiler warning:
In file included from consumer_SDIstream.c:148:0:
sdi_generator.c: In function ‘sdi_init’:
sdi_generator.c:352:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 2 has type ‘uint64_t’ [-Wformat]
sdi_generator.c:354:3: warning: format ‘%li’ expects argument of type ‘long int’, but argument 2 has type ‘uint64_t’ [-Wformat]
Mikko Rapeli [Tue, 31 Jul 2012 08:29:17 +0000 (10:29 +0200)]
linsys/consumer_SDIstream.c: check for null pointers
Fixes Coverity CID 709351: Dereference after null check (FORWARD_NULL)
Comparing "this->device_file_audio" to null implies that "this->device_file_audio" might be null.
370 if (this->device_file_audio) {
...
Passing null variable "this->device_file_audio" to function "sdi_init", which dereferences it. [show details]
422 if (!sdi_init(this->device_file_video, this->device_file_audio, this->blanking, mlt_service_profile((mlt_service) consumer), &this->audio_format)) {
Mikko Rapeli [Tue, 31 Jul 2012 08:23:30 +0000 (10:23 +0200)]
linsys/consumer_SDIstream.c: check for null pointer
Fixes Coverity CID 709400: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "this->device_file_video". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
362 int fd = stat(this->device_file_video, &st);
363 if (fd == -1) {
Dereferencing "this->device_file_video" before a null check.
364 if (this->device_file_video)
Mikko Rapeli [Tue, 31 Jul 2012 08:09:43 +0000 (10:09 +0200)]
kino/filehandler.cc: initialize variables
Fixes Coverity CID 709441: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member field "dvinfo.dwDVAAuxCtl1" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVAAuxCtl" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVAAuxSrc1" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVAAuxSrc" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVReserved" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVVAuxCtl" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVVAuxSrc" is not initialized in this constructor nor in any functions that it calls.
Mikko Rapeli [Tue, 31 Jul 2012 08:07:18 +0000 (10:07 +0200)]
kino/filehandler.cc: check return value from lseek()
Fixes Coverity CID 709329: Unchecked return value (CHECKED_RETURN)
Calling function "lseek" without checking return value (as is done elsewhere 19 out of 20 times).
No check of the return value of "lseek(this->fd, 0L, 0)".
409 lseek( fd, 0, SEEK_SET );
Mikko Rapeli [Tue, 31 Jul 2012 08:03:30 +0000 (10:03 +0200)]
kino/filehandler.cc: initialize variable
Fixes Coverity CID 709442: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""numBlocks"" is not initialized in this constructor nor in any functions that it calls.
Mikko Rapeli [Tue, 31 Jul 2012 07:58:58 +0000 (09:58 +0200)]
kino/filehandler.cc: initialize variables
Fixes Coverity CID 709443: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""everyNthFrame"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""framesToSkip"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""maxFileSize"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""timeStamp"" is not initialized in this constructor nor in any functions that it calls.
Mikko Rapeli [Tue, 31 Jul 2012 07:54:52 +0000 (09:54 +0200)]
kino/avi.cc: initialize variable
Fixes Coverity CID 709439: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member field "dvinfo.dwDVAAuxCtl1" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVAAuxCtl" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVAAuxSrc1" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVAAuxSrc" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVReserved" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVVAuxCtl" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "dvinfo.dwDVVAuxSrc" is not initialized in this constructor nor in any functions that it calls.
Mikko Rapeli [Tue, 31 Jul 2012 07:38:38 +0000 (09:38 +0200)]
kino/avi.cc: initialize variables
Fixes Coverity CID 709437: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""dmlh_chunk"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""odml_list"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwFlags" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwInitialFrames" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwLength" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwQuality" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwRate" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwSampleSize" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwScale" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwStart" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwSuggestedBufferSize" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.fccHandler" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.fccType" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.rcFrame" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.wLanguage" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.wPriority" is not initialized in this constructor nor in any functions that it calls.
Mikko Rapeli [Tue, 31 Jul 2012 07:35:21 +0000 (09:35 +0200)]
kino/avi.cc: initialize variables
Fixes Coverity CID 709438: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""dmlh"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwFlags" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwHeight" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwInitialFrames" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwMaxBytesPerSec" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwMicroSecPerFrame" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwPaddingGranularity" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwReserved" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwStreams" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwSuggestedBufferSize" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwTotalFrames" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "mainHdr.dwWidth" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwFlags" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwInitialFrames" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwLength" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwQuality" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwRate" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwSampleSize" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwScale" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwStart" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.dwSuggestedBufferSize" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.fccHandler" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.fccType" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.rcFrame" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.wLanguage" is not initialized in this constructor nor in any functions that it calls.
Non-static class member field "streamHdr.wPriority" is not initialized in this constructor nor in any functions that it calls.
Check calloc() return and fix Coverity CID 709328: Unchecked return value (CHECKED_RETURN)
Calling function "mlt_producer_init" without checking return value (as is done elsewhere 19 out of 20 times).
No check of the return value of "mlt_producer_init(producer, NULL)".
254 mlt_producer_init( producer, NULL );
Mikko Rapeli [Mon, 30 Jul 2012 12:13:23 +0000 (14:13 +0200)]
consumer_jack.c: fix possible buffer overflow
CID 710871: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 30 byte fixed-size string "con_name" by copying "ports[i]" without checking the length.
290 strcpy( con_name, ports[i] );
Mikko Rapeli [Mon, 30 Jul 2012 11:07:28 +0000 (13:07 +0200)]
producer_pango.c: check for null pointer
Fixes Coverity CID 710867: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "text". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
312 size_t inbuf_n = strlen( text );
...
Dereferencing "text" before a null check.
319 if ( text != NULL && strcmp( text, "" ) && iconv( cd, &inbuf_p, &inbuf_n, &outbuf_p, &outbuf_n ) != -1 )
Mikko Rapeli [Mon, 30 Jul 2012 10:36:32 +0000 (12:36 +0200)]
frei0r/factory.c: fix possible buffer overflow and null dereference
Fixes Coverity CID 709415: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 1024 byte fixed-size string "pluginname" by copying "firstname" without checking the length.
390 strcat(pluginname,firstname);
and
CID 709397: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "firstname". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
390 strcat(pluginname,firstname);
Mikko Rapeli [Wed, 25 Jul 2012 15:15:49 +0000 (17:15 +0200)]
Fix calloc() parameter ordering
First parameter to calloc() is the count and second the amount of
bytes for each item. Likely this has no run time effect since the resulting
buffer size is the same.
Mikko Rapeli [Wed, 25 Jul 2012 15:50:45 +0000 (17:50 +0200)]
mlt_playlist_init(): check return values from mlt_producer_init() and calloc()
Fixes Coverity CID 709327: Unchecked return value (CHECKED_RETURN)
Calling function "mlt_producer_init" without checking return value (as is done elsewhere 17 out of 20 times).
No check of the return value of "mlt_producer_init(producer, self)".
73 mlt_producer_init( producer, self );
Mikko Rapeli [Wed, 25 Jul 2012 09:58:58 +0000 (11:58 +0200)]
mlt_filter.c: fix possible buffer overflows
Fixes Coverity CID 709411: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 20 byte fixed-size string "name" by copying "unique_id" without checking the length.
257 strcat( name, unique_id );
and
CID 709412: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 20 byte fixed-size string "name" by copying "unique_id" without checking the length.
302 strcat( name, unique_id );
Mikko Rapeli [Wed, 25 Jul 2012 09:57:29 +0000 (11:57 +0200)]
mlt_filter_new(): check return value from mlt_filter_init()
Fixes Coverity CID 709326: Unchecked return value (CHECKED_RETURN)
Calling function "mlt_filter_init" without checking return value (as is done elsewhere 7 out of 8 times).
No check of the return value of "mlt_filter_init(self, NULL)".
78 mlt_filter_init( self, NULL );
79 return self;
In file included from producer_avformat.c:157:0:
vdpau.c: In function ‘vdpau_get_buffer’:
vdpau.c:162:10: error: ‘AVFrame’ has no member named ‘age’
vdpau.c:169:10: error: ‘AVFrame’ has no member named ‘age’
Mikko Rapeli [Tue, 24 Jul 2012 17:55:47 +0000 (19:55 +0200)]
mlt_consumer_start(): check return value from mlt_properties_get_int()
Fixes Coverity CID 709343: Division or modulo by zero (DIVIDE_BY_ZERO)
Division by expression "mlt_properties_get_int(properties, "frame_rate_num")" which may be zero has undefined behavior
On this path, function call "mlt_properties_get_int(properties, "frame_rate_num")" has return value of 0
442 int frame_duration = 1000000 / mlt_properties_get_int( properties, "frame_rate_num" ) *
443 mlt_properties_get_int( properties, "frame_rate_den" );
Mikko Rapeli [Tue, 24 Jul 2012 17:35:14 +0000 (19:35 +0200)]
mlt_consumer_new(): handle return value from mlt_consumer_init()
If init() fails return NULL. Fixes Coverity CID 709325.
At conditional (1): "self != NULL" taking the true branch.
339 if ( self != NULL )
CID 709325: Unchecked return value (CHECKED_RETURN)
Calling function "mlt_consumer_init" without checking return value (as is done elsewhere 10 out of 11 times).
No check of the return value of "mlt_consumer_init(self, NULL, profile)".
340 mlt_consumer_init( self, NULL, profile );
Mikko Rapeli [Mon, 2 Jul 2012 18:39:46 +0000 (21:39 +0300)]
riff.cc: Initialize data in constructor
Fixes Coverity CID 709444: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member ""length"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""name"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""offset"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""parent"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""type"" is not initialized in this constructor nor in any functions that it calls.
Non-static class member ""written"" is not initialized in this constructor nor in any functions that it calls.