Skip to content
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

[IAST] Fix version parsing in Dataflow #5263

Merged
merged 1 commit into from
Mar 7, 2024
Merged
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
12 changes: 7 additions & 5 deletions tracer/src/Datadog.Tracer.Native/iast/dataflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ Dataflow::Dataflow(ICorProfilerInfo* profiler)
HRESULT hr = profiler->QueryInterface(__uuidof(ICorProfilerInfo3), (void**) &_profiler);
if (_profiler != nullptr)
{
WCHAR version[1024];
ULONG versionLength;
if (SUCCEEDED(_profiler->GetRuntimeInformation(nullptr, &m_runtimeType, nullptr, nullptr, nullptr, nullptr, 1024,
&versionLength, version)))
USHORT major;
USHORT minor;
USHORT build;

if (SUCCEEDED(_profiler->GetRuntimeInformation(nullptr, &m_runtimeType, &major, &minor, &build, nullptr, 0,
nullptr, nullptr)))
{
m_runtimeVersion = GetVersionInfo(version);
m_runtimeVersion = VersionInfo{major, minor, build, 0};
}
}
trace::Logger::Info("Dataflow::Dataflow -> Detected runtime version : ", m_runtimeVersion.ToString());
Expand Down
2 changes: 1 addition & 1 deletion tracer/src/Datadog.Tracer.Native/iast/iast_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ static thread_local std::unordered_map<void *, bool> locked;
VersionInfo GetVersionInfo(const std::string& version)
{
auto v = version;
if (StartsWith(v, "V"))
if (StartsWith(v, "V") || StartsWith(v, "v"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be unit tests for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably? That's up to ASM though.

{
v = v.substr(1);
}
Expand Down
Loading