Discussion:
FVWM: FvwmWharf.c:414: possible missing break ?
David Binderman
2013-10-03 08:27:22 UTC
Permalink
Hello there,

I just ran static analyser cppcheck over the source code of fvwm-2.6.5

It said many things, including

[FvwmWharf.c:414] -> [FvwmWharf.c:417]: (warning) Variable 'TextureType' is reassigned a value before the old one has been used. 'break;' missing?

Source code is

  case TEXTURE_BUILTIN:
    Builtin:
    TextureType=TEXTURE_BUILTIN;
   default:

Suggest add missing break

Regards

David Binderman
Thomas Adam
2013-10-03 08:34:39 UTC
Permalink
Post by David Binderman
Hello there,
I just ran static analyser cppcheck over the source code of fvwm-2.6.5
It said many things, including
[FvwmWharf.c:414] -> [FvwmWharf.c:417]: (warning) Variable 'TextureType' is reassigned a value before the old one has been used. 'break;' missing?
Source code is
    TextureType=TEXTURE_BUILTIN;
Suggest add missing break
Not worth it. FvwmWharf is dead. If that's *all* it found, I'm amazed.

-- Thomas Adam
David Binderman
2013-10-03 09:15:39 UTC
Permalink
----------------------------------------
Not worth it. FvwmWharf is dead. If that's *all* it found, I'm amazed.
Suggest remove dead code.

Many other things were found. I just triaged some of them.

Here's another one

[FvwmAnimate.c:918]: (error) fprintf format string has 9 parameters but only 8 are given.

I am not sure why the gcc compiler can't find that.

Regards

David Binderman
Thomas Adam
2013-10-03 09:17:09 UTC
Permalink
Post by David Binderman
----------------------------------------
Not worth it. FvwmWharf is dead. If that's *all* it found, I'm amazed.
Suggest remove dead code.
Many other things were found. I just triaged some of them.
That's not helpful, please send through the findings and someone will take a
look at them.

-- Thomas Adam
David Binderman
2013-10-03 09:31:52 UTC
Permalink
Hello there,

----------------------------------------
Date: Thu, 3 Oct 2013 10:17:09 +0100
Subject: Re: FVWM: FvwmWharf.c:414: possible missing break ?
Post by David Binderman
Many other things were found. I just triaged some of them.
That's not helpful, please send through the findings and someone will take a
look at them.
Righto, but there will be some false positives amongst these errors and warnings

First the errors

[FScreen.c:206]: (error) Uninitialized variable: hints
[PictureImageLoader.c:1005]: (error) Uninitialized variable: fpa
[Fft.c:263]: (error) Uninitialized struct member: extents.xOff
[FImage.c:194]: (error) Returning/dereferencing 'fim' after it is deallocated / released
[XError.c:46]: (error) Null pointer dereference
[add_window.c:221]: (error) Dereferencing 'fw' after it is deallocated / released
[FvwmAnimate.c:918]: (error) fprintf format string has 9 parameters but only 8 are given.
[FvwmWharf.c:333]: (error) fprintf format string has 1 parameters but only 0 are given.
[FvwmWharf.c:368]: (error) Array 'margv[9]' accessed at index 9, which is out of bounds.

then the first set of warnings

[Flocale.c:2112] -> [Flocale.c:2117]: (warning) Possible null pointer dereference: fws - otherwise it is redundant to check it against null.
[move_resize.c:834] -> [move_resize.c:838]: (warning) Possible null pointer dereference: paction - otherwise it is redundant to check it against null.
[virtual.c:2056]: (warning) Comparison of a boolean expression with an integer.
[virtual.c:2092]: (warning) Comparison of a boolean expression with an integer.
[session.c:357]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1279]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1384]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1394]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1404]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1414]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1424]: (warning) scanf without field width limits can crash with huge input data.
[session.c:1438]: (warning) scanf without field width limits can crash with huge input data.
[parse.c:111] -> [parse.c:98]: (warning) Possible null pointer dereference: option - otherwise it is redundant to check it against null.
[FvwmIconBox.c:2309]: (warning) scanf without field width limits can crash with huge input data.
[x.c:489]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.
[FvwmProxy.c:596]: (warning) scanf without field width limits can crash with huge input data.
[FvwmProxy.c:621]: (warning) scanf without field width limits can crash with huge input data.
[FvwmProxy.c:627]: (warning) scanf without field width limits can crash with huge input data.
[Instructions.c:389]: (warning) scanf without field width limits can crash with huge input data.
[Instructions.c:612]: (warning) scanf without field width limits can crash with huge input data.
[ButtonArray.c:797] -> [ButtonArray.c:790]: (warning) Possible null pointer dereference: temp - otherwise it is redundant to check it against null.
[FvwmWharf.c:414] -> [FvwmWharf.c:417]: (warning) Variable 'TextureType' is reassigned a value before the old one has been used. 'break;' missing?
[FvwmWharf.c:1677]: (warning) scanf without field width limits can crash with huge input data.
[FvwmWharf.c:1693]: (warning) scanf without field width limits can crash with huge input data.

and the second set, which your compiler is probably already detecting

