summaryrefslogtreecommitdiff
path: root/src/backend/regex
AgeCommit message (Collapse)Author
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2008-02-19Refactor backend makefiles to remove lots of duplicate codePeter Eisentraut
2008-02-14Sync our regex code with upstream changes since last time we did this, whichTom Lane
was Tcl 8.4.8. The main changes are to remove the never-fully-implemented code for multi-character collating elements, and to const-ify some stuff a bit more fully. In combination with the recent security patch, this commit brings us into line with Tcl 8.5.0. Note that I didn't make any effort to duplicate a lot of cosmetic changes that they made to bring their copy into line with their own style guidelines, such as adding braces around single-line IF bodies. Most of those we either had done already (such as ANSI-fication of function headers) or there is no point because pgindent would undo the change anyway.
2008-01-03Fix assorted security-grade bugs in the regex engine. All of these problemsTom Lane
are shared with Tcl, since it's their code to begin with, and the patches have been copied from Tcl 8.5.0. Problems: CVE-2007-4769: Inadequate check on the range of backref numbers allows crash due to out-of-bounds read. CVE-2007-4772: Infinite loop in regex optimizer for pattern '($|^)*'. CVE-2007-6067: Very slow optimizer cleanup for regex with a large NFA representation, as well as crash if we encounter an out-of-memory condition during NFA construction. Part of the response to CVE-2007-6067 is to put a limit on the number of states in the NFA representation of a regex. This seems needed even though the within-the-code problems have been corrected, since otherwise the code could try to use very large amounts of memory for a suitably-crafted regex, leading to potential DOS by driving the system into swap, activating a kernel OOM killer, etc. Although there are certainly plenty of ways to drive the system into effective DOS with poorly-written SQL queries, these problems seem worth treating as security issues because many applications might accept regex search patterns from untrustworthy sources. Thanks to Will Drewry of Google for reporting these problems. Patches by Will Drewry and Tom Lane. Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067
2007-11-15pgindent run for 8.3.Bruce Momjian
2007-10-22Add a useless return statement to suppress a warning seen with someTom Lane
versions of gcc (I'm seeing it with Apple's gcc 4.0.1). I think the reason we did not see this before was that the assert() macros in the regex code were all no-ops till recently.
2007-10-06Make dumpcolors() have tolerable performance when using 32-bit chr,Tom Lane
as we do (and upstream Tcl doesn't). The loop limit might be subject to negotiation if anyone ever tries to do regex debugging in Far Eastern languages, but for now 1000 seems plenty. CHR_MAX was right out :-(
2007-10-06Adjust some regex debugging printouts to not give wrong-format-widthTom Lane
warnings on a 64-bit machine. Noted while chasing a recent regex bug report.
2007-02-01Wording cleanup for error messages. Also change can't -> cannot.Bruce Momjian
Standard English uses "may", "can", and "might" in different ways: may - permission, "You may borrow my rake." can - ability, "I can lift that log." might - possibility, "It might rain today." Unfortunately, in conversational English, their use is often mixed, as in, "You may use this variable to do X", when in fact, "can" is a better choice. Similarly, "It may crash" is better stated, "It might crash".
2005-11-22Re-run pgindent, fixing a problem where comment lines after a blankBruce Momjian
comment line where output as too long, and update typedefs for /lib directory. Also fix case where identifiers were used as variable names in the backend, but as typedefs in ecpg (favor the backend for indenting). Backpatch to 8.1.X.
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-09-24Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.Tom Lane
2005-07-10I made the patch that implements regexp_replace again.Bruce Momjian
The specification of this function is as follows. regexp_replace(source text, pattern text, replacement text, [flags text]) returns text Replace string that matches to regular expression in source text to replacement text. - pattern is regular expression pattern. - replacement is replace string that can use '\1'-'\9', and '\&'. '\1'-'\9': back reference to the n'th subexpression. '\&' : entire matched string. - flags can use the following values: g: global (replace all) i: ignore case When the flags is not specified, case sensitive, replace the first instance only. Atsushi Ogawa
2005-05-25Add parentheses to macros when args are used in computations. WithoutBruce Momjian
them, the executation behavior could be unexpected.
2004-11-24Install Tcl regex fixes to sync our regex engine with Tcl 8.4.8 (up fromTom Lane
8.4.1). This corrects some curious regex bugs, though not the greediness issue I was hoping to find a solution for :-(
2004-05-07Solve the 'Turkish problem' with undesirable locale behavior for caseTom Lane
conversion of basic ASCII letters. Remove all uses of strcasecmp and strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp; remove most but not all direct uses of toupper and tolower in favor of pg_toupper and pg_tolower. These functions use the same notions of case folding already developed for identifier case conversion. I left the straight locale-based folding in place for situations where we are just manipulating user data and not trying to match it to built-in strings --- for example, the SQL upper() function is still locale dependent. Perhaps this will prove not to be what's wanted, but at the moment we can initdb and pass regression tests in Turkish locale.
2003-11-29$Header: -> $PostgreSQL Changes ...PostgreSQL Daemon
2003-09-29Fix broken definition of :print: character class, per Bruno Wolff.Tom Lane
Also, make :alnum: character class directly dependent on isalnum() rather than guessing.
2003-08-08Another pgindent run with updated typedefs.Bruce Momjian
2003-08-04pgindent run.Bruce Momjian
2003-02-05Replace regular expression package with Henry Spencer's latest versionTom Lane
(extracted from Tcl 8.4.1 release, as Henry still hasn't got round to making it a separate library). This solves a performance problem for multibyte, as well as upgrading our regexp support to match recent Tcl and nearly match recent Perl.
2002-11-08This patch removes a bunch of superfluous #include directives: ifBruce Momjian
postgres.h or c.h includes a system header (such as stdio.h or stdlib.h), there's no need to specifically include it in any of the .c files in the backend. Neil Conway
2002-09-16Remove retest Makefile entry because it does not compile.Bruce Momjian
2002-09-04pgindent run.Bruce Momjian
2002-09-03Remove all traces of multibyte and locale options. Clean up commentsPeter Eisentraut
referring to "multibyte" where it really means character encoding.
2002-09-02Remove sys/types.h in files that include postgres.h, and hence c.h,Bruce Momjian
because c.h has sys/types.h.
2002-08-29Remove #ifdef MULTIBYTE per hackers list discussion.Tatsuo Ishii
2002-06-11Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.Thomas G. Lockhart
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~". Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape). Extend the definition to make the FOR clause optional. Define textregexsubstr() to actually implement this feature. Update the regression test to include these new string features. All tests pass. Rename the regular expression support routines from "pg95_xxx" to "pg_xxx". Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
2002-05-05Fix code to work when isalpha and friends are macros, not functions.Tom Lane
2002-04-24[ Patch comments in three pieces.]Bruce Momjian
Attached is a pacth against 7.2 which adds locale awareness to the character classes of the regular expression engine. ... > > I still think the xdigit class could be handled the same way the digit > > class is (by enumeration rather than using the isxdigit function). That > > saves you a cicle, and I don't think there's any loss. > > In fact, I will email you when I apply the original patch. I miss that case :-(. Here is the pached patch. ... Here is a patch which addresses Tatsuo's concerns (it does return an static struct instead of constructing it).
2001-11-05New pgindent run with fixes suggested by Tom. Patch manually reviewed,Bruce Momjian
initdb/regression tests pass.
2001-10-28Another pgindent run. Fixes enum indenting, and improves #endifBruce Momjian
spacing. Also adds space for one-line comments.
2001-10-25pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian
tests pass.
2001-10-25Add do { ... } while (0) to more bad macros.Bruce Momjian
2001-10-04Add dependency for regexec.cTatsuo Ishii
2001-03-22pgindent run. Make it all clean.Bruce Momjian
2001-03-19Make regular-expression error messages a tad less obscure,Tom Lane
per gripe from Josh Berkus.
2001-02-13Clean up portability problems in regexp package: change all routineTom Lane
definitions from K&R to ANSI C style, and fix broken assumption that int and long are the same datatype. This repairs problems observed on Alpha with regexps having between 32 and 63 states.
2000-12-03Ensure that all uses of <ctype.h> functions are applied to unsigned-charTom Lane
values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00.
2000-11-30Make all commands that link a program look likePeter Eisentraut
$(CC) $(CFLAGS) $(LDFLAGS) <object files> <extra-libraries> $(LIBS) -o $@ This form seemed to be the most portable, readable, and logical, but in any case it's better than having a dozen different ones in the tree.
2000-10-20Add support for VPATH builds, that is, building somewhere else than in thePeter Eisentraut
source directory. This involves mostly makefiles using $(srcdir) when they might have used ".". (Regression tests don't work with this, yet.) Sort out usage of CPPFLAGS, CFLAGS (and CXXFLAGS). Add "override" keyword in most places, to preserve necessary flags even when the user overrode the flags.
2000-08-31Fix relative path references so that make knowns which dependencies referPeter Eisentraut
to one another. Sort out builddir vs srcdir variable namings. Remove some now obsoleted make variables.
2000-05-29Generated header files parse.h and fmgroids.h are now copied intoTom Lane
the src/include tree, so that -I backend is no longer necessary anywhere. Also, clean up some bit rot in contrib tree.
2000-01-19Removed MBFLAGS from makefiles since it's now done in include/config.h.Peter Eisentraut
1999-12-13New LDOUT makefile variable for QNX os.Bruce Momjian
1999-12-09Make LD -r as macros that can be changed for QNX.Bruce Momjian
1999-07-17 Move some system includes into c.h, and remove duplicates.Bruce Momjian
1999-07-15Change #include's to use <> and "" as appropriate.Bruce Momjian
1999-05-25pgindent run over code.Bruce Momjian
1999-05-21add retest, a regex testing programTatsuo Ishii