backport raptor fixes that are merged upstream but unreleased

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 <caolan.mcnamara@collabora.com>
Change-Id: I70d9f5d5489628775a7e8a3b0dbe448ef285465b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3990
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f34d6fa958a84638060f648abbecbca0b290d63e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206206
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2026-06-08 13:37:09 +02:00
committed by Xisco Fauli
parent 632f432d2f
commit e074f782b3
2 changed files with 59 additions and 0 deletions
+1
View File
@@ -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:
@@ -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 <component>/.. 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