gpt4 book ai didi

c++ - 如何在 GCC 中使用 Container Overflow Bugs 检测?

转载 作者:行者123 更新时间:2023-11-30 05:25:11 46 4
gpt4 key购买 nike

关于 EuroLLVM 2014 Kostya Serebryany presented vector 溢出检测的一种方法。在幻灯片 12 上,他提供了指向 GCC revision 207517 的链接。在哪里可以看到 branches/google/gcc-4_8/libstdc++-v3/
我想知道我可以在哪个 GCC 版本上使用 Container Overflow Bugs 检测?如果它只在主干中,它在 Clang 3.9 版本中可用还是也在主干中?

最佳答案

Sanitizer vector annotations 在原始 gcc 中不可用,更改仅是 gcc 的 google 分支的一部分(在 gcc.gnu.org 上发布)。分支机构说明:https://www.gnu.org/software/gcc/svn.html

google/main This branch contains Google local patches that are staged to be contributed to trunk. Some of these patches are either in the process of being reviewed, or have not yet been proposed. The intent of this branch is to serve as a staging platform to allow collaboration with external developers. Patches in this branch are only expected to remain here until they are reviewed and accepted in trunk. This branch is maintained by Diego Novillo

提交向 vector 添加 AddressSanitizer 注释:

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=207517 “对于 Google b/8513090,将 AddressSanitizer 注释添加到 std::vector”:

https://gcc.gnu.org/viewcvs/gcc/branches/google/gcc-4_8/libstdc%2B%2B-v3/include/bits/vector.tcc?r1=207517&r2=207516&pathrev=207517

我们可以从提交中获取注释的名称:

 // When sanitizer annotataions are off, avoid bazillion of no-op
// functions that blow up debug binary size.
#define __sanitizer_vector_annotate_new()
#define __sanitizer_vector_annotate_delete()
#define __sanitizer_vector_annotate_increase(a)
#define __sanitizer_vector_annotate_shrink(a)

现在 GNU 的 vector.tcc 或 STL_vector.h 主干版本中没有 sanitizer 注释(搜索“sanitizer”):

https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/vector.tcc https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_vector.h

邮件列表 gcc-patches 中的主题:https://gcc.gnu.org/ml/gcc-patches/2014-05/msg02180.html “检测 std::vector 中的“容器溢出”错误”,来自:Konstantin Serebryany,2014 年 5 月 26 日。

关于c++ - 如何在 GCC 中使用 Container Overflow Bugs 检测?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38425369/

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