bugGNU Octave - Bugs: bug #47875, audiowrite: segmentation fault...

 
 

bug #47875: audiowrite: segmentation fault when named parameter is missing coresponding value

Submitter:  Rick T <ratulloch>
Submitted:  Sun 08 May 2016 09:36:32 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Rick T Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 13 May 2016 07:42:00 PM UTC, comment #10: 

Checked the example of failing code in comment #2 and it is working now.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 13 May 2016 07:04:29 PM UTC, comment #9: 

I checked in the following change on the stable branch:

http://hg.savannah.gnu.org/hgweb/octave/rev/2c6d1ef071d1

John W. Eaton <jwe>
Group administrator
Thu 12 May 2016 11:13:47 PM UTC, comment #8: 

No, I don't at the moment. I agree that crashes should be fixed with extreme prejudice, so I'll take a look at fixing this on stable in the next day or two since no one has expressed interest.

Mike Miller <mtmiller>
Group Member
Thu 12 May 2016 01:02:26 AM UTC, comment #7: 

@Mike: It's an easy bug to fix.  Do you have a way to identify a new contributor who wants to tackle this?  Otherwise, it might be best to go ahead and fix it on the stable branch since it does result in a segfault.

Rik <rik5>
Group administrator
Sun 08 May 2016 06:30:32 PM UTC, comment #6: 

Yes, indeed I have configured --enable-bounds-check, hence it doesn't crash. Sorry for the noise.

Pantxo Diribarne <pantxo>
Group Member
Sun 08 May 2016 05:55:53 PM UTC, comment #5: 

@pantxo: have you configured with --enable-bounds-check?

Anonymous
Sun 08 May 2016 05:13:09 PM UTC, comment #4: 

It still segfaults for me on the default branch, rev 894b440027fa.

Mike Miller <mtmiller>
Group Member
Sun 08 May 2016 04:47:41 PM UTC, comment #3: 

Default dev branch doesn't segfault. Mike's minimal scripts returns an error instead:


error: index (5): out of bound 4


Pantxo Diribarne <pantxo>
Group Member
Sun 08 May 2016 03:35:23 PM UTC, comment #2: 

Here is a more minimal example:


audiowrite ("foo.wav", 1, 44100, "BitsPerSample")


The top two frames of the backtrace:


#0  0x00007fffe674aebe in octave_value::int_value (frc_str_conv=false, req_int=false, this=0x8c8c08) at ../libinterp/octave-value/ov.h:732
#1  Faudiowrite (args=...) at ../libinterp/dldfcn/audioread.cc:344


This is clearly because the code is not checking whether args(i+1) is valid if args(i) is a valid parameter name.

This would be a good bug for a new contributor to work on.

Mike Miller <mtmiller>
Group Member
Sun 08 May 2016 09:45:25 AM UTC, comment #1: 

the code posted in summary stripped things out so I attached the file as a text file that will cause the crash)

Rick T <ratulloch>
Sun 08 May 2016 09:36:32 AM UTC, original submission:  

Octave 4.0 crashes using audiowrite if incorrect values are used.

This is the code that crashes Octave every-time using octave 4.0.0.  I'm using Ubuntu 16.04 64bit


fs =8000;                    % Sampling frequency
fs_rate=fs;
dursec=10; %%duration of signal in seconds

t=linspace(0,2*pi,dursec*fs);
freq=primes(fs/2*dursec);
freq=freq';

ya=zeros(1,length(t));
numfreq=numel(freq)

for ii=1:1:numel(freq)
ya = ya+sin(freq(ii,1)*t);
end

audio_prop='BitsPerSample',16,'Artist','artist rt','Title','title section rt','Comment','Comments section rt';
audiowrite('/tmp/test.flac',[ya(:) -1*ya(:)],44100,audio_prop)




this can be prevented by using the correct syntax and changing the following two lines
audio_prop={'BitsPerSample',16,'Artist','artist rt','Title','title section rt','Comment','Comments:fn used goes here'};
audiowrite('/tmp/test.flac',[ya(:) -1*ya(:)],44100,audio_prop{:})

Rick T <ratulloch>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #37100:  aw_crash_code.m added by ratulloch (450B - text/x-objcsrc - the code posted in summary stripped things out so I attached the file as a text file that will cause the crash)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by ratulloch (Submitted the item)
  • -email is unavailable- added by ratulloch
  •  

    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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-13 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2016-05-08 mtmiller Operating SystemGNU/Linux Any
        SummaryCrash on audiowrite audiowrite: segmentation fault when named parameter is missing coresponding value
    2016-05-08 jordigh StatusNone Confirmed
    2016-05-08 ratulloch Attached File- Added aw_crash_code.m, #37100
    2016-05-08 ratulloch Carbon-Copy- Added ratulloch

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code