]> granicus.if.org Git - postgresql/commit
Make replace(), split_part(), and string_to_array() behave somewhat sanely
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jul 2007 20:34:54 +0000 (20:34 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jul 2007 20:34:54 +0000 (20:34 +0000)
commitc556447c70c937e5910fbbbc9653adc22c42a5ee
treeda5b0638083bf887703aee9b00a2a5a72e61c52a
parentf1dda4c54e1b1d52e9975f9de8feac951ee6d45b
Make replace(), split_part(), and string_to_array() behave somewhat sanely
when handed an invalidly-encoded pattern.  The previous coding could get
into an infinite loop if pg_mb2wchar_with_len() returned a zero-length
string after we'd tested for nonempty pattern; which is exactly what it
will do if the string consists only of an incomplete multibyte character.
This led to either an out-of-memory error or a backend crash depending
on platform.  Per report from Wiktor Wodecki.
src/backend/utils/adt/varlena.c