Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Wiki Markup
Two consecutive question marks signify the start of a trigraph sequence. According to the C99 Standard \[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\]:

All occurrences in a source file of the following sequences of three characters (that is, trigraph sequences) are replaced with the corresponding single character.

??=

#

 

??)

]

 

??!

|

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d183dd31c59e9031-d24373c7-4b7d451c-ade095ac-233bdb9ac57a75c75ad57841"><ac:plain-text-body><![CDATA[

??(

[

 

??'

^

 

??>

}

]]></ac:plain-text-body></ac:structured-macro>

??/

\

 

??<

{

 

??-

~

...

Inadvertent trigraphs can result in unexpected behavior. Some compilers provide options to warn when trigraphs are encountered or to disable trigraph expansion. Use the warning options and ensure your code compiles cleanly. (see See guideline MSC00-C. Compile cleanly at high warning levels.).

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

PRE07-C

low

unlikely

medium

P2

L3

Automated Detection

...

Tool

Version

Checker

Description

Section

LDRA tool suite

...

Include Page
c:LDRA_V
c:LDRA_V

 

 

Section

GCC

Include Page
c:GCC_V
c:GCC_V

 

Section

can detect violation of this recommendation when the -Wtrigraphs flag is used

...

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Other Languages

This rule appears in the C++ Secure Coding Standard as : PRE07-CPP. Avoid using repeated question marks.

Bibliography

Wiki Markup
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 5.2.1.1, "Trigraph sequences"
\[[MISRA 042004|AA. Bibliography#MISRA 04]\] Rule 4.2

...