Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity review fixes v2 #10

Merged
merged 45 commits into from
Aug 7, 2012

Conversation

mcfrisk
Copy link
Contributor

@mcfrisk mcfrisk commented Aug 6, 2012

Changes to previous pull req:

  • changed from snprintf() to strncpy()/strncat()

Fixes Coverity CID 709361: Argument cannot be negative (NEGATIVE_RETURNS)
Function "ftell(f)" returns a negative number.
Assigning: signed variable "size" = "ftell".
 937                                        size = ftell( f );
 938                                        fseek( f, 0, SEEK_SET );
 939                                        logbuffer = av_malloc( size + 1 );
At conditional (1): "!logbuffer" taking the false branch.
 940                                        if ( !logbuffer )
 941                                                mlt_log_fatal( MLT_CONSUMER_SERVICE( consumer ), "Could not allocate log buffer\n" );
 942                                        else
 943                                        {
"size" is passed to a parameter that cannot be negative.
 944                                                size = fread( logbuffer, 1, size, f );
Fixes Coverity CID 709413: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 512 byte fixed-size string "temp" by copying "profile" without checking the length.
 58                        strcpy( temp, profile );

and

CID 709414: Copy into fixed size buffer (STRING_OVERFLOW)
You might overrun the 512 byte fixed-size string "result" by copying "metavalue" without checking the length.
225                                                                        strcat( result, metavalue ? metavalue : "-" );
Fixes Coverity CID 709349: Dereference after null check (FORWARD_NULL)
Comparing "playlist" to null implies that "playlist" might be null.
401                        if ( playlist != NULL )
...
Passing null variable "&playlist->parent.parent.parent" to function "mlt_properties_get_int", which dereferences it. [show details]
466        if ( !mlt_properties_get_int( MLT_PLAYLIST_PROPERTIES( playlist ), "_melt_first" ) ||
467                  mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( playlist ) ) > 0 )
468                mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track );
Fixes Coverity CID 709350: Dereference after null check (FORWARD_NULL)
Comparing "type" to null implies that "type" might be null.
 39        char *arg = type == NULL ? NULL : strchr( type, ':' );
...
Passing null variable "type" to function "mlt_factory_filter", which dereferences it. [show details]
 50        filter = mlt_factory_filter( profile, type, arg );
Fixes Coverity CID 710856: Dereference after null check (FORWARD_NULL)
Comparing "*frame" to null implies that "*frame" might be null.
491                if ( *frame != NULL )
492                        data = mlt_properties_get_data( MLT_FRAME_PROPERTIES( *frame ), "dv_data", NULL );
493        }
494
At conditional (2): "data != NULL" taking the false branch.
495        if ( data != NULL )
...
Passing null variable "*frame" to function "mlt_frame_set_position", which dereferences it. [show details]
540        mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
Fixes Coverity CID 709406: Wrong sizeof argument (SIZEOF_MISMATCH)
Passing argument "handle" of type "void *" and argument "8 /* sizeof (void *) */" to function "mlt_properties_set_data" is suspicious.
281                mlt_properties_set_data(properties, "_dlclose_handle", handle , sizeof (void*) , NULL , NULL );
282                mlt_properties_set_data(properties, "_dlclose", dlclose , sizeof (void*) , NULL , NULL );
CID 709406: Wrong sizeof argument (SIZEOF_MISMATCH) [select defect]
283                mlt_properties_set_data(properties, "f0r_construct", f0r_construct , sizeof(void*),NULL,NULL);
CID 709406: Wrong sizeof argument (SIZEOF_MISMATCH) [select defect]
284                mlt_properties_set_data(properties, "f0r_update", f0r_update , sizeof(void*),NULL,NULL);
285                if (f0r_update2)
286                        mlt_properties_set_data(properties, "f0r_update2", f0r_update2 , sizeof(void*),NULL,NULL);
CID 709406: Wrong sizeof argument (SIZEOF_MISMATCH) [select defect]
287                mlt_properties_set_data(properties, "f0r_destruct", f0r_destruct , sizeof(void*),NULL,NULL);
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);
Fixes Coverity CID 709407: Wrong sizeof argument (SIZEOF_MISMATCH)
Passing argument "inst" of type "void *" and argument "8 /* sizeof (void *) */" to function "mlt_properties_set_data" is suspicious.
 79                mlt_properties_set_data(  prop  ,  ctorname , inst, sizeof(void*) , f0r_destruct , NULL );;
