运行最简单的 C++ 时,AVG 访问被拒绝警告;程序

发布于 2024-09-06 14:04:04 字数 613 浏览 3 评论 0原文

我正在运行一个非常简单的 C++ 程序:

#include <list>
#include <vector>

int main(int argc, char **args) {

}

我进入命令提示符并编译并运行:

g++ whatever.cpp
a.exe

通常情况下这工作得很好。它编译得很好,但当我运行它时,它显示“访问被拒绝”,并且 AVG 弹出,告诉我已检测到威胁Trojan Horse Generic 17.CKZT。我尝试使用 Microsoft 编译器 (cl.exe) 再次编译,但运行良好。所以我回去,并添加:

#include <iostream>

使用g++编译并运行。这次效果很好。

那么谁能告诉我为什么 AVG 会将空的 main 方法报告为特洛伊木马,但如果包含 iostream 标头却不会?

更新:

我在 main 方法中添加了一个 return 语句,现在我发现只有在返回 0 时才会出现错误。任何其他返回值似乎都工作正常。

这是怎么回事?

I am running a very simple C++ program:

#include <list>
#include <vector>

int main(int argc, char **args) {

}

I go to the command prompt and compile and run:

g++ whatever.cpp
a.exe

Normally this works just fine. It compiles fine, but when I run it it says Access Denied and AVG pops up telling me that a threat has been detected Trojan Horse Generic 17.CKZT. I tried compiling again using the Microsoft Compiler (cl.exe) and it runs fines. So I went back, and added:

#include <iostream>

compiled using g++ and ran. This time it worked fine.

So can anyone tell me why AVG would report an empty main method as a trojan horse but if the iostream header is included it doesn't?

UPDATE:

I added a return statement to the main method and now I find that I only get the error if I return 0. Any other return value and it seems to work fine.

What's going on here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦途 2024-09-13 14:04:04

您不是第一个遇到防病毒软件误报的人。

可能发生的情况是,防病毒启发式方法在程序中存在的标准运行时库上出错,因为恶意软件也使用它们。当然,合法软件也使用它们!事实上,它没有在 iostream 上出错,这可能意味着 iostream 在恶意软件编写者中并不是很受欢迎。

You're not the first person to encounter false positives by antivirus software.

What probably happened is that the antivirus heuristics tripped up on the standard runtime libraries present in your programs, since malware uses them as well. Of course, legitimate software uses them too! The fact that it didn't trip up on iostream probably means that iostream isn't very popular among malware writers.

囚我心虐我身 2024-09-13 14:04:04

如果您只想尽快解决问题,
只需将可执行文件的文件夹放入AVG的白名单即可。

我的首选步骤:

  1. 为了安全起见,您应该发送可执行文件
    到像这样的在线病毒/恶意软件扫描程序:

    • www.virustotal.com:VirusTotal - 免费在线病毒和恶意软件扫描
    • virusscan.jotti.org/en :Jotti 的恶意软件扫描
  2. 如果他们报告“误报”,则插入已编译可执行文件的路径
    进入 AVG 的白名单
    所以它不会扫描该文件夹。
    我不熟悉 AVG,
    但每种防病毒软件
    有一个从扫描中排除文件的选项。

  3. 如果您足够勇敢,请调试可执行文件并找到导致调用的原因。

    如果

  4. 另一种解决方案可能是虚拟化轻量级 Linux 系统,
    在其上安装 gcc(当然还有 g++),并使用“g++ 专用环境”

    开发您的命令行应用程序。


// 第一步是此对话的总结.
// 如果您将源代码和您编译的“受感染”可执行文件发送给我,那么我会检查它。
// (C++) main 函数中缺少 return 语句意味着返回 0

If you only want to overcome the problem as fast as possible,
just put the folder of the executables into AVG's whitelist.

My preferred steps:

  1. For safety's sake, you should send your executable
    to an online virus/malware scanner like these:

    • www.virustotal.com : VirusTotal - Free Online Virus and Malware Scan
    • virusscan.jotti.org/en : Jotti's malware scan
  2. if they report 'false positive', then insert the path of the compiled executables
    into AVG's whitelist,
    so it doesn't scan that folder.
    I'm not conversant with AVG,
    but every antivirus
    has an option to exclude files from scan.

  3. If you're brave enough, debug the executable and find the causing call.

  4. An alternative solution may be to virtualize a lightweight linux system,
    install gcc (with g++, of course) on it, and use that "g++ dedicated environment"
    to
    develop your commandline apps.


// The 1st step is a sum-up of this conversation.
// If you send me the source and the 'infected' executable that you compiled, then I'll check it.
// The missing return statement in the (C++) main function means returns 0.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文