Actions
Bug #4181
closedName::end undefined behavior
Start date:
07/11/2017
Due date:
% Done:
100%
Estimated time:
1.00 h
Description
Snippet to reproduce:
// g++ -std=c++11 -o x x.cpp $(pkg-config --cflags --libs libndn-cxx) -fsanitize=undefined
#include <ndn-cxx/name.hpp>
int
main()
{
ndn::Name n0;
n0.end();
}
Actual: /usr/include/c++/5/bits/stl_iterator.h:754:17: runtime error: reference binding to null pointer of type 'const struct Block'
Expected: no such error
Additionally, Name::begin()
also triggers undefined behavior if name is empty.
Updated by Junxiao Shi over 7 years ago
- Assignee set to Junxiao Shi
I can work on this after https://gerrit.named-data.net/4025 is merged.
Updated by Junxiao Shi over 7 years ago
- Subject changed from Name::end undefined behavior to Name::end undefined behavior if name.empty()
Updated by Davide Pesavento over 7 years ago
Actually, both Name::begin()
and Name::end()
dereference a past-the-end iterator (which is not dereferenceable) if the name is empty.
Updated by Junxiao Shi over 7 years ago
- Subject changed from Name::end undefined behavior if name.empty() to Name::end undefined behavior
- Description updated (diff)
- Status changed from New to In Progress
Updated by Junxiao Shi over 7 years ago
- Status changed from In Progress to Code review
- % Done changed from 0 to 100
Updated by Junxiao Shi over 7 years ago
- Status changed from Code review to Closed
Actions