-
Notifications
You must be signed in to change notification settings - Fork 33
Security: Replace unsafe eval() with safe numeric parsing in core MATLAB library files (Issue #245) #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pradeeban
merged 8 commits into
ControlCore-Project:dev
from
GaneshPatil7517:fix/issue-245-remove-eval-matlab
Feb 11, 2026
Merged
Security: Replace unsafe eval() with safe numeric parsing in core MATLAB library files (Issue #245) #259
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7db41e4
Security: Replace unsafe eval() in MATLAB parsers with safe numeric p…
GaneshPatil7517 f209689
Update concore_initval.m
pradeeban 0371a28
Update concore_default_maxtime.m
pradeeban 1966e9d
Update concore_iport.m
pradeeban 23df70f
Update concore_read.m
pradeeban b600bed
Update concore_read.m
pradeeban ec4e9f0
Update concore_initval.m
pradeeban 764bc1a
Security: Also fix eval() in concore_oport.m
GaneshPatil7517 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,20 @@ | ||
| function [result] = concore_initval(simtime_val) | ||
| global concore; | ||
| result = eval(simtime_val); | ||
| % Safe numeric parsing (replaces unsafe eval) | ||
| clean_str = strtrim(simtime_val); | ||
| clean_str = regexprep(clean_str, '[\[\]]', ''); | ||
| clean_str = strrep(clean_str, ',', ' '); | ||
| result = sscanf(clean_str, '%f').'; | ||
| % Guard against empty or invalid numeric input | ||
| if isempty(result) | ||
| concore.simtime = 0; | ||
| result = []; | ||
| return; | ||
| end | ||
| concore.simtime = result(1); | ||
| result = result(2:length(result)); | ||
| if numel(result) >= 2 | ||
| result = result(2:end); | ||
| else | ||
| result = []; | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.