Is pascal vulnarable to heap overflow vulnarability?I think pascal doesn't any have problem with stack overflow attack.is it true in heap overflow attack too?does pascal any problem with heap overflow attack?
Thanks.

That depends entirely on the OS and the compiler vendor.

I'm pretty sure that old Turbo Pascals will properly crash if you try to overflow the heap. Delphi will raise an exception. For other vendors, particularly on OSes other than Windows, your results may vary.

Hope this helps.

BTW, please don't shout.

i 'm very very thanks for your answer.i use freepascal compiler.do you think may be have problem with this compiler?i want to know my program that compile with freepascal ,is safe about stack overflow and heap overflow?
Thanks.

FPC will generate exceptions for them. Check FPC's documentation for runtime errors.

Good luck!

i 'm sorry my friend.i 'm very new in programming.what's the meaning of exception in your sentence.is this mean that FPC permit to occur overflow in compiled program or don't permit occur overflow in program.it's very important for me that know which in occur.
Thanks a lot my friend

My friend, It looks like that you are using Borland CodeGear FreePascal IDE! If it is so, then you are enabled to tell the compiler what to do. it is easy. just you should use compiler directives.
for this issue, (i think) this could help a bit:
use this in the top body of your code.

1. {$STACKCHECKS ON}
2. {$Q+} or {$OVERFLOWCHECKS ON}
3. {$R+}

comments:

$R+: RANGECHECKS ON
you can use (-) or (OFF) instead to tell the compiler stop doing that special task.

The $Q directive controls the generation of overflow checking code. In the {$Q+} state, certain integer arithmetic operations (+, -, *, Abs, Sqr, Succ, Pred, Inc, and Dec) are checked for overflow. If an overflow check fails, an EIntOverflow exception is raised (or the program is terminated if exception handling is not enabled). The $Q switch is usually used in conjunction with the $R switch, which enables and disables the generation of range-checking code.

For More Info, Refer to CODEGEAR help: RAD SUTDIO DOCUMENTATION, COMPILER DIRECTIVES

Hope it helps. Dont Worry! Be Happy!
and Good Luck.

This article has been dead for over six months. Start a new discussion instead.