summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-10-13 15:51:27 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-10-13 15:51:27 +0000
commit8fcc1628b61893fa9719c1f8ae8a032494b98946 (patch)
tree36f70ab2bb1b4a31dabceab437c8b6cb357a20f9
parentb97ccbccda36682d7b0ed61cfb8e923f9dfc7be3 (diff)
downloadpcre-8fcc1628b61893fa9719c1f8ae8a032494b98946.tar.gz
Rewrite code that broke under Mac OS (isxdigit with ++ in its argument).
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@735 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog7
-rw-r--r--pcretest.c8
2 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7495a54..4a5ee38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -107,6 +107,13 @@ Version 8.20 10-Oct-2011
20. Fixed an ASCII-dependent infelicity in pcretest that would have made it
fail to work when decoding hex characters in data strings in EBCDIC
environments.
+
+21. It appears that in at least one Mac OS environment, the isxdigit() function
+ is implemented as a macro that evaluates to its argument more than once,
+ contravening the C 90 Standard (I haven't checked a later standard). There
+ was an instance in pcretest which caused it to go wrong when processing
+ \x{...} escapes in subject strings. The has been rewritten to avoid using
+ things like p++ in the argument of isxdigit().
Version 8.13 16-Aug-2011
diff --git a/pcretest.c b/pcretest.c
index 6aac2c2..8ac3a36 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -2346,7 +2346,13 @@ while (!done)
{
unsigned char *pt = p;
c = 0;
- while (isxdigit(*(++pt)))
+
+ /* We used to have "while (isxdigit(*(++pt)))" here, but it fails
+ when isxdigit() is a macro that refers to its argument more than
+ once. This is banned by the C Standard, but apparently happens in at
+ least one MacOS environment. */
+
+ for (pt++; isxdigit(*pt); pt++)
c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'a' - 10);
if (*pt == '}')
{