On Mon, 2007-12-10 at 16:59 -0800, Plamen Todorov wrote:
> Hello,
> 
> Dia crashes if it is attempted to export shape to a
> file, which extension is not .shape (the UI allows to
> type whatever file extension the user likes or no
> extension at all). The problem seems to come from
> plug-ins/shape/shape-export.c, where after the lines:
> point = strrchr(filename, '.'); it is not checked if
> point == NULL (no file extension). Also the line:
> strlen(g_basename(filename))-6);
> makes assumption of the extension length, which may
> not be correct. Attached is suggestion for fix.

Thank you, your patch seems to work.  While Dia should obviously not
crash, Dia will only load shape files that end in .shape, so it's
slightly problematic to allow non-.shape shape files.  Unfortunately,
there is no way for the export interface to indicate error in the
filename[1].  I think the better way to fix this problem would be to
give a warning message in export_shape and return early if the suffix is
not .shape.

-Lars

[1] The export interface is fairly rudimentary overall, it can't specify
any arguments like size either (except very clumsily like the PNG export
does).  An improved export system would be nice, but is not at the top
of my personal worklist.

_______________________________________________
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia

  • [no subject] Plamen Todorov
    • Non-.shape suffix in shape export Lars Clausen

Reply via email to