Project

General

Profile

Actions

Bug #1304

closed

Name::get should check bounds

Added by Junxiao Shi over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

// g++ name-get.cpp -lndn-cpp-dev -pthread -lboost_system -lboost_filesystem -lcrypto -lcryptopp -lsqlite3 -lrt

#include <ndn-cpp-dev/name.hpp>

int
main()
{
  ndn::Name name("ndn:/hello");
  std::cout << name.get(999);
  std::cout << name.get(-999);

  return 0;
}

Expected: throw exception

Actual: segmentfault

Actions #1

Updated by Junxiao Shi over 11 years ago

  • Tracker changed from Task to Bug

Wow I can edit issues in ndn-cpp-dev now.

Actions #2

Updated by Alex Afanasyev over 11 years ago

I don't want to fix this. It is not library's responsibility to check the bounds of the container...

Actions #3

Updated by Junxiao Shi over 11 years ago

I don't want to fix this. It is not library's responsibility to check the bounds of the container...

Then this should be specified in a Doxygen comment.

Actions #4

Updated by Junxiao Shi over 11 years ago

The STL convention is, operator[] does not check bounds, at checks bounds.

In Name class, both are aliases of get and don't check bounds.

At least, bounds checking should be added to at method.

Actions #5

Updated by Alex Afanasyev over 11 years ago

  • Status changed from New to Closed

at command is checking bounds as of commit:c23442992

Actions

Also available in: Atom PDF