gpt4 book ai didi

delphi - 什么会导致 SysFreeString 遇到 Int 3 断点?

转载 作者:行者123 更新时间:2023-12-01 16:26:06 34 4
gpt4 key购买 nike

我有一些代码在 Delphi 2007 下运行良好,但在 D2010 下崩溃。它涉及传入一个字符串,将其转换为 PWideChar(特别是 WideString 指针,而不是 UnicodeString 指针),进行一些处理,然后对其调用 SysFreeString。它工作正常,直到传入一个空白字符串,然后 SysFreeString 中断。它调用了一堆东西,最终在 NTDLL.DLL 内引发了 Int 3 断点。继续经过这一点会导致

Project raised exception class $C0000005 with message 'access violation at 0x7747206e: read of address 0x539b8dba'.

如果您仔细观察,这不是标准的访问冲突消息。

当堆栈跟踪到达 Int 3 时,其顶部如下所示:

:774e475d ; ntdll.dll
:774afad0 ; ntdll.dll
:774e5de9 ; ntdll.dll
:774a6dff ; ntdll.dll
:76fc1075 ; C:\Windows\system32\ole32.dll
:770e443a ; C:\Windows\system32\oleaut32.dll
:770e3ea3 oleaut32.SysFreeString + 0x4a

有谁知道这里发生了什么吗?

编辑(来自评论):

This isn't a WideString, though. It's a PWideChar generated by StringToOleStr, and there are no double-free errors when a non-blank string is passed in. Unfortunately, I can't really post a code sample because this is a third-party component that's under copyright. (And I can't ask them for support because it's no longer supported. Basically, the whole thing's one big mess.)

最佳答案

我要尝试心灵调试。您的应用程序中存在某种堆损坏,而 SysFreeString 是不幸的受害者(如果没有操作系统符号,很难判断,您可能应该为您的操作系统安装 MSFT 符号包)。

尝试为您的应用启用应用程序验证器(特别是页面堆),看看它是否会更早崩溃。

关于delphi - 什么会导致 SysFreeString 遇到 Int 3 断点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3401415/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com