Bug 72

Summary: Adding additional assertions in Buffer uncovers bugs
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P1    
Version: pre-release   
Hardware: PC   
OS: Linux   
Attachments: patch to add the additional assertions (with it, waf check triggers an assertion)

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.