tdf#166040 unordf: fix assert when importing empty stream

rdf_parser.c:592: (librdf_parser_parse_counted_string_as_stream) assertion failed: string length is not greater than zero

Check for this in librdf_Repository::importGraph()

Change-Id: I27e180fd2fc09c5f43b7fdfcc7faa184bdc0808a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183721
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl
2025-04-04 19:53:59 +02:00
parent c55ae72266
commit 4995811d0d
+5
View File
@@ -999,6 +999,11 @@ librdf_Repository::importGraph(::sal_Int16 i_Format,
// exceptions are propagated
i_xInStream->readBytes( buf, static_cast<sal_Int32>( sz ) );
if (buf.getLength() == 0) {
throw rdf::ParseException(
u"librdf_Repository::importGraph: stream is empty"_ustr, *this);
}
std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (m_NamedGraphs.find(contextU) != m_NamedGraphs.end()) {