Bug #3665
Updated by Alex Afanasyev over 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))`.
Test case to reproduce current problem (thanks to Jeff 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);
}
```