Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A27-0-1 Unclear scope of the rule
#1
Hi,

Rule A27-0-1 says:

Rule A27-0-1 (required, implementation, non-automated)
Inputs from independent components shall be validated.

This is very abstract and vague:

* What is the definition of "independent components"?
* Validated, in what context? When doing what?

The rule is in the section "Input/output library", and the code examples of this rule only talk about string manipulation/formatting functions. Can we therefore assume that this rule is only concerned with validating input passed to string manipulation/formatting functions?

Thanks!
Reply
#2
Firstly, the rule isn't only concerned with string functions

Your project has to decide what an independent component is, with regard to where it is getting its information from. We believe that the spirit of the rule is to validate any input that you do not have guarantees on it or which comes from an untrustworthy source.

The interpretation of 'validate' depends on the expectations you have for the data being input. Should it be in a particular range of values or in a particular format? What happens when those expectations aren't met?
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)