Bugzilla – Full Text Bug Listing |
Summary: | Buffer::Iterator::ReadNtohU16 and ReadNtohU32 are inconsistent with other Read functions. | ||
---|---|---|---|
Product: | ns-3 | Reporter: | debug.ito |
Component: | network | Assignee: | ns-bugs <ns-bugs> |
Status: | PATCH WANTED --- | ||
Severity: | normal | CC: | tomh |
Priority: | P3 | ||
Version: | ns-3-dev | ||
Hardware: | All | ||
OS: | All | ||
Attachments: | Test the behavior of Read functions. |
Created attachment 2748 [details] Test the behavior of Read functions. Most of Buffer::Iterator's Read* member functions crash the application by an assertion error if the buffer's remaining size is smaller than the expected size. However, ReadNtoU16 and ReadNtoU32 sometimes do NOT crash the application. Instead they return some values as if they succeeded. This inconsistent behavior may hide the error, causing a bug that is tricky to track down. This inconsistent behavior is demonstrated in the attached test file. Because I was not sure how to check a code failing an assertion, you have to enable lines with "it crashes" comments manually and see how it crashes the test. The point is, while other Read functions crash the application, ReadNtohU16 and ReadNtoh32 do not. I think the cause of this bug lies in the "by-pass" code of these two functions for better performance.