Skip to content

fix: add integer overflow check in VectorTable.c - #485

Open
anupamme wants to merge 1 commit into
mtiller:masterfrom
anupamme:fix-repo-modelicabook-v-001-modelicabyexample-functions-interpolation-source-vectortable-c
Open

anupamme wants to merge 1 commit into
mtiller:masterfrom
anupamme:fix-repo-modelicabook-v-001-modelicabyexample-functions-interpolation-source-vectortable-c

Conversation

@anupamme

@anupamme anupamme commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Fix high severity security issue in ModelicaByExample/Functions/Interpolation/source/VectorTable.c.

Vulnerability

Field Value
ID V-001
Severity HIGH
Scanner multi_agent_ai
Rule V-001
File ModelicaByExample/Functions/Interpolation/source/VectorTable.c:23
Assessment Likely exploitable
CWE CWE-190

Description: The createVectorTable function allocates memory using 'sizeof(double)*np' without checking for integer overflow. If np is sufficiently large (e.g., near SIZE_MAX / sizeof(double)), the multiplication can overflow, resulting in a small allocation. Subsequent writes to table->x[i] and table->y[i] will write beyond the allocated buffer, causing heap corruption.

Evidence

Exploitation scenario: An attacker who controls the np parameter provides a value like 0x2000000000000000 (on 64-bit systems).

Scanner confirmation: multi_agent_ai rule V-001 flagged this pattern.

Threat Model Context

This is a local CLI tool - exploitation requires the attacker to control command-line arguments or input files.

Changes

  • ModelicaByExample/Functions/Interpolation/source/VectorTable.c

Behavior Preservation

The change is scoped to 1 file on the vulnerable path.


Automated security fix by OrbisAI Security

The createVectorTable function allocates memory using 'sizeof(double)*np' without checking for integer overflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant