Skip to content

C++: add Declaration.hasGlobalOrStdName()#1585

Merged
dbartol merged 9 commits into
github:masterfrom
rdmarsh2:rdmarsh/cpp/hasGlobalOrStdName
Nov 12, 2019
Merged

C++: add Declaration.hasGlobalOrStdName()#1585
dbartol merged 9 commits into
github:masterfrom
rdmarsh2:rdmarsh/cpp/hasGlobalOrStdName

Conversation

@rdmarsh2

Copy link
Copy Markdown
Contributor

This adds Declaration.hasGlobalOrStdName and Declaration.hasStdName, and converts uses of hasGlobalName that refer to C standard library functions that are in the std namespace in C++ to use hasGlobalOrStdName instead.

@rdmarsh2 rdmarsh2 added the C++ label Jul 12, 2019
@rdmarsh2 rdmarsh2 requested a review from a team as a code owner July 12, 2019 17:37
@geoffw0

geoffw0 commented Jul 12, 2019

Copy link
Copy Markdown
Contributor

Changes LGTM.

Do you have any idea whether this is likely to create significant new results for any queries / projects?

Comment thread change-notes/1.22/analysis-cpp.md Outdated
@rdmarsh2 rdmarsh2 force-pushed the rdmarsh/cpp/hasGlobalOrStdName branch from 54e2330 to 77db30b Compare September 13, 2019 20:04
@rdmarsh2

Copy link
Copy Markdown
Contributor Author

Rebased over the autoformat patches and moved changenote to 1.23

hubwriter
hubwriter previously approved these changes Sep 16, 2019
semmledocs-ac
semmledocs-ac previously approved these changes Sep 16, 2019
Comment thread cpp/ql/src/Critical/OverflowCalculated.ql Outdated
Comment thread cpp/ql/src/Critical/OverflowStatic.ql Outdated
Comment thread cpp/ql/src/Security/CWE/CWE-022/TaintedPath.ql Outdated
Comment thread cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql Outdated
Comment thread cpp/ql/src/semmle/code/cpp/Declaration.qll Outdated
Comment thread cpp/ql/src/semmle/code/cpp/commons/File.qll Outdated
Comment thread cpp/ql/src/semmle/code/cpp/commons/File.qll Outdated
Comment thread cpp/ql/src/semmle/code/cpp/security/Security.qll Outdated
Comment thread cpp/ql/src/semmle/code/cpp/security/TaintTracking.qll
Comment thread cpp/ql/src/Critical/OverflowStatic.ql Outdated

predicate bufferAndSizeFunction(Function f, int buf, int size) {
f.hasGlobalOrStdName("read") and buf = 1 and size = 2
f.hasStdName("read") and buf = 1 and size = 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does the hasStdName() predicate do exactly? I ask because I don't believe that read (and other unbuffered I/O routines) get pulled into namespace std.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did that backwards - fixed after the rebase

@rdmarsh2 rdmarsh2 force-pushed the rdmarsh/cpp/hasGlobalOrStdName branch from e5cbf3c to 4018ed6 Compare October 2, 2019 18:42
@jbj

jbj commented Oct 3, 2019

Copy link
Copy Markdown
Contributor

I've resolved all my comments that you've addressed. Two are left.

@rdmarsh2 rdmarsh2 force-pushed the rdmarsh/cpp/hasGlobalOrStdName branch from 6a19497 to 5c084f8 Compare October 7, 2019 21:18

@jbj jbj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[ERROR] Input file ql/cpp/ql/src/Critical/OverflowCalculated.ql is not correctly formatted

Otherwise LGTM.

@dbartol dbartol self-assigned this Nov 12, 2019

@dbartol dbartol left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@dbartol dbartol merged commit 5b33255 into github:master Nov 12, 2019
jbj added a commit to jbj/ql that referenced this pull request Nov 20, 2019
This predicate was removed before github#1585 was merged, but we forgot to
remove it from the change note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants