|
847 | 847 | "ID_virtualAssignment": { |
848 | 848 | "checkPoint": "拷贝和移动赋值运算符不应为虚函数", |
849 | 849 | "level": "warning", |
850 | | - "comment": "拷贝和移动赋值运算符的返回类型应为所属类的非 const 引用,这类运算符即使是虚函数也不便于被重写。", |
| 850 | + "comment": "拷贝和移动赋值运算符的参数应分别为所属类的左值和右值引用,这类运算符即使是虚函数也不便于被重写。", |
851 | 851 | "tag": "declaration", |
852 | 852 | "related": "ID_nonStdAssignmentRetType", |
| 853 | + "standard": "ISO/IEC 14882:2003 12.8(9),ISO/IEC 14882:2011 12.8(17),ISO/IEC 14882:2011 12.8(19)", |
853 | 854 | "reference": "C++ Core Guidelines C.60,C++ Core Guidelines C.63" |
854 | 855 | }, |
855 | 856 | "ID_nonStdCopyAssignmentParam": { |
856 | 857 | "checkPoint": "拷贝赋值运算符的参数应为同类对象的 const 左值引用", |
857 | 858 | "level": "warning", |
858 | 859 | "comment": "拷贝赋值运算符的参数不应按值传递,否则会产生不必要的复制开销以及“对象切片”等问题。", |
859 | 860 | "tag": "declaration", |
| 861 | + "standard": "ISO/IEC 14882:2003 12.8(9),ISO/IEC 14882:2011 12.8(17)", |
860 | 862 | "reference": "C++ Core Guidelines C.60" |
861 | 863 | }, |
862 | 864 | "ID_nonStdMoveAssignmentParam": { |
863 | 865 | "checkPoint": "移动赋值运算符的参数应为同类对象的非 const 右值引用", |
864 | 866 | "level": "warning", |
865 | | - "comment": "移动赋值运算符的参数不可为 const 右值引用,否则将失去移动赋值的意义。", |
| 867 | + "comment": "移动赋值意在将参数的数据转移到当前对象中,故参数不应为 const 右值引用,否则将失去移动赋值的意义。", |
866 | 868 | "tag": "declaration", |
| 869 | + "standard": "ISO/IEC 14882:2011 12.8(19),ISO/IEC 14882:2017 15.8.2(3)", |
867 | 870 | "reference": "C++ Core Guidelines C.63" |
868 | 871 | }, |
869 | 872 | "ID_nonStdAssignmentRetType": { |
870 | 873 | "checkPoint": "拷贝和移动赋值运算符应返回所属类的非 const 引用", |
871 | 874 | "level": "warning", |
872 | 875 | "comment": "拷贝和移动赋值运算符应返回所属类的非 const 引用,便于调用者使用并满足泛型编程的要求。", |
873 | 876 | "tag": "declaration", |
| 877 | + "standard": "ISO/IEC 14882:2003 12.8(10),ISO/IEC 14882:2011 12.8(22)", |
874 | 878 | "reference": "C++ Core Guidelines F.47,C++ Core Guidelines C.60,C++ Core Guidelines C.63" |
875 | 879 | }, |
876 | 880 | "ID_mainReturnsNonInt": { |
|
894 | 898 | "level": "warning", |
895 | 899 | "comment": "main 函数作为程序的入口,链接器需对其特殊处理,不应受命名空间等作用域的限制。", |
896 | 900 | "tag": "global", |
| 901 | + "standard": "ISO/IEC 14882:2003 3.6.1(1),ISO/IEC 14882:2011 3.6.1(1)", |
897 | 902 | "reference": "MISRA C++ 2008 7-3-2" |
898 | 903 | }, |
899 | 904 | "ID_illFormedMain": { |
|
1580 | 1585 | "tag": "expression", |
1581 | 1586 | "related": "ID_confusingAssignment", |
1582 | 1587 | "standard": "ISO/IEC 9899:1999 5.1.2.3(2),ISO/IEC 9899:1999 Annex C,ISO/IEC 9899:2011 5.1.2.3(3),ISO/IEC 9899:2011 Annex C", |
1583 | | - "reference": "CWE-758,C++ Core Guidelines ES.43,C++ Core Guidelines ES.44" |
| 1588 | + "reference": "C++ Core Guidelines ES.43,C++ Core Guidelines ES.44" |
1584 | 1589 | }, |
1585 | 1590 | "ID_complexExpression": { |
1586 | 1591 | "checkPoint": "表达式不应过于复杂", |
|
1683 | 1688 | "level": "warning", |
1684 | 1689 | "comment": "std::move 的参数应为左值,返回值应直接作为接口的参数,除此之外的应用价值有限,且易产生错误。", |
1685 | 1690 | "tag": "expression", |
| 1691 | + "standard": "ISO/IEC 14882:2011 20.2.3(6),ISO/IEC 14882:2017 23.2.5(5)", |
1686 | 1692 | "reference": "C++ Core Guidelines ES.56,C++ Core Guidelines F.18,C++ Core Guidelines F.48" |
1687 | 1693 | }, |
1688 | 1694 | "ID_useAfterMove": { |
|
1699 | 1705 | "comment": "std::forward 的参数应为“转发引用(forwarding references)”,返回值应直接作为接口的参数,除此之外的使用方式价值有限,且易产生错误。", |
1700 | 1706 | "tag": "expression", |
1701 | 1707 | "related": "ID_illForwardingReference", |
| 1708 | + "standard": "ISO/IEC 14882:2011 20.2.3(1),ISO/IEC 14882:2017 23.2.5(1)", |
1702 | 1709 | "reference": "C++ Core Guidelines F.19" |
1703 | 1710 | }, |
1704 | 1711 | "ID_illForwardingReference": { |
|
2804 | 2811 | "tag": "security", |
2805 | 2812 | "related": "ID_sig_illReturn", |
2806 | 2813 | "standard": "ISO/IEC 9899:1999 6.5.5(5)-undefined,ISO/IEC 9899:2011 6.5.5(5)-undefined,ISO/IEC 14882:2011 5.6(4)-undefined,ISO/IEC 14882:2017 8.6(4)-undefined", |
2807 | | - "reference": "CWE-369,C++ Core Guidelines ES.105" |
| 2814 | + "reference": "CWE-189,CWE-369,C++ Core Guidelines ES.105" |
2808 | 2815 | }, |
2809 | 2816 | "ID_nullDerefAllocRet": { |
2810 | 2817 | "checkPoint": "判断资源分配函数的返回值是否有效", |
|
2844 | 2851 | "level": "warning", |
2845 | 2852 | "comment": "弱加密、弱哈希、弱随机、不安全的协议等相关库、函数、类、宏、常量等名称不应出现在代码中。", |
2846 | 2853 | "tag": "security", |
2847 | | - "config": [ "详见说明" ], |
2848 | 2854 | "reference": "CWE-326,CWE-327" |
2849 | 2855 | }, |
2850 | 2856 | "ID_badLength": { |
|
3251 | 3257 | "ID_unsafeStringFunction": { |
3252 | 3258 | "checkPoint": "禁用不安全的字符串函数", |
3253 | 3259 | "level": "warning", |
3254 | | - "comment": "由于历史原因,C 语言某些字符串函数不检查缓冲区长度,易造成运行时错误或安全漏洞。", |
| 3260 | + "comment": "由于历史原因,C 标准库中的某些字符串函数不执行边界检查,易造成运行时错误和安全漏洞。", |
3255 | 3261 | "tag": "security", |
3256 | | - "standard": "ISO/IEC 9899:2011 K.3.7", |
| 3262 | + "standard": "ISO/IEC 9899:2011 Annex K,ISO/IEC 9899:2011 K.3.7,ISO/IEC 9899:2011 K.3.9", |
3257 | 3263 | "related": "ID_bufferOverflow", |
3258 | 3264 | "reference": "CWE-119,CWE-120,CWE-676,MISRA C++ 2008 18-0-5" |
3259 | 3265 | }, |
|
3263 | 3269 | "comment": "当字符串无法被正确转为数值时,stdlib.h 或 cstdlib 中的 atof、atoi、atol 以及 atoll 等函数会导致标准未定义的行为。", |
3264 | 3270 | "tag": "expression", |
3265 | 3271 | "standard": "ISO/IEC 9899:1999 7.20.1(1)-undefined,ISO/IEC 9899:2011 7.22.1(1)-undefined", |
3266 | | - "reference": "CWE-190,MISRA C 2004 20.10,MISRA C 2012 21.7,MISRA C++ 2008 18-0-2" |
| 3272 | + "reference": "MISRA C 2004 20.10,MISRA C 2012 21.7,MISRA C++ 2008 18-0-2" |
3267 | 3273 | }, |
3268 | 3274 | "ID_forbidLongjmp": { |
3269 | 3275 | "checkPoint": "禁用 setjmp、longjmp", |
|
3274 | 3280 | "reference": "C++ Core Guidelines SL.C.1,MISRA C 2004 20.7,MISRA C 2012 21.4,MISRA C++ 2008 17-0-5" |
3275 | 3281 | }, |
3276 | 3282 | "ID_obsoleteFunction": { |
3277 | | - "checkPoint": "不应使用已过时的函数", |
| 3283 | + "checkPoint": "不应使用已过时的接口", |
3278 | 3284 | "level": "warning", |
3279 | | - "comment": "某些函数存在缺陷或漏洞并已宣布过时,应使用更完善的替代方法。", |
| 3285 | + "comment": "某些库函数或系统 API 存在缺陷并已宣布过时,应改用更完善的替代方法。", |
3280 | 3286 | "tag": "security", |
3281 | | - "config": [ "详见说明" ], |
3282 | 3287 | "reference": "CWE-477" |
3283 | 3288 | }, |
3284 | 3289 | "ID_dangerousFunction": { |
3285 | | - "checkPoint": "避免使用具有危险性的函数", |
| 3290 | + "checkPoint": "避免使用具有危险性的接口", |
3286 | 3291 | "level": "warning", |
3287 | | - "comment": "某些函数本身就具有危险性,使用这种函数相当于直接引入了风险。", |
| 3292 | + "comment": "某些库函数或系统 API 本身就具有危险性,使用这种接口相当于直接引入了风险。", |
3288 | 3293 | "tag": "security", |
3289 | | - "config": [ "详见说明" ], |
3290 | | - "reference": "CWE-242,CWE-474,CWE-676" |
| 3294 | + "reference": "CWE-242,CWE-676" |
3291 | 3295 | }, |
3292 | 3296 | "ID_implementationDefinedFunction": { |
3293 | 3297 | "checkPoint": "避免使用由实现定义的库函数", |
3294 | 3298 | "level": "warning", |
3295 | 3299 | "comment": "由实现定义的(implementation-defined)库函数会增加移植或兼容等方面的成本。", |
3296 | 3300 | "tag": "expression", |
3297 | 3301 | "standard": "ISO/IEC 9899:2011 7.14.1.1(3)-implementation,ISO/IEC 9899:2011 7.22.4.1(2)-implementation,ISO/IEC 9899:2011 7.22.4.4(5)-implementation,ISO/IEC 9899:2011 7.22.4.6(2)-implementation,ISO/IEC 9899:2011 7.22.4.8(3)-implementation,ISO/IEC 9899:2011 7.27.2.1(3)-implementation", |
3298 | | - "reference": "MISRA C 2004 20.8,MISRA C 2004 20.11,MISRA C 2004 20.12,MISRA C 2012 21.5,MISRA C 2012 21.8,MISRA C 2012 21.10,MISRA C++ 2008 18-0-3,MISRA C++ 2008 18-0-4,MISRA C++ 2008 18-7-1" |
| 3302 | + "reference": "CWE-474,CWE-589,MISRA C 2004 20.8,MISRA C 2004 20.11,MISRA C 2004 20.12,MISRA C 2012 21.5,MISRA C 2012 21.8,MISRA C 2012 21.10,MISRA C++ 2008 18-0-3,MISRA C++ 2008 18-0-4,MISRA C++ 2008 18-7-1" |
3299 | 3303 | }, |
3300 | 3304 | "ID_missingVoid": { |
3301 | 3305 | "checkPoint": "C 代码中参数列表如果为空应声明为“(void)”", |
|
0 commit comments