POV-Ray : Newsgroups : povray.off-topic : update, updates, updates : Re: update, updates, updates Server Time
29 Jul 2024 02:26:01 EDT (-0400)
  Re: update, updates, updates  
From: clipka
Date: 18 Jan 2013 13:44:27
Message: <50f9980b$1@news.povray.org>
Am 18.01.2013 19:30, schrieb Warp:
> clipka <ano### [at] anonymousorg> wrote:
>> So take an array with a limited size, an "int" as an index into that
>> array, a check whether that index into that array is smaller than the
>> array's size - and you have the recipe for a stack overflow or similar
>> (unless you also remember to check whether the index is non-negative).
>
> There's no index value that *could* be smaller than MIN_INT, so you would
> have a bug certainly (the program wrongly thinks that all indices are
> outside the array), but still no out-of-bounds access.

Okay, let's do it a bit more specific:

   void fubar(int idx)
   {
     char c[1024];
     if (idx < 1024)
       fnord(c[idx]);
     else
       FAIL_SAFE();
   }

   void main()
   {
     fubar(INT_MAX+1);
   }

No out-of-bounds access? Look at the code again.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.