LDRA Testbed Code Review Report

LDRA Testbed ® Code Review Report

# Group : Dovecot-src-lib-test

Overall Result: FAIL

Report Production | Report Configuration | Analysis phases
--- | --- | ---
C/C++ LDRA Testbed Version: 8.3.0 Config. File: C:\Testbed\CCPP_830_Release\C\sate_creport.dat Produced On: Mon Aug 09 2010 at 20:03:52 Penalty File: C:\Testbed\CCPP_830_Release\c\cpen.dat | Report Level: Summary Report Procedures Reported: Fails Only Programming Standards Model: SATE 2010 L1 Plus Line Numbers refer to: Original Source File Violation Details: Violations Only Reporting Scope: Full analysis scope | Static: Yes Complexity: Yes Static Data Flow: Yes Information Flow: Yes Cross Reference: Yes

#### Contents

Overall Quality Summary

- Totals of Violations for each Standard
- Table of Procedure Results
- Table of Source Files in Group
- Table of Global Basic Information

Report on Program Components

- Quality Results Global Program and Selected Procedures

## Overall Quality Summary

#### Totals for Violated Quality Standards

Number of Violations | LDRA Code | (M) Mandatory Standards | CERT Code
--- | --- | --- | ---
40 | 77 S | Macro replacement list needs parentheses. | CERT PRE02-C
20 | 78 S | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
1 | 483 S | free parameter is not heap item. | CERT MEM34-C
2 | 484 S | Attempt to use already freed object. | CERT MEM31-C
3 | 45 D | Pointer not checked for null before use | CERT EXP08-C,EXP34-C
4 | 57 D | Global not initialised at declaration. | CERT EXP33-C

Number of Violations | LDRA Code | (C) Checking (Mandatory) Standards | CERT Code
--- | --- | --- | ---

No Checking Standards Violated

Number of Violations | LDRA Code | (O) Optional Standards | CERT Code
--- | --- | --- | ---

No Optional Standards Violated

Number of Mandatory Standards checked | 27
Number of Checking Standards checked | 1
Number of Optional Standards checked | 3
Total Standards checked | 31

### OVERALL RESULT: FAIL

Out of 18 program components, 13 (72.22 %) pass ( of which 0 conditionally pass ) and 5 fail ( of which 0 fail only because of insufficient comments )

#### Procedure Results

`Quality Result` |  | `Procedure` |  | `Source File` |  | `Unique Violations` |  | `Failure Density` |
`` |  |  |  |  | `(Viols/R.Line %)` |
FAIL |  | Global Program |
Pass |  | test_read |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_seek |  | test-common.c |  | 0 |  | 0 |
FAIL |  | test_istream_create_data |  | test-common.c |  | 25 | - |  | 13 | - |
Pass |  | test_istream_create |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_istream_set_allow_eof |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_istream_se _max_buffer_size |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_istream_set_size |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_begin |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_assert_failed |  | test-common.c |  | 0 |  | 0 |
FAIL |  | test_end |  | test-common.c |  | 25 | - |  | 3 | - |
FAIL |  | test_out |  | test-common.c |  | 25 | - |  | 20 | - |
FAIL |  | test_out_reason |  | test-common.c |  | 25 | - |  | 3 | - |
Pass |  | test_error_handler |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_init |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_deinit |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_run_funcs |  | test-common.c |  | 0 |  | 0 |
Pass |  | test_run |  | test-common.c |  | 0 |  | 0 |

#### Global Information

#### Source Files in Group

Name | Last Modification Date
--- | ---
C:\Code\SAMATE\SATE2010\dovecot-2.0.beta6.20100626\dovecot-2.0.beta6\src\lib-test\test-common.c | Wed Apr 28 19:00:04 2010

#### Global Basic Information

Number of procedures: | 17
Number of locally uncalled procedures: | 0
Maximum loop depth: | 2
Total Cyclomatic Complexity: | 26
Number of reformatted executable lines: | 307
Number of lines of comments: | 274

## Summary Report on all Program Components which FAIL

Globals / code outside procedures - FAIL

#### Standards Violation Summary - All files

Code | File: Src Line | Violation | Standard
--- | --- | --- | ---
M | compat.h: 77 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 78 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 79 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 88 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 214 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 215 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 216 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 217 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 218 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 219 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 220 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 221 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 222 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 223 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 224 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 225 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 226 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 153 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 153 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 155 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 155 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 167 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 168 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 175 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 175 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 176 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 176 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 194 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 194 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 203 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 49 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 51 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 75 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | data-stack.h: 85 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 90 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | data-stack.h: 90 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 97 | Macro replacement list needs parentheses. | CERT PRE02-C
M | mempool.h: 84 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 87 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 88 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 99 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 99 | Macro replacement list needs parentheses. | CERT PRE02-C
M | mempool.h: 102 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 102 | Macro replacement list needs parentheses. | CERT PRE02-C
M | imem.h: 8 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | imem.h: 8 | Macro replacement list needs parentheses. | CERT PRE02-C
M | imem.h: 14 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | imem.h: 14 | Macro replacement list needs parentheses. | CERT PRE02-C
M | imem.h: 15 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | imem.h: 15 | Macro replacement list needs parentheses. | CERT PRE02-C

Code | File: Src Line | Violation | Standard
--- | --- | --- | ---
M | array-decl.h: 4 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | array-decl.h: 4 | Macro replacement list needs parentheses. | CERT PRE02-C
M | array-decl.h: 7 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | array-decl.h: 7 | Macro replacement list needs parentheses. | CERT PRE02-C
M | array-decl.h: 9 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | array-decl.h: 9 | Macro replacement list needs parentheses. | CERT PRE02-C
M | istream.h: 53 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | istream.h: 53 | Macro replacement list needs parentheses. | CERT PRE02-C
M | test-common.h: 11 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | test-common.h: 11 | Macro replacement list needs parentheses. | CERT PRE02-C
M | test-common.c: 12 | Global not initialised at declaration. : test_prefix | CERT EXP33-C
M | test-common.c: 13 | Global not initialised at declaration. : test_success | CERT EXP33-C
M | test-common.c: 14 | Global not initialised at declaration. : failure_count | CERT EXP33-C
M | test-common.c: 15 | Global not initialised at declaration. : total_count | CERT EXP33-C

[ | Top of Report | | | Procedure Table | | | Contents | ]

test_istream_create_data (76 to 93 test-common.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 81 | Pointer not checked for null before use : tstream | CERT EXP08-C,EXP34-C
| 80 |  |
M | 80 | Pointer not checked for null before use : default_pool | CERT EXP08-C,EXP34-C
| Ref. Line -734 (Module 622) |  |

[ | Top of Report | | | Procedure Table | | | Contents | ]

test_end (139 to 146 test-common.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 144 | free parameter is not heap item. | CERT MEM34-C

[ | Top of Report | | | Procedure Table | | | Contents | ]

test_out (148 to 151 test-common.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 150 | Pointer not checked for null before use : NULL | CERT EXP08-C,EXP34-C

[ | Top of Report | | | Procedure Table | | | Contents | ]

test_out_reason (153 to 186 test-common.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 157 | Attempt to use already freed object. | CERT MEM31-C
M | 158 | Attempt to use already freed object. | CERT MEM31-C

[ | Top of Report | | | Procedure Table | | | Contents | ]

### End of Code Review Report

###

### Copyright © 2010 Liverpool Data Research Associates