Bugzilla – Bug 2553
Dead assignment on packet-metadata.cc
Last modified: 2017-04-17 20:23:33 UTC
If you look at line 192: 191 uint32_t result = 0; 192 uint8_t byte; 193 result = 0; // Value stored to 'result' is never read 194 byte = buffer[0]; 195 result = (byte & (~0x80)); There is a dead assignment; patch is trivial.
Another one is at the following lines (266): 254 void 255 PacketMetadata::AppendValueExtra (uint32_t value, uint8_t *buffer) 256 { 257 NS_LOG_FUNCTION (this << value << &buffer); 258 if (value < 0x200000) 259 { 260 uint8_t byte = value & (~0x80); 261 buffer[0] = 0x80 | byte; 262 value >>= 7; 263 byte = value & (~0x80); 264 buffer[1] = 0x80 | byte; 265 value >>= 7; 266 byte = value & (~0x80); // Value stored to 'byte' is never read 267 buffer[2] = value; 268 return; 269 } The patch is less simple: should the value of "byte" be stored somewhere?
Another problem is a use-after-free. I don't open another bug because the patch is trivial: 589 PacketMetadata::Deallocate (data); 590 NS_LOG_LOGIC ("create dealloc size="<<data->m_size); // use-after-free We are deallocating data, and then we are printing a field inside that region of memory. Fortunately no use uses LOGIC debug on PacketMetadata :)
I guess these changes are incorporated already in ns-3-dev? So is there anything else holding this issue open that I could help with ?
Was fixed a while back in changeset 12697:c034f3634c8c