Skip to content

Commit 3f7b92c

Browse files
committed
upgrade to PCRE 7.6.
#changes to code are minimal. this fixes a security bug
1 parent 99c5613 commit 3f7b92c

35 files changed

+1048
-788
lines changed

ext/pcre/pcrelib/AUTHORS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Email domain: cam.ac.uk
88
University of Cambridge Computing Service,
99
Cambridge, England.
1010

11-
Copyright (c) 1997-2007 University of Cambridge
11+
Copyright (c) 1997-2008 University of Cambridge
1212
All rights reserved
1313

1414

@@ -17,7 +17,7 @@ THE C++ WRAPPER LIBRARY
1717

1818
Written by: Google Inc.
1919

20-
Copyright (c) 2007 Google Inc
20+
Copyright (c) 2007-2008 Google Inc
2121
All rights reserved
2222

2323
####

ext/pcre/pcrelib/ChangeLog

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
11
ChangeLog for PCRE
22
------------------
33

4+
Version 7.6 28-Jan-08
5+
---------------------
6+
7+
1. A character class containing a very large number of characters with
8+
codepoints greater than 255 (in UTF-8 mode, of course) caused a buffer
9+
overflow.
10+
11+
2. Patch to cut out the "long long" test in pcrecpp_unittest when
12+
HAVE_LONG_LONG is not defined.
13+
14+
3. Applied Christian Ehrlicher's patch to update the CMake build files to
15+
bring them up to date and include new features. This patch includes:
16+
17+
- Fixed PH's badly added libz and libbz2 support.
18+
- Fixed a problem with static linking.
19+
- Added pcredemo. [But later removed - see 7 below.]
20+
- Fixed dftables problem and added an option.
21+
- Added a number of HAVE_XXX tests, including HAVE_WINDOWS_H and
22+
HAVE_LONG_LONG.
23+
- Added readline support for pcretest.
24+
- Added an listing of the option settings after cmake has run.
25+
26+
4. A user submitted a patch to Makefile that makes it easy to create
27+
"pcre.dll" under mingw when using Configure/Make. I added stuff to
28+
Makefile.am that cause it to include this special target, without
29+
affecting anything else. Note that the same mingw target plus all
30+
the other distribution libraries and programs are now supported
31+
when configuring with CMake (see 6 below) instead of with
32+
Configure/Make.
33+
34+
5. Applied Craig's patch that moves no_arg into the RE class in the C++ code.
35+
This is an attempt to solve the reported problem "pcrecpp::no_arg is not
36+
exported in the Windows port". It has not yet been confirmed that the patch
37+
solves the problem, but it does no harm.
38+
39+
6. Applied Sheri's patch to CMakeLists.txt to add NON_STANDARD_LIB_PREFIX and
40+
NON_STANDARD_LIB_SUFFIX for dll names built with mingw when configured
41+
with CMake, and also correct the comment about stack recursion.
42+
43+
7. Remove the automatic building of pcredemo from the ./configure system and
44+
from CMakeLists.txt. The whole idea of pcredemo.c is that it is an example
45+
of a program that users should build themselves after PCRE is installed, so
46+
building it automatically is not really right. What is more, it gave
47+
trouble in some build environments.
48+
49+
8. Further tidies to CMakeLists.txt from Sheri and Christian.
50+
51+
452
Version 7.5 10-Jan-08
553
---------------------
654

ext/pcre/pcrelib/LICENCE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Email domain: cam.ac.uk
2222
University of Cambridge Computing Service,
2323
Cambridge, England.
2424

25-
Copyright (c) 1997-2007 University of Cambridge
25+
Copyright (c) 1997-2008 University of Cambridge
2626
All rights reserved.
2727

2828

@@ -31,7 +31,7 @@ THE C++ WRAPPER FUNCTIONS
3131

3232
Contributed by: Google Inc.
3333

34-
Copyright (c) 2007, Google Inc.
34+
Copyright (c) 2007-2008, Google Inc.
3535
All rights reserved.
3636