Fixes Coverity CID 710868: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "markup". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
219                                                strcat( markup, line );
...
Dereferencing pointer "markup". (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
228                                if ( markup[ strlen( markup ) - 1 ] == '\n' )
229                                        markup[ strlen( markup ) - 1 ] = '\0';
...
Dereferencing "markup" before a null check.
232                                mlt_properties_set( properties, "markup", ( markup == NULL ? "" : markup ) );
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 )
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] );
Fixes Coverity CID 709359.

Locking "self->refresh_mutex".
148                pthread_mutex_lock( &self->refresh_mutex );
consumer_jack_s.refresh_count is being accessed with lock "self->refresh_mutex" held.
149                self->refresh_count = self->refresh_count <= 0 ? 1 : self->refresh_count + 1;
150                pthread_cond_broadcast( &self->refresh_cond );
151                pthread_mutex_unlock( &self->refresh_mutex );
...
486//      int last_position = -1;
CID 709359: Data race condition (MISSING_LOCK)
Accessing variable "self->refresh_count" (consumer_jack_s.refresh_count) requires the consumer_jack_s.refresh_mutex lock.
487        self->refresh_count = 0;
...
Locking "self->refresh_mutex".
544                                pthread_mutex_lock( &self->refresh_mutex );
545                                if ( refresh == 0 && self->refresh_count <= 0 )
546                                {
547                                        consumer_play_video( self, frame );
548                                        pthread_cond_wait( &self->refresh_cond, &self->refresh_mutex );
549                                }
550                                mlt_frame_close( frame );
consumer_jack_s.refresh_count is being accessed with lock "self->refresh_mutex" held.
Fixes Coverity CID 710857: Explicit null dereferenced (FORWARD_NULL)
Assigning: "saved_plugin" = 0.
134      saved_plugin = NULL;
135    }
136
137  /* initialize plugin parameters */
Dereferencing null variable "saved_plugin".
138  plugin->enabled = settings_get_enabled (saved_plugin->settings);
Fixes Coverity CID 709398: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "frame".
203        *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
Dereferencing "frame" before a null check.
204        if( frame != NULL )
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 );
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.
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.
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.
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.
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.
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 );
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.
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)
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)) {
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]
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);
Upper bounds are not checked yet but maybe should be.
Partially fixes these Coverity findings:

CID 709423: Untrusted value as argument (TAINTED_SCALAR) [select defect]
370                        this.w = atoi( argv[ ++ arg ] );
371                else if ( !strcmp( argv[ arg ], "-h" ) )
CID 709423: Untrusted value as argument (TAINTED_SCALAR) [select defect]
372                        this.h = atoi( argv[ ++ arg ] );
373                else if ( !strcmp( argv[ arg ], "-bands" ) )
CID 709423: Untrusted value as argument (TAINTED_SCALAR) [select defect]
374                        this.bands = atoi( argv[ ++ arg ] );
Fixes Coverity CID 709401: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "frame".
279        *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( this ) );
280
281        mlt_properties properties = MLT_PRODUCER_PROPERTIES(this);
282
283
Dereferencing "frame" before a null check.
284        if( frame != NULL )
Fixes Coverity CID 709408: Wrong sizeof argument (SIZEOF_MISMATCH)
Passing argument "savepic" of type "uint8_t *" and argument "8 /* sizeof (uint8_t *) */" to function "mlt_properties_set_data" is suspicious.
142                                                mlt_properties_set_data ( properties , savename , savepic , sizeof(uint8_t*) , mlt_pool_release, NULL );
Passing argument "savealpha" of type "uint8_t *" and argument "8 /* sizeof (uint8_t *) */" to function "mlt_properties_set_data" is suspicious.
143
Fixes Coverity CID 709402: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "transition". [show details]
 64                        mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "b_alpha", 1 );
 65                }
 66
