]> git.sesse.net Git - mlt/log
mlt
11 years agoUpdate src/modules/avformat/producer_avformat.c
Brian Matherly [Tue, 21 Aug 2012 02:10:22 +0000 (21:10 -0500)]
Update src/modules/avformat/producer_avformat.c

Better way to detect the availability of PIX_FMT_YUVA444P.

11 years agofix melt.c build on windows due to previous commit
Dan Dennedy [Mon, 20 Aug 2012 16:49:52 +0000 (09:49 -0700)]
fix melt.c build on windows due to previous commit

11 years agofix build on ffmpeg v0.5 (no CODEC_ID_VP8)
Dan Dennedy [Mon, 20 Aug 2012 03:51:52 +0000 (20:51 -0700)]
fix build on ffmpeg v0.5 (no CODEC_ID_VP8)

11 years agoremove printf added in previous commit
Dan Dennedy [Mon, 20 Aug 2012 02:27:16 +0000 (19:27 -0700)]
remove printf added in previous commit

11 years agofix possible null pointer with strdup()
Dan Dennedy [Sun, 19 Aug 2012 20:24:30 +0000 (13:24 -0700)]
fix possible null pointer with strdup()

11 years agolet melt be stopped gracefully by signal
Dan Dennedy [Sun, 19 Aug 2012 19:49:11 +0000 (12:49 -0700)]
let melt be stopped gracefully by signal

11 years agowebm works better with use_pts=1 as well (3559115)
Dan Dennedy [Sat, 18 Aug 2012 06:53:26 +0000 (23:53 -0700)]
webm works better with use_pts=1 as well (3559115)

11 years agofix null pointer check (coverity-709396)
Dan Dennedy [Fri, 17 Aug 2012 07:14:45 +0000 (00:14 -0700)]
fix null pointer check (coverity-709396)

11 years agofix possible null pointer dereference (coverity-714581)
Dan Dennedy [Fri, 17 Aug 2012 07:05:27 +0000 (00:05 -0700)]
fix possible null pointer dereference (coverity-714581)

11 years agofix possible null pointer dereferences (coverity-714581)
Dan Dennedy [Fri, 17 Aug 2012 06:50:30 +0000 (23:50 -0700)]
fix possible null pointer dereferences (coverity-714581)

11 years agofix possible null pointer dereference (coverity-714580)
Dan Dennedy [Fri, 17 Aug 2012 06:46:42 +0000 (23:46 -0700)]
fix possible null pointer dereference (coverity-714580)

11 years agofix possible null pointer dereference (coverity-710882)
Dan Dennedy [Fri, 17 Aug 2012 06:40:57 +0000 (23:40 -0700)]
fix possible null pointer dereference (coverity-710882)

11 years agofix possible null pointer dereference (coverity-710870)
Dan Dennedy [Fri, 17 Aug 2012 06:32:04 +0000 (23:32 -0700)]
fix possible null pointer dereference (coverity-710870)

11 years agofix possible null pointer dereferences (coverity-709399)
Dan Dennedy [Fri, 17 Aug 2012 06:29:49 +0000 (23:29 -0700)]
fix possible null pointer dereferences (coverity-709399)

11 years agofix possible null pointer dereferences (coverity-709395)
Dan Dennedy [Fri, 17 Aug 2012 06:27:35 +0000 (23:27 -0700)]
fix possible null pointer dereferences (coverity-709395)

11 years agofix possible null pointer dereference (coverity-709394)
Dan Dennedy [Fri, 17 Aug 2012 06:26:18 +0000 (23:26 -0700)]
fix possible null pointer dereference (coverity-709394)

11 years agofix possible null pointer dereference (coverity-709393)
Dan Dennedy [Fri, 17 Aug 2012 06:24:43 +0000 (23:24 -0700)]
fix possible null pointer dereference (coverity-709393)

11 years agofix memory leak if fail to alloc/init filter (coverity-714584)
Dan Dennedy [Fri, 17 Aug 2012 06:18:17 +0000 (23:18 -0700)]
fix memory leak if fail to alloc/init filter (coverity-714584)

11 years agofix memory leak if fail to alloc/init filter (coverity-714583)
Dan Dennedy [Fri, 17 Aug 2012 06:17:05 +0000 (23:17 -0700)]
fix memory leak if fail to alloc/init filter (coverity-714583)

11 years agofix resource leak on iconv (coverity-714582)
Dan Dennedy [Fri, 17 Aug 2012 06:11:47 +0000 (23:11 -0700)]
fix resource leak on iconv (coverity-714582)

