Control: tags -1 patch
When you have addressed this in unstable please consider backporting to
trixie. I am including the fix and test for CVE-2026-44928 for the
trixie version.
Origin: upstream, 723717c713a01c08efed6b3ded9583d7819e3386
From: Sebastian Pipping <[email protected]>
Date: Tue, 5 May 2026 00:26:01 +0200
Subject: src/UriCompare.c: Fix `EqualsUri` with regard to `.absolutePath`
Applied-Upstream: 1.0.2
Last-Update: 2026-09-01
Backport of the upstream fix to uriparser 0.9.8. The upstream change relies
on the URI_FUNC(HasHost) helper that was introduced in uriparser 0.9.9; since
that helper is not present in 0.9.8, the host check is inlined here using the
equivalent condition (a host is present iff hostText, ip4 or ip6 host data is
set; ipFuture host text is covered by hostText).
---
src/UriCompare.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/UriCompare.c b/src/UriCompare.c
index 8dec8fb..f9def86 100644
--- a/src/UriCompare.c
+++ b/src/UriCompare.c
@@ -81,8 +81,10 @@
return URI_FALSE;
}
- /* absolutePath */
- if ((a->scheme.first == NULL)&& (a->absolutePath != b->absolutePath)) {
+ /* absolutePath -- not meaningful for URIs with a host set! */
+ if ((a->hostText.first == NULL) && (a->hostData.ip4 == NULL)
+ && (a->hostData.ip6 == NULL)
+ && (a->absolutePath != b->absolutePath)) {
return URI_FALSE;
}
Origin: upstream, bd7f2e6c0c17dd78853f85107535391b4635a86d
From: Sebastian Pipping <[email protected]>
Date: Tue, 5 May 2026 00:24:28 +0200
Subject: test/test.cpp: Cover `EqualsUri` with regard to `.absolutePath`
Applied-Upstream: 1.0.2
Last-Update: 2026-09-01
Backport to uriparser 0.9.8 (moved to the location of TestEquals in this
version and re-indented to match the file's tab style).
---
test/test.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/test/test.cpp b/test/test.cpp
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -1965,6 +1965,77 @@
testEqualsHelper("//host:123");
}
+
+TEST(UriSuite, TestEqualsAbsolutePathWithSchemeWithHost) {
+ UriUriA uriAbsPathTrue;
+ UriUriA uriAbsPathFalse;
+
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathTrue, "scheme://host/path1", NULL),
+ URI_SUCCESS);
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathFalse, "scheme://host/path1", NULL),
+ URI_SUCCESS);
+ uriAbsPathTrue.absolutePath = URI_TRUE; // i.e. produce artificially
+
+ EXPECT_EQ(uriAbsPathTrue.absolutePath, URI_TRUE); // self-test
+ EXPECT_EQ(uriAbsPathFalse.absolutePath, URI_FALSE); // self-test
+
+ // NOTE: .absolutePath is ignored for URIs with hosts!
+ EXPECT_EQ(uriEqualsUriA(&uriAbsPathFalse, &uriAbsPathTrue), URI_TRUE);
+
+ uriFreeUriMembersA(&uriAbsPathTrue);
+ uriFreeUriMembersA(&uriAbsPathFalse);
+}
+
+TEST(UriSuite, TestEqualsAbsolutePathWithSchemeWithoutHost) {
+ UriUriA uriAbsPathTrue;
+ UriUriA uriAbsPathFalse;
+
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathTrue, "scheme:/path1", NULL), URI_SUCCESS);
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathFalse, "scheme:path1", NULL), URI_SUCCESS);
+
+ EXPECT_EQ(uriAbsPathTrue.absolutePath, URI_TRUE); // self-test
+ EXPECT_EQ(uriAbsPathFalse.absolutePath, URI_FALSE); // self-test
+
+ EXPECT_EQ(uriEqualsUriA(&uriAbsPathFalse, &uriAbsPathTrue), URI_FALSE);
+
+ uriFreeUriMembersA(&uriAbsPathTrue);
+ uriFreeUriMembersA(&uriAbsPathFalse);
+}
+
+TEST(UriSuite, TestEqualsAbsolutePathWithoutSchemeWithHost) {
+ UriUriA uriAbsPathTrue;
+ UriUriA uriAbsPathFalse;
+
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathTrue, "//host/path1", NULL), URI_SUCCESS);
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathFalse, "//host/path1", NULL), URI_SUCCESS);
+ uriAbsPathTrue.absolutePath = URI_TRUE; // i.e. produce artificially
+
+ EXPECT_EQ(uriAbsPathTrue.absolutePath, URI_TRUE); // self-test
+ EXPECT_EQ(uriAbsPathFalse.absolutePath, URI_FALSE); // self-test
+
+ // NOTE: .absolutePath is ignored for URIs with hosts!
+ EXPECT_EQ(uriEqualsUriA(&uriAbsPathFalse, &uriAbsPathTrue), URI_TRUE);
+
+ uriFreeUriMembersA(&uriAbsPathTrue);
+ uriFreeUriMembersA(&uriAbsPathFalse);
+}
+
+TEST(UriSuite, TestEqualsAbsolutePathWithoutSchemeWithoutHost) {
+ UriUriA uriAbsPathTrue;
+ UriUriA uriAbsPathFalse;
+
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathTrue, "/path1", NULL), URI_SUCCESS);
+ ASSERT_EQ(uriParseSingleUriA(&uriAbsPathFalse, "path1", NULL), URI_SUCCESS);
+
+ EXPECT_EQ(uriAbsPathTrue.absolutePath, URI_TRUE); // self-test
+ EXPECT_EQ(uriAbsPathFalse.absolutePath, URI_FALSE); // self-test
+
+ EXPECT_EQ(uriEqualsUriA(&uriAbsPathFalse, &uriAbsPathTrue), URI_FALSE);
+
+ uriFreeUriMembersA(&uriAbsPathTrue);
+ uriFreeUriMembersA(&uriAbsPathFalse);
+}
+
TEST(UriSuite, TestHostTextTerminationIssue15) {
UriParserStateA state;
UriUriA uri;