Mon Apr 28 21:35:25 2008 UTC ()
Apply patches to fix CVE-2008-0171 in boost-headers and boost-libs.
This is a fix for a possible DoS when using Boost.Regex in an application.

Note that the fix goes into a header, so all applications that use
Boost.Regex may be affected by the problem and need to be rebuilt.


(jmmv)
diff -r1.10 -r1.11 pkgsrc/devel/boost-headers/Makefile
diff -r1.9 -r1.10 pkgsrc/devel/boost-libs/Makefile
diff -r1.11 -r1.12 pkgsrc/meta-pkgs/boost/distinfo
diff -r0 -r1.1 pkgsrc/meta-pkgs/boost/patches/patch-r42674
diff -r0 -r1.1 pkgsrc/meta-pkgs/boost/patches/patch-r42745

cvs diff -r1.10 -r1.11 pkgsrc/devel/boost-headers/Makefile (expand / switch to unified diff)

--- pkgsrc/devel/boost-headers/Makefile 2008/02/05 23:00:27 1.10
+++ pkgsrc/devel/boost-headers/Makefile 2008/04/28 21:35:25 1.11
@@ -1,20 +1,22 @@ @@ -1,20 +1,22 @@
1# $NetBSD: Makefile,v 1.10 2008/02/05 23:00:27 heinz Exp $ 1# $NetBSD: Makefile,v 1.11 2008/04/28 21:35:25 jmmv Exp $
2# 2#
3 3
4BOOST_PACKAGE= headers 4BOOST_PACKAGE= headers
5BOOST_COMMENT= (build-time headers) 5BOOST_COMMENT= (build-time headers)
6BOOST_CONFIG= generate 6BOOST_CONFIG= generate
7 7
 8PKGREVISION= 1
 9
8PKG_DESTDIR_SUPPORT= user-destdir 10PKG_DESTDIR_SUPPORT= user-destdir
9 11
10.include "../../meta-pkgs/boost/Makefile.common" 12.include "../../meta-pkgs/boost/Makefile.common"
11 13
12BJAM_ARGS+= --without-* # disable all libraries 14BJAM_ARGS+= --without-* # disable all libraries
13 15
14.include "../../devel/boost-jam/bjam.mk" 16.include "../../devel/boost-jam/bjam.mk"
15 17
16do-build: 18do-build:
17 19
18do-install: bjam-install 20do-install: bjam-install
19 ${FIND} ${DESTDIR}${PREFIX}/include/boost \ 21 ${FIND} ${DESTDIR}${PREFIX}/include/boost \
20 -type f -print | ${XARGS} ${CHOWN} ${SHAREOWN}:${SHAREGRP} 22 -type f -print | ${XARGS} ${CHOWN} ${SHAREOWN}:${SHAREGRP}

cvs diff -r1.9 -r1.10 pkgsrc/devel/boost-libs/Makefile (expand / switch to unified diff)

--- pkgsrc/devel/boost-libs/Makefile 2008/02/05 23:01:14 1.9
+++ pkgsrc/devel/boost-libs/Makefile 2008/04/28 21:35:25 1.10
@@ -1,21 +1,23 @@ @@ -1,21 +1,23 @@
1# $NetBSD: Makefile,v 1.9 2008/02/05 23:01:14 heinz Exp $ 1# $NetBSD: Makefile,v 1.10 2008/04/28 21:35:25 jmmv Exp $
2# 2#
3 3
4BOOST_PACKAGE= libs 4BOOST_PACKAGE= libs
5BOOST_COMMENT= (binary libraries) 5BOOST_COMMENT= (binary libraries)
6BOOST_CONFIG= installed 6BOOST_CONFIG= installed
7BOOST_INSTALL_LIBS= yes 7BOOST_INSTALL_LIBS= yes
8 8
 9PKG_REVISION= 1
 10
9PKG_DESTDIR_SUPPORT= user-destdir 11PKG_DESTDIR_SUPPORT= user-destdir
10 12
11.include "../../meta-pkgs/boost/Makefile.common" 13.include "../../meta-pkgs/boost/Makefile.common"
12 14
13BJAM_ARGS+= --without-python 15BJAM_ARGS+= --without-python
14 16
15.include "../../devel/boost-jam/bjam.mk" 17.include "../../devel/boost-jam/bjam.mk"
16 18
17do-build: bjam-build 19do-build: bjam-build
18 20
19do-install: boost-install-libs 21do-install: boost-install-libs
20 22
21.include "../../archivers/bzip2/buildlink3.mk" 23.include "../../archivers/bzip2/buildlink3.mk"

cvs diff -r1.11 -r1.12 pkgsrc/meta-pkgs/boost/distinfo (expand / switch to unified diff)

