Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#CCCCFF
borderStylesolid
langc
#include <stdio.h>

typedef struct int_struct {
  int x;
} int_struct;

#define MAX_INTS 10

int main(void){
  size_t i;
  int_struct ints[MAX_INTS];

  for (i = 0; i < MAX_INTS; i++) {
    ints[i] = (int_struct){i};
  }

  for (i = 0; i < MAX_INTS; i++) {
    printf("%d\n", ints[i].x);
  }
 
  return 0;
}

Risk Assessment

Recommendation

Severity

Likelihood

Remediation Cost

Detectable

Repairable

Priority

Level

DCL21-C

Low

low

Unlikely

unlikely

No

medium

No

P2

L3

P1

L3

Automated Detection

Tool

Version

Checker

Description

Astrée
Include Page
Astrée_V
Astrée_V

Supported. Astrée reports runtime errors resulting from the misuse of compound literals.
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC-DCL21
Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C1054, C3217

Bibliography

[ISO/IEC 9899:2011]Subclause 6.5.2.5, "Compound Literals"

...


...

Image Modified Image Modified Image Modified