GNOME Bugzilla – Bug 71902
dif export plugin generates random VECTORS and TUPLES values
Last modified: 2004-12-22 21:47:04 UTC
In plugins/dif/dif.c:dif_file_save, the r variable is used (for the header information) before it is initialized, resulting in garbage values corresponding to r.end.row,r.end.col. Gnumeric ignores these values when reading dif files, which is why this bug hasn't been noticed before. (I noticed it only by looking at the produced dif file.) Steps to reproduce: save any non-empty sheet as dif format. Look at lines 5,8 of the produced .dif file. (Btw, I believe this bug could have been detected with the -Wuninitialized flag to gcc if compiled with optimization.) pjm. diff -dur -x Makefile.in gnumeric-1.0.4/plugins/dif/ChangeLog gnumeric-1.0.4-pjm/plugins/dif/ChangeLog --- gnumeric-1.0.4/plugins/dif/ChangeLog Thu Jan 31 14:21:46 2002 +++ gnumeric-1.0.4-pjm/plugins/dif/ChangeLog Tue Feb 19 15:42:59 2002 @@ -1,3 +1,8 @@ +2002-02-19 Peter Moulder <pmoulder@csse.monash.edu.au> + + * dif.c (dif_file_save): Ensure r is initialized before use. + Affects VECTORS and TUPLES values in dif header. + 2002-01-30 Jody Goldberg <jody@gnome.org> * Release 1.0.4 diff -dur -x Makefile.in gnumeric-1.0.4/plugins/dif/dif.c gnumeric-1.0.4-pjm/plugins/dif/dif.c --- gnumeric-1.0.4/plugins/dif/dif.c Mon Jan 7 08:02:46 2002 +++ gnumeric-1.0.4-pjm/plugins/dif/dif.c Tue Feb 19 11:33:07 2002 @@ -366,6 +366,7 @@ gnumeric_io_error_string (io_context, _("Cannot get default sheet.")); return; } + r = sheet_get_extent (sheet, FALSE); /* Write out the standard headers */ fputs ("TABLE\n" "0,1\n" "\"GNUMERIC\"\n", f); @@ -374,7 +375,6 @@ fputs ("DATA\n0,0\n" "\"\"\n", f); /* Process all cells */ - r = sheet_get_extent (sheet, FALSE); for (row = r.start.row; row <= r.end.row; row++) { fputs ("-1,0\n" "BOT\n", f); for (col = r.start.col; col <= r.end.col; col++) {
Thanks, I'll apply to HEAD and the 1.0 branch.