Fix regexp compiler with translation table

Andreas Schwab schwab@suse.de
Wed May 12 11:52:00 GMT 2004


build_wcs_buffer didn't set mbs when a translation table is used.  This
can result in all kinds of random behaviour during parsing due to use of
uninitialized memory.

2004-05-12  Andreas Schwab  <schwab@suse.de>

	* posix/regex_internal.c (build_wcs_buffer): Also set pstr->mbs
	when translating.

--- posix/regex_internal.c	26 Feb 2004 12:03:50 +0100	1.40
+++ posix/regex_internal.c	12 May 2004 13:46:04 +0200	
@@ -242,7 +242,7 @@ build_wcs_buffer (pstr)
 	  for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
 	    {
 	      ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
-	      buf[i] = pstr->trans[ch];
+	      buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
 	    }
 	  p = (const char *) buf;
 	}

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libc-hacker mailing list