diff options
| author | Bryce Harrington <bryce@bryceharrington.org> | 2014-09-14 23:03:29 +0000 |
|---|---|---|
| committer | bryce <bryce@ubuntu.com> | 2014-09-14 23:03:29 +0000 |
| commit | 70f0a1b307456191c5f2ce103d3edbf4ca23d514 (patch) | |
| tree | fff9aec49679a4fa44b908f901080c0ebaf7e0dd /src/extension/system.cpp | |
| parent | Fix GTK3 build (diff) | |
| download | inkscape-70f0a1b307456191c5f2ce103d3edbf4ca23d514.tar.gz inkscape-70f0a1b307456191c5f2ce103d3edbf4ca23d514.zip | |
Always check result of sp_repr_read_mem for NULL
In cases where undefined or invalid XML is passed to sp_repr_read_mem(),
it will indicate failure by returning NULL. All callers must check for
this and handle the error condition accordingly.
Fixes: lp: #1170248
Fixed bugs:
- https://launchpad.net/bugs/1170248
(bzr r13556)
Diffstat (limited to 'src/extension/system.cpp')
| -rw-r--r-- | src/extension/system.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/extension/system.cpp b/src/extension/system.cpp index c244d9c16..45feb882f 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -556,7 +556,7 @@ build_from_file(gchar const *filename) } /** - * \return The module created + * \return The module created, or NULL if buffer is invalid * \brief This function creates a module from a buffer holding an * XML description. * \param buffer The buffer holding the XML description of the module. @@ -568,6 +568,7 @@ Extension * build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp) { Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), INKSCAPE_EXTENSION_URI); + g_return_val_if_fail(doc != NULL, NULL); Extension *ext = build_from_reprdoc(doc, in_imp); Inkscape::GC::release(doc); return ext; |
