Out Of Bounds memory access

paulpotat
2022-04-07
2022-04-07
  • paulpotat

    paulpotat - 2022-04-07

    Hello,
    I have a question about how CodeSys deals with out of bound accesses.
    For example if I define an array like so :

    test_array : ARRAY[0..9] OF BYTE;
    

    And in my code if I do :

    i := 10;
    test_array[i] := 12;
    

    Surprisingly, no exception is raised and the value is written in the memory at the corresponding address. I can even modifiy the values of other variables in the programm by doing that.

    So my question is : is there a way to detect an out of bound exception ?

     
  • wollvieh

    wollvieh - 2022-04-07

    yes, thats right!

     
    πŸ‘
    1

Log in to post a comment.