Dereferencing "transition" before a null check.
 67                if ( producer != NULL && transition != NULL )
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;
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]
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 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) {}
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; }
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.
Fixes Coverity CID 710859: Data race condition (MISSING_LOCK)
Accessing variable "this->refresh_count" (RtAudioConsumer.refresh_count) requires the RtAudioConsumer.refresh_mutex lock.
225                refresh_count = 0;
...
Locking "this->refresh_mutex".
282                                        pthread_mutex_lock( &refresh_mutex );
283                                        if ( refresh == 0 && refresh_count <= 0 )
284                                        {
285                                                play_video( frame );
286                                                pthread_cond_wait( &refresh_cond, &refresh_mutex );
287                                        }
288                                        mlt_frame_close( frame );
RtAudioConsumer.refresh_count is being accessed with lock "this->refresh_mutex" held.
289                                        refresh_count --;
290                                        pthread_mutex_unlock( &refresh_mutex );
...
Locking "rtaudio->refresh_mutex".
561                pthread_mutex_lock( &rtaudio->refresh_mutex );
RtAudioConsumer.refresh_count is being accessed with lock "rtaudio->refresh_mutex" held.
562                rtaudio->refresh_count = rtaudio->refresh_count <= 0 ? 1 : rtaudio->refresh_count + 1;
563                pthread_cond_broadcast( &rtaudio->refresh_cond );
564                pthread_mutex_unlock( &rtaudio->refresh_mutex );
Fixes Coverity CID 709357 and 709358: Data race condition (MISSING_LOCK)

Locking "mlt_sdl_mutex".
235                        pthread_mutex_lock( &mlt_sdl_mutex );
consumer_sdl_s.sdl_screen is being accessed with lock "mlt_sdl_mutex" held.
236                        this->sdl_screen = SDL_GetVideoSurface( );
237                        pthread_mutex_unlock( &mlt_sdl_mutex );
...
Locking "mlt_sdl_mutex".
269                        pthread_mutex_lock( &mlt_sdl_mutex );
consumer_sdl_s.sdl_screen is being accessed with lock "mlt_sdl_mutex" held.
270                        this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
271                        pthread_mutex_unlock( &mlt_sdl_mutex );
...
Accessing variable "this->sdl_screen" (consumer_sdl_s.sdl_screen) requires the mlt_sdl_mutex lock.
315                this->sdl_screen = NULL;
...
Locking "mlt_sdl_mutex".
573                        pthread_mutex_lock( &mlt_sdl_mutex );
consumer_sdl_s.sdl_screen is being accessed with lock "mlt_sdl_mutex" held.
574                        this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, this->bpp, this->sdl_flags );
575                        if ( consumer_get_dimensions( &this->window_width, &this->window_height ) )
consumer_sdl_s.sdl_screen is being accessed with lock "mlt_sdl_mutex" held.
576                                this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, this->bpp, this->sdl_flags );
577                        pthread_mutex_unlock( &mlt_sdl_mutex );
Fixes Coverity CID 709359: Data race condition (MISSING_LOCK)

Locking "self->refresh_mutex".
145                pthread_mutex_lock( &self->refresh_mutex );
consumer_sdl_s.refresh_count is being accessed with lock "self->refresh_mutex" held.
146                self->refresh_count = self->refresh_count <= 0 ? 1 : self->refresh_count + 1;
147                pthread_cond_broadcast( &self->refresh_cond );
148                pthread_mutex_unlock( &self->refresh_mutex );
...
Accessing variable "self->refresh_count" (consumer_sdl_s.refresh_count) requires the consumer_sdl_s.refresh_mutex lock.
478        self->refresh_count = 0;
...
Locking "self->refresh_mutex".
535                                pthread_mutex_lock( &self->refresh_mutex );
536                                if ( refresh == 0 && self->refresh_count <= 0 )
537                                {
538                                        consumer_play_video( self, frame );
539                                        pthread_cond_wait( &self->refresh_cond, &self->refresh_mutex );
540                                }
541                                mlt_frame_close( frame );
consumer_sdl_s.refresh_count is being accessed with lock "self->refresh_mutex" held.
542                                self->refresh_count --;
543                                pthread_mutex_unlock( &self->refresh_mutex );
Fixes Coverity CID 709403: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "this->play". [show details]
290        int eos_threshold = 20 + mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( this->play ), "buffer" );
...
Assigning: "this->active" = "this->play".
424                                        this->active = this->play;
...
Dereferencing "this->play" before a null check.
466        if ( this->play ) mlt_consumer_stop( this->play );
Fixes Coverity CID 709360: Data race condition (MISSING_LOCK)

