#4 several warnings and errors

open
nobody
None
5
2013-09-07
2012-08-16
No

while building on 'build.opensuse.org' I run into several problems:

I: Program causes undefined operation
(likely same variable used twiceand post/pre incremented in the same expression).
e.g. x = x++; Split it in two operations.
W: nas sequence-point auedit.c:1253

I: Program is using implicit definitions of special functions.
these functions need to use their correct prototypes to allow
the lightweight buffer overflow checking to work.
- Implicit memory/string functions need #include <string.h>.
- Implicit *printf functions need #include <stdio.h>.
- Implicit *printf functions need #include <stdio.h>.
- Implicit *read* functions need #include <unistd.h>.
- Implicit *recv* functions need #include <sys/socket.h>.
E: nas implicit-fortify-decl auvoxware.c:1579
E: nas implicit-fortify-decl config.c:87

I: Function call needs to pass NULL-pointer as last argument
E: nas missing-sentinel audemo.c:1644
E: nas missing-sentinel audiotool.c:467
E: nas missing-sentinel auedit.c:2497
E: nas missing-sentinel aupanel.c:513
E: nas missing-sentinel auphone.c:1154
E: nas missing-sentinel auwave.c:403

I: Program returns random data in a function
E: nas no-return-in-nonvoid-function access.c:552, 444, 397, 303
E: nas no-return-in-nonvoid-function auconvert.c:124
E: nas no-return-in-nonvoid-function auth.c:158, 90
E: nas no-return-in-nonvoid-function connection.c:1810, 1790, 1779, 1764, 1729, 1721
E: nas no-return-in-nonvoid-function gram.y:251
E: nas no-return-in-nonvoid-function io.c:397
E: nas no-return-in-nonvoid-function mitauth.c:105
E: nas no-return-in-nonvoid-function recordBucket.c:79

please find attached patch for solving these warnings/errors.

Discussion

  • Erik Auerswald

    Erik Auerswald - 2013-09-07

    svn revision 292 fixes

    """
    I: Function call needs to pass NULL-pointer as last argument
    E: nas missing-sentinel audemo.c:1644
    E: nas missing-sentinel audiotool.c:467
    E: nas missing-sentinel auedit.c:2497
    E: nas missing-sentinel aupanel.c:513
    E: nas missing-sentinel auphone.c:1154
    E: nas missing-sentinel auwave.c:403
    """

     
  • Erik Auerswald

    Erik Auerswald - 2013-09-07

    The reported "undefined behavior" is well defined IMO.

    """
    I: Program causes undefined operation
    (likely same variable used twiceand post/pre incremented in the same expression).
    e.g. x = x++; Split it in two operations.
    W: nas sequence-point auedit.c:1253
    """

    The patch suggests a change wich may be easier to read for some by avoiding complete use of the post-increment operator together with pointer dereferencing.

    The current code is:

    """
    p++ = (p + *data++) / 2;
    """

    *data++ is obviously correct, any C programmer can see this.

    The remaining part of the code increments the pointer p, after writing a new value derived in part from p to p. There is one write to *p and one to p in this expression. This is well defined.

    I prefer the current, concise way to write this.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks