Csound Csound-dev Csound-tekno Search About

[Cs-dev] i-rate array and table reading out of range segfaults

Date2014-02-18 08:05
Fromjoachim heintz
Subject[Cs-dev] i-rate array and table reading out of range segfaults
Attachmentstest.csd  None  None  
i had a look at the protection of arrays and tables against reading out 
of range. i see that k-arrays are now protected -- excellent (i think 
this was not the case some weeks ago).

for i-arrays, i get an error message, but a segfault nevertheless:
iArray[] array 1, 2, 3, 4, 5, 6, 7
iOff = iArray[7]
print iOff
-> Array index 7 out of range (0,6) for dimension 1
Csound tidy up: Segmentation fault

and for reading a table off limits at i-time as well:
iTable ftgen 0, 0, -7, -2, 1, 2, 3, 4, 5, 6, 7
iOff tab_i 8, iTable
print iOff
-> tab_i off end: table number: 102
Csound tidy up: Segmentation fault


could the segfaults in these cases be avoided?

all best -

	joachim

Date2014-02-18 11:12
Fromjpff
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
Interesting.  tab_i opcode was created without checks for speed; always 
thought that was wrong-minded



------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-02-18 11:25
FromVictor Lazzarini
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
The manual clearly says you are responsible for the checks:

http://www.csounds.com/manual/html/tab.html

whether that’s a bug or a feature, I do not have a conclusive view.

Victor
On 18 Feb 2014, at 08:05, joachim heintz  wrote:

> and for reading a table off limits at i-time as well:
> iTable ftgen 0, 0, -7, -2, 1, 2, 3, 4, 5, 6, 7
> iOff tab_i 8, iTable
> print iOff
> -> tab_i off end: table number: 102
> Csound tidy up: Segmentation fault


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-02-18 21:10
Fromjoachim heintz
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
i know this, but it is no longer true for tab since john introduced a 
boundary check. only true for tab_i and i-arrays.

certainly you (developers) have to decide. i even don't know how 
easy/difficult it might be to avoid segfaults, and if there are 
drawbacks (in terms of speed or whatever).

on the other hand i seem to remember your words that csound should 
*never* segfault, and i know that these errors are very hard to 
understand for users. for instance, if you run my example csd in 
csoundqt, it will simply disappear without any message because of the 
segfault.

best -

	joachim


Am 18.02.2014 12:25, schrieb Victor Lazzarini:
> The manual clearly says you are responsible for the checks:
>
> http://www.csounds.com/manual/html/tab.html
>
> whether that’s a bug or a feature, I do not have a conclusive view.
>
> Victor
> On 18 Feb 2014, at 08:05, joachim heintz  wrote:
>
>> and for reading a table off limits at i-time as well:
>> iTable ftgen 0, 0, -7, -2, 1, 2, 3, 4, 5, 6, 7
>> iOff tab_i 8, iTable
>> print iOff
>> -> tab_i off end: table number: 102
>> Csound tidy up: Segmentation fault
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.

Date2014-02-18 21:14
FromMichael Gogins
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
AttachmentsNone  None  
For table reading, efficiency is very important and would be affected by range checking.

My guesses are:

The impact might be significant at a-rate (but this should be tested).

It would not be as significant at k-rate.

It should not be an issue at all at i-rate.

Regards,
Mike


-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Tue, Feb 18, 2014 at 4:10 PM, joachim heintz <jh@joachimheintz.de> wrote:
i know this, but it is no longer true for tab since john introduced a
boundary check. only true for tab_i and i-arrays.

certainly you (developers) have to decide. i even don't know how
easy/difficult it might be to avoid segfaults, and if there are
drawbacks (in terms of speed or whatever).

on the other hand i seem to remember your words that csound should
*never* segfault, and i know that these errors are very hard to
understand for users. for instance, if you run my example csd in
csoundqt, it will simply disappear without any message because of the
segfault.

best -

        joachim


Am 18.02.2014 12:25, schrieb Victor Lazzarini:
> The manual clearly says you are responsible for the checks:
>
> http://www.csounds.com/manual/html/tab.html
>
> whether that’s a bug or a feature, I do not have a conclusive view.
>
> Victor
> On 18 Feb 2014, at 08:05, joachim heintz <jh@joachimheintz.de> wrote:
>
>> and for reading a table off limits at i-time as well:
>> iTable ftgen 0, 0, -7, -2, 1, 2, 3, 4, 5, 6, 7
>> iOff tab_i 8, iTable
>> print iOff
>> -> tab_i off end: table number: 102
>> Csound tidy up: Segmentation fault
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2014-02-18 21:52
FromVictor Lazzarini
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
That’s very true, I think that is the right thing. Csound should never segfault, and we should
fix tab_i.
On 18 Feb 2014, at 21:10, joachim heintz  wrote:

> on the other hand i seem to remember your words that csound should 
> *never* segfault, and i know that these errors are very hard to 
> understand for users. for instance, if you run my example csd in 
> csoundqt, it will simply disappear without any message because of the 
> segfault.


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-02-19 12:42
Fromjoachim heintz
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
thanks. just to note that it is also about i-arrays (see my test.csd) 
which is for future use much more important.
best -
	joachim


Am 18.02.2014 22:52, schrieb Victor Lazzarini:
> That’s very true, I think that is the right thing. Csound should never segfault, and we should
> fix tab_i.
> On 18 Feb 2014, at 21:10, joachim heintz  wrote:
>
>> on the other hand i seem to remember your words that csound should
>> *never* segfault, and i know that these errors are very hard to
>> understand for users. for instance, if you run my example csd in
>> csoundqt, it will simply disappear without any message because of the
>> segfault.
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists

Date2014-02-19 13:22
FromVictor Lazzarini
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
Ok, I fixed the i-arrays crash. The problem was not the out of bounds, but a segfault when printing the error message.
On 19 Feb 2014, at 12:42, joachim heintz  wrote:

> thanks. just to note that it is also about i-arrays (see my test.csd) 
> which is for future use much more important.
> best -
> 	joachim
> 
> 
> Am 18.02.2014 22:52, schrieb Victor Lazzarini:
>> That’s very true, I think that is the right thing. Csound should never segfault, and we should
>> fix tab_i.
>> On 18 Feb 2014, at 21:10, joachim heintz  wrote:
>> 
>>> on the other hand i seem to remember your words that csound should
>>> *never* segfault, and i know that these errors are very hard to
>>> understand for users. for instance, if you run my example csd in
>>> csoundqt, it will simply disappear without any message because of the
>>> segfault.
>> 
>> 
>> ------------------------------------------------------------------------------
>> Managing the Performance of Cloud-Based Applications
>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>> Read the Whitepaper.
>> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
> 
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2014-02-19 21:53
Fromjoachim heintz
SubjectRe: [Cs-dev] i-rate array and table reading out of range segfaults
yes, works now even in csoundqt. all notes aborted, but no crash.
chapeau ...
	j


Am 19.02.2014 14:22, schrieb Victor Lazzarini:
> Ok, I fixed the i-arrays crash. The problem was not the out of bounds, but a segfault when printing the error message.
> On 19 Feb 2014, at 12:42, joachim heintz  wrote:
>
>> thanks. just to note that it is also about i-arrays (see my test.csd)
>> which is for future use much more important.
>> best -
>> 	joachim
>>
>>
>> Am 18.02.2014 22:52, schrieb Victor Lazzarini:
>>> That’s very true, I think that is the right thing. Csound should never segfault, and we should
>>> fix tab_i.
>>> On 18 Feb 2014, at 21:10, joachim heintz  wrote:
>>>
>>>> on the other hand i seem to remember your words that csound should
>>>> *never* segfault, and i know that these errors are very hard to
>>>> understand for users. for instance, if you run my example csd in
>>>> csoundqt, it will simply disappear without any message because of the
>>>> segfault.
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Managing the Performance of Cloud-Based Applications
>>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>>> Read the Whitepaper.
>>> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>> ------------------------------------------------------------------------------
>> Managing the Performance of Cloud-Based Applications
>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>> Read the Whitepaper.
>> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.ne