clang -cc1 -cc1 -triple amd64-unknown-openbsd6.9 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name diff_output_plain.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/local/lib/clang/11.1.0 -I /home/ben/Projects/got/tog/../include -I /home/ben/Projects/got/tog/../lib -D GOT_LIBEXECDIR=/home/ben/bin -D GOT_VERSION=0.53-current -internal-isystem /usr/local/lib/clang/11.1.0/include -internal-externc-isystem /usr/include -O0 -fdebug-compilation-dir /home/ben/Projects/got/tog/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -o /home/ben/Projects/got/scan/2021-05-28-230913-68537-1 -x c /home/ben/Projects/got/tog/../lib/diff_output_plain.c
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | #include <errno.h> |
19 | #include <stdint.h> |
20 | #include <stdio.h> |
21 | #include <stdbool.h> |
22 | #include <stdlib.h> |
23 | |
24 | #include <arraylist.h> |
25 | #include <diff_main.h> |
26 | #include <diff_output.h> |
27 | |
28 | #include "diff_internal.h" |
29 | |
30 | int |
31 | diff_output_plain(struct diff_output_info **output_info, FILE *dest, |
32 | const struct diff_input_info *info, |
33 | const struct diff_result *result) |
34 | { |
35 | struct diff_output_info *outinfo = NULL; |
36 | int i, rc; |
| 1 | 'rc' declared without an initial value | |
|
37 | |
38 | if (!result) |
| 2 | | Assuming 'result' is non-null | |
|
| |
39 | return EINVAL; |
40 | if (result->rc != DIFF_RC_OK) |
| 4 | | Assuming field 'rc' is equal to DIFF_RC_OK | |
|
| |
41 | return result->rc; |
42 | |
43 | if (output_info) { |
| 6 | | Assuming 'output_info' is null | |
|
| |
44 | *output_info = diff_output_info_alloc(); |
45 | if (*output_info == NULL) |
46 | return errno; |
47 | outinfo = *output_info; |
48 | } |
49 | |
50 | for (i = 0; i < result->chunks.len; i++) { |
| 8 | | Assuming 'i' is < field 'len' | |
|
| 9 | | Loop condition is true. Entering loop body | |
|
51 | struct diff_chunk *c = &result->chunks.head[i]; |
52 | if (c->left_count && c->right_count) |
| 10 | | Assuming field 'left_count' is 0 | |
|
53 | rc = diff_output_lines(outinfo, dest, |
54 | c->solved ? " " : "?", |
55 | c->left_start, c->left_count); |
56 | else if (c->left_count && !c->right_count) |
57 | rc = diff_output_lines(outinfo, dest, |
58 | c->solved ? "-" : "?", |
59 | c->left_start, c->left_count); |
60 | else if (c->right_count && !c->left_count) |
| 11 | | Assuming field 'right_count' is 0 | |
|
61 | rc = diff_output_lines(outinfo, dest, |
62 | c->solved ? "+" : "?", |
63 | c->right_start, c->right_count); |
64 | if (rc) |
| 12 | | Branch condition evaluates to a garbage value |
|
65 | return rc; |
66 | } |
67 | return DIFF_RC_OK; |
68 | } |