horgand segfaults at startup (due to buffer overflow)

Bug #891939 reported by David Monniaux
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
horgand (Debian)
Fix Released
Unknown
horgand (Ubuntu)
Fix Released
High
Unassigned

Bug Description

It is impossible to use Horgand at all because it segfaults at startup.

Starting program: /usr/lib/horgand/horgand
[Thread debugging using libthread_db enabled]
*** buffer overflow detected ***: /usr/lib/horgand/horgand terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0x6d08d5]
/lib/i386-linux-gnu/libc.so.6(+0xe66d7)[0x6cf6d7]
/lib/i386-linux-gnu/libc.so.6(+0xe5a0d)[0x6cea0d]
/usr/lib/horgand/horgand[0x804d21e]
/usr/lib/horgand/horgand[0x804b91f]
/usr/lib/horgand/horgand[0x8078bbd]
/usr/lib/horgand/horgand[0x804a4e8]
/usr/lib/horgand/horgand[0x8078a89]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0x8a)[0x6020aa]
======= Memory map: ========
00110000-0012e000 r-xp 00000000 08:05 4532513 /lib/i386-linux-gnu/ld-2.13.so
0012e000-0012f000 r--p 0001d000 08:05 4532513 /lib/i386-linux-gnu/ld-2.13.so
0012f000-00130000 rw-p 0001e000 08:05 4532513 /lib/i386-linux-gnu/ld-2.13.so
00130000-00131000 r-xp 00000000 00:00 0 [vdso]
00131000-00262000 r-xp 00000000 08:05 3689916 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
00262000-00263000 ---p 00131000 08:05 3689916 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
00263000-00264000 r--p 00131000 08:05 3689916 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
00264000-00266000 rw-p 00132000 08:05 3689916 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
00266000-00267000 rw-p 00000000 00:00 0
00267000-00307000 r-xp 00000000 08:05 3691153 /usr/lib/i386-linux-gnu/libfltk.so.1.1
00307000-00308000 ---p 000a0000 08:05 3691153 /usr/lib/i386-linux-gnu/libfltk.so.1.1
00308000-0030a000 r--p 000a0000 08:05 3691153 /usr/lib/i386-linux-gnu/libfltk.so.1.1
0030a000-0030e000 rw-p 000a2000 08:05 3691153 /usr/lib/i386-linux-gnu/libfltk.so.1.1
0030e000-00311000 rw-p 00000000 00:00 0
00311000-003fd000 r-xp 00000000 08:05 3708171 /usr/lib/i386-linux-gnu/libasound.so.2.0.0
003fd000-00401000 r--p 000eb000 08:05 3708171 /usr/lib/i386-linux-gnu/libasound.so.2.0.0
00401000-00402000 rw-p 000ef000 08:05 3708171 /usr/lib/i386-linux-gnu/libasound.so.2.0.0
00402000-00441000 r-xp 00000000 08:05 3674464 /usr/lib/i386-linux-gnu/libjack.so.0.1.0
00441000-00442000 r--p 0003f000 08:05 3674464 /usr/lib/i386-linux-gnu/libjack.so.0.1.0
00442000-00443000 rw-p 00040000 08:05 3674464 /usr/lib/i386-linux-gnu/libjack.so.0.1.0
00443000-0045a000 r-xp 00000000 08:05 4532531 /lib/i386-linux-gnu/libpthread-2.13.so
0045a000-0045b000 r--p 00016000 08:05 4532531 /lib/i386-linux-gnu/libpthread-2.13.so
0045b000-0045c000 rw-p 00017000 08:05 4532531 /lib/i386-linux-gnu/libpthread-2.13.so
0045c000-0045e000 rw-p 00000000 00:00 0
0045e000-004c9000 r-xp 00000000 08:05 3705122 /usr/lib/i386-linux-gnu/libsndfile.so.1.0.24
004c9000-004ca000 r--p 0006b000 08:05 3705122 /usr/lib/i386-linux-gnu/libsndfile.so.1.0.24
004ca000-004cb000 rw-p 0006c000 08:05 3705122 /usr/lib/i386-linux-gnu/libsndfile.so.1.0.24
004cb000-004cf000 rw-p 00000000 00:00 0
004cf000-004de000 r-xp 00000000 08:05 3425346 /usr/lib/libXpm.so.4.11.0
004de000-004df000 r--p 0000e000 08:05 3425346 /usr/lib/libXpm.so.4.11.0
004df000-004e0000 rw-p 0000f000 08:05 3425346 /usr/lib/libXpm.so.4.11.0
004e0000-005be000 r-xp 00000000 08:05 3671272 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
005be000-005bf000 ---p 000de000 08:05 3671272 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
005bf000-005c3000 r--p 000de000 08:05 3671272 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
005c3000-005c4000 rw-p 000e2000 08:05 3671272 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
005c4000-005cb000 rw-p 00000000 00:00 0
005cb000-005e7000 r-xp 00000000 08:05 4532511 /lib/i386-linux-gnu/libgcc_s.so.1
005e7000-005e8000 r--p 0001b000 08:05 4532511 /lib/i386-linux-gnu/libgcc_s.so.1
005e8000-005e9000 rw-p 0001c000 08:05 4532511 /lib/i386-linux-gnu/libgcc_s.so.1
005e9000-0075f000 r-xp 00000000 08:05 4532517 /lib/i386-linux-gnu/libc-2.13.so
0075f000-00761000 r--p 00176000 08:05 4532517 /lib/i386-linux-gnu/libc-2.13.so
00761000-00762000 rw-p 00178000 08:05 4532517 /lib/i386-linux-gnu/libc-2.13.so
00762000-00765000 rw-p 00000000 00:00 0
00765000-00782000 r-xp 00000000 08:05 3689849 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
00782000-00783000 r--p 0001c000 08:05 3689849 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
00783000-00784000 rw-p 0001d000 08:05 3689849 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
00784000-00787000 r-xp 00000000 08:05 4532520 /lib/i386-linux-gnu/libdl-2.13.so
00787000-00788000 r--p 00002000 08:05 4532520 /lib/i386-linux-gnu/libdl-2.13.so
00788000-00789000 rw-p 00003000 08:05 4532520 /lib/i386-linux-gnu/libdl-2.13.so
00789000-0079d000 r-xp 00000000 08:05 3670812 /usr/lib/i386-linux-gnu/libXft.so.2.2.0
0079d000-0079e000 r--p 00013000 08:05 3670812 /usr/lib/i386-linux-gnu/libXft.so.2.2.0
0079e000-0079f000 rw-p 00014000 08:05 3670812 /usr/lib/i386-linux-gnu/libXft.so.2.2.0
0079f000-007d1000 r-xp 00000000 08:05 3683122 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
007d1000-007d2000 ---p 00032000 08:05 3683122 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
007d2000-007d3000 r--p 00032000 08:05 3683122 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
007d3000-007d4000 rw-p 00033000 08:05 3683122 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
007d4000-007d6000 r-xp 00000000 08:05 3683171 /usr/lib/i386-linux-gnu/libXinerama.so.1.0.0
007d6000-007d7000 r--p 00001000 08:05 3683171 /usr/lib/i386-linux-gnu/libXinerama.so.1.0.0
007d7000-007d8000 rw-p 00002000 08:05 3683171 /usr/lib/i386-linux-gnu/libXinerama.so.1.0.0
007d8000-00800000 r-xp 00000000 08:05 4532521 /lib/i386-linux-gnu/libm-2.13.so
00800000-00801000 r--p 00028000 08:05 4532521 /lib/i386-linux-gnu/libm-2.13.so
00801000-00802000 rw-p 00029000 08:05 4532521 /lib/i386-linux-gnu/libm-2.13.so
00802000-00809000 r-xp 00000000 08:05 4532533 /lib/i386-linux-gnu/librt-2.13.so
00809000-0080a000 r--p 00006000 08:05 4532533 /lib/i386-linux-gnu/librt-2.13.so
0080a000-0080b000 rw-p 00007000 08:05 4532533 /lib/i386-linux-gnu/librt-2.13.so
0080b000-00857000 r-xp 00000000 08:05 3702687 /usr/lib/i386-linux-gnu/libFLAC.so.8.2.0
00857000-00858000 r--p 0004b000 08:05 3702687 /usr/lib/i386-linux-gnu/libFLAC.so.8.2.0
00858000-00859000 rw-p 0004c000 08:05 3702687 /usr/lib/i386-linux-gnu/libFLAC.so.8.2.0
00859000-009bf000 r-xp 00000000 08:05 3686434 /usr/lib/i386-linux-gnu/libvorbisenc.so.2.0.8
009bf000-009d0000 r--p 00165000 08:05 3686434 /usr/lib/i386-linux-gnu/libvorbisenc.so.2.0.8
009d0000-009d1000 rw-p 00176000 08:05 3686434 /usr/lib/i386-linux-gnu/libvorbisenc.so.2.0.8
009d1000-009fa000 r-xp 00000000 08:05 3681123 /usr/lib/i386-linux-gnu/libvorbis.so.0.4.5
009fa000-009fb000 r--p 00028000 08:05 3681123 /usr/lib/i386-linux-gnu/libvorbis.so.0.4.5
009fb000-009fc000 rw-p 00029000 08:05 3681123 /usr/lib/i386-linux-gnu/libvorbis.so.0.4.5
009fc000-00a02000 r-xp 00000000 08:05 3689842 /usr/lib/i386-linux-gnu/libogg.so.0.7.1
00a02000-00a03000 r--p 00005000 08:05 3689842 /usr/lib/i386-linux-gnu/libogg.so.0.7.1
00a03000-00a04000 rw-p 00006000 08:05 3689842 /usr/lib/i386-linux-gnu/libogg.so.0.7.1
00a04000-00a06000 r-xp 00000000 08:05 3679990 /usr/lib/i386-linux-gnu/libXau.so.6.0.0
00a06000-00a07000 r--p 00001000 08:05 3679990 /usr/lib/i386-linux-gnu/libXau.so.6.0.0
00a07000-00a08000 rw-p 00002000 08:05 3679990 /usr/lib/i386-linux-gnu/libXau.so.6.0.0
00a08000-00a0d000 r-xp 00000000 08:05 3682007 /usr/lib/i386-linux-gnu/libXdmcp.so.6.0.0
00a0d000-00a0e000 r--p 00004000 08:05 3682007 /usr/lib/i386-linux-gnu/libXdmcp.so.6.0.0
00a0e000-00a0f000 rw-p 00005000 08:05 3682007 /usr/lib/i386-linux-gnu/libXdmcp.so.6.0.0
00a0f000-00aa0000 r-xp 00000000 08:05 3670729 /usr/lib/i386-linux-gnu/libfreetype.so.6.6.2
00aa0000-00aa1000 ---p 00091000 08:05 3670729 /usr/lib/i386-linux-gnu/libfreetype.so.6.6.2
00aa1000-00aa5000 r--p 00091000 08:05 3670729 /usr/lib/i386-linux-gnu/libfreetype.so.6.6.2
00aa5000-00aa6000 rw-p 00095000 08:05 3670729 /usr/lib/i386-linux-gnu/libfreetype.so.6.6.2
00aa6000-00aaf000 r-xp 00000000 08:05 3683135 /usr/lib/i386-linux-gnu/libXrender.so.1.3.0
00aaf000-00ab0000 r--p 00008000 08:05 3683135 /usr/lib/i386-linux-gnu/libXrender.so.1.3.0
00ab0000-00ab1000 rw-p 00009000 08:05 3683135 /usr/lib/i386-linux-gnu/libXrender.so.1.3.0
00ab1000-00ad7000 r-xp 00000000 08:05 4459205 /lib/i386-linux-gnu/libexpat.so.1.5.2
00ad7000-00ad8000 ---p 00026000 08:05 4459205 /lib/i386-linux-gnu/libexpat.so.1.5.2
00ad8000-00ada000 r--p 00026000 08:05 4459205 /lib/i386-linux-gnu/libexpat.so.1.5.2
00ada000-00adb000 rw-p 00028000 08:05 4459205 /lib/i386-linux-gnu/libexpat.so.1.5.2
00adb000-00aec000 r-xp 00000000 08:05 3695635 /usr/lib/i386-linux-gnu/libXext.so.6.4.0
00aec000-00aed000 r--p 00010000 08:05 3695635 /usr/lib/i386-linux-gnu/libXext.so.6.4.0
00aed000-00aee000 rw-p 00011000 08:05 3695635 /usr/lib/i386-linux-gnu/libXext.so.6.4.0
00aee000-00b01000 r-xp 00000000 08:05 4456499 /lib/i386-linux-gnu/libz.so.1.2.3.4
00b01000-00b02000 r--p 00012000 08:05 4456499 /lib/i386-linux-gnu/libz.so.1.2.3.4
00b02000-00b03000 rw-p 00013000 08:05 4456499 /lib/i386-linux-gnu/libz.so.1.2.3.4
08048000-0808a000 r-xp 00000000 08:05 3413830 /usr/lib/horgand/horgand
0808a000-0808b000 r--p 00041000 08:05 3413830 /usr/lib/horgand/horgand
0808b000-0808c000 rw-p 00042000 08:05 3413830 /usr/lib/horgand/horgand
0808c000-080da000 rw-p 00000000 00:00 0 [heap]
b7fcd000-b7fd6000 rw-p 00000000 00:00 0
b7ffe000-b8000000 rw-p 00000000 00:00 0
bffdf000-c0000000 rw-p 00000000 00:00 0 [stack]

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: horgand 1.14-4
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4-ehci_hcd-lowlatency-hostname
Uname: Linux 3.0.4-ehcihcd-lowlatency-etale i686
NonfreeKernelModules: wl
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Fri Nov 18 07:14:39 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: horgand
UpgradeStatus: Upgraded to oneiric on 2011-10-15 (33 days ago)

Related branches

Revision history for this message
David Monniaux (david-monniaux) wrote :
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

I get a similar error message when attempting to run horgand on Ubuntu 11.10.

Changed in horgand (Ubuntu):
status: New → Confirmed
Revision history for this message
David Monniaux (david-monniaux) wrote :

Problem also occurs if I compile Horgand myself.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

This issue is still present on Ubuntu Raring (and presumably the versions in between). Horgand starts without any problems on my Debian Sid system though, so this might be an Ubuntu-specific issue somehow.

tags: added: precise quantal raring
summary: - horgand segfaults
+ horgand segfaults at startup (due to buffer overflow)
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

High (dead on startup) - set for hjd

Changed in horgand (Ubuntu):
importance: Undecided → High
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

#5 0x00000000004066f7 in strcpy (__src=0x430ed0 "m(Maj7)(b5)", __dest=0x65dd00 <hor+105536> "")
    at /usr/include/x86_64-linux-gnu/bits/string3.h:104
No locals.
#6 HOR::HOR (this=0x6440c0 <hor>) at organ.C:633
        tapsg = {36, 33, 29, 27, 24, 21, 17, 15, 13, 16, 21, 24, 27, 31, 33, 36}
        sizesin = <optimised out>
        x_sin = <optimised out>
        tcombl = {10586, 12340, 6400, 13100, 8004, 7200, 5130, 9037, 12045, 11237, 9456, 7634, 5389, 8056, 10120, 11432}
        tcombr = {10518, 11340, 8450, 11100, 9644, 7560, 9536, 11507, 12600, 11111, 8056, 6048, 7690, 5978, 8845, 10056}

that's:

633 strcpy(Chord4[45].Nom,"m(Maj7)(b5)");

and Chord4 is:
struct Ch4

{
  char Nom[10];
  int type;
  int fund;
  int dist1;
  int dist2;
  int dist3;
} Chord4[50];

so trying to copy a 10char+nil into a 10char buffer - KABOOM!

Changed in horgand (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

OK, here's a patch that gets past the overflow; I think it's safe; there are a LOT of fixed length string buffers in the
code. This stretches this 10 char to 12 char to fit the string being copied in; there are places that append that string
into others in other bits of the code, but I *think* they're big enough.

Having said that, I can't get it to run, it's failing to open the plughw:0,0 audio device for me.

Upstream looks pretty dead.

Dave

Changed in horgand (Debian):
status: Unknown → New
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Fix nom length in Chord4" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Dave Gilbert (ubuntu-treblig) wrote :

Thanks to Steve Cotton pointing out the reason it wouldn't run was just contention on the audio device; with PA suspended and my patch it runs fine.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package horgand - 1.14-5

---------------
horgand (1.14-5) unstable; urgency=medium

  * Prevent SIGSEGV by fixing a buffer overflow, it was tryng to
    strcpy() of an 11 char string (+ '\0') into a 10 char fixed
    array. (Closes: #695467) (LP: #891939)

 -- Alessio Treglia <email address hidden> Wed, 02 Jan 2013 14:06:58 +0000

Changed in horgand (Ubuntu):
status: Triaged → Fix Released
Changed in horgand (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.