Module Printf

A library for dealing with printf-like formatting strings.

Import path

semmle.code.cpp.commons.Printf

Imports

CommonType
FormattingFunction

Provides a class for modeling printf-style formatting functions. To use this QL library, create a QL class extending DataFlowFunction with a characteristic predicate that selects the function or set of functions you are modeling. Within that class, override the predicates provided by FormattingFunction to match the flow within that function.

Printf
StringAnalysis
Type

Predicates

primitiveVariadicFormatter

A standard function such as vprintf that has a format parameter and a variable argument list of type va_arg.

variadicFormatter

Holds if f is a function such as vprintf that has a format parameter (at formatParamIndex) and a variable argument list of type va_arg.

Classes

AttributeFormattingFunction

A function that can be identified as a printf style formatting function by it’s use of the GNU format attribute.

FormatLiteral

A class to represent format strings that occur as arguments to invocations of formatting functions.

FormattingFunctionCall

A call to one of the formatting functions.

NsstringStringWithFormat

The Objective C method stringWithFormat:.

UserDefinedFormattingFunction

A function not in the standard library which takes a printf-like formatting string and a variable number of arguments.