Skip to content

Commit

Permalink
提升版本
Browse files Browse the repository at this point in the history
  • Loading branch information
brotherbeer authored Oct 19, 2024
1 parent 224a953 commit 73c57d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions c-cpp-rules.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "360 安全规则集合",
"version": "1.3.2",
"version": "1.4.0",
"encoding": "utf-8",
"language": "C,C++",
"url": "https://github.com/Qihoo360/safe-rules/blob/main/c-cpp-rules.md",
Expand Down Expand Up @@ -3654,7 +3654,7 @@
"reference": "CWE-119,CWE-125,CWE-787,CWE-788"
},
"ID_protectedData": {
"checkPoint": "类的非常量数据成员不应定义为 protected",
"checkPoint": "类的非常量数据成员不应为 protected",
"level": "suggestion",
"comment": "protected 数据成员在派生类中仍可被随意读写,破坏了封装理念。",
"tag": "type",
Expand Down
8 changes: 4 additions & 4 deletions c-cpp-rules.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# C/C++ 安全规则集合 ![Version](https://img.shields.io/badge/version-1.3.2-brightgreen) <img src="./logo.png" align="right" width="auto" height="100"/>
# C/C++ 安全规则集合 ![Version](https://img.shields.io/badge/version-1.4.0-brightgreen) <img src="./logo.png" align="right" width="auto" height="100"/>

> Bjarne Stroustrup: “*C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.*”

Expand Down Expand Up @@ -209,7 +209,7 @@
<span id="__type">**[5. Type](#type)**</span>
- [5.1 Class](#type.class)
- [R5.1.1 类的非常量数据成员均应为 private](#nonprivatedata)
- [R5.1.2 类的非常量数据成员不应定义为 protected](#protecteddata)
- [R5.1.2 类的非常量数据成员不应为 protected](#protecteddata)
- [R5.1.3 类不应既有 public 数据成员又有 private 数据成员](#mixpublicprivatedata)
- [R5.1.4 有虚函数的基类应具有虚析构函数](#missingvirtualdestructor)
- [R5.1.5 避免多重继承自同一非虚基类](#diamondinheritance)
Expand Down Expand Up @@ -2338,7 +2338,7 @@ void foo() {
T a("xyz");
T b = a; // Shallow copy
....
}
} // Double free
```
例中对象 b 由对象 a 复制而成,a 和 b 在析构时会重复释放同一成员指针,所以存在任一拷贝、移动、析构相关的函数时,应定义所有相关函数,可参见 ID\_violateRuleOfFive 的进一步讨论。
<br/>
Expand Down Expand Up @@ -5603,7 +5603,7 @@ MISRA C++ 2008 11-0-1
<br/>
<br/>

### <span id="protecteddata">▌R5.1.2 类的非常量数据成员不应定义为 protected</span>
### <span id="protecteddata">▌R5.1.2 类的非常量数据成员不应为 protected</span>

ID_protectedData &emsp;&emsp;&emsp;&emsp;&nbsp; :bulb: type suggestion

Expand Down
2 changes: 1 addition & 1 deletion c-ub-list.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 附录:C 未定义行为成因列表 ![Version](https://img.shields.io/badge/version-1.3.2-brightgreen) <img src="./logo.png" align="right" width="auto" height="100"/>
# 附录:C 未定义行为成因列表 ![Version](https://img.shields.io/badge/version-1.4.0-brightgreen) <img src="./logo.png" align="right" width="auto" height="100"/>

> blog.llvm.org: "*Many seemingly reasonable things in C actually have undefined behavior, and this is a common source of bugs in programs.*"
Expand Down
2 changes: 1 addition & 1 deletion cpp-ub-list.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 附录:C++ 未定义行为成因列表 ![Version](https://img.shields.io/badge/version-1.3.2-brightgreen) <img src="./logo.png" align="right" width="auto" height="100"/>
# 附录:C++ 未定义行为成因列表 ![Version](https://img.shields.io/badge/version-1.4.0-brightgreen) <img src="./logo.png" align="right" width="auto" height="100"/>

> cppreference.com: "*Undefined behavior renders the entire program meaningless if certain rules of the language are violated.*"
Expand Down

0 comments on commit 73c57d4

Please sign in to comment.