Why am I getting a buffer overflow error with this line of code?

I have only one line of code, and this:

pcrecpp::RE re("abc");

inside the function OnBnClickedButtonGo(). And this function does not work in release mode, but it works in debug mode.

(I am using Visual Studio 8 on Windows XP.)

Error message:

A buffer overrun has occurred in testregex.exe which has corrupted the program's
internal state. Press Break to debug the program or Continue to terminate
the program.
For more details please see Help topic 'How to debug Buffer Overrun Issues'.

I suspect this is his destructor, which is invisible and implied ... but I really don't know.

PS: I statically refer to PCRE lib version 7.8. PS2: Not very important, but it can help some people who have problems linking to the PCRE library (it took me hours to figure it out): turn on the line #define PCRE_STATIC.

+5
source share
3 answers

. , . C/++, native.dll. / ++, .net. - mixed.dll , :

typedef void ( *FunctionOnStartSend)();

, " ", :

typedef void (__stdcall *FunctionOnStartSend)(); 
+3

, , - "". - , , Match() , , .

0

: VS2008, _SECURE_SCL = 0 (. ). . , , , - MS , , _SECURE_SCL, .

, , VS2008 , . , Release. 2 , libs, . , diff !

Why, why can't the guys from Microsoft embed a small check into the code of the dynamic loader to verify that the current library operation and dynamic loading are incompatible ? Some scythe of code that saves people. Blah!

0
source

All Articles