I dont know what's happening... never seen this before :-/

"main.cpp"

void Test()
{
CConfigLoader loader;
}

"ConfigLoader.h"
class CConfigLoader
{
private:
CONFIG Config;

public:
CConfigLoader(void) {};
~CConfigLoader(void) {};

bool LoadFromFile(char *path) {code_not_being_invoked()};
void LoadDefault() { code_not_being_invoked() };

CONFIG Get() {return Config; };
};

typedef struct _CONFIG
{
struct Video
{
word port;
char profile[64];
} video_ir, video_cam;
bool b_video_ir, b_video_cam;

struct Commands
{
word port;
word timeout;
} commands;
bool b_commands;

struct Detection
{
word sensibility_line[640];
word threshold_1_line[640];
word threshold_2_line[640];

byte sensibility_value[640];
byte threshold_1_value[640];
byte threshold_2_value[640];

int sensibility_count;
int threshold_1_count;
int threshold_2_count;
} detection;
bool b_detection;

struct DeviceIR
{
char source[MAX_PATH];
in_addr address;
word port;
word width;
word height;
byte range;
bool autobrightness;
bool autocontrast;
byte brightness;
byte contrast;
byte ab_brightness;
byte ac_contrast;
bool gamma;
byte nucmode;
byte avg_filter;
byte shrp_filter;
} ir;
bool b_ir;

struct DeviceCAM
{
char source[MAX_PATH];
in_addr address;
word port;
word width;
word height;
byte zoom;
byte focus;
byte shutter;
byte iris;
byte gain;
byte bright;
byte aperture;
bool dzoom;
bool autofocus;
bool palette_negative;
bool palette_bw;
bool osd;
bool icr;
bool autoirc;
bool backlight;
byte whitebalance;
byte autoexposure;
} cam;
bool b_cam;

struct DevicePTZ
{
in_addr address;
word port;
float pan;
float tilt;
} ptz;
bool b_ptz;

char source[MAX_PATH];
} CONFIG, *LPCONFIG;


This produces "Run-Time Check Failure #2 - Stack around the variable 'loader' was corrupted." if running in debug mode when function Test() exits or buffer overrun if running in release.
Any idea?

Instead...

void Test()
{
CONFIG loader;
loader.b_ptz = true;
}
doesn't produce any buffer overrun....