mpg123 crashes with a segfault when using LOAD with an HTTPS webradio URL in remote mode (-R) on ARM (Raspberry Pi). The crash occurs in generic_sendstr() when attempting to print the ICY-NAME metadata. The issue reproduces on both 1.32.10 and 1.33.4.
Platform: Raspberry Pi (armhf, arm-linux-gnueabihf)
OS: Raspbian Buster (Debian 10)
mpg123 versions tested: 1.32.10 and 1.33.4 (compiled from source)
GDB: Raspbian 8.2.1-2
Configure flags: ./configure --with-audio=alsa --enable-static --disable-shared
Binary is fully statically linked against libmpg123 (confirmed via ldd)
# Terminal 1
mpg123 -R --fifo /tmp/mpg123-fifo.cmd
# Terminal 2
echo "LOAD https://jazzradio.ice.infomaniak.ch/jazzradio-high" > /tmp/mpg123-fifo.cmd
Observed behavior:
mpg123 outputs @I jazzradio-high then immediately segfaults.
Backtrace (1.33.4):
gdb --args /usr/local/bin/mpg123 -R --fifo /tmp/mpg123-fifo.cmd
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
@R MPG123 (ThOr) v11
[Detaching after fork from child process 23855]
[Detaching after fork from child process 23856]
@I jazzradio-high
Program received signal SIGSEGV, Segmentation fault.
0x76fbc24c in strlen () from /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so
(gdb) bt full
#0 0x76fbc24c in strlen () from /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so
No symbol table info available.
#1 0x000200a0 in utf8outstr (dest_=dest_@entry=0x7efff13c, source=0xb <error: Cannot access memory at address 0xb>, source@entry=0xbec68 "", to_terminal=to_terminal@entry=1)
at src/local.c:290
dest = 0x0
width = 0
source_fill = <optimized out>
#2 0x00020db4 in outstr (dest=0x7efff13c, dest@entry=0x7efff124, str=str@entry=0xbec68 "", is_utf8=is_utf8@entry=1, is_term=1) at src/local.c:449
ret = 0
usrc = <optimized out>
#3 0x00017fec in generic_sendstr (is_utf8=is_utf8@entry=1, fmt=fmt@entry=0x8d688 "I ICY-NAME: %s", str=0xb <error: Cannot access memory at address 0xb>) at src/control_generic.c:81
ap = {__ap = 0x7efff14c}
outbuf = 0x0
#4 0x00018638 in generic_load (state=1, arg=<optimized out>, fr=<optimized out>) at src/control_generic.c:333
No locals.
#5 generic_load (fr=<optimized out>, arg=<optimized out>, state=1) at src/control_generic.c:311
No locals.
#6 0x00019ca8 in control_generic (fr=0x1) at src/control_generic.c:929
toksave = 0x7efff293 ""
len = 0
comstr = <optimized out>
cmd = 0x7efff258 "LOAD"
arg = 0x7efff25d "https://jazzradio.ice.infomaniak.ch/jazzradio-high"
counter = <optimized out>
next_comstr = 0x7efff294 ""
tv = {tv_sec = 0, tv_usec = 0}
fds = {__fds_bits = {8, 0 <repeats 31 times>}}
n = <optimized out>
alive = <optimized out>
silent = <optimized out>
__func__ = "control_generic"
buf = "LOAD\000https://jazzradio.ice.infomaniak.ch/jazzradio-high\000mp3", '\000' <repeats 149 times>...
last_len = 0
#7 0x000139c4 in main (sys_argc=<optimized out>, sys_argv=<optimized out>) at src/mpg123.c:1309
ret = <optimized out>
result = 0
end_of_files = 0 '\000'
parr = 8421440
fname = <optimized out>
libpar = 10
mp = <optimized out>
pl_utf8 = 0
start_time = {tv_sec = 1000, tv_usec = 1996476672}
__func__ = "main"
stderr_width = 2130705400
stdin_width = <optimized out>
term_ctrl_default = 1
(gdb)
The crash happens at src/control_generic.c:333:
if(filept->htd.icy_name.fill) generic_sendstr(1, "I ICY-NAME: %s", filept->htd.icy_name.p);
The guard icy_name.fill passes (non-zero), but icy_name.p is 0xb — a corrupted pointer, not NULL and not a valid address. This suggests the mpg_string struct is getting corrupted upstream, likely during the HTTPS network helper fork/handoff (two "Detaching after fork from child process" messages are visible before the crash).
The issue may be ARM-specific. I have not yet tested whether HTTP (non-TLS) streams also crash.
I cannot reproduce on AMD64. Is this specific to remote control mode or does plain
also crash? It also prints the ICY info for me … though it is not very informative:
Next step would be to check if a stream capture (
--streamdump file) that is then opened with correct--icy-intervalfrom disk also crashes. This isolates things from the actual HTTP process. Of course, the history of the corrupted string struct would be goodEnvironment
- Platform: armv7l (Raspberry Pi, Raspbian Buster/Debian 10)
1. The problem only occurs in remote mode; plain mode works fine
Plain mode plays the stream without issue:
Remote mode crashes:
Output before crash:
2. Stream capture replayed with correct
--icy-intervalfrom disk does NOT crashCaptured the raw stream using curl (since mpg123 crashes in remote mode before completing a dump):
Confirmed the ICY metadata interval:
Result:
icy-metaint: 16000Replayed in remote mode:
This played back successfully with no crash.
3. History of the corrupted string struct
Set a watchpoint on
filept->htd.icy_name.pand a breakpoint ongeneric_load:Sent the LOAD command from another terminal. On first breakpoint hit (entry to
generic_load),fileptis still NULL as expected. Continued, and after the two fork detaches the watchpoint triggered: