malloc and buffer overflow attacks

Ali Çehreli acehreli at yahoo.com
Fri Dec 31 16:22:30 UTC 2021


On 12/31/21 5:05 AM, max haughton wrote:
> On Friday, 31 December 2021 at 08:46:59 UTC, claptrap wrote:
>> On Friday, 31 December 2021 at 00:13:56 UTC, Walter Bright wrote:
>>> [...]
>>
>> are the asserts not taken out in release mode?
> 
> The compiler ships with assertions turned on.

And to remind, dmd's -release picks 'safeonly' for the following command 
line switch, which can separately be selected to override the default:

   -boundscheck=[on|safeonly|off]
                     bounds checks on, in @safe only, or off

---
@safe: // Assertions are checked by-default for @safe code

int main(string[] args) {
   int[] arr;
   return arr[args.length];
}
---

Ali


More information about the Digitalmars-d mailing list