LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI Error: Over Array Bounds

When the attached C-File is compiled and executed in Debug mode CVI fails with an Over Array Bounds error while dereferencing a valid char * pointer. The function 'LogEnetData ()' is passed a pointer to over a thousand bytes of valid data and yet CVI declares an error when the loop index is 2.  I believe that this violates standard C behaviour.
 
When I single-stepped through the code and monitored the value of pData after it had been incremented, I got the following results:
 
          i                              pData
-------------------           -----------------
          0                        0x0012FA6D                        This is OK
          1                       "Over Array Bounds" 
0 Kudos
Message 1 of 3
(3,150 Views)

Towards the end of your file, you have the line:

    LogEnetData (fp, Message.MsgSize, (unsigned char *)&Message.CsciSource);

You should be using the .Data field of your structure, not the .CsciSource one. Like this:

    LogEnetData (fp, Message.MsgSize, Message.Data);

JR

0 Kudos
Message 2 of 3
(3,146 Views)

I am using the CsciSource field because that's where the logging needs to start

Hurst C.

0 Kudos
Message 3 of 3
(3,130 Views)