|
From: Steve M. <sm...@so...> - 2007-11-28 18:53:46
|
Hi.
First, thanks for rlib. I've been doing some tests with it and have
been impressed that you've already almost exactly implemented the
reporting system I'd just designed :^) . I wrote a little PHP wrapper
for it, allowing users to easily generate parameterized SQL reports..
Planning to release it once it's matured a little.
Anyway.. I spent most of the morning trying to track down what I
eventually discovered was a segfault in parse_line_array. And it
turned out this segfault was caused by a typo in my report. I typed:
<field width="1" />
when I meant to type:
<literal width="1" />
...which crashed because the parser code was assuming there was a
'value' present for <field>.
This could easily be avoided with an r_error and graceful quit, I
think. Below is a patch.
Hope this helps.
Steve
===========
--- parsexml.c (revision 3084)
+++ parsexml.c (working copy)
@@ -98,6 +98,10 @@
struct rlib_report_field *f = g_new0(struct rlib_report_field, 1);
current = (void *)g_new0(struct rlib_element, 1);
sp = xmlGetProp(cur, (const xmlChar *) "value");
+ if(!sp) {
+ r_error(r, "Line: %d - <field> is missing 'value' attribute. \n",
xmlGetLineNo (cur),cur->name);
+ return NULL;
+ }
#if DISABLE_UTF8
utf8_to_8813(r, f->value, (gchar *)sp);
#else
|