[Flac-dev] test_metaflac fails in make check for flac 1.1.2 after --add-padding is performed

Tom Goetze tgoetze at yahoo.com
Thu Sep 7 08:00:14 PDT 2006


Josh,

I applied this patch and all the "make check" tests passed (but I do not have valgrind and I did not use --enable-exhaustive-tests during configure, so it isn't all the tests). Do you see anything suspicious about it?

--- flac-1.1.2.oldBuild/src/flac/decode.c       2005-01-24 20:13:46.000000000 -0800
+++ flac-1.1.2/src/flac/decode.c        2006-09-06 23:36:26.000000000 -0700
@@ -497,7 +497,7 @@
        }

        if((d->is_wave_out || d->is_aiff_out) && ((d->total_samples * d->channels * ((d->bps+7)/8)) & 1)) {
-               if(flac__utils_fwrite("\000", 1, 1, d->fout) != 1) {
+               if(d->fout && flac__utils_fwrite("\000", 1, 1, d->fout) != 1) {
                        print_error_with_state(d, d->is_wave_out?
                                "ERROR writing pad byte to WAVE data chunk" :
                                "ERROR writing pad byte to AIFF SSND chunk"

Tom

Tom Goetze <tgoetze at yahoo.com> wrote: Date: Wed, 30 Aug 2006 00:00:56 -0700 (PDT)
From: Tom Goetze <tgoetze at yahoo.com>
Subject: Re: [Flac-dev] test_metaflac fails in make check for flac 1.1.2 after --add-padding is performed
To: Josh Coalson <xflac at yahoo.com>, flac-dev at xiph.org

 

Josh Coalson <xflac at yahoo.com> wrote:    --- Tom Goetze wrote:
> doing "make check" on flac-1.1.2, I get a segmentation fault 
> 
> ././test_metaflac.sh: line 51: 17370 Segmentation fault flac
> $*
> 
> My linux distribution is a linuxfromscratch 6.1.1
> I built flac using blfs 6.1 directions:

> gcc version 3.4.3

hmm, two things would help. first change the first line of
test_metaflac.sh to

#!/bin/sh -x

when you run the script you will see the exact invocation of flac
before the crash. if you send be the FLAC file, that might help.
also, if you can run the same command in gdb and get a backtrace
that would be another clue.

Josh


  Seems like fwrite doesn't like to write to null. However, it seems clear  from the code that using --test intentionally creates no outputfile for fwrite. 
   
  src/flac/main.c: 1730                        retval = flac__decode_wav(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options);
   
   
  Details below:
   
  (gdb) run
Starting program: /home/tom/sources/flac-1.1.2/src/flac/.libs/lt-flac --silent --test metaflac.flac
  Breakpoint 1, DecoderSession_process (d=0xbffff530) at decode.c:500
500                     if(flac__utils_fwrite("\000", 1, 1, d->fout) != 1) {
(gdb) print d
$1 = (DecoderSession *) 0xbffff530
(gdb) print d->fout
$2 = (FILE *)  0x0
(gdb) n
  Program received signal SIGSEGV, Segmentation fault.
0xb7ea7044 in fwrite () from /lib/libc.so.6
(gdb) bt
#0  0xb7ea7044 in fwrite () from /lib/libc.so.6
#1  0x0804ef09 in DecoderSession_process (d=0xbffff530) at decode.c:500
#2  0x08051275 in flac__decode_wav (infilename=0x8341978 "metaflac.flac", outfilename=0x0, analysis_mode=0, aopts=
      {do_residual_text = 0, do_residual_gnuplot = 1}, options=
          {common = {continue_through_decode_errors = 0, replaygain_synthesis_spec = {apply = 0, use_album_gain = 1, limiter = RGSS_LIMIT__HARD, noise_shaping = NOISE_SHAPING_LOW, preamp = 0}, is_ogg = 0, use_first_serial_number = 1, serial_number = 0, skip_specification = {is_relative = 0, value_is_samples = 1, value = {seconds = 0, samples = 0}}, until_specification = {is_relative = 0, value_is_samples = 1, value = {seconds = 0, samples = 0}},  has_cue_specification = 0, cue_specification = {has_start_point = -1207954168, has_end_point = 0, start_track = 3086395392, start_index = 40, end_track = 3086395392, end_index = 3086396416}}}) at decode.c:203
#3  0x0805a507 in decode_file (infilename=0x8341978 "metaflac.flac") at main.c:1730
#4  0x0805c241 in do_it () at main.c:486
#5  0x0805ca7b in main (argc=4, argv=0xbffffa34) at main.c:284
  
And output of adding -x:
   
  options: -P 4096 -b 1152 -l 0 -q 0 -r 2,2 -V
sh: Verify OK, wrote 554232 bytes, ratio=0.967
+ chmod +w metaflac.flac
+ check_flac
+ run_flac --silent --test metaflac.flac
+ '[' xno = xyes ']'
+ flac --silent --test metaflac.flac
././test_metaflac.sh: line 51:  7636 Segmentation fault      flac $*
+ die 'ERROR in metaflac.flac'
+ echo ERROR in metaflac.flac
ERROR in metaflac.flac
+ exit 1
FAIL: ./test_metaflac.sh
    
  Would it change functionality to add another condition about non-null outputfile to the flac__decode_wav routine on decode.c:500?
   
  Tom
        

---------------------------------
Want to be your own boss? Learn how on  Yahoo! Small Business.  

 				
---------------------------------
Want to be your own boss? Learn how on  Yahoo! Small Business. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20060907/1e848153/attachment.htm


More information about the Flac-dev mailing list