[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: importing regex changes from libc
From: |
Eric Blake |
Subject: |
Re: importing regex changes from libc |
Date: |
Fri, 11 Aug 2006 17:41:26 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
>
> This is broken on cygwin, where wchar_t is 2 bytes but wint_t is 4 bytes.
How about this? Paul, do you want to handle pushing it back upstream to glibc?
2006-08-11 Eric Blake <address@hidden>
* regex_internal.c (re_string_skip_chars): Avoid overflow when
WEOF doesn't fit in wchar_t.
Index: lib/regex_internal.c
===================================================================
RCS file: /sources/gnulib/gnulib/lib/regex_internal.c,v
retrieving revision 1.21
diff -u -r1.21 regex_internal.c
--- lib/regex_internal.c 10 Aug 2006 20:08:01 -0000 1.21
+++ lib/regex_internal.c 11 Aug 2006 17:30:51 -0000
@@ -488,11 +488,12 @@
mbstate_t prev_st;
Idx rawbuf_idx;
size_t mbclen;
- wchar_t wc = WEOF;
+ wint_t wi = WEOF;
+ wchar_t wc;
/* Skip the characters which are not necessary to check. */
for (rawbuf_idx = pstr->raw_mbs_idx + pstr->valid_raw_len;
- rawbuf_idx < new_raw_idx;)
+ rawbuf_idx < new_raw_idx; wi = (wint_t) wc)
{
Idx remain_len;
remain_len = pstr->len - rawbuf_idx;
@@ -512,7 +513,7 @@
/* Then proceed the next character. */
rawbuf_idx += mbclen;
}
- *last_wc = (wint_t) wc;
+ *last_wc = wi;
return rawbuf_idx;
}
#endif /* RE_ENABLE_I18N */