Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: eliminate compliant solution based on runtime assertion and clarified the intent of using a valid() function.

Wiki Markup
Many functions accept pointers as arguments. If the function dereferences an invalid pointer (see [EXP34-C. Do not dereference null pointers]) or reads or writes to a pointer that does not refer to an object, the results are [undefined|BB. Definitions#undefined]. Typically, the program will terminate abnormally when an invalid pointer is dereferenced, but it is possible, for an invalid pointer to be dereferenced, and its memory changed, without abnormal termination \[[Jack 07|AA. References#JackBibliography#Jack 07]\]. Such programs can be difficult to debug because of the difficulty in determining if a pointer is valid.

...

Wiki Markup
\[[ISO/IEC 9899:1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\] Section 6.3.2.3, "Pointers"
\[[Jack 07|AA. References#JackBibliography#Jack 07]\]
\[[MITRE 07|AA. References#MITREBibliography#MITRE 07]\] [CWE ID 20|http://cwe.mitre.org/data/definitions/20.html], "Insufficient Input Validation"
\[[van Sprundel 06|AA. References#vanBibliography#van Sprundel 06]\]

...

MEM09-C. Do not assume memory allocation routines initialize memory      08. Memory Management (MEM)