[Debian-zh-dev] Bug#805544: zhcon: Crash on 64-bit system when the user tries to type Chinese

Anthony Fok foka at debian.org
Thu Nov 19 10:52:17 UTC 2015


Package: zhcon
Version: 1:0.2.6-10
Severity: important
Tags: patch pending

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

When zhcon is running on a 64-bit system (e.g. amd64),
after the end user has pressed Ctrl-Space to switch on the default
(built-in) Chinese input method, pressing any alphabet to try to
enter a Chinese character would immediately crash zhcon.

This problem was also reported by users on various Ubuntu forums, e.g.:

    zhcon在64位下启动输入法崩溃
    http://forum.ubuntu.org.cn/viewtopic.php?t=124062

A solution was posted in 2012:

    Ubuntu Server 12.04 64位系统编译安装zhcon 0.2.6
    http://rsljdkt.iteye.com/blog/1670508

The original fix comes from an admin known as Md85 on the LinuxDev board
on the Chinese SMTH BBS, to which he posted his patch on 2008-10-11,
accessible through this URL:

    http://www.newsmth.net/nForum/#!article/LinuxDev/29280

His post is reproduced below:

==============================================================================
发信人: Md82 (我是KCN的一条狗啊), 信区: LinuxDev
标  题: 一上午时间终于把zhcon的输入法在x86-64调通
发信站: 水木社区 (Sat Oct 11 09:36:29 2008), 站内

zhcon0.2.6的输入法不能在 x86-64上运行,一输入字符就报告段错误
fedora9和fedora10打包的两个binary rpm也一样的问题

阅读代码后发现原作者假设所有机器都是32位指针,所以直接把码表文件(每单元4bytes)
映射到char**数组。在x86-64中,一个char*占了8字节,结果变成由两个码表的偏移量数
值错位32后或出来,明显会超界。

解决办法是把几个数组从char**改成int *,以及修改了相关的偏移量计算代码。现在终
于可以在console灌水了。

具体修改的文件是src/winime.cpp和src/winime.h。
- --

自由对于笨人是极端痛苦的事情,不亚于把他们投入真空。
对于聪明人则不然。


※ 修改:·Md82 于 Oct 11 09:38:01 2008 修改本文·[FROM: 115.130.13.*]
※ 来源:·水木社区 http://newsmth.net·[FROM: 115.130.13.*]


附件(8.7KB) winime.cpp (http://att.newsmth.net/nForum/att/LinuxDev/29280/839)
附件(2.8KB) winime.h   (http://att.newsmth.net/nForum/att/LinuxDev/29280/9818)
==============================================================================

I am happy to report that his patch works perfectly on my laptop
running Debian sid (amd64/x86_64), and will upload a new version soon.

Cheers,

Anthony

- -- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages zhcon depends on:
ii  libc6        2.19-22
ii  libgcc1      1:5.2.1-23
ii  libgpm2      1.20.4-6.1+b2
ii  libncurses5  6.0+20151024-2
ii  libpth20     2.0.7-20
ii  libstdc++6   5.2.1-23
ii  libtinfo5    6.0+20151024-2
ii  unicon-imc2  3.0.4-14+b1

zhcon recommends no packages.

zhcon suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWTanaAAoJEOolALQSxZrP7cwP+wSweFRvUAaayK6xVYFCiPFz
LT+6hz5FilKOgeFqge7J3uGutPXBD6HLPhtrkUNCwmmyTYGtpaaO8D1PzLL02txH
zrz9iY0yACh9lgMSM+ZqSC1hGkBzfCVtoZcqzw5c8Ygy4l8VKFgRUF1gfxqBbjbY
1rYWC35VlHD4HPY+MtsKcDf+3LaXmq2/BkRaPGFdyU94e3YvKyX15pn3wOIIF9LV
jPVTXln7jUMtWYVgMBPyY66bOzCnqRkq9NKlb0GWXh7iEeDYXJdj3HqNlU5pqbIP
C7kfdkq1jKNkk0kpbdyS8NvgwkaCfE0HHabl9MrYYZI0iJOkdTGVqGLXbnjWjvnN
VKQYg0RrtbQUkUbgVwXxOMl8o2szC4kp9uKTJDpWKjqz3/9qhnOLHcHnndcQ2Up7
Loi2I8mJyQvuSG1WJfJn89HxjOI/8N4Bs2LE4IAEjWyD16m/xbLbIu5AqFhR+tr0
APLUCmARKk9/JTkmOfe5HFdX9Oh+XUNvpAkochPu7EQ5fgKnmubH2zvJxwGqob88
7RKlEYd8etmWEYC95zMkMLYFCOUlsAXFnTDaxwjIIt8e2g8gAzaKiFBuAEIPeAWq
WgYN/MW2kNvXU//NViPYGtsf7cmiHR4Qf8NAO57KYpmpVFn/EO7kI7P8zEklWrDd
XLd0/49BCs9gXg0bvkjW
=hEEc
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zhcon-winime-64bit-fix.patch
Type: text/x-diff
Size: 4038 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/chinese-developers/attachments/20151119/267d5d52/attachment.patch>


More information about the Chinese-developers mailing list