CVE-2025-46333: CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer in vancluever z2d
z2d is a pure Zig 2D graphics library. Versions of z2d after `0.5.1` and up to and including `0.6.0`, when writing from one surface to another using `z2d.compositor.StrideCompositor.run`, and higher-level operations when the anti-aliasing mode is set to `.default` (such as `Context.fill`, `Context.stroke`, `painter.fill`, and `painter.stroke`), the source surface can be completely out-of-bounds on the x-axis, but not on the y-axis, by way of a negative offset. This results in an overflow of the value controlling the length of the stride. In non-safe optimization modes (consumers compiling with `ReleaseFast` or `ReleaseSmall`), this could potentially lead to invalid memory accesses or corruption. This issue is patched in version `0.6.1`. Users on an untagged version after `v0.5.1` and before `v0.6.1` are advised to update to address the vulnerability. Those still on Zig `0.13.0` are recommended to downgrade to `v0.5.1`.
AI Analysis
Technical Summary
CVE-2025-46333 is a high-severity vulnerability affecting the z2d library, a pure Zig language 2D graphics library developed by vancluever. The flaw exists in versions after 0.5.1 up to and including 0.6.0. It arises during operations where one graphical surface is written to another using the z2d.compositor.StrideCompositor.run method, as well as higher-level drawing operations such as Context.fill, Context.stroke, painter.fill, and painter.stroke when the anti-aliasing mode is set to .default. The vulnerability is triggered when the source surface is completely out-of-bounds on the x-axis due to a negative offset, while the y-axis remains within bounds. This causes an overflow in the stride length value, which controls the number of bytes per row in the image buffer. In non-safe optimization modes (specifically ReleaseFast or ReleaseSmall), this overflow can lead to invalid memory accesses or memory corruption. The root cause is improper restriction of operations within the bounds of a memory buffer, corresponding to CWE-119, with related issues CWE-122 (Heap-based Buffer Overflow) and CWE-190 (Integer Overflow or Wraparound). The vulnerability requires low privileges (PR:L), partial authentication (AT:P), and user interaction (UI:P) to exploit, with a CVSS 4.0 base score of 7.3 indicating high severity. Exploitation could compromise confidentiality, integrity, and availability of affected systems. The issue is patched in version 0.6.1, and users running untagged versions after 0.5.1 and before 0.6.1 should update immediately. Users on Zig 0.13.0 are advised to downgrade to 0.5.1 to avoid exposure. No known exploits are currently reported in the wild. The vulnerability affects software compiled with unsafe optimization modes, which are common in production builds prioritizing performance over safety checks.
Potential Impact
For European organizations utilizing the z2d graphics library in their software products or internal tools, this vulnerability poses a significant risk. Exploitation could allow attackers to execute arbitrary code, cause application crashes, or corrupt memory, potentially leading to denial of service or unauthorized data access. This is particularly critical for industries relying on graphical rendering, such as design software vendors, embedded systems manufacturers, or any custom applications using Zig and z2d for UI rendering. The requirement for user interaction and partial authentication limits remote exploitation but does not eliminate risk, especially in environments where users may be tricked into opening crafted files or inputs. The memory corruption could be leveraged to escalate privileges or move laterally within networks. Given the high severity and the potential for widespread impact on confidentiality, integrity, and availability, organizations must assess their use of z2d and related Zig-based components. The lack of known exploits in the wild reduces immediate threat but should not lead to complacency. Failure to patch could result in targeted attacks or supply chain compromises, especially as Zig gains adoption in European tech sectors.
Mitigation Recommendations
1. Immediate upgrade to z2d version 0.6.1 for all affected systems is the primary mitigation step. 2. For users on Zig 0.13.0, downgrade to z2d version 0.5.1 until a safe upgrade path is confirmed. 3. Audit all software builds to identify use of z2d versions between 0.5.1 and 0.6.0, particularly those compiled with ReleaseFast or ReleaseSmall optimization modes, and recompile with the patched library. 4. Implement strict input validation and sanitization for any user-supplied graphical data or parameters that interact with z2d rendering functions to reduce the risk of triggering the out-of-bounds condition. 5. Employ runtime memory protection mechanisms such as AddressSanitizer or similar tooling during development and testing to detect and prevent memory corruption issues. 6. Restrict user privileges and limit the ability of untrusted users to execute or interact with applications using z2d to reduce exploitation vectors. 7. Monitor application logs and system behavior for anomalies indicative of memory corruption or crashes related to graphics rendering. 8. Coordinate with software vendors and supply chain partners to ensure patched versions are deployed promptly. 9. Educate developers on safe usage patterns of z2d and the risks of unsafe optimization modes in production builds.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Poland
CVE-2025-46333: CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer in vancluever z2d
Description
z2d is a pure Zig 2D graphics library. Versions of z2d after `0.5.1` and up to and including `0.6.0`, when writing from one surface to another using `z2d.compositor.StrideCompositor.run`, and higher-level operations when the anti-aliasing mode is set to `.default` (such as `Context.fill`, `Context.stroke`, `painter.fill`, and `painter.stroke`), the source surface can be completely out-of-bounds on the x-axis, but not on the y-axis, by way of a negative offset. This results in an overflow of the value controlling the length of the stride. In non-safe optimization modes (consumers compiling with `ReleaseFast` or `ReleaseSmall`), this could potentially lead to invalid memory accesses or corruption. This issue is patched in version `0.6.1`. Users on an untagged version after `v0.5.1` and before `v0.6.1` are advised to update to address the vulnerability. Those still on Zig `0.13.0` are recommended to downgrade to `v0.5.1`.
AI-Powered Analysis
Technical Analysis
CVE-2025-46333 is a high-severity vulnerability affecting the z2d library, a pure Zig language 2D graphics library developed by vancluever. The flaw exists in versions after 0.5.1 up to and including 0.6.0. It arises during operations where one graphical surface is written to another using the z2d.compositor.StrideCompositor.run method, as well as higher-level drawing operations such as Context.fill, Context.stroke, painter.fill, and painter.stroke when the anti-aliasing mode is set to .default. The vulnerability is triggered when the source surface is completely out-of-bounds on the x-axis due to a negative offset, while the y-axis remains within bounds. This causes an overflow in the stride length value, which controls the number of bytes per row in the image buffer. In non-safe optimization modes (specifically ReleaseFast or ReleaseSmall), this overflow can lead to invalid memory accesses or memory corruption. The root cause is improper restriction of operations within the bounds of a memory buffer, corresponding to CWE-119, with related issues CWE-122 (Heap-based Buffer Overflow) and CWE-190 (Integer Overflow or Wraparound). The vulnerability requires low privileges (PR:L), partial authentication (AT:P), and user interaction (UI:P) to exploit, with a CVSS 4.0 base score of 7.3 indicating high severity. Exploitation could compromise confidentiality, integrity, and availability of affected systems. The issue is patched in version 0.6.1, and users running untagged versions after 0.5.1 and before 0.6.1 should update immediately. Users on Zig 0.13.0 are advised to downgrade to 0.5.1 to avoid exposure. No known exploits are currently reported in the wild. The vulnerability affects software compiled with unsafe optimization modes, which are common in production builds prioritizing performance over safety checks.
Potential Impact
For European organizations utilizing the z2d graphics library in their software products or internal tools, this vulnerability poses a significant risk. Exploitation could allow attackers to execute arbitrary code, cause application crashes, or corrupt memory, potentially leading to denial of service or unauthorized data access. This is particularly critical for industries relying on graphical rendering, such as design software vendors, embedded systems manufacturers, or any custom applications using Zig and z2d for UI rendering. The requirement for user interaction and partial authentication limits remote exploitation but does not eliminate risk, especially in environments where users may be tricked into opening crafted files or inputs. The memory corruption could be leveraged to escalate privileges or move laterally within networks. Given the high severity and the potential for widespread impact on confidentiality, integrity, and availability, organizations must assess their use of z2d and related Zig-based components. The lack of known exploits in the wild reduces immediate threat but should not lead to complacency. Failure to patch could result in targeted attacks or supply chain compromises, especially as Zig gains adoption in European tech sectors.
Mitigation Recommendations
1. Immediate upgrade to z2d version 0.6.1 for all affected systems is the primary mitigation step. 2. For users on Zig 0.13.0, downgrade to z2d version 0.5.1 until a safe upgrade path is confirmed. 3. Audit all software builds to identify use of z2d versions between 0.5.1 and 0.6.0, particularly those compiled with ReleaseFast or ReleaseSmall optimization modes, and recompile with the patched library. 4. Implement strict input validation and sanitization for any user-supplied graphical data or parameters that interact with z2d rendering functions to reduce the risk of triggering the out-of-bounds condition. 5. Employ runtime memory protection mechanisms such as AddressSanitizer or similar tooling during development and testing to detect and prevent memory corruption issues. 6. Restrict user privileges and limit the ability of untrusted users to execute or interact with applications using z2d to reduce exploitation vectors. 7. Monitor application logs and system behavior for anomalies indicative of memory corruption or crashes related to graphics rendering. 8. Coordinate with software vendors and supply chain partners to ensure patched versions are deployed promptly. 9. Educate developers on safe usage patterns of z2d and the risks of unsafe optimization modes in production builds.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-04-22T22:41:54.911Z
- Cisa Enriched
- true
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 682d983dc4522896dcbef937
Added to database: 5/21/2025, 9:09:17 AM
Last enriched: 6/24/2025, 6:23:09 PM
Last updated: 7/27/2025, 3:09:22 AM
Views: 6
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.