Bugzilla – Bug 72
Adding additional assertions in Buffer uncovers bugs
Last modified: 2007-09-10 12:55:10 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.
Created attachment 52 [details] patch to add the additional assertions (with it, waf check triggers an assertion)
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.