From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Stary Newsgroups: gmane.comp.audio.sox.devel Subject: spectrogram segfault Date: Thu, 1 Jan 2015 21:23:36 +0100 Message-ID: <20150101202336.GB17144@www.stare.cz> Reply-To: sox-devel@lists.sourceforge.net NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1420143841 31710 80.91.229.3 (1 Jan 2015 20:24:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Jan 2015 20:24:01 +0000 (UTC) To: sox-devel@lists.sourceforge.net Original-X-From: sox-devel-bounces@lists.sourceforge.net Thu Jan 01 21:23:56 2015 Return-path: Envelope-to: gcasd-sox-devel@m.gmane.org X-ACL-Warn: Mail-Followup-To: sox-devel@lists.sourceforge.net Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1Y6mHb-0003Lg-64 X-BeenThere: sox-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: sox-devel-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.comp.audio.sox.devel:392 Archived-At: Received: from lists.sourceforge.net ([216.34.181.88]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y6mHj-0004ZK-2c for gcasd-sox-devel@m.gmane.org; Thu, 01 Jan 2015 21:23:55 +0100 Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Y6mHe-0000dr-6t; Thu, 01 Jan 2015 20:23:50 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Y6mHc-0000dl-PL for sox-devel@lists.sourceforge.net; Thu, 01 Jan 2015 20:23:48 +0000 Received: from mx.prizen.cz ([79.98.77.229] helo=www.stare.cz) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1Y6mHb-0003Lg-64 for sox-devel@lists.sourceforge.net; Thu, 01 Jan 2015 20:23:48 +0000 Received: from www.stare.cz (localhost [127.0.0.1]); by www.stare.cz (OpenSMTPD) with ESMTP id fac3aa18; for ; Thu, 1 Jan 2015 21:23:36 +0100 (CET) On Dec 22 19:21:10, chris@cnpbagwell.com wrote: > A new release candidate has been released There seems to be a bug in the spectrogram effect, also present in earlier releases. $ sox -c 1 -b 16 -r 1000 -n file.wav synth 1 sin 440 gain -3 $ sox file.wav -n spectrogram $ sox file.wav -n spectrogram -x 1000 $ sox file.wav -n spectrogram -x 1001 Segmentation fault (core dumped) $ sox file.wav -n spectrogram -X 1000 $ sox file.wav -n spectrogram -X 1001 Segmentation fault (core dumped) It seems that if the -x size of the spectrogram is bigger than the number of actual samples (1000 in the example), or samples/second, SoX segfaults instead of rejecting that option (say, limiting the number to the number of samples available). This is surely done in the start() function of spectrogram.c but instead of trying to decipher it, I will leave to the devs. Below please see the output of sox -V on the good and bad case, here is an illustrative diff of the two: --- /tmp/good Thu Jan 1 21:18:41 2015 +++ /tmp/bad Thu Jan 1 21:18:36 2015 @@ -33,15 +33,13 @@ Precision : 16-bit Duration : 00:00:01.00 = 1000 samples ~ 75 CDDA sectors sox DBUG effects: sox_add_effect: extending effects table, new size = 8 -sox DBUG spectrogram: duration=1 x_size=1000 pixels_per_sec=1000 dft_size=1024 +sox DBUG spectrogram: duration=1 x_size=1001 pixels_per_sec=1001 dft_size=1024 sox DBUG spectrogram: window_density=0.5 -sox DBUG spectrogram: step_size=1 block_steps=1 +sox INFO spectrogram: actual pixels/s = -inf +sox DBUG spectrogram: step_size=-2147483648 block_steps=0 sox INFO sox: effects chain: input 1000Hz 1 channels (multi) 16 bits 00:00:01.00 sox INFO sox: effects chain: spectrogram 1000Hz 1 channels 16 bits 00:00:01.00 sox INFO sox: effects chain: output 1000Hz 1 channels (multi) 16 bits 00:00:01.00 -sox DBUG sox: start-up time = 0.002191 -sox DBUG spectrogram: cols=489 left=0 end=24 -sox INFO spectrogram: PNG truncated at 1 seconds -sox INFO spectrogram: PNG truncated at 1 seconds -sox DBUG spectrogram: flushed cols=1000 left=1 end=-512 -sox DBUG spectrogram: signal-max=-4.11314 +sox DBUG sox: start-up time = 0.005625 +sox DBUG spectrogram: cols=0 left=1073741312 end=1024 +Segmentation fault (core dumped) I am running this on OpanBSD/amd64 but that doesn't seem to be relevant. Jan GOOD: sox: SoX v14.4.2 time: Jan 1 2015 20:51:29 uname: OpenBSD lenovo.stare.cz 5.6 GENERIC.MP#735 amd64 compiler: gcc 4.2.1 20070719 arch: 1288 48 88 L sox INFO formats: detected file format type `wav' sox DBUG wav: Searching for 66 6d 74 20 sox DBUG wav: WAV Chunk fmt sox DBUG wav: Searching for 64 61 74 61 sox DBUG wav: WAV Chunk data sox DBUG wav: Reading Wave file: Microsoft PCM format, 1 channel, 1000 samp/sec sox DBUG wav: 2000 byte/sec, 2 block align, 16 bits/samp, 2000 data bytes sox DBUG wav: 1000 Samps/chans sox DBUG wav: Searching for 4c 49 53 54 Input File : 'file.wav' Channels : 1 Sample Rate : 1000 Precision : 16-bit Duration : 00:00:01.00 = 1000 samples ~ 75 CDDA sectors File Size : 2.04k Bit Rate : 16.4k Sample Encoding: 16-bit Signed Integer PCM Endian Type : little Reverse Nibbles: no Reverse Bits : no Output File : '' (null) Channels : 1 Sample Rate : 1000 Precision : 16-bit Duration : 00:00:01.00 = 1000 samples ~ 75 CDDA sectors sox DBUG effects: sox_add_effect: extending effects table, new size = 8 sox DBUG spectrogram: duration=1 x_size=1000 pixels_per_sec=1000 dft_size=1024 sox DBUG spectrogram: window_density=0.5 sox DBUG spectrogram: step_size=1 block_steps=1 sox INFO sox: effects chain: input 1000Hz 1 channels (multi) 16 bits 00:00:01.00 sox INFO sox: effects chain: spectrogram 1000Hz 1 channels 16 bits 00:00:01.00 sox INFO sox: effects chain: output 1000Hz 1 channels (multi) 16 bits 00:00:01.00 sox DBUG sox: start-up time = 0.002191 sox DBUG spectrogram: cols=489 left=0 end=24 sox INFO spectrogram: PNG truncated at 1 seconds sox INFO spectrogram: PNG truncated at 1 seconds sox DBUG spectrogram: flushed cols=1000 left=1 end=-512 sox DBUG spectrogram: signal-max=-4.11314 BAD: sox: SoX v14.4.2 time: Jan 1 2015 20:51:29 uname: OpenBSD lenovo.stare.cz 5.6 GENERIC.MP#735 amd64 compiler: gcc 4.2.1 20070719 arch: 1288 48 88 L sox INFO formats: detected file format type `wav' sox DBUG wav: Searching for 66 6d 74 20 sox DBUG wav: WAV Chunk fmt sox DBUG wav: Searching for 64 61 74 61 sox DBUG wav: WAV Chunk data sox DBUG wav: Reading Wave file: Microsoft PCM format, 1 channel, 1000 samp/sec sox DBUG wav: 2000 byte/sec, 2 block align, 16 bits/samp, 2000 data bytes sox DBUG wav: 1000 Samps/chans sox DBUG wav: Searching for 4c 49 53 54 Input File : 'file.wav' Channels : 1 Sample Rate : 1000 Precision : 16-bit Duration : 00:00:01.00 = 1000 samples ~ 75 CDDA sectors File Size : 2.04k Bit Rate : 16.4k Sample Encoding: 16-bit Signed Integer PCM Endian Type : little Reverse Nibbles: no Reverse Bits : no Output File : '' (null) Channels : 1 Sample Rate : 1000 Precision : 16-bit Duration : 00:00:01.00 = 1000 samples ~ 75 CDDA sectors sox DBUG effects: sox_add_effect: extending effects table, new size = 8 sox DBUG spectrogram: duration=1 x_size=1001 pixels_per_sec=1001 dft_size=1024 sox DBUG spectrogram: window_density=0.5 sox INFO spectrogram: actual pixels/s = -inf sox DBUG spectrogram: step_size=-2147483648 block_steps=0 sox INFO sox: effects chain: input 1000Hz 1 channels (multi) 16 bits 00:00:01.00 sox INFO sox: effects chain: spectrogram 1000Hz 1 channels 16 bits 00:00:01.00 sox INFO sox: effects chain: output 1000Hz 1 channels (multi) 16 bits 00:00:01.00 sox DBUG sox: start-up time = 0.005625 sox DBUG spectrogram: cols=0 left=1073741312 end=1024 Segmentation fault (core dumped) ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net