std::string view is a reference-like data structure in the C++ Standard Template Library (STL) that enables fast and cheap processing of read-only strings. Due to its wide applicability and performance enhancing power, std::string view has been very popular since its introduction in the C++17 standard. However, its careless use can lead to serious memory management bugs. As the lifetime of a std::string view is not tied to the lifetime of the referenced string in any way, it is the user's responsibility to ensure that the view is only used while the viewed string is live and its buffer is not reallocated. This paper describes a static analysis tool that finds programming errors caused by the incorrect use of std::string view. Our work included modeling std::string view operations in the analysis, defining steps to detect lifetime errors, constructing user-friendly diagnostic messages, and performing an evaluation of the checker.


翻译:std::string_view是C++标准模板库(STL)中一种类引用的数据结构,能够实现对只读字符串的快速且低开销处理。由于其广泛的适用性和性能提升能力,自C++17标准引入以来,std::string_view已变得非常流行。然而,对其不当使用可能导致严重的内存管理错误。由于std::string_view的生命周期与所引用字符串的生命周期并无任何绑定关系,用户有责任确保仅在所查看字符串存活且其缓冲区未被重新分配时使用该视图。本文描述了一种静态分析工具,用于发现因错误使用std::string_view而导致的编程错误。我们的工作包括在分析中对std::string_view操作进行建模、定义检测生命周期错误的步骤、构建用户友好的诊断信息,并对该检查器进行了评估。

0
下载
关闭预览

相关内容

WWW 2024 | GraphTranslator: 将图模型对齐大语言模型
专知会员服务
27+阅读 · 2024年3月25日
《用于代码弱点识别的 LLVM 中间表示》CMU
专知会员服务
14+阅读 · 2022年12月12日
专知会员服务
16+阅读 · 2021年10月4日
【ACL2020】多模态信息抽取,365页ppt
专知会员服务
151+阅读 · 2020年7月6日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
RL解决'BipedalWalkerHardcore-v2' (SOTA)
CreateAMind
31+阅读 · 2019年7月17日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
CVE-2018-7600 - Drupal 7.x 远程代码执行exp
黑客工具箱
14+阅读 · 2018年4月17日
CNN 反向传播算法推导
统计学习与视觉计算组
30+阅读 · 2017年12月29日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Arxiv
18+阅读 · 2021年3月16日
Arxiv
17+阅读 · 2021年2月15日
A survey on deep hashing for image retrieval
Arxiv
15+阅读 · 2020年6月10日
UNITER: Learning UNiversal Image-TExt Representations
Arxiv
23+阅读 · 2019年9月25日
Augmentation for small object detection
Arxiv
13+阅读 · 2019年2月19日
Arxiv
21+阅读 · 2018年5月23日
VIP会员
最新内容
伊朗战争停火期间美军关键弹药状况分析
专知会员服务
1+阅读 · 46分钟前
电子战革命:塑造战场的十年突破(2015–2025)
专知会员服务
2+阅读 · 今天9:19
人工智能即服务与未来战争(印度视角)
专知会员服务
0+阅读 · 今天7:57
《美国战争部2027财年军事人员预算》
专知会员服务
0+阅读 · 今天7:44
伊朗战争中的电子战
专知会员服务
4+阅读 · 今天7:04
大语言模型平台在国防情报应用中的对比
专知会员服务
6+阅读 · 今天3:12
美海军“超配项目”
专知会员服务
6+阅读 · 今天2:13
相关VIP内容
WWW 2024 | GraphTranslator: 将图模型对齐大语言模型
专知会员服务
27+阅读 · 2024年3月25日
《用于代码弱点识别的 LLVM 中间表示》CMU
专知会员服务
14+阅读 · 2022年12月12日
专知会员服务
16+阅读 · 2021年10月4日
【ACL2020】多模态信息抽取,365页ppt
专知会员服务
151+阅读 · 2020年7月6日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
相关资讯
RL解决'BipedalWalkerHardcore-v2' (SOTA)
CreateAMind
31+阅读 · 2019年7月17日
meta learning 17年:MAML SNAIL
CreateAMind
11+阅读 · 2019年1月2日
CVE-2018-7600 - Drupal 7.x 远程代码执行exp
黑客工具箱
14+阅读 · 2018年4月17日
CNN 反向传播算法推导
统计学习与视觉计算组
30+阅读 · 2017年12月29日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
相关论文
Arxiv
18+阅读 · 2021年3月16日
Arxiv
17+阅读 · 2021年2月15日
A survey on deep hashing for image retrieval
Arxiv
15+阅读 · 2020年6月10日
UNITER: Learning UNiversal Image-TExt Representations
Arxiv
23+阅读 · 2019年9月25日
Augmentation for small object detection
Arxiv
13+阅读 · 2019年2月19日
Arxiv
21+阅读 · 2018年5月23日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员