[zeromq-dev] MSVC2012 static code analysis on 0mq 2.2
Steven McCoy
steven.mccoy at miru.hk
Wed Sep 5 21:03:39 CEST 2012
It appears to work for x64 now, took long enough to get there and execute.
Most errors are unsurprisingly assertion guarded null pointer dereferences.
Interesting issues (which don't copy & paste well)
1:
[image: Inline images 1]
Which is a platform specific issue:
*Windows Server 2003 and Windows XP: *In low memory situations, *
> InitializeCriticalSection* can raise a *STATUS_NO_MEMORY*exception. This
> exception was eliminated starting with Windows Vista.
Ref:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683472(v=vs.85).aspx
2:
[image: Inline images 2]
This is a valid defect, the size() parameter is checked but the result
of malloc
is not.
zmq_assert (peer_identity_.size () <= 0xff);
cmd.args.attach.peer_identity_size =
(unsigned char) peer_identity_.size ();
cmd.args.attach.peer_identity =
(unsigned char*) malloc (peer_identity_.size ());
alloc_assert (cmd.args.attach.peer_identity_size);
memcpy (cmd.args.attach.peer_identity, peer_identity_.data (),
peer_identity_.size ());
Duplicate: line 264.
3:
[image: Inline images 3]
This is in zmq_poll, I'm guessing the fd_set's are big?
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120905/0b739c2a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 7948 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120905/0b739c2a/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 13594 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120905/0b739c2a/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 8781 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120905/0b739c2a/attachment-0002.png>
More information about the zeromq-dev
mailing list