! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Mousepad 0.3.0 Segfaults when opening a file 4096 bytes in size
Status:
RESOLVED: DUPLICATE
Product:
Mousepad
Component:
General

Comments

Description bobthedoode 2017-11-11 09:00:34 CET
Created attachment 7424 
A plain text file that causes Mousepad to segfault when opening. Contains 4096 letter 'A's

Issue: Mousepad segfaults when opening a file that is exactly 4096 bytes
in size or a multiple of 4096 bytes.

To replicate the issue:
1. Create a normal text file that is exactly 4096 bytes in size. Contents do not 
seem to matter.  
2. Try to open the file with Mousepad. It does not matter if Mousepad is 
launched by double-clicking on the file in a file browser, or if launched from 
the command line. Mousepad also crashes when I try to open the file from 
within Mousepad by going to File->Open... and choosing the file. 

I first noticed this bug when trying to open a text file created from a man 
page. I ran strace while trying to open the text file with Mousepad and 
noticed that it crashed after mmaping the file, which was exactly 4096 bytes 
in size. Mousepad segfaults every time it tries to open a file 4096 bytes in 
size regardless of file contents. Note that file sizes that are a multiple of 
4096 appear to cause Mousepad to crash also. I have confirmed that 
Mousepad also crashes when opening files that are 8192, 12288, 16384, 
and 81920 bytes in size. For the sake of completeness, I have uploaded a test 
file that causes Mousepad to crash. Below is the end of the output from 
strace and various bits of information about my system. I have been able
to reproduce this segfault tens of times and Mousepad has consistently  
generated a SIGSEGV when opening the file. Please let me know 
if there is anything else I can do to help. 


The last few lines of strace output with a file 4096 bytes in size:
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6ab27f2000
read(6, "# GTK+ Input Method Modules file"..., 4096) = 2186
read(6, "", 4096)                       = 0
read(6, "", 4096)                       = 0
close(6)                                = 0
munmap(0x7f6ab27f2000, 4096)            = 0
access("/home/user/./test", F_OK)    = 0
open("/home/user/./test", O_RDONLY)  = 6
fstat(6, {st_mode=S_IFREG|0664, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, 6, 0) = 0x7f6ab23d0000
close(6)                                = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7f6ab23d1000} ---
+++ killed by SIGSEGV +++
Segmentation fault


Last few lines of strace output using a file 16384 bytes in size:
open("/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=2186, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbfbec3a000
read(6, "# GTK+ Input Method Modules file"..., 4096) = 2186
read(6, "", 4096)                       = 0
read(6, "", 4096)                       = 0
close(6)                                = 0
munmap(0x7fbfbec3a000, 4096)            = 0
access("/home/user/test2", F_OK)     = 0
open("/home/user/test2", O_RDONLY)   = 6
fstat(6, {st_mode=S_IFREG|0664, st_size=16384, ...}) = 0
mmap(NULL, 16384, PROT_READ, MAP_PRIVATE, 6, 0) = 0x7fbfbe818000
close(6)                                = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fbfbe81c000} ---
+++ killed by SIGSEGV +++
Segmentation fault


$: uname -a
Linux Host 3.13.0-135-generic #184-Ubuntu SMP Wed Oct 18 11:55:51 UTC 2017 
x86_64 x86_64 x86_64 GNU/Linux

$: mousepad -v
Mousepad 0.3.0

Copyright (c) 2007
	The Xfce development team. All rights reserved.

Please report bugs to <http://bugzilla.xfce.org/>.

$: cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

$: cat /etc/os-release 
NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.5 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

Version numbers of installed Mousepad dependencies:
libc6: 2.19-0ubuntu6.13
libdbus-1-3: 1.6.18-0ubuntu4.5
libdbus-glib-1-2: 0.100.2-1
libglib2.0-0: 2.40.2-0ubuntu1
libgtk2.0-0: 2.24.23-0ubuntu1.4
libgtksourceview2.0-0: 2.10.5-1ubuntu2.14.04.1
libpango-1.0-0: 1.36.3-1ubuntu1.1
libxfce4util6: 4.10.1-1ubuntu1
Comment 1 Matthew Brush editbugs 2017-11-11 20:20:38 CET
Thanks for the detailed report. I cannot reproduce this with the current version of Mousepad, I believe it was fixed in:

https://bugzilla.xfce.org/show_bug.cgi?id=11079

If you are able to test the current version and confirm, that would be fantastic.
Comment 2 bobthedoode 2017-11-11 21:00:20 CET
I compiled the latest version from the git.xfce.org and it works just fine. Sorry about the repeat bug report.
Comment 3 Matthew Brush editbugs 2017-11-13 00:18:25 CET
Close comment

*** This bug has been marked as a duplicate of bug 11079 ***

Bug #13988

Reported by:
bobthedoode
Reported on: 2017-11-11
Last modified on: 2017-11-13

People

Assignee:
Matthew Brush
CC List:
1 user

Version

Target Milestone:
Mousepad 0.2.x

Attachments

Additional information