faad2 --long-help option causes a segfault after the basic build / licence information is printed. Recompiling does not help. Seems to run fine otherwise. Version faad2-2.0-r3 Reproducible: Always Steps to Reproduce: 1.Execute faad --long-help 2. 3. Actual Results: bash-2.05b$ faad --long-help *********** Ahead Software MPEG-4 AAC Decoder V2.0 ****************** Build: Nov 7 2004 Copyright 2002-2004: Ahead Software AG http://www.audiocoding.com Floating point version This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ************************************************************************** Segmentation fault
It segfaults with any invalid arg. faad --help works, faad --fakelongarg crashes. Also it doesn't crash on a default-linux/x86/gcc2 system.
probably some allocation issue
Taking over faad2 for sound herd.
(gdb) bt #0 0x00002f942d3c3690 in strncmp () from /lib/libc.so.6 #1 0x0000000000404add in _getopt_internal (argc=2, argv=0x79c25322e408, optstring=0x405ab3 "o:a:s:f:b:l:wgdhit", longopts=0x68, longind=0x79c25322e2f8, long_only=0) at getopt.c:468 #2 0x00000000004034b5 in main (argc=2, argv=0x79c25322e408) at main.c:1059 #3 0x00002f942d36f66c in __libc_start_main () from /lib/libc.so.6 #4 0x000000000040177a in _start () okay I have the trace, I'd like to mark this as UPSTREAM but upstream is dead... I'll see in the next days if I can find a patch in their last cvs version, as their code is *really* messy.
Created attachment 77175 [details, diff] faad2-2.0_long_opts.patch This patch fixes the segfault by added a NULL option at the end of long_options. From the getopt.3 manpage: "The last element of the [struct option] array has to be filled with zeroes."
Thanks Thomas, patch applied in -r10.