bugGNU Octave - Bugs: bug #57939, audioplayer.play crashes with...

 
 

bug #57939: audioplayer.play crashes with exception when called with nbits = 32

Submitter:  Michael Josenhans <mjosenhans>
Submitted:  Mon 02 Mar 2020 02:26:22 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  3 - Low Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.0.90 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 31 May 2020 04:57:51 PM UTC, comment #8: 

You're right.  The code doesn't work.  And the second problem is that there are no BIST tests to catch this sort of thing.  I fixed both problems in this changeset: https://hg.savannah.gnu.org/hgweb/octave/rev/28676df1deaf.

Rik <rik5>
Group administrator
Sun 31 May 2020 01:25:48 PM UTC, comment #7: 

I wonder how this code can run successfully.
https://hg.savannah.gnu.org/hgweb/octave/rev/41750ce4752c


if (nbits != 8 || nbits != 16 || nbits != 24)
        error ("audioplayer: NBITS must be 8, 16, or 24");


It will always trigger an error message, unless || is replaced by &&

Armin Müller <arm_in>
Tue 24 Mar 2020 07:49:39 PM UTC, comment #6: 

Marking as low priority since I believe the input validation change will prevent the segfault.  It is now more of a question about whether support for 32-bit players should be added.

Rik <rik5>
Group administrator
Sun 15 Mar 2020 10:02:44 PM UTC, comment #5: 

I improved the inputvalidation for audioplayer so it will catch odd NBITS settings before ever getting to a callback funciton.  See https://hg.savannah.gnu.org/hgweb/octave/rev/41750ce4752c.  Since this caused a segfault, I made the fix on the stable branch.

Note that Matlab's audioplayer function only supports 8, 16, and 24 bit players.  Can this bug be closed now?

Marking as Ready For Test.


Rik <rik5>
Group administrator
Thu 12 Mar 2020 03:35:15 PM UTC, comment #4: 

Yes, input validation is my hobby horse.  I would always like to see more of it.

Rik <rik5>
Group administrator
Thu 12 Mar 2020 05:28:43 AM UTC, comment #3: 

A third issue is lack of input validation in the constructor. It's not clear to me if 32 bits should be accepted, or should be an error, or if it depends on the hardware.

But if the user enters 31 as the number of bits, we should probably report an error in the constructor.

Mike Miller <mtmiller>
Group Member
Mon 09 Mar 2020 05:08:54 PM UTC, comment #2: 

This is really two problems.  The first problem is in audiodevinfo.cc.  The callback function uses a switch statement which has cases for 8-, 16-, and 24-bit audio.  There is no case statement for 32-bit audio so the switch statement falls through to the default case which calls error().

The second issue is that error() when invoked from a callback causes a termination of the entire program, rather than just returning to the Octave prompt.

Rik <rik5>
Group administrator
Mon 02 Mar 2020 05:50:40 PM UTC, comment #1: 

Confirmed on Debian.


>> y = rand (1e5, 1);
>> player = audioplayer (y, 16000, 32);
>> play (player)
error: invalid player bit depth in callback function
terminate called after throwing an instance of 'octave::execution_exception'
fatal: caught signal Aborted -- stopping myself...
Aborted (core dumped)


Mike Miller <mtmiller>
Group Member
Mon 02 Mar 2020 02:26:22 PM UTC, original submission:  


FileNameDest='C:\test\test.wav'; % any wav file
[signal fs] = audioread(FileNameDest);
p1 = audioplayer(signal, fs,32); % Here should be nBis 8 or 16 bits not 32
play(p1);

Ocatve GUI crashes, when play is called.

Michael Josenhans <mjosenhans>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arm_in (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mjosenhans (Submitted the item)
  • -email is unavailable- added by mjosenhans
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-30 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-03-24 rik5 Priority5 - Normal 3 - Low
    2020-03-15 rik5 StatusConfirmed Ready For Test
        Releasedev 6.0.90
    2020-03-02 mtmiller StatusNone Confirmed
        Release5.1.0 dev
        Operating SystemMicrosoft Windows Any
        SummaryAudioplayer play creashes if audioplayer is called with nBits = 32 audioplayer.play crashes with exception when called with nbits = 32
    2020-03-02 mjosenhans Carbon-Copy- Added mjosenhans

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code