summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2022-10-29 22:32:11 +0200
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2022-10-29 22:32:11 +0200
commit0c23cbef1a729b95597d225cad90345a0cf7de9a (patch)
tree697f20d2671106e317eafdc9535693e4aa8535db
parent130dc6e51879b4e337a53719ef325c7d6b3dae94 (diff)
parent1d7d65107664f3451d7384598209e5dfcbb871cc (diff)
Merge branch 'feature/upstream' into develop
-rw-r--r--.github/workflows/build-and-test.yml36
-rw-r--r--.gitignore2
-rw-r--r--CMakeLists.txt12
-rw-r--r--ChangeLog23
-rw-r--r--THANKS6
-rw-r--r--appveyor.yml22
-rw-r--r--include/uriparser/Uri.h2
-rw-r--r--include/uriparser/UriBase.h28
-rw-r--r--src/UriMemory.c5
-rw-r--r--src/UriParse.c29
-rw-r--r--test/VersionSuite.cpp2
-rw-r--r--test/test.cpp38
-rw-r--r--tool/uriparse.c8
13 files changed, 143 insertions, 70 deletions
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 293c9ca..168fa2b 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -17,8 +17,8 @@ jobs:
include:
- name: Native Linux
cmake_args: >-
- -DCMAKE_C_COMPILER=clang-13
- -DCMAKE_CXX_COMPILER=clang++-13
+ -DCMAKE_C_COMPILER=clang-15
+ -DCMAKE_CXX_COMPILER=clang++-15
cflags: >-
-fsanitize=address,undefined,leak
-fno-sanitize-recover=all
@@ -34,16 +34,19 @@ jobs:
-DMINGW=ON
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@v2.4.0
+ - uses: actions/checkout@v3.0.2
- name: Add Clang/LLVM repositories (Non-MinGW)
if: "${{ ! contains(matrix.cmake_args, 'mingw') }}"
run: |-
+ set -x
+ source /etc/os-release
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
+ sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-15 main"
- name: Install build dependencies
run: |-
+ set -x
sudo apt-get update
sudo apt-get install --yes --no-install-recommends -V \
cmake \
@@ -56,20 +59,35 @@ jobs:
- name: Install build dependencies (MinGW)
if: "${{ contains(matrix.cmake_args, 'mingw') }}"
run: |-
+ set -x -u -o pipefail
+ source /etc/os-release
+
+ # Get rid of packages installed from ppa:ondrej/php so that we will be able to install wine32:i386 without conflicts
+ # (see issue https://github.com/actions/virtual-environments/issues/4589)
+ # In detail we:
+ # 1. Remove all packages that ppa:ondrej/php has but plain Ubuntu doesn't, e.g. everything PHP
+ # 2. Revert (remaining) packages that ppa:ondrej/php and plain Ubuntu share, back to the plain Ubuntu version
+ # 3. Assert that no packages from ppa:ondrej/php are left installed
+ dpkg -l | grep '^ii' | fgrep deb.sury.org | awk '{print $2}' | grep '^php' \
+ | xargs -r -t sudo apt-get remove --yes libpcre2-posix3 libzip4
+ dpkg -l | grep '^ii' | fgrep deb.sury.org | awk '{print $2}' | sed "s,\$,/${UBUNTU_CODENAME}," \
+ | xargs -r -t sudo apt-get install --yes --no-install-recommends --allow-downgrades -V
+ ! dpkg -l | grep '^ii' | fgrep deb.sury.org
+
+ # Install 32bit Wine
sudo dpkg --add-architecture i386 # for wine32
- sudo apt-add-repository ppa:ondrej/php -y # due to libwine:i386 conflicts
sudo apt-get update # again, due to new architecture
sudo apt-get install --yes --no-install-recommends -V \
mingw-w64 \
wine-stable \
- wine32
+ wine32:i386
- name: Install build dependencies (Non-MinGW)
if: "${{ ! contains(matrix.cmake_args, 'mingw') }}"
run: |-
sudo apt-get install --yes --no-install-recommends -V \
- clang-13 \
- llvm-13
+ clang-15 \
+ llvm-15
- name: Build, test and install
run: |-
@@ -165,7 +183,7 @@ jobs:
fi
popd
- git fetch --tags --unshallow origin # for "git describe" in make-distcheck.sh
+ git fetch --force --tags --unshallow origin # for "git describe" in make-distcheck.sh
GTEST_PREFIX="${GTEST_PREFIX}" \
./make-distcheck.sh \
diff --git a/.gitignore b/.gitignore
index f7fe56a..a55df50 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
/.idea/
-/config.h
+/UriConfig.h
/build/
/cmake-build-debug/
/CMakeCache.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b80f71..313092a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,14 +38,14 @@ cmake_minimum_required(VERSION 3.3)
project(uriparser
VERSION
- 0.9.6
+ 0.9.7
LANGUAGES
C
)
# See https://verbump.de/ for what these numbers do
set(URIPARSER_SO_CURRENT 1)
-set(URIPARSER_SO_REVISION 29)
+set(URIPARSER_SO_REVISION 30)
set(URIPARSER_SO_AGE 0)
include(CheckCCompilerFlag)
@@ -110,11 +110,11 @@ if(URIPARSER_COMPILER_SUPPORTS_VISIBILITY)
endif()
#
-# config.h
+# UriConfig.h
#
check_symbol_exists(wprintf wchar.h HAVE_WPRINTF)
check_function_exists(reallocarray HAVE_REALLOCARRAY) # no luck with CheckSymbolExists
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/UriConfig.h.in config.h)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/UriConfig.h.in UriConfig.h)
#
# C library
@@ -193,7 +193,7 @@ target_include_directories(uriparser
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
- ${CMAKE_CURRENT_BINARY_DIR} # for config.h
+ ${CMAKE_CURRENT_BINARY_DIR} # for UriConfig.h
)
uriparser_install(
@@ -288,7 +288,7 @@ if(URIPARSER_BUILD_TESTS)
target_include_directories(testrunner PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_BINARY_DIR} # for config.h
+ ${CMAKE_CURRENT_BINARY_DIR} # for UriConfig.h
)
target_link_libraries(testrunner PUBLIC
diff --git a/ChangeLog b/ChangeLog
index cf1a837..7cf421b 100644
--- a/ChangeLog
+++ b/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/THANKS b/THANKS
index c696f93..3213f9b 100644
--- a/THANKS
+++ b/THANKS
@@ -7,7 +7,9 @@ Alexander Richardson
Arkadiusz Miskiewicz
Andreas Sturmlechner
Blair Sadewitz
+Brecht Sanders
Chris Hills
+Christopher Degawa
Cristian Rodriguez
Dan Pape
Daniel Chapiesky
@@ -22,6 +24,7 @@ Edward Z. Yang
Eren Türkay
Fabrice Fontaine
Friedrich Delgado Friedrichs
+Gaspard Petit
Gary Mazzaferro
Graham Percival
Harvey Vrsalovic
@@ -36,12 +39,14 @@ Kouhei Sutou
Kurt Schwehr
Marc Novakowski
Marcin Juszkiewicz
+Mariusz Zaborski
Martin Michlmayr
Michael Anthony Puls II
Michelino Chionchio
Michel Zou
Mo McRoberts
myd7349
+Niclas Rosenvik
Periklis Akritidis
Philip de Nier
Radu Hociung
@@ -54,6 +59,7 @@ Robert Buchholz
Robert Kausch
Ryan Schmidt
Sandro Mani
+Scallop Ye
Schrijvers Luc
Scott Donelan
Sezai Tekin
diff --git a/appveyor.yml b/appveyor.yml
index ec111fa..2f6f632 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -45,16 +45,6 @@ environment:
# https://www.appveyor.com/docs/windows-images-software/
matrix:
- # Visual Studio 2015, 32 bit
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- CMAKE_GENERATOR: Visual Studio 14 2015
- PLATFORM: Win32
-
- # Visual Studio 2015, 64 bit
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- CMAKE_GENERATOR: Visual Studio 14 2015 Win64
- PLATFORM: x64
-
# Visual Studio 2017, 32 bit
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Visual Studio 15 2017
@@ -65,14 +55,14 @@ environment:
CMAKE_GENERATOR: Visual Studio 15 2017 Win64
PLATFORM: x64
- # Visual Studio 2019, 32 bit
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMAKE_GENERATOR: Visual Studio 16 2019
+ # Visual Studio 2022, 32 bit
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
+ CMAKE_GENERATOR: Visual Studio 17 2022
COMMON_CMAKE_ARGS: -A Win32
- # Visual Studio 2019, 64 bit
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMAKE_GENERATOR: Visual Studio 16 2019
+ # Visual Studio 2022, 64 bit
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
+ CMAKE_GENERATOR: Visual Studio 17 2022
COMMON_CMAKE_ARGS: -A x64
before_build:
diff --git a/include/uriparser/Uri.h b/include/uriparser/Uri.h
index ea4a913..d2c8610 100644
--- a/include/uriparser/Uri.h
+++ b/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/include/uriparser/UriBase.h b/include/uriparser/UriBase.h
index 089c2c6..5216b1d 100644
--- a/include/uriparser/UriBase.h
+++ b/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,23 +98,19 @@
/* Import/export decorator */
-#if defined(URI_STATIC_BUILD)
-# define URI_PUBLIC
+#if defined(_MSC_VER)
+# if 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/src/UriMemory.c b/src/UriMemory.c
index baed204..916d7ce 100644
--- a/src/UriMemory.c
+++ b/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/src/UriParse.c b/src/UriParse.c
index eefa8d1..a672c8e 100644
--- a/src/UriParse.c
+++ b/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/test/VersionSuite.cpp b/test/VersionSuite.cpp
index a46f0d5..01f0284 100644
--- a/test/VersionSuite.cpp
+++ b/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/test/test.cpp b/test/test.cpp
index 31e9866..fade025 100644
--- a/test/test.cpp
+++ b/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/tool/uriparse.c b/tool/uriparse.c
index 027f2d2..edd9e04 100644
--- a/tool/uriparse.c
+++ b/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");
}