From e074f782b3bb9d3ffaafc013b80f5f61a00da89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sun, 7 Jun 2026 11:12:54 +0000 Subject: [PATCH] backport raptor fixes that are merged upstream but unreleased MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These three changes are on raptor master but not in any release raptor_ntriples.c: inspect the last character of a blank node id only when the id length is greater than zero (upstream ece2c79d, github issue 70). raptor_rfc2396.c: return an empty path when normalisation reduces the remaining length to zero (upstream da7a7997, github issue 70). raptor_term.c: guard the language copy loop with language_len (github issue 83 / pull request 84) Signed-off-by: Caolán McNamara Change-Id: I70d9f5d5489628775a7e8a3b0dbe448ef285465b Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3990 Reviewed-by: Andras Timar Tested-by: Jenkins CPCI (cherry picked from commit f34d6fa958a84638060f648abbecbca0b290d63e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206206 Reviewed-by: Xisco Fauli Tested-by: Jenkins --- external/redland/UnpackedTarball_raptor.mk | 1 + .../raptor-backport-unreleased-fixes.patch.1 | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 external/redland/raptor/raptor-backport-unreleased-fixes.patch.1 diff --git a/external/redland/UnpackedTarball_raptor.mk b/external/redland/UnpackedTarball_raptor.mk index 26c681b344a3..8491e104cc41 100644 --- a/external/redland/UnpackedTarball_raptor.mk +++ b/external/redland/UnpackedTarball_raptor.mk @@ -32,6 +32,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,raptor,\ $(if $(SYSTEM_ICU),,external/redland/raptor/raptor-icu.patch) \ external/redland/raptor/disable-libxml-cleanup.patch.1 \ external/redland/raptor/CVE-2024-57823.patch.1 \ + external/redland/raptor/raptor-backport-unreleased-fixes.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/redland/raptor/raptor-backport-unreleased-fixes.patch.1 b/external/redland/raptor/raptor-backport-unreleased-fixes.patch.1 new file mode 100644 index 000000000000..7683ca73a44f --- /dev/null +++ b/external/redland/raptor/raptor-backport-unreleased-fixes.patch.1 @@ -0,0 +1,58 @@ +--- a/src/raptor_ntriples.c ++++ b/src/raptor_ntriples.c +@@ -212,7 +212,7 @@ raptor_ntriples_parse_term_internal(raptor_world* world, + locator->column--; + locator->byte--; + } +- if(term_class == RAPTOR_TERM_CLASS_BNODEID && dest[-1] == '.') { ++ if(term_class == RAPTOR_TERM_CLASS_BNODEID && position > 0 && dest[-1] == '.') { + /* If bnode id ended on '.' move back one */ + dest--; + +--- a/src/raptor_rfc2396.c ++++ b/src/raptor_rfc2396.c +@@ -351,6 +351,10 @@ raptor_uri_normalize_path(unsigned char* path_buffer, size_t path_len) + *dest++ = *s++; + *dest = '\0'; + path_len -= len; ++ if(path_len <= 0) { ++ *path_buffer = '\0'; ++ return 0; ++ } + + if(p && p < prev) { + /* We know the previous prev path component and we didn't do +@@ -390,6 +394,10 @@ raptor_uri_normalize_path(unsigned char* path_buffer, size_t path_len) + /* Remove /.. at the end of the path */ + *prev = '\0'; + path_len -= (s-prev); ++ if(path_len <= 0) { ++ *path_buffer = '\0'; ++ return 0; ++ } + } + + +--- a/src/raptor_term.c ++++ b/src/raptor_term.c +@@ -209,10 +209,16 @@ raptor_new_term_from_counted_literal(raptor_world* world, + } + + l = new_language; +- while((c = *language++)) { +- if(c == '_') +- c = '-'; +- *l++ = c; ++ { ++ size_t i; ++ for(i = 0; i < language_len; i++) { ++ c = *language++; ++ if(!c) ++ break; ++ if(c == '_') ++ c = '-'; ++ *l++ = c; ++ } + } + *l = '\0'; + } else