This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ #13637] fix false multi-byte matches in some regularexpressions


	* posix/regex_internal.c (re_string_skip_chars): Fix
	miscomputation of remain_len that may cause incomplete
	multi-byte character and false match.

---
 ChangeLog              |    7 +++++++
 posix/regex_internal.c |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 153d80f..592f7a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-02-16  Stanislav Brabec  <sbrabec@suse.cz>
+
+	[BZ #13637]
+	* posix/regex_internal.c (re_string_skip_chars): Fix miscomputation
+	of remain_len that may cause incomplete multi-byte character and
+	false match.
+
 2012-02-22  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #2547]
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index b71eae4..9be8a53 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -499,7 +499,7 @@ re_string_skip_chars (re_string_t *pstr, int new_raw_idx, wint_t *last_wc)
        rawbuf_idx < new_raw_idx;)
     {
       wchar_t wc2;
-      int remain_len = pstr->len - rawbuf_idx;
+      int remain_len = pstr->raw_len - rawbuf_idx;
       prev_st = pstr->cur_state;
       mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
 			  remain_len, &pstr->cur_state);
-- 
1.7.7

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarskà 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]