diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-10-21 02:10:44 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2024-10-21 02:46:30 +0300 |
commit | abfbeb17e56bd9abc275de0f7ace6c197e00e3bf (patch) | |
tree | 251134ddb2bd0929bff310b707d3b5bde239e4ee /src | |
parent | 3b3bc070f802491e98f87d9191e7d33fec78dd5a (diff) | |
download | sciteco-abfbeb17e56bd9abc275de0f7ace6c197e00e3bf.tar.gz |
fixed EOL conversion on UTF-8 texts
* The old bug of saving gchar in gints, so teco_eol_reader_t::last_char could become negative.
* When converting from an UTF-8 text with CRLF linebreaks, we could have data loss and corruptions.
* On strings ending in UTF-8 characters, teco_eol_reader_t::offset would overflow, resulting
in invalid reads and potentially insertion of data garbage.
I observed this with G~ on Gtk.
* Test cased updated. Couldn't reproduce the bug with the test suite, though.
Diffstat (limited to 'src')
-rw-r--r-- | src/eol.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -239,7 +239,7 @@ teco_eol_reader_convert(teco_eol_reader_t *ctx, gchar **ret, gsize *data_len, GE else if (ctx->eol_style != SC_EOL_CR) ctx->eol_style_inconsistent = TRUE; } - ctx->last_char = buffer[i]; + ctx->last_char = (guchar)buffer[i]; break; } } |