clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name v_delete.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 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/usr.bin/vi/build/obj -resource-dir /usr/local/lib/clang/13.0.0 -I /usr/src/usr.bin/vi/build -I /usr/src/usr.bin/vi/build/../include -I . -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/usr.bin/vi/build/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -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 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c /usr/src/usr.bin/vi/build/../vi/v_delete.c
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | #include "config.h" |
| 13 | |
| 14 | #include <sys/types.h> |
| 15 | #include <sys/queue.h> |
| 16 | #include <sys/time.h> |
| 17 | |
| 18 | #include <bitstring.h> |
| 19 | #include <limits.h> |
| 20 | #include <stdio.h> |
| 21 | |
| 22 | #include "../common/common.h" |
| 23 | #include "vi.h" |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | int |
| 33 | v_delete(SCR *sp, VICMD *vp) |
| 34 | { |
| 35 | recno_t nlines; |
| 1 | 'nlines' declared without an initial value | |
|
| 36 | size_t len; |
| 37 | int lmode; |
| 38 | |
| 39 | lmode = F_ISSET(vp, VM_LMODE) ? CUT_LINEMODE : 0; |
| 2 | | Assuming the condition is false | |
|
| |
| 40 | |
| 41 | |
| 42 | if (cut(sp, F_ISSET(vp, VC_BUFFER) ? &vp->buffer : NULL, |
| 4 | | Assuming the condition is false | |
|
| |
| 8 | | Assuming the condition is false | |
|
| |
| 43 | &vp->m_start, &vp->m_stop, |
| 44 | lmode | (F_ISSET(vp, VM_CUTREQ) ? CUT_NUMREQ : CUT_NUMOPT))) |
| 6 | | Assuming the condition is false | |
|
| |
| 45 | return (1); |
| 46 | |
| 47 | |
| 48 | if (del(sp, &vp->m_start, &vp->m_stop, lmode)) |
| 10 | | Assuming the condition is false | |
|
| |
| 49 | return (1); |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | if (!db_exist(sp, vp->m_final.lno + 1)) { |
| 12 | | Assuming the condition is false | |
|
| |
| 56 | if (db_last(sp, &nlines)) |
| 57 | return (1); |
| 58 | if (nlines == 0) { |
| 59 | vp->m_final.lno = 1; |
| 60 | vp->m_final.cno = 0; |
| 61 | return (0); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | if (db_get(sp, vp->m_final.lno, 0, NULL, &len)) { |
| 14 | | Assuming the condition is true | |
|
| |
| 71 | if (db_get(sp, nlines, DBG_FATAL, NULL, &len)) |
| 16 | | 2nd function call argument is an uninitialized value |
|
| 72 | return (1); |
| 73 | vp->m_final.lno = nlines; |
| 74 | } |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | if (!F_ISSET(vp, VM_LMODE)) { |
| 85 | F_CLR(vp, VM_RCM_MASK); |
| 86 | F_SET(vp, VM_RCM_SET); |
| 87 | |
| 88 | |
| 89 | if (vp->m_final.cno >= len) |
| 90 | vp->m_final.cno = len ? len - 1 : 0; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | if (F_ISSET(vp, VM_LDOUBLE)) { |
| 99 | F_CLR(vp, VM_RCM_MASK); |
| 100 | F_SET(vp, VM_RCM_SETFNB); |
| 101 | } |
| 102 | return (0); |
| 103 | } |