libadm
libadm copied to clipboard
set(AudioContentId) calls getParent().lock()->lookup(id) without checking for nullptr
It does check for nullptr before doing this, but it could have been removed in the meantime.
This is probably the same for the other types.
So
https://github.com/ebu/libadm/blob/4703bdc3fab08011fa9be44334e11122308a2fee/src/elements/audio_content.cpp#L96-L98
should be
{
auto parent = getParent().lock();
if(parent && parent->lookup(id)) {
throw std::runtime_error("id already in use");
}
}
?
Yeah, exactly. In practice it's fine in single-threaded code, but I have to think about it every time I see it.