summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@google.com>2016-03-04 00:40:39 +0000
committerPascal Terjan <pterjan@gmail.com>2016-03-07 09:43:36 +0000
commitdb47c44565b443d8f1cb1280061762a7bc607a86 (patch)
treebd1f41ba269b294a1d39dea6bbffc6e35d47237f /giscanner
parent27bd12dac3e772a5828b144c4040e327204d2059 (diff)
downloadgobject-introspection-db47c44565b443d8f1cb1280061762a7bc607a86.tar.gz
Do not segfault on comments with invalid UTF-8
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/giscannermodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c
index cd0718e4..4c1f00f3 100644
--- a/giscanner/giscannermodule.c
+++ b/giscanner/giscannermodule.c
@@ -631,6 +631,12 @@ pygi_source_scanner_get_comments (PyGISourceScanner *self)
if (comment->comment)
{
comment_obj = PyUnicode_FromString (comment->comment);
+ if (!comment_obj)
+ {
+ g_print ("Comment is not valid Unicode in %s line %d\n", comment->filename, comment->line);
+ Py_INCREF (Py_None);
+ comment_obj = Py_None;
+ }
}
else
{