Skip to content

Commit 3bc1b5e

Browse files
Copilothecko
andcommitted
Fix infinite recursion SEGV in DSM readFile self-include fallback
Co-authored-by: hecko <855807+hecko@users.noreply.github.com>
1 parent 210c701 commit 3bc1b5e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

_codeql_detected_source_root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.

apps/dsm/DSMStateDiagramCollection.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ bool DSMStateDiagramCollection::readFile(const string& filename, const string& n
110110
if (stat(include_name.c_str(), &status) != 0) {
111111
string with_ext = include_name + ".dsm";
112112
if (stat(with_ext.c_str(), &status) == 0 &&
113-
!(status.st_mode & S_IFDIR)) {
113+
!(status.st_mode & S_IFDIR) &&
114+
with_ext != filename) {
114115
DBG("'%s' not found, using '%s'\n",
115116
include_name.c_str(), with_ext.c_str());
116117
actual_include = with_ext;

0 commit comments

Comments
 (0)