Bug#691301: abiword: Abiword segfaults, dumps core

2014-02-14 Thread Matti Hamalainen


I think this one can be closed now, at least the current testing/unstable 
version has the fix incorporated.


--
] ccr/TNSP ^ pWp  ::  ccr tnsp org  ::  http://tnsp.org/~ccr/
] PGP key: 7BED 62DE 898D D1A4 FC4A  F392 B705 E735 307B AAE3


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-26 Thread Matti Hämäläinen


Hi!

After apt-getting the Abiword source and doing some poking around, I 
finally managed to uncover what the problem was and it is a bit silly.


As background information, I semi-recently converted my system from 
ISO-8859-1 to using UTF-8 unicode, but apparently I had forgotten to

change the user name/comment fields in /etc/passwd, and those entries
were still using some 8-bit ISO-8859-1 accented characters.

Now, what happens when Abiword is run is  that the following code
gets executed during creation of a new document in 
src/text/ptbl/xp/pd_Document.cpp:


PD_Document::PD_Document()
[...]
const gchar *name = g_get_real_name();
if(strcmp(name, Unknown) == 0)
name = g_get_user_name();
gchar *utf8name = g_locale_to_utf8(name, -1, NULL, NULL, NULL);
m_sUserName = utf8name;
g_free(utf8name);

The issue here is that as g_get_{real,user}_name() return the name in 
ISO-8859-1 encoding, but the system locale is set to en_US.UTF-8, which 
causes g_locale_to_utf8() conversion to fail and return NULL.


Which, in turn, causes a segfault in the m_sUserName = utf8name 
assignation (you can't assign a NULL const char value to std::string).


While this may be considered an user error, I think it would be prudent to 
not crash when such situation is encountered. Thus, I propose the 
following patch:


--- src/text/ptbl/xp/pd_Document.cpp.orig   2012-10-26 17:51:28.0 
+0300
+++ src/text/ptbl/xp/pd_Document.cpp2012-10-26 18:27:32.0 +0300
@@ -213,8 +213,13 @@
if(strcmp(name, Unknown) == 0)
name = g_get_user_name();
gchar *utf8name = g_locale_to_utf8(name, -1, NULL, NULL, NULL);
-   m_sUserName = utf8name;
-   g_free(utf8name);
+   if (utf8name != NULL)
+   {
+   m_sUserName = utf8name;
+   g_free(utf8name);
+   }
+   else
+   m_sUserName = Unknown;
 }

 PD_Document::~PD_Document()


Hope this helps.

--
] ccr/TNSP ^ pWp  ::  ccr tnsp org  ::  http://ccr.tnsp.org/
] PGP key: 0466 95ED 96DF 3701 C71D D62D 10A6 28A6 1374 C112--- src/text/ptbl/xp/pd_Document.cpp.orig	2012-10-26 17:51:28.0 +0300
+++ src/text/ptbl/xp/pd_Document.cpp	2012-10-26 18:27:32.0 +0300
@@ -213,8 +213,13 @@
 	if(strcmp(name, Unknown) == 0)
 		name = g_get_user_name();
 	gchar *utf8name = g_locale_to_utf8(name, -1, NULL, NULL, NULL);
-	m_sUserName = utf8name;
-	g_free(utf8name);
+	if (utf8name != NULL)
+	{
+		m_sUserName = utf8name;
+		g_free(utf8name);
+	}
+	else
+		m_sUserName = Unknown;
 }
 
 PD_Document::~PD_Document()


Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-26 Thread Dmitry Smirnov
Dear Matti,

Many thanks to you for investigation and the provided patch.
I wouldn't be able to fix this problem without your help.

I forwarded your information upstream so hopefully they will integrate your 
proposed solution.

Cheers,
Dmitry.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-23 Thread Matti Hamalainen
Package: abiword
Version: 2.9.2+svn20120603-8
Severity: important

Hello.

Attempting to run Abiword 2.9.2+svn20120603-8 on my 32bit testing desktop box
results in segmentation fault + core dump. Deleting Abiword related directories
and files under $HOME/.config/ etc. seems not to help. Reinstalling package
does not help.

Just running abiword --version works as expected, but any attempt to get to
the actual GUI fails as described.

GDB debug session:

