After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703952 - [xls] Text encoding problem
[xls] Text encoding problem
Status: RESOLVED OBSOLETE
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
git master
Other Linux
: Normal critical
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2013-07-10 14:04 UTC by jutaky
Modified: 2018-05-22 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description jutaky 2013-07-10 14:04:19 UTC
Segfault in __memcpy_ssse3_back when exporting to xls.

Git versions of glib, goffice, gnumeric, libgsf and libxml2.

Test case: http://jutaky.com/fuzzing/gnumeric_case_8646_725_2xls.gnumeric

Segfault triggered by opening the test case with gnumeric and using Save As and saving as xls.

Alternatively running "ssconvert gnumeric_case_8646_725_2xls.gnumeric out.xls".

Backtrace from ssconvert:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff335d650 in __memcpy_ssse3_back () from /usr/lib/libc.so.6
(gdb) bt
  • #0 __memcpy_ssse3_back
    from /usr/lib/libc.so.6
  • #1 gsf_outfile_msole_write
    at gsf-outfile-msole.c line 578
  • #2 gsf_output_write
    at gsf-output.c line 443
  • #3 msole_metadata_write_string
    at gsf-msole-utils.c line 1416
  • #4 msole_metadata_write_prop
    at gsf-msole-utils.c line 1501
  • #5 msole_metadata_write_prop
    at gsf-msole-utils.c line 1465
  • #6 msole_metadata_write_section
    at gsf-msole-utils.c line 1609
  • #7 gsf_doc_meta_data_write_to_msole
    at gsf-msole-utils.c line 1744
  • #8 excel_save
    at boot.c line 289
  • #9 excel_biff8_file_save
    at boot.c line 322
  • #10 go_plugin_loader_module_func_file_save
    at app/go-plugin-loader-module.c line 366
  • #11 go_plugin_file_saver_save
    at app/go-plugin-service.c line 948
  • #12 go_file_saver_save
    at app/file.c line 848
  • #13 wbv_save_to_output
    at workbook-view.c line 1050
  • #14 wb_view_save_to_uri
    at workbook-view.c line 1087
  • #15 wb_view_save_as
    at workbook-view.c line 1123
  • #16 convert
    at ssconvert.c line 788
  • #17 main
    at ssconvert.c line 855

--
Juha Kylmänen
Research Assistant, OUSPG
Comment 1 Andreas J. Guelzow 2013-07-10 20:05:14 UTC
The issue is that in  msole_metadata_write_string we are converting a string using g_convert_with_iconv but fail to check whether the conversion is successful. In this case the function returns a null pointer with bytes_written=1.

I don't know how to fix this correctly.
Comment 2 Morten Welinder 2013-07-11 13:54:53 UTC
Crash fixed.

Keeping open because this happened in the writing phase.  Why do we have
bogus metadata there?
Comment 3 Andreas J. Guelzow 2013-07-12 03:10:51 UTC
Morten, what do you mean with "bogus metadata"? If you check txt with g_utf8_validate you see that it is indeed valid, i.e. 
g_utf8_validate (txt, -1, NULL)
returns true.

The problem is that the conversion from UTF8 to CP1252 fails, not that the UTF8  code is invalid.
Comment 4 Morten Welinder 2013-07-12 13:31:17 UTC
Hmm...  Not bogus then.

That, of course, just leaves the question of why CP1252 is being used.
And if there's anything we can do about it.
Comment 5 Andreas J. Guelzow 2013-07-12 15:12:38 UTC
When libreoffice saves this file as xls it seems to use UTF-8 for most parts and  CP1252 for the first part. At least according to gsf_msole_iconv_open_codepage_for_import when we open that file.
Comment 6 GNOME Infrastructure Team 2018-05-22 14:00:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnumeric/issues/226.