--- pkgsrc/meta-pkgs/boost/distinfo 2008/01/04 19:58:41 1.11
+++ pkgsrc/meta-pkgs/boost/distinfo 2008/04/28 21:35:25 1.12
@@ -1,14 +1,16 @@ @@ -1,14 +1,16 @@
1$NetBSD: distinfo,v 1.11 2008/01/04 19:58:41 jmmv Exp $ 1$NetBSD: distinfo,v 1.12 2008/04/28 21:35:25 jmmv Exp $
2 2
3SHA1 (boost_1_34_1.tar.bz2) = b771271d5cbd3bdb0f119dd66dfd36bad7a66866 3SHA1 (boost_1_34_1.tar.bz2) = b771271d5cbd3bdb0f119dd66dfd36bad7a66866
4RMD160 (boost_1_34_1.tar.bz2) = 303327ff852bc19dd7a94657fdef3c56f5882e06 4RMD160 (boost_1_34_1.tar.bz2) = 303327ff852bc19dd7a94657fdef3c56f5882e06
5Size (boost_1_34_1.tar.bz2) = 12986931 bytes 5Size (boost_1_34_1.tar.bz2) = 12986931 bytes
6SHA1 (patch-ac) = 453d4107df03e96e66cbdbebceebdfcbed2710c1 6SHA1 (patch-ac) = 453d4107df03e96e66cbdbebceebdfcbed2710c1
7SHA1 (patch-ad) = 074db0bdee7ca145cda2c938626b7d5e3e1e7368 7SHA1 (patch-ad) = 074db0bdee7ca145cda2c938626b7d5e3e1e7368
8SHA1 (patch-af) = f0a1fc4b9884663fbe5b9613bc61837b8e6e6af1 8SHA1 (patch-af) = f0a1fc4b9884663fbe5b9613bc61837b8e6e6af1
9SHA1 (patch-ah) = dc5d1d90998aad0f9689470166fd82f1eccdffe3 9SHA1 (patch-ah) = dc5d1d90998aad0f9689470166fd82f1eccdffe3
10SHA1 (patch-ak) = 32785c636ccc9be479db2d40d170f95e77d4e291 10SHA1 (patch-ak) = 32785c636ccc9be479db2d40d170f95e77d4e291
11SHA1 (patch-al) = 23756770d17d7958b0b9423e379fe0a1a2dd83f8 11SHA1 (patch-al) = 23756770d17d7958b0b9423e379fe0a1a2dd83f8
12SHA1 (patch-am) = 07f1e1e15d4129c7a8762ad2e81632fdd24e9515 12SHA1 (patch-am) = 07f1e1e15d4129c7a8762ad2e81632fdd24e9515
13SHA1 (patch-an) = 91887a9a37e9d891252e0556ee40b58a1c6bc6cf 13SHA1 (patch-an) = 91887a9a37e9d891252e0556ee40b58a1c6bc6cf
14SHA1 (patch-ao) = a8499a326f72c9fbfd31f0b0f23014729a2a0dae 14SHA1 (patch-ao) = a8499a326f72c9fbfd31f0b0f23014729a2a0dae
 15SHA1 (patch-r42674) = f115b4ae5ab3e184d711a9d8968f3a435249e5f3
 16SHA1 (patch-r42745) = 432417b0ad4944c9da9f68cf2e855d91c698c4f6

File Added: pkgsrc/meta-pkgs/boost/patches/Attic/patch-r42674
$NetBSD: patch-r42674,v 1.1 2008/04/28 21:35:25 jmmv Exp $

Fix for CVE-2008-0171.  Patch from Boost's svn repository, r42674.

--- boost/regex/v4/basic_regex_parser.hpp (revision 38864)
+++ boost/regex/v4/basic_regex_parser.hpp (revision 42674)
@@ -785,4 +785,5 @@
       case syntax_element_jump:
       case syntax_element_startmark:
+      case syntax_element_backstep:
          // can't legally repeat any of the above:
          fail(regex_constants::error_badrepeat, m_position - m_base);
@@ -1870,4 +1871,5 @@
    {
       re_syntax_base* b = this->getaddress(expected_alt_point);
+      // Make sure we have exactly one alternative following this state:
       if(b->type != syntax_element_alt)
       {
@@ -1878,4 +1880,13 @@
       {
          fail(regex_constants::error_bad_pattern, m_position - m_base);
+         return false;
+      }
+      // check for invalid repetition of next state:
+      b = this->getaddress(expected_alt_point);
+      b = this->getaddress(static_cast<re_alt*>(b)->next.i, b);
+      if((b->type != syntax_element_assert_backref)
+         && (b->type != syntax_element_startmark))
+      {
+         fail(regex_constants::error_badrepeat, m_position - m_base);
          return false;
       }
--- libs/regex/test/regress/test_perl_ex.cpp (revision 30980)
+++ libs/regex/test/regress/test_perl_ex.cpp (revision 42674)
@@ -122,4 +122,15 @@
    TEST_INVALID_REGEX("(?:(a)|b)(?(?<", perl);
    TEST_INVALID_REGEX("(?:(a)|b)(?(?<a", perl);
+
+   TEST_INVALID_REGEX("(?(?!#?)+)", perl);
+   TEST_INVALID_REGEX("(?(?=:-){0})", perl);
+   TEST_INVALID_REGEX("(?(123){1})", perl);
+   TEST_INVALID_REGEX("(?(?<=A)*)", perl);
+   TEST_INVALID_REGEX("(?(?<=A)+)", perl);
+
+   TEST_INVALID_REGEX("(?<!*|^)", perl);
+   TEST_INVALID_REGEX("(?<!*|A)", perl);
+   TEST_INVALID_REGEX("(?<=?|A)", perl);
+   TEST_INVALID_REGEX("(?<=*|\B)", perl);
 }
 

File Added: pkgsrc/meta-pkgs/boost/patches/Attic/patch-r42745
$NetBSD: patch-r42745,v 1.1 2008/04/28 21:35:25 jmmv Exp $

Fix for CVE-2008-0171.  Patch from Boost's svn repository, r42745.

--- libs/regex/test/regress/test_perl_ex.cpp (revision 42674)
+++ libs/regex/test/regress/test_perl_ex.cpp (revision 42745)
@@ -132,5 +132,5 @@
    TEST_INVALID_REGEX("(?<!*|A)", perl);
    TEST_INVALID_REGEX("(?<=?|A)", perl);
-   TEST_INVALID_REGEX("(?<=*|\B)", perl);
+   TEST_INVALID_REGEX("(?<=*|\\B)", perl);
 }