mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
C++: Reject invalid results from getFirstFormatArgumentIndex()
This commit is contained in:
@@ -50,8 +50,6 @@ private class Fprintf extends FormattingFunction, NonThrowingFunction {
|
||||
override int getFormatParameterIndex() { result = 1 }
|
||||
|
||||
override int getOutputParameterIndex(boolean isStream) { result = 0 and isStream = true }
|
||||
|
||||
override int getFirstFormatArgumentIndex() { result = 2 }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -125,6 +125,7 @@ abstract class FormattingFunction extends ArrayFunction, TaintFunction {
|
||||
// The formatting function either has a definition in the snapshot, or all
|
||||
// `DeclarationEntry`s agree on the number of parameters (otherwise we don't
|
||||
// really know the correct number)
|
||||
result > 0 and // Avoid invalid declarations
|
||||
if this.hasDefinition()
|
||||
then result = this.getDefinition().getNumberOfParameters()
|
||||
else result = this.getNumberOfExplicitParameters()
|
||||
|
||||
Reference in New Issue
Block a user