aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-06-24 20:53:50 +0300
committerArnold D. Robbins <arnold@skeeve.com>2013-06-24 20:53:50 +0300
commite50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a (patch)
treeaf79bfb696961e24ee87adec38b526c0e8cb6ef3
parentb3d8abcd4404089f1e242dbd7d3785c638d160f6 (diff)
downloadegawk-e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a.tar.gz
egawk-e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a.tar.bz2
egawk-e50f9b883b4aa5d6ce7f9218f7dfba8b5686ee2a.zip
Fix multibyte character problem with brackets in dfa.c.
-rw-r--r--ChangeLog8
-rw-r--r--dfa.c13
2 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index ea96384d..33f2d317 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-06-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dfa.c (copytoks): Rewrite to call addtok_mb() directly. Avoids
+ problems with multibyte characters inside character sets.
+ Thanks to Steven Daniels <stevendaniels88@gmail.com> for reporting
+ the problem. Much thanks to Mike Haertel <mike@ducky.net> for the
+ analysis and fix.
+
2013-06-24 Eli Zaretskii <eliz@gnu.org>
* io.c: Move #include "popen.h" out of the HAVE_SOCKETS condition,
diff --git a/dfa.c b/dfa.c
index 54e0ae9d..2195e281 100644
--- a/dfa.c
+++ b/dfa.c
@@ -1847,13 +1847,12 @@ copytoks (size_t tindex, size_t ntokens)
{
size_t i;
- for (i = 0; i < ntokens; ++i)
- {
- addtok (dfa->tokens[tindex + i]);
- /* Update index into multibyte csets. */
- if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
- dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
- }
+ if (MB_CUR_MAX > 1)
+ for (i = 0; i < ntokens; ++i)
+ addtok_mb(dfa->tokens[tindex + i], dfa->multibyte_prop[tindex + i]);
+ else
+ for (i = 0; i < ntokens; ++i)
+ addtok_mb(dfa->tokens[tindex + i], 3);
}
static void