Jules
Jules

Reputation: 7776

The left operand of '&' is a garbage value

I wouldn't normally paste an image, I would provide the code as text, but I felt that the analyzer warnings where important.

I'm not sure what this means and how to fix the problems.

enter image description here

The full code can be found here https://github.com/robbiehanson/CocoaHTTPServer/blob/master/Core/Categories/DDData.m

Upvotes: 3

Views: 1181

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185731

Typically you can expand the warning in the sidebar to get a detailed list of the control flow that leads to this situation. In your case, the static analyzer is saying that, given a certain set of circumstances, that line of code will execute where inbuf[1] has never been initialized to a value, and thus is garbage.

I would guess that the circumstances are if ch == '=', this will set flendtext to YES, which will set ixinbuf to 3, which means that inbuf[x] for x == 0-2 will never be initialized, and the subsequent access of these values is garbage.

Upvotes: 7

Related Questions