Skip to content

Fix: security scan issues related to memory safety & input validation - #1723

Open
sruthi0107 wants to merge 3 commits into
ROCm:developfrom
sruthi0107:sec-fixes-mythos-ago
Open

Fix: security scan issues related to memory safety & input validation#1723
sruthi0107 wants to merge 3 commits into
ROCm:developfrom
sruthi0107:sec-fixes-mythos-ago

Conversation

@sruthi0107

Copy link
Copy Markdown
Contributor

Motivation

A security audit of the OpenVX GDF loader and AGO parser flagged several memory-safety and input-validation issues (buffer/integer overflows, a format-string bug, and an unrestricted module load). This PR fixes all of them.

Technical Details

  • Bounded string copies (ago_interface.cpp, ago_util.cpp): unbounded strcpy/sscanf("%s") of GDF tokens into fixed stack buffers replaced with snprintf / width specifiers (%63s, %255s) and length-checked memcpys.
    • Heap OOB write (ago_interface.cpp): added an AGO_MAX_PARAMS bounds check before the node->paramList[p] write.
    • Integer overflows (ago_util.cpp): tensor/image/remap allocation sizes now computed in 64-bit with __builtin_mul_overflow guards.
    • Format string (vxImage.cpp): GDF filename templates are validated (integer conversions only) before use as an snprintf format, blocking %n/%s.
    • Unrestricted import (ago_interface.cpp): agoLoadModule rejects module names with path separators or .., so a GDF can't dlopen an arbitrary library by path (bare search-path names still load).

Test Plan

Build from source and run ctests

Test Result

All ctests pass

@kiritigowda kiritigowda self-assigned this Jul 27, 2026
@kiritigowda kiritigowda added enhancement New feature or request bugfix Bug fixes to existing features ci:precheckin labels Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fixes to existing features ci:precheckin enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants