Skip to content

Conversation

@MathiasVP
Copy link
Contributor

The lack of these models were causing some false negatives at Microsoft.

Copilot AI review requested due to automatic review settings January 9, 2025 17:34
@MathiasVP MathiasVP requested a review from a team as a code owner January 9, 2025 17:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 5 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • cpp/ql/test/library-tests/dataflow/external-models/flow.expected: Language not supported
  • cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected: Language not supported
  • cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp: Language not supported
  • cpp/ql/test/library-tests/dataflow/taint-tests/test_mad-signatures.expected: Language not supported

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@github-actions github-actions bot added the C++ label Jan 9, 2025
@MathiasVP MathiasVP added no-change-note-required This PR does not need a change note and removed no-change-note-required This PR does not need a change note labels Jan 9, 2025
Copy link
Contributor

@redsun82 redsun82 left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +7 to +8
- ["", "", False, "SysAllocStringByteLen", "", "", "Argument[*0]", "ReturnValue[*]", "value", "manual"]
- ["", "", False, "SysAllocStringLen", "", "", "Argument[*0]", "ReturnValue[*]", "value", "manual"]
Copy link
Contributor

Choose a reason for hiding this comment

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

These two presumably can cut the tail of the string passed in as an argument (when the passed length is too short). I assume we still consider that value flow (although part of the data has gone missing)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. We model that somewhat inconsistency across different models. For example, strncpy is currently modeled as taint because the length argument could mean that we only did a partial copy. In practice, I have a feeling that most of these length-bounded functions are used simply as defensive programming and do provide full copies in most cases. So nowadays I tend to lean towards modeling them as value-preserving.

Copy link

Choose a reason for hiding this comment

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

SysAllocString[Byte]Len are used when the input string is not null-terminated. BSTRs store their length explicitly, so it's really more that SysAllocString(s) is a shorthand for SysAllocStringLen(wcslen(s)). It's the same as the constructors for std::basic_string.

@MathiasVP MathiasVP merged commit a35dc7e into github:main Jan 10, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants