Bug 1078 - PacketTagList::Add performs NS_ASSERT counting one byte too few
PacketTagList::Add performs NS_ASSERT counting one byte too few
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
All All
: P5 trivial
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-24 09:27 EDT by Christian
Modified: 2011-03-24 10:16 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian 2011-03-24 09:27:05 EDT
The PacketTagList::Add (Tag) method checks that the tag being added is not greater than PACKET_TAG_MAX_SIZE.

  NS_ASSERT (tag.GetSerializedSize () < PACKET_TAG_MAX_SIZE);

PACKET_TAG_MAX_SIZE is set to 20.
The Tag in questions *can* contain an Inet6SocketAddress.
If that is the case its size will be:
  16 (IPv6 address) + 2 (port number) + 1+1 (as defined in Address::GetSerializedSize()) which sums up to 20, and systematically fails the assert.

I think that replacing '<' with '<=' fixes the issue.
Comment 1 Mathieu Lacage 2011-03-24 10:16:08 EDT
changeset afe2960e58b7