Menu

#144 p7z/C/Ppmd7.c:406:5: Function call argument is an uninitialized value

v1.0 (example)
open
nobody
None
5
2015-02-18
2015-02-18
No

Xcode Product Analyze seems to correctly report use of uninitialized variable if skip != 0. See attachment

1 Attachments

Discussion

  • Igor Pavlov

    Igor Pavlov - 2015-02-18

    What exact argument is uninitialized?
    Now it's difficult to think about that code. I don't understand it right now.
    But I suppose that there is no BUG. Maybe there is some condition why the code flow execution is correct always.

     
  • Leo Kuznetsov

    Leo Kuznetsov - 2015-02-18

    I was doing something else completely (cleaning up Objective-C code actually) and run analysis in Xcode on whole project. Got ~70+ "warnings" from p7zip sources (which is part of the code). In this particular case Xcode (clang actually) is trying to say that if skip==1 and the loop iterated zero times. ps[--numPs] will refer to junk value. I do NOT know if the loop always iterates at least once - but I guess it might be the case. If you have access to Mac OSX and clang - it may worth running clang on the whole project and pacifying it.

    Feel free to reject the bug - I just wanted you to know that the tool exists.

    I personally benefited from using it - it found several quite non-obvious conditions leading to potential bugs that were not trivial in my own code.

    Leo

     
  • Igor Pavlov

    Igor Pavlov - 2015-02-18

    Yes, thanks.
    I have no mac. So I can't check the code with Xcode now.

     

Log in to post a comment.