xi-gtk icon indicating copy to clipboard operation
xi-gtk copied to clipboard

xi-gtk freezes when opening files whose names are invalid utf8, and have invalid utf8

Open mateon1 opened this issue 7 years ago • 3 comments

How to reproduce:

  1. Open xi-gtk
  2. Open a file whose filename is invalid utf8, which contains invalid utf8, so xi-core exits. in my case, the filename is: (hex) 20 ed 96 4f 56 (or escaped): " \xed\x96OV" the file is a corrupt stack trace that contains some non-utf8 gibberish, but any binary file should work.
  3. After xi-core exits, xi-gtk enters an infinite loop printing error messages to the console

Stdout/stderr:

starting plugins for view-id-1
starting plugins for view-id-3
xi-core exited with error:
Io(Error { repr: Custom(Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") }) })

(xi-gtk:8440): Json-CRITICAL **: json_parser_load_from_data: assertion 'data != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_has_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_get_string_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_get_object_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_parser_load_from_data: assertion 'data != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_has_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_get_string_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_get_object_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_parser_load_from_data: assertion 'data != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_has_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_get_string_member: assertion 'object != NULL' failed

(xi-gtk:8440): Json-CRITICAL **: json_object_get_object_member: assertion 'object != NULL' failed

The spam of Json-CRITICAL errors continues forever. The only solution is to kill xi-gtk.

mateon1 avatar Jan 05 '18 07:01 mateon1

The infinite loop should be fixed in 39d55592e67f00d85ba737c7c3fed69022100340. Filenames that are invalid UTF-8 are hard to support with the current architecture as the front-end communicates with the core through JSON and the JSON has to be valid UTF-8. Support for files whose content uses a non-UTF-8 encoding is something that should be handled in the core.

eyelash avatar May 18 '18 14:05 eyelash

Support for non-utf8 filenames would be possible if annoying, but is probably something xi-core should support eventually. It means paths are going to need to be sent in base64 or something. I'd welcome an issue in xi-core but I don't expect to get around to it in a hurry.

Better support for non-utf8 encodings is definitely important, and there's been some very preliminary groundwork in this direction in core. I also don't think there's a real issue up for that, so again file in xi-core if you like @mateon1 :)

cmyr avatar May 19 '18 01:05 cmyr

See also google/xi-editor#796

eyelash avatar Sep 14 '18 16:09 eyelash