From: Jan Stary <hans@stare.cz>
To: sox-devel@lists.sourceforge.net
Subject: spectrogram segfault
Date: Thu, 1 Jan 2015 21:23:36 +0100 [thread overview]
Message-ID: <20150101202336.GB17144@www.stare.cz> (raw)
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
next reply other threads:[~2015-01-01 20:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-01 20:23 Jan Stary [this message]
2015-01-22 8:48 ` spectrogram segfault Pander
2015-12-29 22:07 ` Eric Wong
2024-05-18 15:19 ` spectrogram -x bug Jan Stary
2024-05-18 16:11 ` Martin Guy
2024-05-19 9:26 ` Martin Guy
[not found] ` <yw1x4jasaa0p.fsf@mansr.com>
2024-05-20 17:20 ` Martin Guy
2024-05-20 21:20 ` Jan Stary
2024-05-21 14:34 ` Måns Rullgård
2024-05-21 15:00 ` Måns Rullgård
2024-05-21 16:08 ` Martin Guy
2024-05-22 14:18 ` Jan Stary
2024-05-23 11:23 ` Måns Rullgård
2024-05-22 14:12 ` Jan Stary
2024-05-23 16:05 ` Jan Stary
2024-05-23 19:04 ` Måns Rullgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.sourceforge.net/lists/listinfo/sox-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150101202336.GB17144@www.stare.cz \
--to=sox-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/sox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).