From bb0fbadacbd603b1e8d258f75ff5ca8ee481feb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 1 Nov 2015 18:59:02 +0100 Subject: Imported Upstream version 0.8.4 --- ChangeLog | 6 ++++++ Makefile.am | 2 +- Makefile.in | 2 +- THANKS | 1 + configure | 20 ++++++++++---------- configure.ac | 2 +- include/uriparser/UriBase.h | 2 +- src/UriParse.c | 25 +++++++++++++------------ test/test.cpp | 7 +++++-- 9 files changed, 39 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fc5a79..74052a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-10-12 -- 0.8.4 + + * Fixed: Stack overflow on parsing malformed IPv6 addresses with + more than eigtht quads. Thanks to Alexander Klink for the report! + * Soname: 1:20:0 + 2015-10-04 -- 0.8.3 * Fixed: uriCompareRange reported NULL pointer and range of diff --git a/Makefile.am b/Makefile.am index 14b6489..1a41102 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,7 @@ pkginclude_HEADERS = \ include/uriparser/UriIp4.h -liburiparser_la_LDFLAGS = -version-info 1:19:0 +liburiparser_la_LDFLAGS = -version-info 1:20:0 if WIN32 liburiparser_la_LDFLAGS += -no-undefined endif diff --git a/Makefile.in b/Makefile.in index 6bf457a..587f3cd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -655,7 +655,7 @@ pkginclude_HEADERS = \ include/uriparser/UriDefsUnicode.h \ include/uriparser/UriIp4.h -liburiparser_la_LDFLAGS = -version-info 1:19:0 $(am__append_1) +liburiparser_la_LDFLAGS = -version-info 1:20:0 $(am__append_1) liburiparser_la_SOURCES = \ src/UriCommon.c \ src/UriCommon.h \ diff --git a/THANKS b/THANKS index 04c8762..79c61f8 100644 --- a/THANKS +++ b/THANKS @@ -1,6 +1,7 @@ Adam Gross Adeodato Simó Adrian Manrique +Alexander Klink Arkadiusz Miskiewicz Blair Sadewitz Chris Hills diff --git a/configure b/configure index 456029d..e2e4bbc 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for uriparser 0.8.3. +# Generated by GNU Autoconf 2.69 for uriparser 0.8.4. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='uriparser' PACKAGE_TARNAME='uriparser' -PACKAGE_VERSION='0.8.3' -PACKAGE_STRING='uriparser 0.8.3' +PACKAGE_VERSION='0.8.4' +PACKAGE_STRING='uriparser 0.8.4' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1346,7 +1346,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures uriparser 0.8.3 to adapt to many kinds of systems. +\`configure' configures uriparser 0.8.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1416,7 +1416,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of uriparser 0.8.3:";; + short | recursive ) echo "Configuration of uriparser 0.8.4:";; esac cat <<\_ACEOF @@ -1548,7 +1548,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -uriparser configure 0.8.3 +uriparser configure 0.8.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1947,7 +1947,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by uriparser $as_me 0.8.3, which was +It was created by uriparser $as_me 0.8.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2810,7 +2810,7 @@ fi # Define the identity of the package. PACKAGE='uriparser' - VERSION='0.8.3' + VERSION='0.8.4' cat >>confdefs.h <<_ACEOF @@ -16883,7 +16883,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by uriparser $as_me 0.8.3, which was +This file was extended by uriparser $as_me 0.8.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16949,7 +16949,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -uriparser config.status 0.8.3 +uriparser config.status 0.8.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 23bc958..fda2d5e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.61) -AC_INIT([uriparser], [0.8.3]) +AC_INIT([uriparser], [0.8.4]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([1.10.1 foreign dist-zip dist-bzip2 no-dist-gzip subdir-objects]) diff --git a/include/uriparser/UriBase.h b/include/uriparser/UriBase.h index 831e608..bc63b05 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 8 -#define URI_VER_RELEASE 3 +#define URI_VER_RELEASE 4 #define URI_VER_SUFFIX_ANSI "" #define URI_VER_SUFFIX_UNICODE URI_ANSI_TO_UNICODE(URI_VER_SUFFIX_ANSI) diff --git a/src/UriParse.c b/src/UriParse.c index 59a398b..e3cdc68 100644 --- a/src/UriParse.c +++ b/src/UriParse.c @@ -709,8 +709,20 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat { int setZipper = 0; + if (digitCount > 0) { + if (zipperEver) { + uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount); + quadsAfterZipperCount++; + } else { + uriWriteQuadToDoubleByte(digitHistory, digitCount, state->uri->hostData.ip6->data + 2 * quadsDone); + } + quadsDone++; + digitCount = 0; + } + letterAmong = 0; + /* Too many quads? */ - if (quadsDone > 8 - zipperEver) { + if (quadsDone >= 8 - zipperEver) { URI_FUNC(StopSyntax)(state, first); return NULL; } @@ -743,17 +755,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(URI_TYPE(ParserState) * stat return NULL; /* ":::+ "*/ } } - if (digitCount > 0) { - if (zipperEver) { - uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount); - quadsAfterZipperCount++; - } else { - uriWriteQuadToDoubleByte(digitHistory, digitCount, state->uri->hostData.ip6->data + 2 * quadsDone); - } - quadsDone++; - digitCount = 0; - } - letterAmong = 0; if (setZipper) { zipperEver = 1; diff --git a/test/test.cpp b/test/test.cpp index 670aa07..d6f14cb 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -281,8 +281,11 @@ Rule | Example | hostSet | absPath | emptySeg URI_TEST_IP_SIX_FAIL("0:0:0:0:0:0:0:"); URI_TEST_IP_SIX_FAIL("0:0:0:0:0:0:0:1.2.3.4"); - // Nine quads - URI_TEST_IP_SIX_FAIL("0:0:0:0:0:0:0:0:0"); + // Nine quads (or more) + URI_TEST_IP_SIX_FAIL("1:2:3:4:5:6:7:8:9"); + URI_TEST_IP_SIX_FAIL("::2:3:4:5:6:7:8:9"); + URI_TEST_IP_SIX_FAIL("1:2:3:4::6:7:8:9"); + URI_TEST_IP_SIX_FAIL("1:2:3:4:5:6:7:8::"); // Invalid IPv4 part URI_TEST_IP_SIX_FAIL("::ffff:001.02.03.004"); // Leading zeros -- cgit v1.2.3