04-08-2010 01:40 PM
04-08-2010 01:45 PM
When I am dynamically allocating a buffer, I always initialize the pointer to NULL.
This tells me the pointer is not valid and I can use it to test if the buffer had been previously allocated before doing a call to free.
Like so:
double * buffer = NULL;
buffer = malloc (sizeof (double) * BUFFER_SIZE);
if (buffer != NULL) free (buffer);
04-21-2010 03:19 PM
The variable is declared as
CMSG cmsg_tx[2047]; /* buffer for can messages */
How should I allocate is this case?
I do not understand the fact that a few elements (of index) past end of array but the value of index at moment of error is 0 (0=0)....
03-03-2011 12:50 PM
The described error does still appear sometimes. Is it possible that CVI has an error because of reporting out-of-bound while the index is set to zero? Maybe I can find my mistake if you can explain me what the meaning of the reportet error is. (Dereference of out-of-bound-pointer"
08-15-2012 04:07 AM
Have you resove your problem about "out-of-bounds pointer"?I also encounter the same problem. Please share me how to deal with the problem
08-17-2012 10:49 AM
No, sometimes the problem does still appear. I am not sure about the exact error source, but the problem does only appear in some routines. Maybe it is a grubby programming style at some program parts. - I do not know up to the present.
It would be nice if you can tell if you find something out.
01-09-2014 10:41 AM
01-09-2014 10:43 AM
03-29-2015 09:47 AM
I had similar problem.
Maybe this is where you make mistake.
For example if this is your callback function
int CVICALLBACK callback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
int variable1, variable2; // initialize variable.
float variable 3, variable 4;
function1...
function2....
break;
}
return 0;
}
You should put initialization variable above "switch (event)" and below "CVICALLBACK callback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)"
Like this:
int CVICALLBACK callback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
int variable1, variable2; // initialize variable.
float variable 3, variable 4;
switch (event)
{
case EVENT_COMMIT:
function1...
function2....
break;
}
return 0;
}
After this i dont get message error: ATAL RUN-TIME ERROR: Dereference of out-of-bounds pointer: 1388055715 bytes (86753482 elements) before start of array.
10-04-2019 04:32 AM
I had similar problems in DEBUG configuration ONLY. CVI debugger gives (misleading?) "Dereference of out-of-bounds pointer" in situations where everything looks fine, or at least it's difficult to understand what the issue refers to.
So I had to disable "run-time check" in Debug build configuration to move on (Release build works fine).
I'm using now CVI 2017 so it looks like this issue remains for several versions.
Regards,
/Paolo Santos