unoxml/source/rdf/librdf_repository.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 76f6a756692a0ad3c5c0724f72a4c5d07ddad4a0
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Apr 4 17:33:10 2025 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed Apr 9 07:32:45 2025 +0200

    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.st...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 4995811d0d9cf74fecf9b733b0a0f04fb15e372e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183731
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 09b4a9cac17a..aa1cf229b364 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -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()) {

Reply via email to