gcc's optimizations (gcc version 4.1.2) lead to wrong behavior and segmentation faults in
MP4Box. This only happens with long file-names. Depending on how long they are
the results differ.
Example 1: MP4Box -aviraw video
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.avi
-O0: Extracting AVI video (format XVID) to
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault_video.cmp (works)
-O1: Extracting AVI mp3 audio (no segfault, but ends up extracting audio
instead of video)
-O2: Same as -O1
-Os: same as -O1
Example 2: MP4Box -aviraw video
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.blalfsd\ fsdfsd.avi
-O0: Extracting AVI video (format XVID) to
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault_video.cmp (works)
-O1: Extracting AVI mp3 audio (no segfault, but ends up extracting audio
instead of video)
-O2: Extracting AVI mp3 audio
Segmentation fault=========== | (99/100) (starts extracting mp3 instead of
video and segfaults)
-Os: same as -O2
All the above was done with CFLAGS="-OX -march=athlon-xp -pipe". I made a run
with CFLAGS="-O2" and the outcome was the same.
Debugging led nowhere:
GNU gdb 6.7.1
Copyright (C) 2007 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 "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) set args -aviraw video
/home/sk/The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.blalfsd\ fsdfsd.avi
(gdb) run
Starting program: /usr/bin/MP4Box -aviraw video
/home/sk/The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.blalfsd\ fsdfsd.avi
[Thread debugging using libthread_db enabled]
[New Thread 0xb7bd16c0 (LWP 5607)]
Extracting AVI mp3 audio
AVI Extract: |=================== | (99/100)
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7bd16c0 (LWP 5607)]
0x00000000 in ?? ()
(gdb) set logging file backtrace.log
(gdb) set logging on
Copying output to backtrace.log.
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x00000000 in ?? ()
(gdb) set logging off
Done logging to backtrace.log.
(gdb) quit
The program is running. Exit anyway? (y or n) y
Not really meaningful. I followed the guide, set CFLAGS="-O2 -march=athlon-xp
-pipe -ggdb" and FEATURES="nostrip" and emerged glibc, zlib and gpac with
USE=debug. I found these in my syslog:
MP4Box[5729]: segfault at 00000000 eip 00000000 esp bf8c0069 error 4
Hi all,
gcc's optimizations (gcc version 4.1.2) lead to wrong behavior and segmentation faults in
MP4Box. This only happens with long file-names. Depending on how long they are
the results differ.
Example 1: MP4Box -aviraw video
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.avi
-O0: Extracting AVI video (format XVID) to
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault_video.cmp (works)
-O1: Extracting AVI mp3 audio (no segfault, but ends up extracting audio
instead of video)
-O2: Same as -O1
-Os: same as -O1
Example 2: MP4Box -aviraw video
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.blalfsd\ fsdfsd.avi
-O0: Extracting AVI video (format XVID) to
The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault_video.cmp (works)
-O1: Extracting AVI mp3 audio (no segfault, but ends up extracting audio
instead of video)
-O2: Extracting AVI mp3 audio
Segmentation fault=========== | (99/100) (starts extracting mp3 instead of
video and segfaults)
-Os: same as -O2
All the above was done with CFLAGS="-OX -march=athlon-xp -pipe". I made a run
with CFLAGS="-O2" and the outcome was the same.
Debugging led nowhere:
GNU gdb 6.7.1
Copyright (C) 2007 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 "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) set args -aviraw video
/home/sk/The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.blalfsd\ fsdfsd.avi
(gdb) run
Starting program: /usr/bin/MP4Box -aviraw video
/home/sk/The.Long.Filenames.Make.MP4Box.Crash.AKA.Segfault.blalfsd\ fsdfsd.avi
[Thread debugging using libthread_db enabled]
[New Thread 0xb7bd16c0 (LWP 5607)]
Extracting AVI mp3 audio
AVI Extract: |=================== | (99/100)
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7bd16c0 (LWP 5607)]
0x00000000 in ?? ()
(gdb) set logging file backtrace.log
(gdb) set logging on
Copying output to backtrace.log.
(gdb) bt
#0 0x00000000 in ?? ()
#1 0x00000000 in ?? ()
(gdb) set logging off
Done logging to backtrace.log.
(gdb) quit
The program is running. Exit anyway? (y or n) y
Not really meaningful. I followed the guide, set CFLAGS="-O2 -march=athlon-xp
-pipe -ggdb" and FEATURES="nostrip" and emerged glibc, zlib and gpac with
USE=debug. I found these in my syslog:
MP4Box[5729]: segfault at 00000000 eip 00000000 esp bf8c0069 error 4
System info:
Portage 2.1.4.4 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0,
2.6.23.16 i686)
=================================================================
System uname: 2.6.23.16 i686 AMD Sempron(tm) 2400+
Timestamp of tree: Tue, 19 Feb 2008 13:16:01 +0000
ccache version 2.4 [enabled]
app-shells/bash: 3.2_p17-r1
dev-lang/python: 2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache: 2.4-r7
sys-apps/baselayout: 1.12.10-r5
sys-apps/sandbox: 1.2.18.1-r2
sys-devel/autoconf: 2.13, 2.61-r1
sys-devel/automake: 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils: 2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool: 1.5.24
virtual/os-headers: 2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="-O2 -march=athlon-xp -pipe"