Project

General

Profile

Actions

Bug #4181

closed

Name::end undefined behavior

Added by Junxiao Shi almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Base
Target version:
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.

Actions

Also available in: Atom PDF