Bug 72 - Adding additional assertions in Buffer uncovers bugs
Adding additional assertions in Buffer uncovers bugs
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
PC Linux
: P1 blocker
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-06 07:01 UTC by Gustavo J. A. M. Carneiro
Modified: 2007-09-10 12:55 UTC (History)
0 users

See Also:


Attachments
patch to add the additional assertions (with it, waf check triggers an assertion) (1.21 KB, patch)
2007-09-06 07:02 UTC, Gustavo J. A. M. Carneiro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2007-09-06 07:01:40 UTC
I found the assertion:
    NS_ASSERT (m_start <= m_data->m_initialStart);
in Buffer::AddAtStart being triggered for my OLSR code.

I must say that I don't understand the Buffer implementation.  However, that particular assertion is present at the very start of Buffer::AddAtStart and doesn't check the parameter, which leads me to conclude it is an internal consistency check on the buffer state, thus an invariant.  Invariants must be observed everywhere, and so I added the assertion in a few more places and was able to trigger the assertion from the unit tests.  Either the assertion is wrong or there is another bug inside Buffer.
Comment 1 Gustavo J. A. M. Carneiro 2007-09-06 07:02:41 UTC
Created attachment 52 [details]
patch to add the additional assertions (with it, waf check triggers an assertion)
Comment 2 Mathieu Lacage 2007-09-10 12:55:10 UTC
reduced testcase.

  p = Packet (10);
  ADD_HEADER (p, 8);
  ADD_TRAILER (p, 8);
  ADD_TRAILER (p, 8);
  p.RemoveAtStart (8+10+8);
  CHECK_HISTORY (p, 1, 8);

I have a fix in a private repo but I need to clean it up before inclusion.