We have a code that runs a dll but right at the end of the function, at the last curly brace, I get this error = run time check failure #2 stack around the variable was corrupted. This is not caused by my vector being out of bounds.
My code is -
vector<LocalStruct> arr(1000);
for(auto x : ArrayOfLocalStructs)
{
arr.push_back(x);
}
return arr;
Thus, I am not accessing an out of bounds vector since vector can obviously double its size when it gets filled. All answers I have found online have an out of bounds array index error but for my code everything was working yesterday. Is it may be because of some corrupted system files since our application is a MFC application which also accesses system files.
The above code is in a DLL file in my workplace, but the code looks like the small snippet I added. When running this snippet in visual studio alone, it doesn't throw any error, but only does on the DLL file at my workplace. Is there any way to debug this? Since in debugger it just fails at the last curly brace of the function?
Aucun commentaire:
Enregistrer un commentaire