A serious security bug... caused by no bounds checking.

Steven Schveighoffer schveiguy at yahoo.com
Fri Apr 11 08:57:26 PDT 2014


On Fri, 11 Apr 2014 11:43:15 -0400, Dicebot <public at dicebot.lv> wrote:

> On Friday, 11 April 2014 at 15:15:21 UTC, Meta wrote:
>> Hasn't there been a proposal before to allow @system/@trusted/@safe  
>> blocks, allowing it to be a bit more granular than at the function  
>> level? Maybe:
>>
>> @trusted
>> {
>>     arr.ptr[index]
>> }
>>
>> Could be lowered to (() @trusted => arr.ptr[index]).
>
> I think it was rejected for the very reason that it gives nothing over  
> writing this:
>
> () @trusted
> {
>      arr.ptr[index];
> }();
>
> It has resulted in some changes by Kenji though that guarantee that  
> immediately-called delegate is always inlined. Hope those were merged.

If this works as seamlessly as a statement, that is a reasonable solution.

Re: ugliness, it's not important. These are not common situations.

-Steve


More information about the Digitalmars-d mailing list