为什么我用这行代码得到缓冲区溢出错误?

War*_*tin 5 pcre destructor buffer-overrun

我只有一行代码,这是:

pcrecpp::RE re("abc");
Run Code Online (Sandbox Code Playgroud)

在一个函数内部OnBnClickedButtonGo().此功能在发布模式下失败,但在调试模式下可以正常工作.

(我在Windows XP上使用Visual Studio 8.)

错误消息是:

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'.
Run Code Online (Sandbox Code Playgroud)

我怀疑它是它的析构函数,它是隐形的和隐含的......但我真的不知道.

PS:我静态链接到PCRE lib版本7.8.PS2:不太相关,但可以帮助一些链接到PCRE库的人(我花了几个小时来解决它):包括该行#define PCRE_STATIC.

cod*_*gic 0

如果它仅发生在发布模式下,则可能某些内容正在被“优化”。尝试做一些不仅仅是一个衬里的事情,比如 Match() ,甚至可能打印出匹配项。