mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-03 07:53:39 +02:00
Fix bug in strinfo
We can't search for a larger needle inside of a smaller haystack, and unsigned integer subtraction tends to result in very large numbers rather than small ones. Add a check for this case and abort out immediately. Also add a test case (lifted directly from the docs) that demonstrates the problem. Issue discovered and tracked down by Milan Bouchet-Valat
This commit is contained in:
@@ -147,6 +147,9 @@ strinfo_scan (const guint32 *strinfo,
|
||||
{
|
||||
guint i = 0;
|
||||
|
||||
if (length < n_words)
|
||||
return -1;
|
||||
|
||||
while (i <= length - n_words)
|
||||
{
|
||||
guint j = 0;
|
||||
|
Reference in New Issue
Block a user