@@ -42,21 +42,6 @@ private Type getAFormatterWideTypeOrDefault() {
4242 * A standard library function that uses a `printf`-like formatting string.
4343 */
4444abstract class FormattingFunction extends ArrayFunction , TaintFunction {
45- int firstFormatArgumentIndex ;
46-
47- FormattingFunction ( ) {
48- firstFormatArgumentIndex > 0 and
49- if this .hasDefinition ( )
50- then firstFormatArgumentIndex = this .getDefinition ( ) .getNumberOfParameters ( )
51- else
52- if this instanceof BuiltInFunction
53- then firstFormatArgumentIndex = this .getNumberOfParameters ( )
54- else
55- forex ( FunctionDeclarationEntry fde | fde = this .getAnExplicitDeclarationEntry ( ) |
56- firstFormatArgumentIndex = fde .getNumberOfParameters ( )
57- )
58- }
59-
6045 /** Gets the position at which the format parameter occurs. */
6146 abstract int getFormatParameterIndex ( ) ;
6247
@@ -135,8 +120,21 @@ abstract class FormattingFunction extends ArrayFunction, TaintFunction {
135120 * Gets the position of the first format argument, corresponding with
136121 * the first format specifier in the format string. We ignore all
137122 * implicit function definitions.
123+ *
124+ * There is no result if the formatting function takes a `va_list` argument.
138125 */
139- int getFirstFormatArgumentIndex ( ) { result = firstFormatArgumentIndex }
126+ int getFirstFormatArgumentIndex ( ) {
127+ result > 0 and
128+ if this .hasDefinition ( )
129+ then result = this .getDefinition ( ) .getNumberOfParameters ( )
130+ else
131+ if this instanceof BuiltInFunction
132+ then result = this .getNumberOfParameters ( )
133+ else
134+ forex ( FunctionDeclarationEntry fde | fde = this .getAnExplicitDeclarationEntry ( ) |
135+ result = fde .getNumberOfParameters ( )
136+ )
137+ }
140138
141139 /**
142140 * Gets the position of the buffer size argument, if any.
0 commit comments