You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Secure-Coding-Guide-for-Python/CWE-682/CWE-1335/README.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,7 +164,7 @@ print("Will never reach here")
164
164
165
165
## Compliant Solution
166
166
167
-
Bit-shifting is an optimization pattern that works better for languages closer to the CPU than Python. Math in Python is better done by arithmetical functions in Python as stated by *NUM01-P3 Do Not Perform Bit-wise and Arithmetic Operations on the Same Data*[[SEI CERT JAVA 2024]](https://eteamspace.internal.ericsson.com/pages/viewpage.action?pageId=1122687324).
167
+
Bit-shifting is an optimization pattern that works better for languages closer to the CPU than Python. Math in Python is better done by arithmetical functions in Python as stated by *CWE-1335: Promote readability and compatibility by using mathematical written code with arithmetic operations instead of bit-wise operations*[[OpenSSF Secure Coding in Python 2025]](https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Secure-Coding-Guide-for-Python/CWE-682/CWE-1335/01/README.md).
168
168
Understanding `ctypes` or `C` requires understanding the *CERT C Coding Standard*[[SEI CERT C 2025]](https://www.securecoding.cert.org/confluence/display/seccode/CERT+C+Coding+Standard)and setting boundaries manually in Python.
169
169
170
170
## Automated Detection
@@ -176,6 +176,15 @@ Not available
176
176
<table>
177
177
<tr>
178
178
<td>
179
+
<ahref="https://github.com/ossf/wg-best-practices-os-developers/tree/main/docs/Secure-Coding-Guide-for-Python">[OpenSSF Secure Coding in Python 2025]</a>
180
+
</td>
181
+
<td>
182
+
<ahref="https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Secure-Coding-Guide-for-Python/CWE-682/CWE-1335/01/README.md">CWE-1335: Promote readability and compatibility by using mathematical written code with arithmetic operations instead of bit-wise operations</a>
0 commit comments