Skip to content

Conversation

@geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented Nov 19, 2018

We've noticed curious results from "Missing return statement" (AV Rule 114.ql) recently where there are multiple results on functions with void return types (that really shouldn't be reported by this query). For example:
- boost 'output.c' line 31 (https://jenkins.internal.semmle.com/job/Build-Snapshot/job/boost/)
- jdku8 'p11_util.c' line 241
- powerDNS https://lgtm.com/projects/g/PowerDNS/pdns/rev/pr-df4d3165025fea0596de157837ac0c477b323f21

It turns out these functions have been extracted with multiple return types, typically int due to an implicitly declared use of the function before a proper void declaration is encountered. This PR adds a test and a simple solution to exclude such functions.

@ian-semmle what should the extractor be doing with code such as the new test case?

@geoffw0 geoffw0 added the C++ label Nov 19, 2018
@geoffw0 geoffw0 requested a review from a team as a code owner November 19, 2018 16:37
Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

Excellent. This fixes the problem for PowerDNS: https://lgtm.com/query/1107702639757094211/

@jbj jbj merged commit 6c0305c into github:master Nov 20, 2018
@ian-semmle
Copy link
Contributor

What it's doing seems reasonable to me. gcc says warning: conflicting types for ‘f13_func’, and clang says error: conflicting types for 'f13_func'.

cklin pushed a commit that referenced this pull request May 23, 2022
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.

3 participants