Skip to content

pySCG: Numbers related landing page to explain generic issues, such as array with ctypes and numpy #712

Open
@myteron

Description

@myteron

Numbers landing page to explain generic issues around:

  • Hardware limitations
  • A Python int can be much bigger than what is known as 64 bit int and why NUM13 does not apply
  • Python relation to primitive int numpy ctypes
  • implicit conversion can come unexpected
  • explicit conversion can have unexpected results.
  • Upper boundaries
  • Lower boundaries.

Content that is helpful for understanding numbers or above points and applicable for all numeric related issues such as
Avoid loss of precision when converting primitive integers to floating-point

Pythons array module is the closest thing to primitive types mentioned in the Java or C rules such as unsigned or signed int, float, long or char. The array module should be at least mentioned together with numpy and ctypes.

CWE-191: Detect or prevent integer overflow

"by classes and are protected against overflows.  Primitive types such as numpy , time  or ctype share issues known from C , or C++"

CWE-1335: Incorrect Bitwise Shift of Integer

CWE-1335: Promote readability and compatibility by using mathematical written code with arithmetic operations instead of bit-wise operations

"outcomes. Python's ctypes  module allows integration of C based system libraries into Python and direct access to C-type variables that can have"

CWE-197: Control rounding when converting to less precise numbers

"Python has ctypes module allowing users to work with many different data types. "

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions