Closed mss closed 1 year ago
I digged a bit and the id the tool is requesting is appstreamcli get org.kde.neon.com.ubuntu.ddebs
for which appstreamcli
tells me: Unable to find component with ID 'org.kde.neon.com.ubuntu.ddebs'!
.
According to the code linked above does pool.componentsById(id)
return at least one component nevertheless.
4 0x00007fb701fc640e in AppStream::Component::toString (this=this@entry=0x0) at ../qt/component.cpp:731
Eh... It looks like your component is nullptr
and you are dereferencing NULL here.
The code you linked doesn't make sense to me in what it is trying to achieve, but I also don't see how it would return a NULL component either.
QList<AppStream::Component> components;
for (const auto &id : ids) {
const auto matchedComponents = pool.componentsById(id);
components += matchedComponents;
Q_ASSERT(components.count() == 1); // ensure distros use valid ids
const auto &component = matchedComponents.at(0);
Q_ASSERT(component.isValid()); // we've seen crash reports that indicated invalid components, unclear why. verify them for now.
qWarning() << component.toString();
qWarning() << component.packageNames();
Q_ASSERT(component.kind() == AppStream::Component::KindRepository);
}
=> As soon as you run through the for-loop twice and found components, components.count()
will be > 1
, so how does this code not crash in the respective assertion? (It would even crash in the first try when there's two repositories providing the same component...)
That's not the source of the bug though... Purely from looking at the code, I have no idea (yet) how this could happen.
I digged a bit and the id the tool is requesting is
appstreamcli get org.kde.neon.com.ubuntu.ddebs
for whichappstreamcli
tells me:Unable to find component with ID 'org.kde.neon.com.ubuntu.ddebs'!
.
Also very odd - was this component maybe injected from some kind of non-stabdard location that isn't read by default by AppStream?
4 0x00007fb701fc640e in AppStream::Component::toString (this=this@entry=0x0) at ../qt/component.cpp:731
Eh... It looks like your component is
nullptr
and you are dereferencing NULL here.
To me it looks like the component
is not null but the m_cpt
(or whatever valueWrap(as_component_to_string(m_cpt))
returns) is a nullptr
.
The code you linked doesn't make sense to me in what it is trying to achieve [..]
Indeed, I pointed that out on the KDE bug already. I think this is a leftover of the "multiple ids aren't implemented yet" TODO further up and even though the code is slightly wrong it happens to work because it checks that only one id is given further up (ie. the whole loop is misleading).
That's not the source of the bug though... Purely from looking at the code, I have no idea (yet) how this could happen.
To me it looks like the pool.componentsById(id)
returns a QList
with an Component
with an inner nullptr
if the id
can't be found. But I haven't had a chance to recompile that code with debugging enabled yet to verify this.
I digged a bit and the id the tool is requesting is
appstreamcli get org.kde.neon.com.ubuntu.ddebs
for whichappstreamcli
tells me:Unable to find component with ID 'org.kde.neon.com.ubuntu.ddebs'!
.Also very odd - was this component maybe injected from some kind of non-stabdard location that isn't read by default by AppStream?
Nope, all the code there is is in that file. The Component
is provided by the Pool
, nothing fancy going on.
Ah, wait. I think the bug is actually in that code. This is release code so the Q_ASSERT
s are probably not doing anything. So the components.count() == 1
isn't catching a zero element list being added before. And matchedComponents.at(0)
would violate the requirement that the index must exist in the list, ie. it could return anything which wouldn't be caught by the next Q_ASSERT
either. So the next line would be the first actual request to that invalid value.
Let me check that with the actual upstream code first, I'll get back to you and sorry for bothering you if this was not a bug in the first place.
Let me check that with the actual upstream code first, I'll get back to you and sorry for bothering you if this was not a bug in the first place.
Did your tests work? ;-)
Closing this, as it's likely not an AppStream issue. If the issue persists, feel free to reopen this issue.
I originally reported this to KDE as bug 474402 but this looks like an upstream bug: Whatever their tool is doing wrong or however the metadata is malformed, the library shouldn't crash.
To reproduce this:
drkonqi-pk-debug-installer /usr/bin/dolphin
(or choose any other KDE app or lib as the argument)This will result in a crash with the following stack trace:
The source code for the tool triggering the crash is available at https://invent.kde.org/system/drkonqi-pk-debug-installer/-/blob/acd7675aa72a61ede8b85fe96fc5cd225506312b/src/DebugRepoEnabler.cpp#L43 and it looks fine at least to my rusty C++ eyes.
Neon ships
libappstream
version0.16.2
but a quick glance at the release log didn't look like this was fixed in the current0.16.3
(libxmlb
is at0.3.14
already).