Commit c556447
committed
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.1 parent f1dda4c commit c556447
1 file changed
+13
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
| 701 | + | |
705 | 702 | | |
706 | | - | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
707 | 707 | | |
708 | | - | |
| 708 | + | |
709 | 709 | | |
710 | | - | |
711 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
712 | 715 | | |
| 716 | + | |
713 | 717 | | |
714 | | - | |
715 | 718 | | |
716 | 719 | | |
717 | 720 | | |
| |||
0 commit comments