Locking "this->refresh_mutex".
133                pthread_mutex_lock( &this->refresh_mutex );
consumer_sdl_s.refresh_count is being accessed with lock "this->refresh_mutex" held.
134                this->refresh_count = this->refresh_count <= 0 ? 1 : this->refresh_count + 1;
135                pthread_cond_broadcast( &this->refresh_cond );
136                pthread_mutex_unlock( &this->refresh_mutex );
...
Accessing variable "this->refresh_count" (consumer_sdl_s.refresh_count) requires the consumer_sdl_s.refresh_mutex lock.
295        this->refresh_count = 0;
...
Locking "this->refresh_mutex".
445                                pthread_mutex_lock( &this->refresh_mutex );
446                                if ( this->running && speed == 0 && this->refresh_count <= 0 )
447                                {
448                                        mlt_events_fire( properties, "consumer-sdl-paused", NULL );
449                                        pthread_cond_wait( &this->refresh_cond, &this->refresh_mutex );
450                                }
consumer_sdl_s.refresh_count is being accessed with lock "this->refresh_mutex" held.
451                                this->refresh_count --;
452                                pthread_mutex_unlock( &this->refresh_mutex );
Fixes Coverity CID 709357: Data race condition (MISSING_LOCK)
Accessing variable "this->sdl_screen" (consumer_sdl_s.sdl_screen) requires the mlt_sdl_mutex lock.
230                this->sdl_screen = NULL;
...
Locking "mlt_sdl_mutex".
445                pthread_mutex_lock( &mlt_sdl_mutex );
consumer_sdl_s.sdl_screen is being accessed with lock "mlt_sdl_mutex" held.
446                this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
447                if ( consumer_get_dimensions( &this->window_width, &this->window_height ) )
448                        this->sdl_screen = SDL_SetVideoMode( this->window_width, this->window_height, 0, this->sdl_flags );
449
450                uint32_t color = mlt_properties_get_int( this->properties, "window_background" );
451                if ( this->sdl_screen )
452                {
453                        SDL_FillRect( this->sdl_screen, NULL, color >> 8 );
454                        changed = 1;
455                }
456                pthread_mutex_unlock( &mlt_sdl_mutex );
Fixes Coverity CID 709404:
Dereference before null check (REVERSE_INULL)
Dereferencing pointer "g". [show details]
 85        if ( !mlt_geometry_parse( g, vectors, length, -1, -1 ) )
...
Dereferencing "g" before a null check.
104        if ( g ) mlt_geometry_close( g );
Fixes Coverity CID 709365 and 709366:
Dereference null return value (NULL_RETURNS)
Function "mlt_filter_new" returns null (checked 50 out of 52 times). [show details]
Assigning: "parent" = null return value from "mlt_filter_new".
201                mlt_filter parent = mlt_filter_new();
Dereferencing a null pointer "parent".
202                parent->child = self;
Fixes Coverity CID 709405: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "data".
244        data->stab = calloc( 1, sizeof(StabData) );
245        data->trans = calloc( 1, sizeof (TransformData) ) ;
Dereferencing "data" before a null check.
246        if ( data )
ddennedy added a commit that referenced this pull request Aug 7, 2012
@ddennedy ddennedy merged commit 9b64e66 into mltframework:master Aug 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants