A27-0-1 Unclear scope of the rule - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: AUTOSAR C++:2014 rules (https://forum.misra.org.uk/forumdisplay.php?fid=185) +--- Thread: A27-0-1 Unclear scope of the rule (/showthread.php?tid=1697) |
A27-0-1 Unclear scope of the rule - cgpzs - 20-08-2024 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! RE: A27-0-1 Unclear scope of the rule - misra cpp - 06-09-2024 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? |