LDRA Testbed Code Review Report

LDRA Testbed ® Code Review Report

# System : Dovecot-src-lib-charset

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 19:14:00 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 System
- 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
--- | --- | --- | ---
32 | 77 S | Macro replacement list needs parentheses. | CERT PRE02-C
16 | 78 S | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
2 | 5 D | Procedure contains UR data flow anomalies. | CERT EXP33-C
4 | 45 D | Pointer not checked for null before use | CERT EXP08-C,EXP34-C
2 | 69 D | Procedure contains UR data flow anomalies. | CERT EXP33-C

Number of Violations | LDRA Code | (C) Checking (Mandatory) Standards | CERT Code
--- | --- | --- | ---
1 | 76 D | Procedure not called in code analysed |

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 11 program components, 7 (63.64 %) pass ( of which 0 conditionally pass ) and 4 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 |  | buffer_get_data |  | buffer.h analysed in charset-iconv.c |  | 0 |  | 0 |
Pass |  | buffer_get_used_size |  | buffer.h analysed in charset-iconv.c |  | 0 |  | 0 |
Pass |  | uni_utf8_char_bytes |  | unichar.h analysed in charset-iconv.c |  | 0 |  | 0 |
FAIL |  | charset_to_utf8_begin |  | charset-iconv.c |  | 13 | - |  | 4 | - |
Pass |  | charset_to_utf8_end |  | charset-iconv.c |  | 0 |  | 0 |
Pass |  | charset_to_utf8_reset |  | charset-iconv.c |  | 0 |  | 0 |
FAIL |  | charset_to_utf8_try |  | charset-iconv.c |  | 38 | - |  | 4 | - |
Pass |  | charset_to_utf8 |  | charset-iconv.c |  | 0 |  | 0 |
Pass |  | charset_is_utf8 |  | charset-utf8.c |  | 0 |  | 0 |
FAIL |  | charset_to_utf8_str |  | charset-utf8.c |  | 50 | - |  | 31 | - |

#### Global Information

#### Source Files in System

Name | Last Modification Date
--- | ---
C:\Code\SAMATE\SATE2010\dovecot-2.0.beta6.20100626\dovecot-2.0.beta6\src\lib-charset\charset-utf8.c | Fri Mar 26 07:16:36 2010
C:\Code\SAMATE\SATE2010\dovecot-2.0.beta6.20100626\dovecot-2.0.beta6\src\lib-charset\charset-iconv.c | Mon Jun 21 19:00:04 2010

#### Global Basic Information

Number of procedures: | 10
Number of locally uncalled procedures: | 0
Maximum loop depth: | 1
Total Cyclomatic Complexity: | 28
Number of reformatted executable lines: | 287
Number of lines of comments: | 1207

## 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: 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: 196 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 197 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 204 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 204 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 205 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 205 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 223 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 223 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 232 | 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
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

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

charset_to_utf8_begin (18 to 37 charset-iconv.c) - FAIL

#### Standards Violation Summary

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

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

charset_to_utf8_try (56 to 126 charset-iconv.c) - FAIL

#### Standards Violation Summary

Code | Violation | Standard
--- | --- | ---
M | Procedure contains UR data flow anomalies. | CERT EXP33-C

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 95 | Pointer not checked for null before use : ic_srcbuf | CERT EXP08-C,EXP34-C
| 93 |  |
M | 95 | Pointer not checked for null before use : ic_destbuf | CERT EXP08-C,EXP34-C
| 86 |  |
M | 62 | Procedure contains UR data flow anomalies. : tmpbuf | CERT EXP33-C
| 123 |  |

#### Possible UR Anomalies

The following variables may be referenced before being given a value

File | Undefine | File | Reference | Variable
--- | --- | --- | --- | ---
charset-iconv.c | 62 | charset-iconv.c | 123 | tmpbuf

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

charset_to_utf8_str (19 to 33 charset-utf8.c) - FAIL

#### Standards Violation Summary

Code | Violation | Standard
--- | --- | ---
M | Procedure contains UR data flow anomalies. | CERT EXP33-C

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 29 | Pointer not checked for null before use : t | CERT EXP08-C,EXP34-C
| 26 |  |
M | 23 | Procedure contains UR data flow anomalies. : t | CERT EXP33-C
| 26 |  |
C | 19 | Procedure not called in code analysed : charset_to_utf8_str |

#### Possible UR Anomalies

The following variables may be referenced before being given a value

File | Undefine | File | Reference | Variable
--- | --- | --- | --- | ---
charset-utf8.c | 23 | charset-utf8.c | 26 | t

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

### End of Code Review Report

###

### Copyright © 2010 Liverpool Data Research Associates