[Gnucash-changes] r12989 - gnucash/trunk/src/report - Check for invalid options tables when loading reports.

Chris Shoemaker c.shoemaker at cox.net
Fri Jan 27 17:46:37 EST 2006


On Fri, Jan 27, 2006 at 05:32:37PM -0500, Derek Atkins wrote:
> Quoting Chris Shoemaker <c.shoemaker at cox.net>:
> 
> >>     (if (>= id *gnc:_report-next-serial_*)
> >>         (set! *gnc:_report-next-serial_* (+ id 1)))
> >>     (gnc:report-add id r)
> >>-    id))
> >>+    #f))
> >>
> >
> >*sigh* This was a mistake.  I convinced myself that we didn't depend
> >on the return value, and we didn't used to, but we do now.  New-style
> >saved-reports won't restore until I'll fix this in my next commit.
> 
> I was wondering about that, but I hadn't had the time to actually
> go read the code and convince myself this was okay.
> 

There's something a bit strange here, too.  We have in
gnc_plugin_page_report_recreate_page():

        option_string = g_key_file_get_string(key_file, group_name,
                                              SCHEME_OPTIONS, &error);
        if (error) {
          g_warning("error reading group %s key %s: %s",
                    group_name, SCHEME_OPTIONS, error->message);
          LEAVE("bad value");
          return NULL;
        }
        scm_id = scm_c_eval_string(option_string);
        if (!scm_integer_p(scm_id)) {
          g_free(option_string);
          LEAVE("report id not an integer");
          return NULL;
        }

        report_id = scm_num2int(scm_id, SCM_ARG1, __FUNCTION__);


Now, since the option string I created evaluates to #f, you'd _really_
think this would trigger the "report id not an integer" error path.

But, no.  Instead: 
ERROR: In procedure gnc_plugin_page_report_recreate_page:
ERROR: Wrong type argument in position 1: #f

And a clean crash.  Not very nice.  :(

-chris


More information about the gnucash-devel mailing list