11 years agofix A/V synch on more H.264 files (without B-frames)
Dan Dennedy [Wed, 15 Aug 2012 23:49:06 +0000 (16:49 -0700)]
fix A/V synch on more H.264 files (without B-frames)

reported by Jordan Keyes

11 years agoIncrease libavutil version required to use PIX_FMT_YUVA444P.
Brian Matherly [Tue, 14 Aug 2012 04:10:55 +0000 (23:10 -0500)]
Increase libavutil version required to use PIX_FMT_YUVA444P.

PIX_FMT_YUVA444P was added to ffmpeg in version 51.35.101 - and so the precompiler check was correctly set to that version. However, it has not yet been added to libav. And libav recently increased the libavutil version to 51.38.0. This causes a compilation error against libav master because the precompiler check passes, but PIX_FMT_YUVA444P is not defined.

The current libavutil versions are:
 * ffmpeg master: 51.69.100
 * ffmpeg 0.11:   51.54.100
 * libav  master: 51.38.0

This commit sets the precompiler to check against version 51.54.0. This will allow PIX_FMT_YUVA444P to be used when compiled against both ffmpeg master and ffmpeg 0.11 - while avoiding errors when compiling against libav master. However, if libav keeps incrementing the version without adding PIX_FMT_YUVA444P, this number may have to be increased again in the future.

11 years agofix reading properties file without trailing newline
Dan Dennedy [Sun, 12 Aug 2012 17:38:35 +0000 (10:38 -0700)]
fix reading properties file without trailing newline

11 years agofix melt progress display on Windows
Dan Dennedy [Sun, 12 Aug 2012 01:22:32 +0000 (18:22 -0700)]
fix melt progress display on Windows

11 years agofix -progress2 with pipe input
Dan Dennedy [Sat, 11 Aug 2012 17:24:02 +0000 (10:24 -0700)]
fix -progress2 with pipe input

11 years agofix melt progress indication on Windows with MELT_NOSDL
Dan Dennedy [Sat, 11 Aug 2012 07:22:05 +0000 (00:22 -0700)]
fix melt progress indication on Windows with MELT_NOSDL

11 years agolet melt be built without SDL on Windows
Dan Dennedy [Fri, 10 Aug 2012 07:07:08 +0000 (00:07 -0700)]
let melt be built without SDL on Windows

with -DMELT_NOSDL in CFLAGS

11 years agorelay first nested consumer's frame-show event instead of own
Dan Dennedy [Wed, 8 Aug 2012 07:38:06 +0000 (00:38 -0700)]
relay first nested consumer's frame-show event instead of own

11 years agofix integrity of images with multi consumer
Dan Dennedy [Wed, 8 Aug 2012 07:11:30 +0000 (00:11 -0700)]
fix integrity of images with multi consumer

11 years agofix seeking jack clients when seeking while paused
Dan Dennedy [Sun, 5 Aug 2012 21:00:18 +0000 (14:00 -0700)]
fix seeking jack clients when seeking while paused

11 years agoMerge pull request #10 from mcfrisk/coverity_review_fixes_v2
Dan Dennedy [Tue, 7 Aug 2012 04:17:46 +0000 (21:17 -0700)]
Merge pull request #10 from mcfrisk/coverity_review_fixes_v2

Coverity review fixes v2

11 years agovideostab/filter_videostab2.c: check for null
Mikko Rapeli [Wed, 1 Aug 2012 16:04:03 +0000 (18:04 +0200)]
videostab/filter_videostab2.c: check for null

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 )

11 years agovideostab/filter_videostab*.c: check return value from mlt_filter_new()
Mikko Rapeli [Wed, 1 Aug 2012 15:44:20 +0000 (17:44 +0200)]
videostab/filter_videostab*.c: check return value from mlt_filter_new()

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;

11 years agovideostab/filter_videostab*.c: check for null
Mikko Rapeli [Wed, 1 Aug 2012 15:41:33 +0000 (17:41 +0200)]
videostab/filter_videostab*.c: check for null

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 );

11 years agosdl/consumer_sdl_still.c: use mutex when changing sdl_screen
Mikko Rapeli [Wed, 1 Aug 2012 15:28:49 +0000 (17:28 +0200)]
sdl/consumer_sdl_still.c: use mutex when changing sdl_screen

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 );

11 years agosdl/consumer_sdl_preview.c: use mutex when changing refresh_count
Mikko Rapeli [Wed, 1 Aug 2012 15:21:51 +0000 (17:21 +0200)]
sdl/consumer_sdl_preview.c: use mutex when changing refresh_count

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 );

11 years agosdl/consumer_sdl_preview.c: check for null pointer
Mikko Rapeli [Wed, 1 Aug 2012 15:19:12 +0000 (17:19 +0200)]
sdl/consumer_sdl_preview.c: check for null pointer

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 );

11 years agosdl/consumer_sdl_audio.c: use mutex when changing refresh_count
Mikko Rapeli [Wed, 1 Aug 2012 13:42:10 +0000 (15:42 +0200)]
sdl/consumer_sdl_audio.c: use mutex when changing refresh_count

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 );

11 years agosdl/consumer_sdl.c: use mutex when changing sdl_screen
Mikko Rapeli [Wed, 1 Aug 2012 13:20:13 +0000 (15:20 +0200)]
sdl/consumer_sdl.c: use mutex when changing sdl_screen

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 );

11 years agortaudio/consumer_rtaudio.cpp: use mutex when changing refresh_count
Mikko Rapeli [Wed, 1 Aug 2012 13:06:22 +0000 (15:06 +0200)]
rtaudio/consumer_rtaudio.cpp: use mutex when changing refresh_count

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 );

11 years agortaudio/consumer_rtaudio.cpp: initialize variables
Mikko Rapeli [Wed, 1 Aug 2012 08:19:28 +0000 (10:19 +0200)]
rtaudio/consumer_rtaudio.cpp: initialize variables

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.

11 years agortaudio/RtAudio.h: initialize variables
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; }

11 years agortaudio/RtAudio.h: initialize variable
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) {}

11 years agortaudio/RtAudio.cpp: check for null pointer
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;

11 years agoqimage/producer_kdenlivetitle.c: add error handling
Mikko Rapeli [Tue, 31 Jul 2012 11:23:00 +0000 (13:23 +0200)]
qimage/producer_kdenlivetitle.c: add error handling

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]

11 years agoqimage/kdenlivetitle_wrapper.cpp: check for division by zero
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;

11 years agoplus/filter_affine.c: check for null pointer
Mikko Rapeli [Tue, 31 Jul 2012 09:55:08 +0000 (11:55 +0200)]
plus/filter_affine.c: check for null pointer

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 )

11 years agooldfilm/filter_dust.c: use correct argument for sizeof()
Mikko Rapeli [Tue, 31 Jul 2012 09:34:17 +0000 (11:34 +0200)]
oldfilm/filter_dust.c: use correct argument for sizeof()

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

11 years agomotion_est/producer_slowmotion.c: check for null pointer
Mikko Rapeli [Tue, 31 Jul 2012 09:26:12 +0000 (11:26 +0200)]
motion_est/producer_slowmotion.c: check for null pointer

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 )

11 years agolumas/luma.c: check lower bounds on input
Mikko Rapeli [Tue, 31 Jul 2012 09:22:21 +0000 (11:22 +0200)]
lumas/luma.c: check lower bounds on input

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 ] );

11 years agolinsys/sdi_generator.c: cast ints to uint64_t
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);

11 years agolinsys/sdi_generator.c: fix printf() format
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]

11 years agolinsys/consumer_SDIstream.c: check for null pointers
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)) {

11 years agolinsys/consumer_SDIstream.c: check for null pointer
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)

11 years agokino/filehandler.cc: initialize variables
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.

11 years agokino/filehandler.cc: check return value from lseek()
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 );

11 years agokino/filehandler.cc: initialize variable
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.

11 years agokino/filehandler.cc: initialize variables
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.

11 years agokino/avi.cc: initialize variable
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.

11 years agokino/avi.cc: initialize variables
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.

11 years agokino/avi.cc: initialize variables
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.

11 years agokdenlive/producer_framebuffer.c: check return values
Mikko Rapeli [Mon, 30 Jul 2012 16:20:24 +0000 (18:20 +0200)]
kdenlive/producer_framebuffer.c: check return values

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 );

11 years agokdenlive/producer_framebuffer.c: check for null pointer
Mikko Rapeli [Mon, 30 Jul 2012 16:18:57 +0000 (18:18 +0200)]
kdenlive/producer_framebuffer.c: check for null pointer

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 )

11 years agojack_rack_add_plugin(): handle null pointer
Mikko Rapeli [Mon, 30 Jul 2012 15:43:50 +0000 (17:43 +0200)]
jack_rack_add_plugin(): handle null pointer

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);

11 years agoconsumer_jack.c: initialize refresh_count with mutex held
Mikko Rapeli [Mon, 30 Jul 2012 12:21:57 +0000 (14:21 +0200)]
consumer_jack.c: initialize refresh_count with mutex held

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.

11 years agoconsumer_jack.c: fix possible buffer overflow
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] );

11 years agoproducer_pango.c: check for null pointer
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 )

11 years agoproducer_pango_init(): check for null pointer
Mikko Rapeli [Mon, 30 Jul 2012 10:56:28 +0000 (12:56 +0200)]
producer_pango_init(): check for null pointer

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 ) );

11 years agofrei0r/frei0r_helper.c: use correct argument to sizeof()
Mikko Rapeli [Mon, 30 Jul 2012 10:54:06 +0000 (12:54 +0200)]
frei0r/frei0r_helper.c: use correct argument to sizeof()

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 );;

11 years agofrei0r/factory.c: fix possible buffer overflow and null dereference
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);

11 years agofrei0r/factory.c: fix sizeof() arguments
Mikko Rapeli [Mon, 30 Jul 2012 10:34:13 +0000 (12:34 +0200)]
frei0r/factory.c: fix sizeof() arguments

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);

11 years agoproducer_libdv.c: check for null pointer
Mikko Rapeli [Mon, 30 Jul 2012 10:15:18 +0000 (12:15 +0200)]
producer_libdv.c: check for null pointer

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 ) );

11 years agotransition_region.c: check for null pointer
Mikko Rapeli [Sun, 29 Jul 2012 11:22:44 +0000 (13:22 +0200)]
transition_region.c: check for null pointer

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 );

11 years agoproducer_melt_init(): check for null pointer
Mikko Rapeli [Sun, 29 Jul 2012 10:32:39 +0000 (12:32 +0200)]
producer_melt_init(): check for null pointer

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 );

11 years agofilter_data_show.c: check dest buffer sizes
Mikko Rapeli [Thu, 26 Jul 2012 09:24:41 +0000 (11:24 +0200)]
filter_data_show.c: check dest buffer sizes

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 : "-" );

11 years agoadd image cache size property to avformat producer
Dan Dennedy [Sun, 5 Aug 2012 04:05:16 +0000 (21:05 -0700)]
add image cache size property to avformat producer

11 years agolower default cache size to 4 to reduce memory usage
Dan Dennedy [Sun, 5 Aug 2012 04:02:07 +0000 (21:02 -0700)]
lower default cache size to 4 to reduce memory usage

11 years agofix memory leak when using mlt_cache for frames
Dan Dennedy [Sat, 4 Aug 2012 00:09:41 +0000 (17:09 -0700)]
fix memory leak when using mlt_cache for frames

11 years agoMerge pull request #8 from gmarco/changes
Dan Dennedy [Fri, 3 Aug 2012 20:10:07 +0000 (13:10 -0700)]
Merge pull request #8 from gmarco/changes

fix width output of filter in xml

11 years agofix width output of filter in xml
Marco Gittler [Fri, 3 Aug 2012 19:33:38 +0000 (21:33 +0200)]
fix width output of filter in xml

11 years agoconsumer_avformat: handle negative return value
Mikko Rapeli [Thu, 26 Jul 2012 08:17:26 +0000 (10:17 +0200)]
consumer_avformat: handle negative return value

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 );

11 years agoMerge pull request #6 from mcfrisk/coverity
Dan Dennedy [Mon, 30 Jul 2012 03:36:14 +0000 (20:36 -0700)]
Merge pull request #6 from mcfrisk/coverity

Coverity fixes

11 years agoMerge pull request #5 from mcfrisk/vdpau
Dan Dennedy [Mon, 30 Jul 2012 03:33:14 +0000 (20:33 -0700)]
Merge pull request #5 from mcfrisk/vdpau

Vdpau

11 years agoFix calloc() parameter ordering
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.

11 years agomlt_property_get_time(): get mutex before accessing self->types
Mikko Rapeli [Wed, 25 Jul 2012 18:43:44 +0000 (20:43 +0200)]
mlt_property_get_time(): get mutex before accessing self->types

Fixes Coverity CID 709356: Data race condition (MISSING_LOCK)
Accessing variable "self->types" (mlt_property_s.types) requires the mlt_property_s.mutex lock.
871                self->types |= mlt_prop_string;

11 years agomlt_producer_seek(): check that eof is not NULL
Mikko Rapeli [Wed, 25 Jul 2012 16:05:52 +0000 (18:05 +0200)]
mlt_producer_seek(): check that eof is not NULL

Fixes Coverity CID 709348: Dereference after null check (FORWARD_NULL)
Comparing "eof" to null implies that "eof" might be null.
 310        else if ( use_points && ( eof == NULL || !strcmp( eof, "pause" ) ) && position >= mlt_producer_get_playtime( self ) )
 311        {
 312                mlt_producer_set_speed( self, 0 );
 313                position = mlt_producer_get_playtime( self ) - 1;
 314        }
At conditional (3): "use_points" taking the true branch.
Passing null variable "eof" to function "strcmp", which dereferences it. (The dereference is assumed on the basis of the 'nonnull' parameter attribute.)
 315        else if ( use_points && !strcmp( eof, "loop" ) && position >= mlt_producer_get_playtime( self ) )

11 years agomlt_producer_new(): check return value from mlt_producer_init()
Mikko Rapeli [Wed, 25 Jul 2012 15:56:39 +0000 (17:56 +0200)]
mlt_producer_new(): check return value from mlt_producer_init()

11 years agomlt_playlist_init(): check return values from mlt_producer_init() and calloc()
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 );

11 years agomlt_frame_get_waveform(): handle memory allocation failure
Mikko Rapeli [Wed, 25 Jul 2012 10:08:34 +0000 (12:08 +0200)]
mlt_frame_get_waveform(): handle memory allocation failure

Fixes Coverity CID 709347.

At conditional (1): "bitmap != NULL" taking the false branch.
CID 709347: Dereference after null check (FORWARD_NULL)
Comparing "bitmap" to null implies that "bitmap" might be null.
 802        if ( bitmap != NULL )
 803                memset( bitmap, 0, size );
 804        mlt_properties_set_data( properties, "waveform", bitmap, size, ( mlt_destructor )mlt_pool_release, NULL );
...
 826                        // Position buffer pointer using y coordinate, stride, and x coordinate
Assigning null: "p" = "bitmap + i / skip + displacement * w".
 827                        unsigned char *p = bitmap + i / skip + displacement * w;
...
 831                                if ( *pcm < 0 )
Dereferencing null variable "p".
 832                                        p[ w * k ] = ( k == 0 ) ? 0xFF : p[ w * k ] + gray;
 833                                else
Dereferencing null variable "p".
 834                                        p[ w * k ] = ( k == height ) ? 0xFF : p[ w * k ] + gray;

11 years agomlt_filter.c: fix possible buffer overflows
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 );

11 years agomlt_filter_new(): check return value from mlt_filter_init()
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;

11 years agovdpau: reduce runtime detection cost
Mikko Rapeli [Wed, 25 Jul 2012 21:47:23 +0000 (23:47 +0200)]
vdpau: reduce runtime detection cost

Don't try to dlopen() every time, once is enough.

11 years agoFix vdpau library paths
Christian Marillat [Wed, 25 Jul 2012 07:00:33 +0000 (09:00 +0200)]
Fix vdpau library paths

They have changed in Debian.

11 years agovdpau compilation fix for ffmpeg 0.11
Christian Marillat [Wed, 25 Jul 2012 06:58:32 +0000 (08:58 +0200)]
vdpau compilation fix for ffmpeg 0.11

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’

11 years agoMerge pull request #4 from mcfrisk/coverity
Dan Dennedy [Wed, 25 Jul 2012 03:53:00 +0000 (20:53 -0700)]
Merge pull request #4 from mcfrisk/coverity

A few Coverity fixes

11 years agomlt_consumer_start(): check return value from mlt_properties_get_int()
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" );

11 years agomlt_consumer_start(): get mutex before accessing put_active
Mikko Rapeli [Tue, 24 Jul 2012 17:44:53 +0000 (19:44 +0200)]
mlt_consumer_start(): get mutex before accessing put_active

Fixes Coverity CID 709355: Data race condition (MISSING_LOCK)
Accessing variable "self->put_active" (mlt_consumer_s.put_active) requires the mlt_consumer_s.put_mutex lock.
 411        self->put_active = 1;

11 years agomlt_consumer_new(): handle return value from mlt_consumer_init()
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 );

11 years agomlt_consumer.c: watch out for null pointer
Mikko Rapeli [Tue, 24 Jul 2012 17:19:24 +0000 (19:19 +0200)]
mlt_consumer.c: watch out for null pointer

Fixes Coverity CID 709393: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "profile".
 235                profile->sample_aspect_num = mlt_properties_get_int( properties, "sample_aspect_num" );
Dereferencing "profile" before a null check.
 236                if ( profile )

11 years agomlt_cache.c: watch out for null pointer
Mikko Rapeli [Mon, 23 Jul 2012 12:28:38 +0000 (14:28 +0200)]
mlt_cache.c: watch out for null pointer

Fixes Coverity CID 709346: Dereference after null check (FORWARD_NULL)
Comparing "result" to null implies that "result" might be null.
449                if ( result && result->data )
450                        result->refcount++;
Dereferencing null variable "result".
451                mlt_log( NULL, MLT_LOG_DEBUG, "%s: get %d = %p, %p\n", __FUNCTION__, cache->count - 1, *hit, result->data );
452