[Flocale.c:2469]: (warning) %i in format string (no. 3) requires a signed integer but the argument type is 'unsigned int'.
[PictureUtils.c:2397]: (warning) %i in format string (no. 1) requires a signed integer but the argument type is 'unsigned int'.
[Colorset.c:145]: (warning) %n in format string (no. 2) requires 'int *' but the argument type is 'unsigned int *'.
[Picture.c:331]: (warning) %d in format string (no. 3) requires a signed integer but the argument type is 'unsigned int'.
[Picture.c:339]: (warning) %d in format string (no. 2) requires a signed integer but the argument type is 'unsigned int'.
[session.c:184]: (warning) %i in format string (no. 1) requires a signed integer but the argument type is 'unsigned int'.
[session.c:184]: (warning) %i in format string (no. 2) requires a signed integer but the argument type is 'unsigned int'.
[module_interface.c:648]: (warning) %d in format string (no. 1) requires a signed integer but the argument type is 'unsigned int'.
[modconf.c:351]: (warning) %d in format string (no. 1) requires a signed integer but the argument type is 'unsigned int'.
[button.c:647]: (warning) %d in format string (no. 3) requires a signed integer but the argument type is 'unsigned int'.
[button.c:662]: (warning) %d in format string (no. 3) requires a signed integer but the argument type is 'unsigned int'.
[output.c:53]: (warning) %i in format string (no. 2) requires a signed integer but the argument type is 'unsigned int'.
[output.c:53]: (warning) %i in format string (no. 3) requires a signed integer but the argument type is 'unsigned int'.
[output.c:60]: (warning) %i in format string (no. 2) requires a signed integer but the argument type is 'unsigned int'.
[output.c:60]: (warning) %i in format string (no. 3) requires a signed integer but the argument type is 'unsigned int'.
[output.c:140]: (warning) %i in format string (no. 1) requires a signed integer but the argument type is 'unsigned int'.
[output.c:140]: (warning) %i in format string (no. 2) requires a signed integer but the argument type is 'unsigned int'.
[FvwmButtons.c:1931]: (warning) %u in format string (no. 1) requires an unsigned integer but the argument type is 'int'.
[FvwmButtons.c:1931]: (warning) %u in format string (no. 2) requires an unsigned integer but the argument type is 'int'.
[FvwmCommand.c:891]: (warning) %ld in format string (no. 3) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:891]: (warning) %ld in format string (no. 4) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:891]: (warning) %ld in format string (no. 5) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:891]: (warning) %ld in format string (no. 6) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:902]: (warning) %ld in format string (no. 3) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:902]: (warning) %ld in format string (no. 4) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:902]: (warning) %ld in format string (no. 5) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:924]: (warning) %ld in format string (no. 2) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:924]: (warning) %ld in format string (no. 3) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:924]: (warning) %ld in format string (no. 4) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:924]: (warning) %ld in format string (no. 5) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:924]: (warning) %ld in format string (no. 6) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:936]: (warning) %ld in format string (no. 2) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:977]: (warning) %ld in format string (no. 3) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:977]: (warning) %ld in format string (no. 4) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:977]: (warning) %ld in format string (no. 5) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmCommand.c:977]: (warning) %ld in format string (no. 6) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmEvent.c:491]: (warning) %ld in format string (no. 3) requires a signed long integer but the argument type is 'unsigned long *'.
[FvwmPager.c:2025]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'.
[FvwmPager.c:2047]: (warning) %d in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'.
[FvwmProxy.c:1800]: (warning) %x in format string (no. 1) requires an integer but the argument type is 'struct Anonymous1'.
[FvwmProxy.c:1806]: (warning) %x in format string (no. 1) requires an integer but the argument type is 'struct Anonymous0'.
[FvwmProxy.c:2790]: (warning) %d in format string (no. 6) requires a signed integer but the argument type is 'unsigned int'.
[FvwmProxy.c:2871]: (warning) %d in format string (no. 4) requires a signed integer but the argument type is 'unsigned int'.
[FvwmRearrange.c:262]: (warning) %u in format string (no. 4) requires an unsigned integer but the argument type is 'int'.
[FvwmRearrange.c:262]: (warning) %u in format string (no. 5) requires an unsigned integer but the argument type is 'int'.
[FvwmRearrange.c:272]: (warning) %u in format string (no. 2) requires an unsigned integer but the argument type is 'int'.
[FvwmRearrange.c:272]: (warning) %u in format string (no. 3) requires an unsigned integer but the argument type is 'int'.
[FvwmRearrange.c:275]: (warning) %u in format string (no. 2) requires an unsigned integer but the argument type is 'int'.
[FvwmRearrange.c:275]: (warning) %u in format string (no. 3) requires an unsigned integer but the argument type is 'int'.

Regards

David Binderman
Dan Espen
2013-10-06 23:55:59 UTC
Permalink
Post by David Binderman
Hello there,
----------------------------------------
Date: Thu, 3 Oct 2013 10:17:09 +0100
Subject: Re: FVWM: FvwmWharf.c:414: possible missing break ?
Post by David Binderman
Many other things were found. I just triaged some of them.
That's not helpful, please send through the findings and someone will take a
look at them.
Righto, but there will be some false positives amongst these errors and warnings
First the errors
[FScreen.c:206]: (error) Uninitialized variable: hints
Hi,

I should take a look at this so I've saved the mail,
but I've been pretty busy with work and next week I'm
going to be completely offline for a week so you may not
hear anything for a while.

The effort is appreciated.
--
Dan Espen
Loading...