aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/uriparser
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2022-10-19 20:00:14 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2022-10-19 20:00:14 +0300
commit33ffd2163c280a9bcc0e7a9e67088b3ac5f6295b (patch)
tree9d6a2049912d84f2184155b254f215d60c22ad8f /contrib/restricted/uriparser
parenta42f7e7e0064e0d5bc54bde4506539d4766e1356 (diff)
downloadydb-33ffd2163c280a9bcc0e7a9e67088b3ac5f6295b.tar.gz
Update contrib/restricted/uriparser to 0.9.7
Diffstat (limited to 'contrib/restricted/uriparser')
-rw-r--r--contrib/restricted/uriparser/ChangeLog23
-rw-r--r--contrib/restricted/uriparser/UriConfig.h (renamed from contrib/restricted/uriparser/config.h)2
-rw-r--r--contrib/restricted/uriparser/include/uriparser/Uri.h2
-rw-r--r--contrib/restricted/uriparser/include/uriparser/UriBase.h29
-rw-r--r--contrib/restricted/uriparser/src/UriMemory.c5
-rw-r--r--contrib/restricted/uriparser/src/UriParse.c29
-rw-r--r--contrib/restricted/uriparser/test/VersionSuite.cpp2
-rw-r--r--contrib/restricted/uriparser/test/test.cpp38
-rw-r--r--contrib/restricted/uriparser/tool/uriparse.c8
9 files changed, 98 insertions, 40 deletions
diff --git a/contrib/restricted/uriparser/ChangeLog b/contrib/restricted/uriparser/ChangeLog
index cf1a837663..7cf421bd31 100644
--- a/contrib/restricted/uriparser/ChangeLog
+++ b/contrib/restricted/uriparser/ChangeLog
@@ -2,6 +2,29 @@ NOTE: uriparser is looking for help with a few things:
https://github.com/uriparser/uriparser/labels/help%20wanted
If you can help, please get in touch. Thanks!
+2022-10-05 -- 0.9.7
+
+ * Fixed: Multiple issues with IPv6 and IPvFuture literal parsing
+ (GitHub #146, GitHub #150)
+ Thanks to Scallop Ye for the report and the pull request!
+ * Fixed: Fix symbol visibility for -DBUILD_SHARED_LIBS=OFF (GitHub #139,
+ GitHub #141); thanks to Mariusz Zaborski for the report!
+ * Fixed: For MinGW, use size_t for inet_ntop declaration and fix macro
+ checks for both MinGW and mingw-w64 (GitHub #131)
+ * Fixed: Compiler warnings (GitHub #132, GitHub #152)
+ * Improved: Use name UriConfig.h rather than generic config.h for the
+ config header file to avoid name clashes and also include it through
+ "UriConfig.h" with quotes rather than <UriConfig.h> so that it is found
+ in quote path locations (GitHub #149)
+ Thanks to Gaspard Petit for bringing this up!
+ * Improved: Document need for UriConfig.h in UriMemory.c (GitHub #136)
+ * Infrastructure: Add (support for) Visual Studio 17/2022 (GitHub #152)
+ * Infrastructure: Drop (support for) Visual Studio <=14/2015 (GitHub #152)
+ * Infrastructure: Update Clang from 13 to 15 (GitHub #143, GitHub #151)
+ * Infrastructure: Make MinGW with 32bit Wine on Ubuntu 20.04 possible
+ (GitHub #142, GitHub #144, GitHub #145)
+ * Soname: 1:30:0 — see https://verbump.de/ for what these numbers do
+
2022-01-06 -- 0.9.6
>>>>>>>>>>>>> SECURITY >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
diff --git a/contrib/restricted/uriparser/config.h b/contrib/restricted/uriparser/UriConfig.h
index ebb62f778d..d1c07bab7c 100644
--- a/contrib/restricted/uriparser/config.h
+++ b/contrib/restricted/uriparser/UriConfig.h
@@ -41,7 +41,7 @@
-#define PACKAGE_VERSION "0.9.6"
+#define PACKAGE_VERSION "0.9.7"
#define HAVE_WPRINTF
#define HAVE_REALLOCARRAY
diff --git a/contrib/restricted/uriparser/include/uriparser/Uri.h b/contrib/restricted/uriparser/include/uriparser/Uri.h
index ea4a913029..d2c86103ec 100644
--- a/contrib/restricted/uriparser/include/uriparser/Uri.h
+++ b/contrib/restricted/uriparser/include/uriparser/Uri.h
@@ -1,4 +1,4 @@
-/* 0beb20dace01f4b2fa24c3bf9f7e8e616f621e4697260805a2b63a4d190e64c0 (0.9.6+)
+/* 4bf720e0ca97527a28e4c30f1c35b36a0b5f2697265c5ddc81080eaab4344ef2 (0.9.7+)
*
* uriparser - RFC 3986 URI parsing library
*
diff --git a/contrib/restricted/uriparser/include/uriparser/UriBase.h b/contrib/restricted/uriparser/include/uriparser/UriBase.h
index 2e63f92c86..76a746cb1f 100644
--- a/contrib/restricted/uriparser/include/uriparser/UriBase.h
+++ b/contrib/restricted/uriparser/include/uriparser/UriBase.h
@@ -55,7 +55,7 @@
/* Version */
#define URI_VER_MAJOR 0
#define URI_VER_MINOR 9
-#define URI_VER_RELEASE 6
+#define URI_VER_RELEASE 7
#define URI_VER_SUFFIX_ANSI ""
#define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI)
@@ -98,24 +98,19 @@
/* Import/export decorator */
-#define URI_STATIC_BUILD
-#if defined(URI_STATIC_BUILD)
-# define URI_PUBLIC
+#if defined(_MSC_VER)
+# if 1 /* defined(URI_STATIC_BUILD) */
+# define URI_PUBLIC
+# elif defined(URI_LIBRARY_BUILD)
+# define URI_PUBLIC __declspec(dllexport)
+# else
+# define URI_PUBLIC __declspec(dllimport)
+# endif
#else
-# if defined(URI_LIBRARY_BUILD)
-# if defined(_MSC_VER)
-# define URI_PUBLIC __declspec(dllexport)
-# elif defined(URI_VISIBILITY)
-# define URI_PUBLIC __attribute__ ((visibility("default")))
-# else
-# define URI_PUBLIC
-# endif
+# if ! defined(URI_LIBRARY_BUILD) || ! defined(URI_VISIBILITY)
+# define URI_PUBLIC
# else
-# if defined(_MSC_VER)
-# define URI_PUBLIC __declspec(dllimport)
-# else
-# define URI_PUBLIC
-# endif
+# define URI_PUBLIC __attribute__ ((visibility("default")))
# endif
#endif
diff --git a/contrib/restricted/uriparser/src/UriMemory.c b/contrib/restricted/uriparser/src/UriMemory.c
index baed2040da..916d7cea83 100644
--- a/contrib/restricted/uriparser/src/UriMemory.c
+++ b/contrib/restricted/uriparser/src/UriMemory.c
@@ -42,12 +42,15 @@
* Holds memory manager implementation.
*/
-#include <config.h>
+#include "UriConfig.h" /* for HAVE_REALLOCARRAY */
#ifdef HAVE_REALLOCARRAY
# ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
# endif
+# ifdef __NetBSD__
+# define _OPENBSD_SOURCE 1
+# endif
#endif
#include <errno.h>
diff --git a/contrib/restricted/uriparser/src/UriParse.c b/contrib/restricted/uriparser/src/UriParse.c
index eefa8d1347..a672c8eb1f 100644
--- a/contrib/restricted/uriparser/src/UriParse.c
+++ b/contrib/restricted/uriparser/src/UriParse.c
@@ -478,6 +478,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
switch (*first) {
case _UT('v'):
+ case _UT('V'):
*/
if (first + 1 >= afterLast) {
URI_FUNC(StopSyntax)(state, afterLast, memory);
@@ -540,7 +541,9 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(
}
switch (*first) {
+ /* The leading "v" of IPvFuture is case-insensitive. */
case _UT('v'):
+ case _UT('V'):
{
const URI_CHAR * const afterIpFuture
= URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
@@ -624,11 +627,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
/* Leading zero */
URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
+ 10 * digitHistory[1]
@@ -662,11 +660,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
/* Leading zero */
URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
+ 10 * digitHistory[1]
@@ -788,6 +781,10 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL; /* ":::+ "*/
}
+ } else if (quadsDone == 0 || first[1] == _UT(']')) {
+ /* Single leading or trailing ":" */
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
}
if (setZipper) {
@@ -797,7 +794,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
break;
case _UT('.'):
- if ((quadsDone > 6) /* NOTE */
+ if ((quadsDone + zipperEver > 6) /* NOTE */
|| (!zipperEver && (quadsDone < 6))
|| letterAmong
|| (digitCount == 0)
@@ -810,11 +807,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
/* Leading zero */
URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
+ 10 * digitHistory[1]
@@ -848,6 +840,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
if (digitCount > 0) {
if (zipperEver) {
+ /* Too many quads? */
+ if (quadsDone >= 7) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount);
quadsAfterZipperCount++;
} else {
diff --git a/contrib/restricted/uriparser/test/VersionSuite.cpp b/contrib/restricted/uriparser/test/VersionSuite.cpp
index a46f0d59b3..01f0284e58 100644
--- a/contrib/restricted/uriparser/test/VersionSuite.cpp
+++ b/contrib/restricted/uriparser/test/VersionSuite.cpp
@@ -23,7 +23,7 @@
#include <cstdio>
-#include <config.h> // for PACKAGE_VERSION
+#include "UriConfig.h" // for PACKAGE_VERSION
#include <uriparser/UriBase.h>
diff --git a/contrib/restricted/uriparser/test/test.cpp b/contrib/restricted/uriparser/test/test.cpp
index 8580399733..7552ba0f41 100644
--- a/contrib/restricted/uriparser/test/test.cpp
+++ b/contrib/restricted/uriparser/test/test.cpp
@@ -213,6 +213,18 @@ TEST(UriSuite, TestIpSixPass) {
URI_TEST_IP_SIX_PASS("2001:db8:100:f101::1");
URI_TEST_IP_SIX_PASS("a:b:c::12:1");
URI_TEST_IP_SIX_PASS("a:b::0:1:2:3");
+
+ // Issue #146: These are not leading zeros.
+ URI_TEST_IP_SIX_PASS("::100.1.1.1");
+ URI_TEST_IP_SIX_PASS("::1.100.1.1");
+ URI_TEST_IP_SIX_PASS("::1.1.100.1");
+ URI_TEST_IP_SIX_PASS("::1.1.1.100");
+ URI_TEST_IP_SIX_PASS("::100.100.100.100");
+ URI_TEST_IP_SIX_PASS("::10.1.1.1");
+ URI_TEST_IP_SIX_PASS("::1.10.1.1");
+ URI_TEST_IP_SIX_PASS("::1.1.10.1");
+ URI_TEST_IP_SIX_PASS("::1.1.1.10");
+ URI_TEST_IP_SIX_PASS("::10.10.10.10");
}
TEST(UriSuite, TestIpSixFail) {
@@ -259,6 +271,32 @@ TEST(UriSuite, TestIpSixFail) {
// Nonhex
URI_TEST_IP_SIX_FAIL("g:0:0:0:0:0:0");
+
+ // Issue #146: Zipper between the 7th and 8th quads.
+ URI_TEST_IP_SIX_FAIL("0:0:0:0:0:0:0::1");
+
+ // Issue #146: Leading or trailing ":".
+ URI_TEST_IP_SIX_FAIL(":1::1");
+ URI_TEST_IP_SIX_FAIL("1::1:");
+ URI_TEST_IP_SIX_FAIL(":1::1:");
+ URI_TEST_IP_SIX_FAIL(":0:0:0:0:0:0:0:0");
+ URI_TEST_IP_SIX_FAIL("0:0:0:0:0:0:0:0:");
+ URI_TEST_IP_SIX_FAIL(":0:0:0:0:0:0:0:0:");
+
+ // Issue #146: Zipper between six quads and IPv4 address.
+ URI_TEST_IP_SIX_FAIL("1:1:1:1:1:1::1.1.1.1");
+}
+
+TEST(UriSuite, TestIpFuture) {
+ UriParserStateA stateA;
+ UriUriA uriA;
+ stateA.uri = &uriA;
+
+ // Issue #146: The leading "v" of IPvFuture is case-insensitive.
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "//[vF.addr]"));
+ uriFreeUriMembersA(&uriA);
+ ASSERT_TRUE(0 == uriParseUriA(&stateA, "//[VF.addr]"));
+ uriFreeUriMembersA(&uriA);
}
TEST(UriSuite, TestIpSixOverread) {
diff --git a/contrib/restricted/uriparser/tool/uriparse.c b/contrib/restricted/uriparser/tool/uriparse.c
index 027f2d2892..edd9e04396 100644
--- a/contrib/restricted/uriparser/tool/uriparse.c
+++ b/contrib/restricted/uriparser/tool/uriparse.c
@@ -43,9 +43,11 @@
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
-# ifdef __MINGW32__
+# if defined(__MINGW32__) && \
+ (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3 || \
+ _WIN32_WINNT < _WIN32_WINNT_VISTA)
WINSOCK_API_LINKAGE const char * WSAAPI inet_ntop(
- int af, const void *src, char *dst, socklen_t size);
+ int af, const void *src, char *dst, size_t size);
# endif
#else
# include <sys/socket.h>
@@ -57,7 +59,7 @@ WINSOCK_API_LINKAGE const char * WSAAPI inet_ntop(
#define RANGE(x) (int)((x).afterLast-(x).first), ((x).first)
-void usage() {
+void usage(void) {
printf("Usage: uriparse URI [..]\n");
}