$ gdb abiword
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as i486-linux-gnu.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /usr/bin/abiword...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/abiword
[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib/i386-linux-
gnu/i686/cmov/libthread_db.so.1.

Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52
52  ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S: No such file or
directory.
(gdb) bt
#0  __strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52
#1  0xb7bca8e2 in PD_Document::PD_Document() () from /usr/lib/i386-linux-
gnu/libabiword-2.9.so
#2  0xb7cd3aba in AP_Frame::_loadDocument(char const*, int, bool) () from
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#3  0xb7cd4895 in AP_Frame::loadDocument(char const*, int, bool) () from
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#4  0xb7cd3017 in AP_Frame::loadDocument(char const*, int) () from
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#5  0xb7c867d8 in AP_App::openCmdLineFiles(AP_Args const*) () from
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#6  0xb7addfea in AP_UnixApp::main(char const*, int, char**) () from
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#7  0x080484e3 in ?? ()
#8  0xb7790e46 in __libc_start_main (main=0x80484c0, argc=1, ubp_av=0xb884,
init=0x80485e0, fini=0x80485d0,
rtld_fini=0xb7ff0590, stack_end=0xb87c) at libc-start.c:228
#9  0x08048509 in ?? ()
(gdb)



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.6.2-grsec-dc (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages abiword depends on:
ii  abiword-common  2.9.2+svn20120603-8
ii  gsfonts 1:8.11+urwcyr1.0.7~pre44-4.2
ii  libabiword-2.9  2.9.2+svn20120603-8
ii  libc6   2.13-35
ii  libdbus-1-3 1.6.8-1
ii  libdbus-glib-1-20.100-1
ii  libgcc1 1:4.7.1-7
ii  libgcrypt11 1.5.0-3
ii  libglib2.0-02.33.12+really2.32.4-2
ii  libgnutls26 2.12.20-1
ii  libgsf-1-1141.14.21-2.1
ii  libgtk-3-0  3.4.2-4
ii  libjpeg88d-1
ii  libloudmouth1-0 1.4.3-8
ii  libots0 0.5.0-2.1
ii  libpng12-0  1.2.49-1
ii  librdf0 1.0.15-1+b1
ii  libreadline66.2-8
ii  libsoup2.4-12.38.1-2
ii  libstdc++6  4.7.1-7
ii  libtelepathy-glib0  0.18.2-2
ii  libtidy-0.99-0  20091223cvs-1.2
ii  libwmf0.2-7 0.2.8.4-10
ii  libwpd-0.9-90.9.4-3
ii  libwpg-0.2-20.2.1-1
ii  libwps-0.2-20.2.7-1
ii  libxml2 2.8.0+dfsg1-6
ii  libxslt1.1  1.1.26-14
ii  zlib1g  1:1.2.7.dfsg-13

Versions of packages abiword recommends:
pn  abiword-plugin-grammar none
pn  abiword-plugin-mathviewnone
ii  aspell-en [aspell-dictionary]  7.1-0-1
pn  fonts-liberation   none
ii  poppler-utils  0.18.4-3

abiword suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-23 Thread Dmitry Smirnov
Hi Matti,

Would you be able to reproduce with older kernel from testing please?

Thanks.

Regards,
Dmitry.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-23 Thread Matti Hämäläinen

On Wed, 24 Oct 2012, Dmitry Smirnov wrote:


Hi Matti,

Would you be able to reproduce with older kernel from testing please?


Yep. Same result with vanilla / stock Debian testing kernel

Linux mos6502 3.2.0-3-686-pae #1 SMP Mon Jul 23 03:50:34 UTC 2012 i686 GNU/Linux

ii  linux-image-3.2.0-3-686-pae 3.2.23-1

[...]
(gdb) run
Starting program: /usr/bin/abiword
[Thread debugging using libthread_db enabled]
Using host libthread_db library 
/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1.


Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2_bsf () at 
../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52

52  ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S: No such file or 
directory.
(gdb) bt
#0  __strlen_sse2_bsf () at 
../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52

#1  0xb7bca8e2 in PD_Document::PD_Document() () from 
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#2  0xb7cd3aba in AP_Frame::_loadDocument(char const*, int, bool) () from 
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#3  0xb7cd4895 in AP_Frame::loadDocument(char const*, int, bool) () from 
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#4  0xb7cd3017 in AP_Frame::loadDocument(char const*, int) () from 
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#5  0xb7c867d8 in AP_App::openCmdLineFiles(AP_Args const*) () from 
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#6  0xb7addfea in AP_UnixApp::main(char const*, int, char**) () from 
/usr/lib/i386-linux-gnu/libabiword-2.9.so
#7  0x080484e3 in ?? ()
#8  0xb7790e46 in __libc_start_main (main=0x80484c0, argc=1, ubp_av=0xb884, 
init=0x80485e0, fini=0x80485d0,
rtld_fini=0xb7ff0590, stack_end=0xb87c) at libc-start.c:228
#9  0x08048509 in ?? ()
(gdb)