3737

ext/pcre/pcrelib/NEWS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
News about PCRE releases
22
------------------------
33

4+
Release 7.6 28-Jan-08
5+
---------------------
6+
7+
The main reason for having this release so soon after 7.5 is because it fixes a
8+
potential buffer overflow problem in pcre_compile() when run in UTF-8 mode. In
9+
addition, the CMake configuration files have been brought up to date.
10+
11+
412
Release 7.5 10-Jan-08
513
---------------------
614

ext/pcre/pcrelib/NON-UNIX-USE

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ This document contains the following sections:
88
The C++ wrapper functions
99
Building for virtual Pascal
1010
Stack size in Windows environments
11+
Linking programs in Windows environments
1112
Comments about Win32 builds
12-
Building PCRE with CMake
13+
Building PCRE on Windows with CMake
14+
Use of relative paths with CMake on Windows
15+
Testing with runtest.bat
1316
Building under Windows with BCC5.5
1417
Building PCRE on OpenVMS
1518

@@ -31,10 +34,12 @@ library consists entirely of code written in Standard C, and so should compile
3134
successfully on any system that has a Standard C compiler and library. The C++
3235
wrapper functions are a separate issue (see below).
3336

34-
The PCRE distribution includes support for CMake. This support is relatively
35-
new, but has already been used successfully to build PCRE in multiple build
36-
environments on Windows. There are some instructions in the section entitled
37-
"Building PCRE with CMake" below.
37+
The PCRE distribution includes a "configure" file for use by the Configure/Make
38+
build system, as found in many Unix-like environments. There is also support
39+
support for CMake, which some users prefer, in particular in Windows
40+
environments. There are some instructions for CMake under Windows in the
41+
section entitled "Building PCRE with CMake" below. CMake can also be used to
42+
build PCRE in Unix-like systems.
3843

3944

4045
GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY
@@ -177,15 +182,22 @@ significantly slower when this is done. There is more about stack usage in the
177182
"pcrestack" documentation.
178183

179184

185+
LINKING PROGRAMS IN WINDOWS ENVIRONMENTS
186+
187+
If you want to statically link a program against a PCRE library in the form of
188+
a non-dll .a file, you must define PCRE_STATIC before including pcre.h,
189+
otherwise the pcre_malloc() and pcre_free() exported functions will be declared
190+
__declspec(dllimport), with unwanted results.
191+
192+
180193
COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below)
181194

182195
There are two ways of building PCRE using the "configure, make, make install"
183196
paradigm on Windows systems: using MinGW or using Cygwin. These are not at all
184197
the same thing; they are completely different from each other. There is also
185-
some experimental, undocumented support for building using "cmake", which you
186-
might like to try if you are familiar with "cmake". However, at the present
187-
time, the "cmake" process builds only a static library (not a dll), and the
188-
tests are not automatically run.
198+
support for building using CMake, which some users find a more straightforward
199+
way of building PCRE under Windows. However, the tests are not run
200+
automatically when CMake is used.
189201

190202
The MinGW home page (http://www.mingw.org/) says this:
191203

@@ -217,10 +229,13 @@ also link with libpcre, which contains the basic functions. (Some earlier
217229
releases of PCRE included the basic libpcre functions in libpcreposix. This no
218230
longer happens.)
219231

220-
If you want to statically link your program against a non-dll .a file, you must
221-
define PCRE_STATIC before including pcre.h, otherwise the pcre_malloc() and
222-
pcre_free() exported functions will be declared __declspec(dllimport), with
223-
unwanted results.
232+
A user submitted a special-purpose patch that makes it easy to create
233+
"pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll"
234+
as a special target. If you use this target, no other files are built, and in
235+
particular, the pcretest and pcregrep programs are not built. An example of how
236+
this might be used is:
237+
238+
./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll
224239

225240
Using Cygwin's compiler generates libraries and executables that depend on
226241
cygwin1.dll. If a library that is generated this way is distributed,
@@ -252,44 +267,73 @@ terminators in order to get some of the tests to work. We hope to improve
252267
things in this area in future.
253268

254269

255-
BUILDING PCRE WITH CMAKE
270+
BUILDING PCRE ON WINDOWS WITH CMAKE
256271

257272
CMake is an alternative build facility that can be used instead of the
258273
traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles,
259274
MinGW makefiles, MSYS makefiles, NMake makefiles, UNIX makefiles, Visual Studio
260275
6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions
261276
were contributed by a PCRE user.
262277

263-
1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure
264-
that cmake\bin is on your path.
278+
1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure
279+
that cmake\bin is on your path.
265280

266-
2. Unzip (retaining folder structure) the PCRE source tree into a source
267-
directory such as C:\pcre.
281+
2. Unzip (retaining folder structure) the PCRE source tree into a source
282+
directory such as C:\pcre.
268283

269-
3. Create a new, empty build directory: C:\pcre\build\
284+
3. Create a new, empty build directory: C:\pcre\build\
270285

271-
4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys
272-
for Msys/MinGW or Visual Studio Command Prompt for VC/VC++
286+
4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys
287+
for Msys/MinGW or Visual Studio Command Prompt for VC/VC++
273288

274-
5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build
275-
directories, respectively
289+
5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build
290+
directories, respectively
276291

277-
6. Hit the "Configure" button.
292+
6. Hit the "Configure" button.
278293

279-
7. Select the particular IDE / build tool that you are using (Visual Studio,
280-
MSYS makefiles, MinGW makefiles, etc.)
294+
7. Select the particular IDE / build tool that you are using (Visual Studio,
295+
MSYS makefiles, MinGW makefiles, etc.)
281296

282-
8. The GUI will then list several configuration options. This is where you can
283-
enable UTF-8 support, etc.
297+
8. The GUI will then list several configuration options. This is where you can
298+
enable UTF-8 support, etc.
284299

285-
9. Hit "Configure" again. The adjacent "OK" button should now be active.
300+
9. Hit "Configure" again. The adjacent "OK" button should now be active.
286301

287302
10. Hit "OK".
288303

289304
11. The build directory should now contain a usable build system, be it a
290305
solution file for Visual Studio, makefiles for MinGW, etc.
291306

292-
Testing with RunTest.bat
307+
308+
USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS
309+
310+
A PCRE user comments as follows:
311+
312+
I thought that others may want to know the current state of
313+
CMAKE_USE_RELATIVE_PATHS support on Windows.
314+
315+
Here it is:
316+
-- AdditionalIncludeDirectories is only partially modified (only the
317+
first path - see below)
318+
-- Only some of the contained file paths are modified - shown below for
319+
pcre.vcproj
320+
-- It properly modifies
321+
322+
I am sure CMake people can fix that if they want to. Until then one will
323+
need to replace existing absolute paths in project files with relative
324+
paths manually (e.g. from VS) - relative to project file location. I did
325+
just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big
326+
deal.
327+
328+
AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;"
329+
AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;"
330+
331+
RelativePath="pcre.h">
332+
RelativePath="pcre_chartables.c">
333+
RelativePath="pcre_chartables.c.rule">
334+
335+
336+
TESTING WITH RUNTEST.BAT
293337

294338
1. Copy RunTest.bat into the directory where pcretest.exe has been created.
295339

@@ -384,5 +428,5 @@ $! Locale could not be set to fr
384428
$!
385429
=========================
386430

387-
Last Updated: 21 September 2007
431+
Last Updated: 25 January 2008
388432
****

ext/pcre/pcrelib/README

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ If you are using HP's ANSI C++ compiler (aCC), please see the special note
119119
in the section entitled "Using HP's ANSI C++ compiler (aCC)" below.
120120

121121
The following instructions assume the use of the widely used "configure, make,
122-
make install" process. There is also some experimental support for "cmake" in
123-
the PCRE distribution, but it is incomplete and not documented. However, if you
124-
are a "cmake" user, you might want to try it.
122+
make install" process. There is also support for CMake in the PCRE
123+
distribution; there are some comments about using CMake in the NON-UNIX-USE
124+
file, though it can also be used in Unix-like systems.
125125

126126
To build PCRE on a Unix-like system, first run the "configure" command from the
127127
PCRE distribution directory, with your current directory set to the directory
@@ -303,12 +303,12 @@ script that can be run to recreate the configuration, and config.log, which
303303
contains compiler output from tests that "configure" runs.
304304

305305
Once "configure" has run, you can run "make". It builds two libraries, called
306-
libpcre and libpcreposix, a test program called pcretest, a demonstration
307-
program called pcredemo, and the pcregrep command. If a C++ compiler was found
308-
on your system, "make" also builds the C++ wrapper library, which is called
309-
libpcrecpp, and some test programs called pcrecpp_unittest,
310-
pcre_scanner_unittest, and pcre_stringpiece_unittest. Building the C++ wrapper
311-
can be disabled by adding --disable-cpp to the "configure" command.
306+
libpcre and libpcreposix, a test program called pcretest, and the pcregrep
307+
command. If a C++ compiler was found on your system, "make" also builds the C++
308+
wrapper library, which is called libpcrecpp, and some test programs called
309+
pcrecpp_unittest, pcre_scanner_unittest, and pcre_stringpiece_unittest.
310+
Building the C++ wrapper can be disabled by adding --disable-cpp to the
311+
"configure" command.
312312

313313
The command "make check" runs all the appropriate tests. Details of the PCRE
314314
tests are given below in a separate section of this document.
@@ -360,9 +360,6 @@ system. The following are installed (file names are all relative to the
360360
pcretest.txt the pcretest man page
361361
pcregrep.txt the pcregrep man page
362362

363-
Note that the pcredemo program that is built by "configure" is *not* installed
364-
anywhere. It is a demonstration for programmers wanting to use PCRE.
365-
366363
If you want to remove PCRE from your system, you can run "make uninstall".
367364
This removes all the files that "make install" installed. However, it does not
368365
remove any directories, because these are often shared with other programs.
@@ -743,4 +740,4 @@ The distribution should contain the following files:
743740
Philip Hazel
744741
Email local part: ph10
745742
Email domain: cam.ac.uk
746-
Last updated: 18 December 2007
743+
Last updated: 25 January 2008

ext/pcre/pcrelib/config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ them both to 0; an emulation function will be used. */
251251
#define PACKAGE_NAME "PCRE"
252252

253253
/* Define to the full name and version of this package. */
254-
#define PACKAGE_STRING "PCRE 7.5"
254+
#define PACKAGE_STRING "PCRE 7.6"
255255

256256
/* Define to the one symbol short name of this package. */
257257
#define PACKAGE_TARNAME "pcre"
258258

259259
/* Define to the version of this package. */
260-
#define PACKAGE_VERSION "7.5"
260+
#define PACKAGE_VERSION "7.6"
261261

262262

263263
/* If you are compiling for a system other than a Unix-like system or
@@ -310,7 +310,7 @@ them both to 0; an emulation function will be used. */
310310

311311
/* Version number of package */
312312
#ifndef VERSION
313-
#define VERSION "7.5"
313+
#define VERSION "7.6"
314314
#endif
315315

316316
/* Define to empty if `const' does not conform to ANSI C. */

ext/pcre/pcrelib/dftables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
and semantics are as close as possible to those of the Perl 5 language.
77
88
Written by Philip Hazel
9-
Copyright (c) 1997-2007 University of Cambridge
9+
Copyright (c) 1997-2008 University of Cambridge
1010
1111
-----------------------------------------------------------------------------
1212
Redistribution and use in source and binary forms, with or without

0 commit comments

Comments
 (0)