Log in
Confluence
  • Spaces
  • Hit enter to search
  • Help
    • Online Help
    • Keyboard Shortcuts
    • Feed Builder
    • What’s new
    • About Confluence
  • Log in

SEI CERT C++ Coding Standard
  • Pages

Space shortcuts

  • Dashboard
  • Secure Coding Home
  • Android
  • C
  • C++
  • Java
  • Perl

Page tree

Browse pages
    • Attachments (0)
    • Page History
    • Page Information
    • Resolved comments
    • View in Hierarchy
    • View Source
    • Export to PDF
    • Export to Word
  1. Pages
  2. SEI CERT C++ Coding Standard
  3. 2 Rules
  • Jira links

Rule 04. Containers (CTR)

  • Created by Aaron Ballman, last updated by David Svoboda on Jun 25, 2025 2 minute read

  • Page:
    CTR50-CPP. Guarantee that container indices and iterators are within the valid range
  • Page:
    CTR51-CPP. Use valid references, pointers, and iterators to reference elements of a container
  • Page:
    CTR52-CPP. Guarantee that library functions do not overflow
  • Page:
    CTR53-CPP. Use valid iterator ranges
  • Page:
    CTR54-CPP. Do not subtract iterators that do not refer to the same container
  • Page:
    CTR55-CPP. Do not use an additive operator on an iterator if the result would overflow
  • Page:
    CTR56-CPP. Do not use pointer arithmetic on polymorphic objects
  • Page:
    CTR57-CPP. Provide a valid ordering predicate
  • Page:
    CTR58-CPP. Predicate function objects should not be mutable


The following rules from the SEI CERT C Coding Standard also apply in C++:

  • Page:
    ARR30-C. Do not form or use out-of-bounds pointers or array subscripts
  • Page:
    ARR37-C. Do not add or subtract an integer to a pointer to a non-array object
  • Page:
    ARR38-C. Guarantee that library functions do not form invalid pointers
  • Page:
    ARR39-C. Do not add or subtract a scaled integer to a pointer

Information for Editors
To have a new guideline automatically listed above be sure to label it ctr and rule.

Risk Assessment Summary

Rule

Severity

Likelihood

Detectable

Repairable

Priority

Level

CTR50-CPPHighLikelyNoNo

P9

L2

CTR51-CPPHighProbableNoNo

P6

L2

CTR52-CPPHighLikelyNoNo

P9

L2

CTR53-CPPHighProbableNoNo

P6

L2

CTR54-CPPMediumProbableNoNo

P4

L3

CTR55-CPPHighLikelyNoNo

P9

L2

CTR56-CPPHighLikelyNoNo

P9

L2

CTR57-CPPLowProbableNoNo

P2

L3

CTR58-CPPLowLikelyYesNo

P6

L2




  • rule-list
  • ctr
  • rule
  • section
Overview
Content Tools
  • Powered by Atlassian Confluence 9.2.12
  • Printed by Atlassian Confluence 9.2.12
  • Report a bug
  • Atlassian News
Atlassian

Carnegie Mellon University
Software Engineering Institute
4500 Fifth Avenue
Pittsburgh, PA 15213-2612
412-268-5800

Contact Us
  • Office Locations|
  • Additional Sites Directory|
  • Legal|
  • Privacy Notice|
  • CMU Ethics Hotline|
  • www.sei.cmu.edu

©2025 Carnegie Mellon University

{"serverDuration": 67, "requestCorrelationId": "c2ebb6431f125635"}