Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,8 @@
}
if (const char* const argIndirect = functionnode->Attribute("indirect")) {
const int indirect = strToInt<int>(argIndirect);
if (indirect < 0 || indirect >= static_cast<int>(ac.direction.size()))
return Error(ErrorCode::BAD_ATTRIBUTE_VALUE, argIndirect);
ac.direction[indirect] = dir; // TODO: handle multiple directions/indirect levels
}
else
Expand Down
17 changes: 17 additions & 0 deletions test/testlibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,23 @@ class TestLibrary : public TestFixture {

// comma followed by dot
LOADLIB_ERROR_INVALID_RANGE("-10:0,.5:");

// arg indirect out of range (index into ArgumentChecks::direction)
LOADLIBERROR("<?xml version=\"1.0\"?>\n"
"<def>\n"
" <function name=\"foo\">\n"
" <arg nr=\"1\" direction=\"in\" indirect=\"1000000\"/>\n"
" </function>\n"
"</def>",
Library::ErrorCode::BAD_ATTRIBUTE_VALUE);

LOADLIBERROR("<?xml version=\"1.0\"?>\n"
"<def>\n"
" <function name=\"foo\">\n"
" <arg nr=\"1\" direction=\"out\" indirect=\"-5\"/>\n"
" </function>\n"
"</def>",
Library::ErrorCode::BAD_ATTRIBUTE_VALUE);
}

void loadLibCombinations() const {
Expand Down
Loading