View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000592 | Cinelerra-GG | [All Projects] Bug | public | 2021-10-09 16:39 | 2021-10-11 02:57 |
Reporter | Andrew-R | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | new | Resolution | open | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0000592: cppcheck 2.6 partial scan | ||||
Description | I tried to run cppcheck tool on guicast/ and cinelerra/ dirs like this (might be wrong?) $ cppcheck -j 7 -x c++ * > ../cpp_check_cinelerra.log 2>&1 $ cppcheck -j 7 -x c++ *.C *.h *.inc > ../cpp_check_guicast.log 2>&1 it tend to hang after more than 20 min on some files, but partial cscan results are attached | ||||
Steps To Reproduce | run cppcheck with '-x c++' argument on Cinelerra codebase watch out for possible errors. | ||||
Additional Information | run over my termux codebase | ||||
Tags | No tags attached. | ||||
yeah, now after some sleeping I think pluginprefs. C was about to changing plugin path/folder (for customization). if file still compileable may be we can connect it somewhere.. | |
@Andrew-R As long as I am testing other things anyway, I have applied vrender_init.diff and valgrind_errs.diff just to see how it goes. The patch for cinelerra/ci did not take effect -- I do not understand why this patch even exists as for me "ci" is simply a symbolic link to ../bin/cinelerra About "all appear to be disconnected from build.... " -- it has been common practice to not delete routines just in case they come in handy later so I would not be concerned about any of them and I would not change any of them. So I did not apply patch to pluginprefs.C. Oops and forgot to apply patch to resourcepixmap.C (will add later as already started the build). In another BT, MatN said he was going to be busy doing something else in the next few days but maybe when he gets back, he can do a code review. It is better to have someone else look at the code that knows C++. |
|
I tried to fix (mute?) some 'unitialized in constructor' warnings in vrender.C found with cppcheck --enable=warning but they sadly do not fix anything, but hopefully not break things too? it will be great if @MatN will have a look at my hacking..
vrender_init.diff (495 bytes)
diff --git a/cinelerra-5.1/cinelerra/vrender.C b/cinelerra-5.1/cinelerra/vrender.C index be3d0c3b..03b1421d 100644 --- a/cinelerra-5.1/cinelerra/vrender.C +++ b/cinelerra-5.1/cinelerra/vrender.C @@ -70,6 +70,11 @@ VRender::VRender(RenderEngine *renderengine) asynchronous = 0; // render 1 frame at a time framerate_counter = 0; video_out = 0; + track_w = track_h = 0; + output_w = output_h = 0; + first_frame = 0; + output_offset = 0; + source_length = 0; render_strategy = -1; } |
|
scale.C videoconfig.C videowindow.C videowindowgui.C vtransition.C all appear to be disconnected from build.... |
|
I also tried to fix resourcepixmap.C : $ git diff cinelerra/resourcepixmap.C diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index 1406dd2d..5b5a12f8 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -238,7 +238,7 @@ VFrame *ResourcePixmap::change_title_color(VFrame *title_bg, int color) c.r = color>>16; c.g = color>>8; c.b = color>>0; c.a = 0xff; if( BC_CModels::has_alpha(colormodel) && // fast path BC_CModels::calculate_pixelsize(colormodel) == sizeof(unsigned) ) { - const unsigned gap_rgba = (0xff<<24) | + const unsigned gap_rgba = ((uint32_t)(0xff)<<24) | (gap_grey<<16) | (gap_grey<<8) | (gap_grey<<0); if( th > 0 ) { unsigned *bp = (unsigned *)bar_rows[0]; $ |
|
for some reason pluginprefs.C also not connected to anywhere in Makefile and thus not getting build? $ git diff pluginprefs.C diff --git a/cinelerra-5.1/cinelerra/pluginprefs.C b/cinelerra-5.1/cinelerra/pluginprefs.C index 2a3f7878..20e68db1 100644 --- a/cinelerra-5.1/cinelerra/pluginprefs.C +++ b/cinelerra-5.1/cinelerra/pluginprefs.C @@ -93,6 +93,7 @@ PluginGlobalPathText::~PluginGlobalPathText() {} int PluginGlobalPathText::handle_event() { strcpy(pwindow->thread->preferences->global_plugin_dir, get_text()); + return 1; } @@ -110,4 +111,5 @@ PluginLocalPathText::~PluginLocalPathText() {} int PluginLocalPathText::handle_event() { strcpy(pwindow->thread->preferences->local_plugin_dir, get_text()); + return 1; } I added those 'return 1' in ::handle_event functions based on patch.C also cinelerra/pluginmessages.C mostly empty and not connected to build.. |
|
I tried to fix few errs, but I can only hope my fixes not break something. Simple loading one media file and playback works, but you probably need to stress-test this with loading as many files as possible)
valgrind_errs.diff (3,040 bytes)
diff --git a/cinelerra-5.1/cinelerra/apluginthread.C b/cinelerra-5.1/cinelerra/apluginthread.C index bb23c306..fd172f65 100644 --- a/cinelerra-5.1/cinelerra/apluginthread.C +++ b/cinelerra-5.1/cinelerra/apluginthread.C @@ -35,7 +35,7 @@ APluginThread::~APluginThread() delete plugin_server; } -APluginThread::attach() +void APluginThread::attach() { // open the plugin plugin_server->open_plugin(); @@ -44,7 +44,7 @@ APluginThread::attach() plugin_server->start_gui(); } -APluginThread::detach() +void APluginThread::detach() { //printf("APluginThread::detach\n"); if(plugin_server) diff --git a/cinelerra-5.1/cinelerra/ci b/cinelerra-5.1/cinelerra/ci index bc987833..22858982 120000 --- a/cinelerra-5.1/cinelerra/ci +++ b/cinelerra-5.1/cinelerra/ci @@ -1 +1 @@ -../bin/cinelerra \ No newline at end of file +../bin/cin \ No newline at end of file diff --git a/cinelerra-5.1/cinelerra/cursor.C b/cinelerra-5.1/cinelerra/cursor.C index b392dda1..87f932bb 100644 --- a/cinelerra-5.1/cinelerra/cursor.C +++ b/cinelerra-5.1/cinelerra/cursor.C @@ -51,6 +51,7 @@ return 0; int Cursor_::draw(int flash, long selectionstart, long selectionend, long zoom_sample, long viewstart, int vertical) { return 0; +#if 0 if(canvas->get_h() * canvas->get_w() == 0) return 1; if(zoom_sample == 0) return 1; // no canvas @@ -93,6 +94,7 @@ return 0; canvas->set_opaque(); } if(flash) canvas->flash(); +#endif } int Cursor_::resize(int w, int h) diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index 977ad1cb..2e1b0c73 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -859,7 +859,8 @@ int IndexFile::read_info(Indexable *test_indexable) data = new char[index_state->index_start]; temp = fread(data, index_state->index_start - sizeof(int64_t), 1, fd); - if(!temp) return 1; + if(!temp) { delete [] data; + return 1;} data[index_state->index_start - sizeof(int64_t)] = 0; FileXML xml; diff --git a/cinelerra-5.1/cinelerra/indexstate.C b/cinelerra-5.1/cinelerra/indexstate.C index 803c4f0b..87d907a1 100644 --- a/cinelerra-5.1/cinelerra/indexstate.C +++ b/cinelerra-5.1/cinelerra/indexstate.C @@ -304,6 +304,7 @@ int IndexState::read_markers(char *index_dir, char *file_path) if( memcmp(version, MARKER_MAGIC_VERSION, vsz) ) { eprintf(_("IndexState::read_markers marker file version mismatched\n: %s\n"), marker_path); + fclose(fp); return 1; } ret = read_marks(fp); diff --git a/cinelerra-5.1/cinelerra/recordengine.C b/cinelerra-5.1/cinelerra/recordengine.C index 2fb14891..b13424f8 100644 --- a/cinelerra-5.1/cinelerra/recordengine.C +++ b/cinelerra-5.1/cinelerra/recordengine.C @@ -225,7 +225,7 @@ int RecordEngine::open_input_devices(int duplex) { int audio_opened = 0; int video_opened = 0; - AudioConfig *aconfig /* = mwindow->preferences->aconfig */; + AudioConfig *aconfig = mwindow->preferences->aconfig; // Initialize sharing if(record->do_audio && record->do_video) |
|
I attach my 2 logs (Arch linux 64-bit, kde, ryzen 3700x, 32 Gb ram). Guicast took about 5 min; cinelerra I stopped it after 3 hours.... cpp_check.tar.gz (25,571 bytes) |
|
yeah, to my surprize for example file cinelerra-5.1/cinelerra/recordengine.C not even connected to build system! I hope some of those errors are false positives. |
|
@Andrew-R That is a lot of errors and not even all of them. It would be a good idea to fix some of them carefully. |
|
argh, it also was cppcheck 2.5, not 2.6 (sorry) | |
And for guicast/ dir : bctextbox.C:952:7: error: Uninitialized variable: letter1 [uninitvar] if(letter1 <= highlight_letter3) ^ Checking bctexture.C: __TERMUX__... === bctrace.C:469:39: error: Resource leak: sfp [resourceLeak] if( !fgets(line,sizeof(line), sfp) ) return; ^ Checking bctitle.C: NO_GUICAST... == filesystem.C:524:20: error: Uninitialized variable: string [uninitvar] strcpy(new_dir, string); ^ Checking filesystem.C: BOOBY... == bcwindowbase.C:3413:0: error: failed to expand 'SET_LOCK', Wrong number of parameters for macro 'SET_LOCK'. [preprocessorErrorDirective] SET_LOCK(this, title, location); ^ Checking bcwindowdraw.C: SINGLE_THREAD... == bcwindowbase.C:970:37: error: Uninitialized variable: event [uninitvar] result = active_grab->grab_event(event); ^ bcwindowbase.C:978:9: error: Uninitialized variable: event [uninitvar] switch(event->type) { ^ Checking vframe3d.C: BOOBY... == |
|
those errs a bit of concerning, IMO: Checking batchrender.C: HAVE_FIREWIRE... Checking audiodevice.C: HAVE_OSS... bdcreate.C:1050:3: warning: Possible null pointer dereference: submenu [nullPointer] submenu->add_submenuitem(new CreateBD_FormatItem(this, i, bd_formats[i].name)); ^ bdcreate.C:1039:24: note: Assignment 'submenu=0', assigned value is 0 BC_SubMenu *submenu = 0; ^ bdcreate.C:1043:29: note: Assuming condition is false if( ww != bd_formats[i].w || hh != bd_formats[i].h ) { ^ bdcreate.C:1050:3: note: Null pointer dereference submenu->add_submenuitem(new CreateBD_FormatItem(this, i, bd_formats[i].name)); ^ Checking bdcreate.C: HAVE_FIREWIRE... bdwrite.C:3034:38: error: Resource leak: ifp [resourceLeak] if( bd_path("/BDMV/", fmt, ap) ) return 1; ^ bdwrite.C:3096:45: error: Resource leak: ifp [resourceLeak] if( bd_path("/BDMV/BACKUP/", fmt, ap) ) return 1; ^ bdwrite.C:3034:46: error: va_list 'ap' was opened but not closed by va_end(). [va_end_missing] if( bd_path("/BDMV/", fmt, ap) ) return 1; ^ bdwrite.C:3076:44: error: va_list 'ap' was opened but not closed by va_end(). [va_end_missing] if( bd_path("/BDMV/", fmt, ap) ) return 1; ^ bdwrite.C:3096:53: error: va_list 'ap' was opened but not closed by va_end(). [va_end_missing] if( bd_path("/BDMV/BACKUP/", fmt, ap) ) return 1; ^ 140/1200 files checked 8% done === brender.C:138:33: error: Uninitialized variable: string [uninitvar] arguments[0] = new char[strlen(string) + 1]; ^ Checking cache.inc ... === channelpicker.C:444:4: warning: Possible null pointer dereference: (Theme*)get_theme() [nullPointer] ((Theme*)get_theme())->widget_border * 4; ^ channelpicker.C:474:32: warning: Possible null pointer dereference: (Theme*)get_theme() [nullPointer] x += channel_text->get_w() + ((Theme*)get_theme())->widget_border; ^ channelpicker.C:480:34: warning: Possible null pointer dereference: (Theme*)get_theme() [nullPointer] x += channel_select->get_w() + ((Theme*)get_theme())->widget_border; ^ channelpicker.C:486:34: warning: Possible null pointer dereference: (Theme*)get_theme() [nullPointer] x += channel_button->get_w() + ((Theme*)get_theme())->widget_border; ^ channelpicker.C:521:29: warning: Possible null pointer dereference: get_current_channel() [nullPointer] return get_current_channel()->title; ^ Checking clipedit.inc ... == edits.C:479:2: warning: Possible null pointer dereference: current [nullPointer] current->load_properties(file, startproject); ^ edits.C:478:33: note: Assignment 'current=append_new_edit()', assigned value is 0 Edit* current = append_new_edit(); ^ edits.C:479:2: note: Null pointer dereference current->load_properties(file, startproject); ^ edits.C:481:18: warning: Possible null pointer dereference: current [nullPointer] startproject += current->length; ^ edits.C:478:33: note: Assignment 'current=append_new_edit()', assigned value is 0 Edit* current = append_new_edit(); ^ edits.C:481:18: note: Null pointer dereference startproject += current->length; ^ Checking edits.h ... == filescene.C:1867:2: error: Resource leak: fd [resourceLeak] return result; ^ filescene.C:1201:3: error: Common realloc mistake: 'text' nulled but not freed upon failure [memleakOnRealloc] text = (char*)realloc(text, len1 + len2 + len3); ^ filescene.C:1257:4: error: Common realloc mistake: 'audio' nulled but not freed upon failure [memleakOnRealloc] audio = (unsigned char*)realloc(audio, audio_allocated); ^ filescene.C:1357:6: error: Common realloc mistake: 'audio' nulled but not freed upon failure [memleakOnRealloc] audio = (unsigned char*)realloc(audio, audio_allocated); ^ 399/1200 files checked 34% done == indexstate.C:307:5: error: Resource leak: fp [resourceLeak] return 1; ^ 480/1200 files checked 40% done indexfile.C:862:13: error: Memory leak: data [memleak] if(!temp) return 1; ^ Checking indexstate.h ... == loadbalance.C:210:3: warning: Possible null pointer dereference: single_client [nullPointer] single_client->server = this; ^ loadbalance.C:209:29: note: Assignment 'single_client=new_client()', assigned value is 0 single_client = new_client(); ^ loadbalance.C:210:3: note: Null pointer dereference single_client->server = this; ^ 542/1200 files checked 45% done == mediadb.C:167:17: error: Resource leak: fp [resourceLeak] if( !fp != 0 ) return 1; ^ Checking mediadb.C: __x86_64__... === menueffects.C:481:4: warning: Possible null pointer dereference: plugin_array [nullPointer] plugin_array->start_plugins(mwindow, ^ menueffects.C:479:38: note: Assignment 'plugin_array=create_plugin_array()', assigned value is 0 plugin_array = create_plugin_array(); ^ menueffects.C:481:4: note: Null pointer dereference plugin_array->start_plugins(mwindow, ^ menueffects.C:488:4: warning: Possible null pointer dereference: plugin_array [nullPointer] plugin_array->run_plugins(); ^ menueffects.C:479:38: note: Assignment 'plugin_array=create_plugin_array()', assigned value is 0 plugin_array = create_plugin_array(); ^ menueffects.C:488:4: note: Null pointer dereference plugin_array->run_plugins(); ^ menueffects.C:490:4: warning: Possible null pointer dereference: plugin_array [nullPointer] plugin_array->stop_plugins(); ^ menueffects.C:479:38: note: Assignment 'plugin_array=create_plugin_array()', assigned value is 0 plugin_array = create_plugin_array(); ^ menueffects.C:490:4: note: Null pointer dereference plugin_array->stop_plugins(); ^ Checking menueffects.C: HAVE_FIREWIRE... == packagerenderer.C:710:19: warning: Possible null pointer dereference: playable_track [nullPointer] playable_edit = playable_track->edits->get_playable_edit(current_position, 1); ^ packagerenderer.C:620:26: note: Assignment 'playable_track=0', assigned value is 0 Track *playable_track = 0; ^ packagerenderer.C:626:3: note: Calling function 'direct_copy_possible', 3rd argument 'playable_track' value is 0 playable_track, ^ packagerenderer.C:689:17: note: Assuming condition is Assuming condition is false current_track && result; ^ packagerenderer.C:710:19: note: Null pointer dereference playable_edit = playable_track->edits->get_playable_edit(current_position, 1); ^ Checking packagerenderer.C: HAVE_FIREWIRE... === pluginlv2client.C:329:13: warning: The address of local variable 'output_ptr' might be accessed at non-zero index. [objectIndex] output_ptr[i]->set_offset(0); ^ pluginlv2client.C:343:44: note: Address of variable taken here. return process_realtime(size, &input_ptr, &output_ptr, 1); ^ pluginlv2client.C:343:44: note: Calling function 'process_realtime', 3rd argument '&output_ptr' value is lifetime=output_ptr return process_realtime(size, &input_ptr, &output_ptr, 1); ^ pluginlv2client.C:329:13: note: The address of local variable 'output_ptr' might be accessed at non-zero index. output_ptr[i]->set_offset(0); ^ Checking pluginlv2config.h ... == Checking recordmonitor.h: HAVE_FIREWIRE... recordengine.C:256:6: error: Uninitialized variable: aconfig [uninitvar] if(aconfig->audio_in_driver == aconfig->audio_duplex_driver && ^ recordengine.C:257:12: error: Uninitialized variable: aconfig [uninitvar] !strcmp(aconfig->oss_in_device, aconfig->oss_duplex_device) && ^ recordengine.C:258:4: error: Uninitialized variable: aconfig [uninitvar] aconfig->oss_in_bits == aconfig->oss_duplex_bits && ^ recordengine.C:259:4: error: Uninitialized variable: aconfig [uninitvar] aconfig->oss_in_channels == aconfig->oss_duplex_channels) ^ 862/1200 files checked 74% done == renderfarmfsclient.C:535:15: error: va_list 'ap' was opened but not closed by va_end(). [va_end_missing] return result; ^ Checking renderfarmfsserver.C ... == resourcepixmap.C:241:34: error: Signed integer overflow for expression '0xff<<24'. [integerOverflow] const unsigned gap_rgba = (0xff<<24) | ^ Checking samples.h ... 929/1200 files checked 79% done == scopewindow.C:1203:13: error: Invalid log() argument nr 1. The value is 0 but the valid values are '4.94066e-324:'. [invalidFunctionArg] max = log(max) * vnorm; ^ scopewindow.C:1199:13: note: Assignment 'max=0', assigned value is 0 int max = 0; ^ scopewindow.C:1200:27: note: Assuming condition is false for(int i=accum_start; i<accum_end; ++i ) ^ scopewindow.C:1203:13: note: Invalid argument max = log(max) * vnorm; ^ Checking trackpopup.h ... === trackcanvas.C:1516:7: error: Uninitialized variable: pixmap_x [uninitvar] pixmap_x, pixmap_w, pixmap_h); ^ trackcanvas.C:1512:8: error: Uninitialized variable: pixmap_w [uninitvar] if(pixmap_w && pixmap_h) ^ trackcanvas.C:1512:20: error: Uninitialized variable: pixmap_h [uninitvar] if(pixmap_w && pixmap_h) ^ trackcanvas.C:1516:17: error: Uninitialized variable: pixmap_w [uninitvar] pixmap_x, pixmap_w, pixmap_h); ^ trackcanvas.C:1516:27: error: Uninitialized variable: pixmap_h [uninitvar] pixmap_x, pixmap_w, pixmap_h); ^ trackcanvas.C:1518:10: error: Uninitialized variable: pixmap_w [uninitvar] if( pixmap_w > pixmap->pixmap_w || ^ trackcanvas.C:1519:10: error: Uninitialized variable: pixmap_h [uninitvar] pixmap_h > pixmap->pixmap_h) ^ trackcanvas.C:1520:22: error: Uninitialized variable: pixmap_w [uninitvar] pixmap->resize(pixmap_w, pixmap_h); ^ trackcanvas.C:1522:7: error: Uninitialized variable: pixmap_x [uninitvar] pixmap_x, pixmap_w, pixmap_h); ^ trackcanvas.C:1522:17: error: Uninitialized variable: pixmap_w [uninitvar] pixmap_x, pixmap_w, pixmap_h); ^ trackcanvas.C:1522:27: error: Uninitialized variable: pixmap_h [uninitvar] pixmap_x, pixmap_w, pixmap_h); ^ trackcanvas.C:1527:8: error: Uninitialized variable: pixmap_x [uninitvar] pixmap_x, pixmap_w, pixmap_h, ^ trackcanvas.C:1527:18: error: Uninitialized variable: pixmap_w [uninitvar] pixmap_x, pixmap_w, pixmap_h, ^ trackcanvas.C:1527:28: error: Uninitialized variable: pixmap_h [uninitvar] pixmap_x, pixmap_w, pixmap_h, ^ trackcanvas.C:1537:8: error: Uninitialized variable: pixmap_x [uninitvar] pixmap_x, pixmap_w); ^ Checking tracksedit.C: HAVE_FIREWIRE... == |
|
cpp_check_cinelerra.log (108,795 bytes) cpp_check_guicast.log (66,390 bytes) |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2021-10-09 16:39 | Andrew-R | New Issue | |
2021-10-09 16:39 | Andrew-R | File Added: cpp_check_cinelerra.log | |
2021-10-09 16:39 | Andrew-R | File Added: cpp_check_guicast.log | |
2021-10-09 16:54 | Andrew-R | Note Added: 0005020 | |
2021-10-09 17:00 | Andrew-R | Note Added: 0005021 | |
2021-10-09 17:04 | Andrew-R | Note Added: 0005022 | |
2021-10-10 03:11 | PhyllisSmith | Note Added: 0005025 | |
2021-10-10 05:10 | Andrew-R | Note Added: 0005027 | |
2021-10-10 12:12 | Andrea_Paz | File Added: cpp_check.tar.gz | |
2021-10-10 12:12 | Andrea_Paz | Note Added: 0005029 | |
2021-10-10 16:15 | Andrew-R | File Added: valgrind_errs.diff | |
2021-10-10 16:15 | Andrew-R | Note Added: 0005033 | |
2021-10-10 16:48 | Andrew-R | Note Added: 0005034 | |
2021-10-10 17:10 | Andrew-R | Note Added: 0005035 | |
2021-10-10 17:39 | Andrew-R | Note Added: 0005036 | |
2021-10-10 19:30 | Andrew-R | File Added: vrender_init.diff | |
2021-10-10 19:30 | Andrew-R | Note Added: 0005040 | |
2021-10-11 00:47 | PhyllisSmith | Note Added: 0005044 | |
2021-10-11 02:57 | Andrew-R | Note Added: 0005045 |