mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-18 05:18:47 +02:00
test_string_replace: Exercise zero-length replacements
Previously, these would have done 2**32 replacements, and the first one would have consumed 6GB of memory in the process. They now match what Python `str.replace()` does. Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2452 Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
0a8c7e57ab
commit
bf70d58d55
@ -528,6 +528,12 @@ test_string_replace (void)
|
|||||||
"", 3 },
|
"", 3 },
|
||||||
{ "aaa", "aa", "bb", 0,
|
{ "aaa", "aa", "bb", 0,
|
||||||
"bba", 1 },
|
"bba", 1 },
|
||||||
|
{ "foo", "", "bar", 0,
|
||||||
|
"barfbarobarobar", 4 },
|
||||||
|
{ "", "", "x", 0,
|
||||||
|
"x", 1 },
|
||||||
|
{ "", "", "", 0,
|
||||||
|
"", 1 },
|
||||||
};
|
};
|
||||||
gsize i;
|
gsize i;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user