Re: Crash when pasting Unicode text from Firefox [patch]

From: Chris Leonard <cjlhomeaddress_at_gmail.com>
Date: Mon Aug 13 2012 - 16:59:44 CEST

Dear Dmitry,

I'm not a coder so I cannot comment on your patch, but as someone who
cares deeply about L10n, Unicode is obviously very important to me and
I want to thank you for working on this issue, which will benefit many
of our users.

cjl

On Mon, Aug 13, 2012 at 10:09 AM, Dmitry Smirnov <onlyjob@member.fsf.org> wrote:
> Dear Abiword team,
>
> Here I'm forwarding to you information and the patch partially fixing crash on
> unicode character(s) paste. (2.8.6 and the trunk versions are affected).
>
> Patch is only fixing this problem in 'Paste' but 'Paste Unformatted' is still
> affected. I'm sure you would know better how to fix.
>
> Just to remind, this important problem can be easily reproduced with the
> following steps:
>
> * Go to http://en.wikipedia.org/wiki/Linear_B#Unicode
> * Copy one or more character(s) from the Unicode table
> * Paste in a new Abiword document.
>
> I also provided this information in remotely related ticket #13280 but I hope
> it will have better visibility here.
>
> Thank you.
>
> Regards,
> Dmitry.
>
>
> ---------- Forwarded Message ----------
>
> Subject: Bug#681060: abiword: Crash when copying Unicode text from Firefox
> Date: Mon, 13 Aug 2012, 03:40:23
> From: "Ying-Chun Liu (PaulLiu)" <paulliu@debian.org>
> To: 681060@bugs.debian.org
>
> Hi,
>
> I think I found the root cause of the bug.
> It is because the character is not in UCS-2 but in UTF-16LE.
>
> I first make a patch to add an error message to the g_convert function call.
> As attachment add_debug_message_of_g_convert.patch
>
> And then it prints
> "ut_iconv.cpp:379 UT_convert() Cannot convert str fffe00d801dc(6) from
> UCS-2LE to UTF-8 because Invalid byte sequence in conversion input"
>
> And because the conversion is failed, thus the result string is NULL.
> And the NULL passed to memmove() at ut_bytebuf.cpp:96 which causes the
> CRASH.
>
> And then I just reorder the encoding preference order in
> src/af/xap/xp/xap_EncodingManager.cpp. Please see attachment
> reorderencoding.patch.
> It works fine. The character is just appeared onto abiword.
>
> So my suggestion is we either do the proper handle of the conversion
> failure (when NULL is returned, we ignore the paste maybe). Or we can
> make "UTF-16LE" as preferred value rather than UCS-2.
>
> Yours,
> Paul
>
> --
> PaulLiu (劉穎駿)
> E-mail: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
>
> -----------------------------------------
Received on Mon Aug 13 17:00:50 2012

This archive was generated by hypermail 2.1.8 : Mon Aug 13 2012 - 17:00:50 CEST