VSS Package Index Abraxas VSS Home Table of Contents
// 4.2.2 Software Integrity
/*
Self-modifying, dynamically loaded, or interpreted code is prohibited, except under
the security provisions outlined in section 6.4.e. This prohibition is to ensure that the
software tested and approved during the qualification process remains unchanged and
retains its integrity. External modification of code during execution shall be
prohibited. Where the development environment (programming language and
development tools) includes the following features, the software shall provide
controls to prevent accidental or deliberate attempts to replace executable code:
*/
// a Unbounded arrays or strings (includes buffers used to move data)
// global
char foo[]; // bad unbounded
char foo1[100]; // good
// local
Function Definition: v1char foo[]; // bad unboundedchar foo1[100]; // goodAbraxas Software, Inc.
Module - v422b.html
// 4.2.2 Software Integrity/*Self-modifying, dynamically loaded, or interpreted code is prohibited, except underthe security provisions outlined in section 6.4.e. This prohibition is to ensure that thesoftware tested and approved during the qualification process remains unchanged andretains its integrity. External modification of code during execution shall beprohibited. Where the development environment (programming language anddevelopment tools) includes the following features, the software shall providecontrols to prevent accidental or deliberate attempts to replace executable code:*/// b Pointer variablescp = 1; // NO, verboten*cp = 1; // NOFunction Definition: vss_542bcp = 1; // NO, verboten*cp = 1; // NOAbraxas Software, Inc.
Module - v422c.html
// 4.2.2 Software Integrity/*Self-modifying, dynamically loaded, or interpreted code is prohibited, except underthe security provisions outlined in section 6.4.e. This prohibition is to ensure that thesoftware tested and approved during the qualification process remains unchanged andretains its integrity. External modification of code during execution shall beprohibited. Where the development environment (programming language anddevelopment tools) includes the following features, the software shall providecontrols to prevent accidental or deliberate attempts to replace executable code:*/// c Dynamic memory allocation and management.Function Definition: v422cchar *mp = malloc(100); // illegalfree(mp); // illegalAbraxas Software, Inc.
Module - v423a.html
/*423a. Each module shall have a specific function that can be tested and verifiedindependently of the remainder of the code. In practice, some additionalmodules (such as library modules) may be needed to compile the moduleunder test, but the modular construction allows the supporting modules to bereplaced by special test versions that support test objectives;1 Some software languages and development environments use a different definition ofmodule but this principle still applies.*/Function Definition: vss_v423aFunction Definition: vss_v423aAbraxas Software, Inc.
Module - v423b.html
/*VSS 423b. Each module shall be uniquely and mnemonically named, using names thatdiffer by more than a single character. In addition to the unique name, themodules shall include a set of header comments identifying the modulespurpose, design, conditions, and version history, followed by the operationalcode. Headers are optional for modules of fewer than ten executable lineswhere the subject module is embedded in a larger module that has a headercontaining the header information. Library modules shall also have a headercomment describing the purpose of the library and version information;*/Function Definition: vss_423bvss_423b() { // good function, is similiar to module nameFunction Definition: testtest() { // ok, small routineFunction Definition: testfuntestfun() { // bad this function doesn't belong hereAbraxas Software, Inc.
Module - v423c.html
/*423c. All required resources, such as data accessed by the module, should either becontained within the module or explicitly identified as input or output to themodule. Within the constraints of the programming language, such resourcesshall be placed at the lowest level where shared access is needed. If thatshared access level is across multiple modules, the definitions should bedefined in a single file (called header files in some languages, such as C)where any changes can be applied once and the change automatically appliesto all modules upon compilation or activation;*/int v423c ; // no global dataAbraxas Software, Inc.
Module - v423e.html
/*423e. Each module shall have a single entry point, and a single exit point, fornormal process flow. For library modules or languages such as the objectorientedlanguages, the entry point is to the individual contained module ormethod invoked. The single exit point is the point where control is returned.At that point, the data that is expected as output must be appropriately set.The exception for the exit point is where a problem is so severe thatexecution cannot be resumed. In this case, the design must explicitly protectall recorded votes and audit log information and must implement formalexception handlers provided by the language; and*/Function Definition: Func1/* Do some stuff with dog and clog here */} /* This is not allowed two return points *///This also applies to exit() calls.Function Definition: vss_423ereturn; // explicit return at end of function is ok,Abraxas Software, Inc.
Module - v425c.html
/*425 c. Names shall be unique within an application. Names shall differ by more thana single character. All single-character names are forbidden except those forvariables used as loop indexes. In large systems where subsystems tend to bedeveloped independently, duplicate names may be used where the scope ofthe name is unique within the application. Names should always be uniquewhere modules are shared;*/int d = 0; /* not allowed unless used in as a loop index */Function Definition: v4for ( ;; i ) {} // oki++; // baddog++; // goodFunction Definition: v4a//For example:switch(i){ //not allowedAbraxas Software, Inc.
Module - v427a.html
/*427 a. All modules shall contain headers. For small modules of 10 lines or less, theheader may be limited to identification of unit and revision information. Otherheader information should be included in the small unit headers if not clear fromthe actual lines of code.*//* =========================================================================*//**FUNCTION: VSS_BeginTasks()PURPOSE: Initialize all tasks.PARAMETERS:noneOUTPUT PARAMETERS:IntegerRETURN VALUE:int = 0 for success or positive value for failureUSE OF GLOBALS:FILES REFERENCED:FUNCTIONS CALLED:readREVISIONS:*/Function Definition: VSS_BeginTasks// line 5// line 10// bad case, no headerFunction Definition: VSS_BeginTask_BAD// line 5// line 10Function Definition: v5tiny// ok, smallAbraxas Software, Inc.
Module - v427b.html
/*427 b. Descriptive comments shall be provided to identify objects and data types.All variables shall have comments at the point of declaration clearlyexplaining their use. Where multiple variables that share the same meaningare required, the variables may share the same comment;*/// first foo is bad at line 9, no comment associatedint fuu; /* ok */// goodint fubar; //goodFunction Definition: v6v6() { // next foo is bad, no commentint fubar; //good//O.K. Does this one also take into account - YES/* good */Abraxas Software, Inc.
Module - v542k.html
/*5.4.2 Assessment of Coding ConventionsK. Has no line of code exceeding 80 columns in width (including comments andtab expansions) without justification;*/// bad long lineAbraxas Software, Inc.
Module - v542r.html
/*5.4.2 Assessment of Coding Conventionsr. Has functions with fewer than six levels of indented scope, counted asfollows:*/Function Definition: function_v542K//1//2//3//4//5//codeFunction Definition: function_v542K_bad//1//2//3//4//5if ( f > 0 ) { exit(); } // six, ILLEGALAbraxas Software, Inc.
Module - v542s.html
/*vss 542s. Initializes every variable upon declaration where permitted*/// globalint foo = 1; //goodint foam; // bad// localFunction Definition: v8int foo = 1; // goodint foam; // badAbraxas Software, Inc.
Module - v542u.html
/*vss542u. Has all constants other than 0 and 1 defined or enumerated, or shall have acomment which clearly explains what each constant means in the context ofits use. Where 0 and 1 have multiple meanings in the code unit, eventhey should be identified. Example: 0 may be used as FALSE, initializinga counter to zero, or as a special flag in a non-binary category.*/// good caseschar my_array[FOURLETTERWORD]; // is fineint array[100]; // good, has comment// BAD CASES FOLLOW ....Abraxas Software, Inc.
Module - v542v.html
/*542 v. Only contains the minimum implementation of the a = b ? c : d syntax.Expansions such as j=a?(b?c:d):e; are prohibited.*/Function Definition: f542va = b ? c : d ; // even the usage of this is questionable, the use of nested is illegalVSS Package Index Abraxas VSS Home Table of ContentsCodeCheck Copyright (c) 1988-2006 by Abraxas Software Inc. (R). All rights reserved.