Bug 70096

Summary: sndfile-util.c crashes on 24 bit files
Product: PulseAudio Reporter: Tanu Kaskinen <tanuk>
Component: coreAssignee: Kiran <kiraank>
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: kiraank, lennart
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Tanu Kaskinen 2013-10-03 19:01:49 UTC
Reported in IRC:

<kiraank> Hi, I am using PA 2.1 and getting this error when I try to play some wav file using paplay : "Code should not be reached at pulsecore/sndfile-util.c:391, function pa_sndfile_readf_function(). Aborting.

I had a look at pa_sndfile_readf_function(). It handles a limited set of sample formats. I then checked what kind of sample specs paplay can give that function. It looks like the sample spec is coming from pa_sndfile_read_sample_spec(), and that function can return format PA_SAMPLE_S24NE, which is not handled by pa_sndfile_readf_function().

We couldn't figure out with kiraank what the sample format of the test file was ("file test.wav" didn't show the bit depth for some reason). I then tried to create a test file with this command:

    parecord --device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor --format=s24le > test.wav

but that crashed too, in a similar way but not exactly the same:

    Code should not be reached at pulsecore/sndfile-util.c:413, function pa_sndfile_writef_function(). Aborting.
    Aborted
Comment 1 Kiran 2013-10-05 23:07:05 UTC
Submitted patch:



From 970387d89e39362af1dddad7b374206f39c5b8f9 Mon Sep 17 00:00:00 2001
From: Kiran Krishnappa <kiraank@gmail.com>
Date: Sat, 5 Oct 2013 14:55:52 -0700
Subject: [PATCH] sndfile-util: fix format for 24bit depth wav files

PA_SAMPLE_24NE generated in pa_sndfile_read_sample_spec is not
handled in pa_sndfile_readf_function. paplay used to get aborted
for 24bit depth wav files
---
 src/pulsecore/sndfile-util.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c
index 0820ee4..46689af 100644
--- a/src/pulsecore/sndfile-util.c
+++ b/src/pulsecore/sndfile-util.c
@@ -386,6 +386,9 @@ pa_sndfile_readf_t pa_sndfile_readf_function(const pa_sample_spec *ss) {
         case PA_SAMPLE_ALAW:
             return NULL;

+        case PA_SAMPLE_S24NE:
+            return NULL;
+
         default:
             pa_assert_not_reached();
     }
--
1.7.9.5
Comment 2 Tanu Kaskinen 2013-10-13 07:02:22 UTC
This is now fixed: http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=ab254364868240623b6643d80a7447d6ee7b0e44

Thanks, Kiran!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.