Hi,
I'm having some random crashes, possibly due to bad tag files? Patch
attached "fixes" the segfault, but I'm pretty sure it's not the
"correct" fix.
P.S. I also noticed in this block of code::
encodings_convert_to_utf8_from_charset(utf8_name, (gsize) -1, ...)
Is it OK the cast a negative number to `gsize` and will it have the
desired effect for that function? The `-1` here is supposed to tell the
encoding function that the string is nul terminated and is to be
measured with `strlen()` IIUC.
Cheers,
Matthew Brush
diff --git a/src/symbols.c b/src/symbols.c
index 65017de..971dcd9 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -1070,7 +1070,13 @@ static gchar *get_symbol_tooltip(GeanyDocument *doc, const TMTag *tag)
}
if (utf8_name != NULL)
- setptr(utf8_name, g_markup_escape_text(utf8_name, -1));
+ {
+ /* Invalid UTF-8 can be in utf8_name, so make sure it's valid
+ * before escaping, otherwise skip. This prevents a segfault on
+ * bad UTF-8. */
+ if (g_utf8_validate(utf8_name, -1, NULL))
+ setptr(utf8_name, g_markup_escape_text(utf8_name, -1));
+ }
return utf8_name;
}
_______________________________________________
Geany-devel mailing list
[email protected]
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel