Menu

#207 Program received signal SIGSEGV, Segmentation fault.

1.18.x
closed-fixed
nobody
Coredump (1)
5
2014-08-25
2014-02-04
fabrice
No

OS:
$ uname -a
Linux 3.10.19+ #600 PREEMPT Sat Nov 16 20:34:43 GMT 2013 armv6l GNU/Linux

Version:
$ /usr/bin/mpg123 --version
mpg123 1.14.4
Same with http://www.mpg123.de/snapshot (version 20140131000000)

How to reproduce:
$ /usr/bin/mpg123 -R -b 2048
@R MPG123 (ThOr) v7
quit
Segmentation fault

Under gdb with version 20140131000000, the segmentation fault is due to a use of memory already freed (double free?):
(gdb)...
[audio.c:571] debug: ending buffer
Program received signal SIGSEGV, Segmentation fault.
real_buffer_stop () at buffer.c:88
88 buffermem->justwait = TRUE;
(gdb) p *buffermem
Cannot access memory at address 0xb6b03000
(gdb) where
#0 real_buffer_stop () at buffer.c:88
#1 0x0000c890 in exit_output (ao=0x0, rude=0) at audio.c:572
#2 0x00013610 in safe_exit (code=0) at mpg123.c:192
#3 0x0000abc4 in main (sys_argc=<optimized out="">, sys_argv=<optimized out="">)
at mpg123.c:1032

This memory has been freed in "control_generic.c, function control_generic, line ~807"
...
#ifndef NOXFERMEM
if (param.usebuffer) {
kill(buffer_pid, SIGINT);
xfermem_done_writer(buffermem);
waitpid(buffer_pid, NULL, 0);
xfermem_done(buffermem);
}
#endif

Fix ?
No more SEGV by deleting the free in control_generic.c

Discussion

  • Thomas Orgis

    Thomas Orgis - 2014-02-05

    OK, that was an easy one. Removing the code you quoted is the thing to do, as cleanup of audio outputs, together with buffer closing, happens after control_generic returns. The control interface code got overtaken while consolidating the output work.

    Current shapshot should be fixed.

     
  • Thomas Orgis

    Thomas Orgis - 2014-03-25
    • status: open --> closed-fixed
     

Log in to post a comment.