--
] ccr/TNSP ^ pWp  ::  ccr tnsp org  ::  http://ccr.tnsp.org/
] PGP key: 0466 95ED 96DF 3701 C71D D62D 10A6 28A6 1374 C112


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-23 Thread Dmitry Smirnov
On Wed, 24 Oct 2012 12:57:02 Matti Hämäläinen wrote:
  Would you be able to reproduce with older kernel from testing please?
 
 Yep. Same result with vanilla / stock Debian testing kernel

Thank you very much for trying that.

Unfortunately I can't reproduce the issue neither I have any clues regarding 
what could be wrong. Could you please provide any information that you think 
might be helpful -- desktop environment, theme, strace output etc.

Thank you.

-- 
Regards,
Dmitry.


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#691301: abiword: Abiword segfaults, dumps core

2012-10-23 Thread Matti Hämäläinen

On Wed, 24 Oct 2012, Dmitry Smirnov wrote:


On Wed, 24 Oct 2012 12:57:02 Matti Hämäläinen wrote:

Would you be able to reproduce with older kernel from testing please?


Yep. Same result with vanilla / stock Debian testing kernel


Thank you very much for trying that.

Unfortunately I can't reproduce the issue neither I have any clues regarding
what could be wrong. Could you please provide any information that you think
might be helpful -- desktop environment, theme, strace output etc.


No DE per se, just plain Window Maker, Adwaita Cupertino SL Gtk+ 2/3-theme
(neither seem to be affecting this.)

Anyway, I just noticed that there's a debug symbols package for Abiword .. 
oops - my bad. With the debug symbols, something interesting is revealed 
by GDB:


Starting program: /usr/bin/abiword 
[Thread debugging using libthread_db enabled]

Using host libthread_db library 
/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1.

Program received signal SIGSEGV, Segmentation fault.
__strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52
52  ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S: No such file or 
directory.
(gdb) bt
#0  __strlen_sse2_bsf () at ../sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S:52
#1  0xb7bca8e2 in length (__s=0x0) at 
/usr/include/c++/4.7/bits/char_traits.h:261
#2  assign (__s=0x0, this=0x856ddb4) at 
/usr/include/c++/4.7/bits/basic_string.h:1128
#3  operator= (__s=0x0, this=0x856ddb4) at 
/usr/include/c++/4.7/bits/basic_string.h:552
#4  PD_Document::PD_Document (this=0x856db80) at pd_Document.cpp:216
#5  0xb7cd3aba in AP_Frame::_loadDocument (this=this@entry=0x8150488, 
szFilename=szFilename@entry=0x0,
ieft=ieft@entry=0, createNew=createNew@entry=false) at ap_Frame.cpp:202
#6  0xb7cd4895 in AP_Frame::loadDocument (this=0x8150488, szFilename=0x0, 
ieft=0, createNew=false) at ap_Frame.cpp:475
#7  0xb7cd3017 in AP_Frame::loadDocument (this=0x8150488, szFilename=0x0, 
ieft=0) at ap_Frame.cpp:513
#8  0xb7c867d8 in AP_App::openCmdLineFiles (this=0x804dc10, args=0xb6e8) at 
ap_App.cpp:70
#9  0xb7addfea in AP_UnixApp::main (szAppName=0x8048660 abiword, argc=1, 
argv=0xb874) at ap_UnixApp.cpp:1377
#10 0x080484e3 in main (argc=1, argv=0xb874) at 
../src/wp/main/gtk/UnixMain.cpp:30
(gdb)


The facts that szFilename is a NULL pointer and createNew is false 
seem wrong to me, but I can't bother to download the source tarball to see 
whether they actually have any relevance to this.


Strace is over 500kB, so I'll refrain from attaching, but here's a link:

http://tnsp.org/~ccr/abiword-strace.txt


--
] ccr/TNSP ^ pWp  ::  ccr tnsp org  ::  http://ccr.tnsp.org/
] PGP key: 0466 95ED 96DF 3701 C71D D62D 10A6 28A6 1374 C112