
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
:Authors: Michael Griffin
:Version: 8.5.3 for 2025-01-13 :Copyright: 2014 - 2025 :License: This document may be distributed under the Apache 2.0 License. :Language: Python 3.6 or later
The arrayfunc module provides high speed array processing functions for use with the standard Python array module. These functions are patterned after the functions in the standard Python Itertools and math module together with some additional ones from other sources.
The purpose of these functions is to perform mathematical calculations on arrays faster than using native Python.
See full documentation at: http://arrayfunc.readthedocs.io/en/latest/
If you are installing on an ARM platform such as the Raspberry Pi, see the installation notes at the end before attempting to install from PyPI using PIP.
The functions fall into several categories.
========= ====================================================================== Function Description ========= ====================================================================== count Fill an array with evenly spaced values using a start and step values. cycle Fill an array with evenly spaced values using a start, stop, and step values, and repeat until the array is filled. repeat Fill an array with a specified value. ========= ======================================================================
============== ================================================================= Function Description ============== ================================================================= afilter Select values from an array based on a boolean criteria. compress Select values from an array based on another array of boolean values. dropwhile Select values from an array starting from where a selected criteria fails and proceding to the end. takewhile Like dropwhile, but starts from the beginning and stops when the criteria fails. ============== =================================================================
============== ================================================================= Function Description ============== ================================================================= findindex Returns the index of the first value in an array to meet the specified criteria. findindices Searches an array for the array indices which meet the specified criteria and writes the results to a second array. Also returns the number of matches found. ============== =================================================================
============== ================================================================= Function Description ============== ================================================================= aany Returns True if any element in an array meets the selected criteria. aall Returns True if all element in an array meet the selected criteria. amax Returns the maximum value in the array. amin Returns the minimum value in the array. asum Calculate the arithmetic sum of an array. ============== =================================================================
========= ====================================================================== Function Description ========= ====================================================================== convert Convert arrays between data types. The data will be converted into the form required by the output array. ========= ======================================================================
=========== =============================================== Function Equivalent to =========== =============================================== add x + y truediv x / y floordiv x // y mod x % y mul x * y neg -x pow x**y or math.pow(x, y) pow2 x * x or math.pow(x, 2) pow3 x * x * x or math.pow(x, 3) sub x - y abs_ abs(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== eq x == y gt x > y ge x >= y lt x < y le x <= y ne x != y =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== and_ x & y or_ x | y xor x ^ y invert ~x lshift x << y rshift x >> y =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== exp math.exp(x) expm1 math.expm1(x) log math.log(x) log10 math.log10(x) log1p math.log1p(x) log2 math.log2(x) sqrt math.sqrt(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== acosh math.acosh(x) asinh math.asinh(x) atanh math.atanh(x) cosh math.cosh(x) sinh math.sinh(x) tanh math.tanh(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== acos math.acos(x) asin math.asin(x) atan math.atan(x) atan2 math.atan2(x, y) cos math.cos(x) hypot math.hypot(x, y) sin math.sin(x) tan math.tan(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== degrees math.degrees(x) radians math.radians(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== ceil math.ceil(x) copysign math.copysign(x, y) fabs math.fabs(x) factorial math.factorial(x) floor math.floor(x) fmod math.fmod(x, y) isfinite math.isfinite(x) isinf math.isinf(x) isnan math.isnan(x) ldexp math.ldexp(x, y) trunc math.trunc(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== erf math.erf(x) erfc math.erfc(x) gamma math.gamma(x) lgamma math.lgamma(x) =========== ===============================================
=========== =============================================== Function Equivalent to =========== =============================================== fma fma(x, y, z) or x * y + z =========== ===============================================
Attributes
In addition to functions, a set of attributes are provided representing the platform specific maximum and minimum numerical values for each array type. These attributes are part of the "arraylimits" module.
Arrayfunc supports all standard Python 3.x array types.
Average performance increase on x86_64 Ubuntu with GCC is 100 times faster than native Python. Performance will vary depending on the function, operation, array data type used, and whether overflow checking is enabled, with the performance increase ranging from 50% to 3000 times.
Other platforms show similar improvements.
Detailed performance figures are listed in the full documentation.
Arrayfunc is written in 'C' and uses the standard C libraries to implement the underlying math functions. Arrayfunc has been tested on the following platforms.
======================= ======= ==== ======== =======
OS Arch Bits Compiler Python
======================= ======= ==== ======== =======
almalinux 9.5 x86_64 64 GCC 3.9.19
alpine 3.20.3 i686 32 GCC 3.12.7
Debian 12 i686 32 GCC 3.11.2
Debian 12 x86_64 64 GCC 3.11.2
FreeBSD 14.1 amd64 64 Clang 3.11.10
OpenBSD 7.6 amd64 64 Clang 3.11.10
Raspbian 12 armv7l 32 GCC 3.11.2
Ubuntu 24.04 aarch64 64 GCC 3.12.3
Debian 12 aarch64 64 GCC 3.11.2
opensuse-leap 15.6 x86_64 64 GCC 3.6.15
Ubuntu 24.04 x86_64 64 GCC 3.12.3
Ubuntu 24.10 x86_64 64 GCC 3.12.7
MS Windows 11 AMD64 64 MSC 3.13.1
======================= ======= ==== ======== =======
amd64 and x86_64 are two names for the same thing. armv7l is 32 bit ARM. aarch64 is 64 bit ARM. The ARM test hardware consists of Raspberry PI models 3, 4, and 5.
Please note that this is a Python 3 package. To install using Pip, you will need (with Debian package in brackets):
example::
# Install from PyPI.
pip3 install arrayfunc
# Force install from PyPI source instead of using a binary wheel.
pip3 install --user --force-reinstall --no-binary=:all: arrayfunc
# Install from a local copy of the source package (Linux).
pip3 install --no-index --find-links=. arrayfunc
# Install a local package as a user package.
pip3 install --user --no-index --find-links=. arrayfunc
# Windows, FreeBSD, and OpenBSD seems to use "pip" instead
# of "pip3" for some reason.
pip install arrayfunc
Newer versions of OpenBSD and FreeBSD will not install this package correctly when running setup.py directly. Use pip to install, even for local package installs. Testing of this package has been changed to use only pip (or pip3) in order to provide a common testing method for all platforms. Testing using setup.py directly is no longer done.
Recent versions of PyPI seem to be building their own binary wheels for some platforms using their own infrastruction. This may result in an invalid ARM binary on Raspberry Pi.
If you have difficulties, then either download the tar.gz version and install it locally (see the above instructions for a local install). Alternatively, see the above example for how to force a binary install instead of using a wheel. There is also a bash script called "setupuser.sh" which will call setup. py directly with the appropriate parameters.
The setup.py file has platform detection code which it uses to pass the correct flags to the C compiler. For ARM, this includes the CPU type. If you are using an ARM CPU type which is not recognized then setup.py may not compile in SIMD features. You can experiment with modifying setup.py to add new ARM models, but be sure that anything you try is compatible with the existing ones.
PEP-668 (PEPs describe changes to Python) introduced a new feature which can affect how packages are installed with PIP. If PIP is configured to be EXTERNALLY-MANAGED it will refuse to install a package outside of a virtual environment.
The intention of this is to prevent conflicts between packages which are installed using the system package manager, and ones which are installed using PIP.
Linux distros which are affeced by this include the latest versions of Debian and Ubuntu.
As this package is a library which is intended to be used by other applications, there is no one right way to install it, whether inside or outside of a virtual environment. Review the options available with PIP to see what is suitable for your application.
For testing purposes this package was installed by setting the environment variable PIP_BREAK_SYSTEM_PACKAGES to "1", which effectively disables this feature in PIP.
example::
export PIP_BREAK_SYSTEM_PACKAGES=1
FAQs
Fast array processing functions
We found that arrayfunc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.