Project

General

Profile

Bug #3665

Updated by Junxiao Shi almost 8 years ago

The current code makes an assumption that an "empty" name component is a generic name component with empty content, which breaks the logic given ImplicitSha256DigestComponent type is smaller than GenericNameComponent. 

 The temporary solution would be to replace `name::Component()` with `name::Component(Block(ImplicitSha256DigestComponent))`. 
     The correct solution would be relax requirements (and update TLV spec) on what types name components can carry and then use `name::Component(Block(0))`. 

 Snippet Test case to reproduce [from current problem (thanks to Jeff Thompson](http://www.lists.cs.ucla.edu/pipermail/ndn-lib/2016-July/000333.html): Thompson) 

 ```cpp 
 BOOST_AUTO_TEST_CASE(ExcludeGenericImplicitDigest) 
 { 
   uint8_t WIRE[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 
   Exclude exclude; 
   exclude.excludeBefore(name::Component("C")); 
   name::Component component = name::Component::fromImplicitSha256Digest(WIRE, sizeof(WIRE)); 
   BOOST_CHECK_EQUAL(exclude.isExcluded(component), true); 
 } 
 ```

Back