jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
419 stars 65 forks source link

potentilaly unititialized variable #577

Closed L0ric0 closed 3 years ago

L0ric0 commented 3 years ago

myMPD version: 8.1.2

Describe the bug

while building with distribution provided buildflags

CPPFLAGS="-D_FORTIFY_SOURCE=2"                                                                                                                                                                                                                                                                                                 
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \                                                                                                                                                                                                                                                         
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat \ # -Werror=format-security \                                                                                                                                                                                                                                                         
        -fstack-clash-protection -fcf-protection"                                                                                                                                                                                                                                                                              
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"                                                                                                                                                                                                                                                                                   
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

gcc complains about:

/tmp/makepkg/mympd/src/myMPD-8.1.2/cli_tools/mympd-script.c: In function 'parse_arguments.part.0':
/tmp/makepkg/mympd/src/myMPD-8.1.2/cli_tools/mympd-script.c:34:12: error: 'count' may be used uninitialized [-Werror=maybe-uninitialized]
   34 |         if (count == 2) {
      |            ^
/tmp/makepkg/mympd/src/myMPD-8.1.2/cli_tools/mympd-script.c:32:13: note: 'count' was declared here
   32 |         int count;
      |             ^

and

/tmp/makepkg/mympd/src/myMPD-8.1.2/src/mympd_api/mympd_api_browse.c: In function 'mympd_api_browse_album_list':
/tmp/makepkg/mympd/src/myMPD-8.1.2/src/mympd_api/mympd_api_browse.c:427:9: error: 'count' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  427 |     int count;
      |         ^

To Reproduce

Steps to reproduce the behavior:

  1. build mympd with the build

Expected behavior no warnings/ errors while building

Screenshots

If applicable, add screenshots to help explain your problem.

Server plattform (please complete the following information):

Client plattform (please complete the following information):

Debug logs (please attach if it can be usefull)

Look at https://jcorporation.github.io/myMPD/debug

Configuration (please attach if it can be usefull)

Additional context

Add any other context about the problem here.

jcorporation commented 3 years ago

My arch build on https://build.opensuse.org/package/show/home:jcorporation/myMPD builds without warnings.

It seems this is no real issue but I fix this warnings regardless. Please check latest devel.

L0ric0 commented 3 years ago

ok i seem to have stricter settings on my laptop than on my pi. The issue is fixed thanks.