clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name dump.c -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 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/var/lib/jenkins/workspace/scan-build-libnsfb -fcoverage-compilation-dir=/var/lib/jenkins/workspace/scan-build-libnsfb -resource-dir /usr/lib/llvm-19/lib/clang/19 -D _BSD_SOURCE -D _DEFAULT_SOURCE -D _POSIX_C_SOURCE=200112L -I /var/lib/jenkins/workspace/scan-build-libnsfb/include/ -I /var/lib/jenkins/workspace/scan-build-libnsfb/src -D _ALIGNED=__attribute__((aligned)) -D STMTEXPR=1 -D DEBUG -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Og -Wwrite-strings -Wno-error -std=c99 -fconst-strings -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -analyzer-display-progress -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/lib/jenkins/workspace/scan-build-libnsfb/clangScanBuildReports/2025-11-02-100314-3636243-1 -x c src/dump.c
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | #include <stdbool.h> |
| 10 | #include <stdio.h> |
| 11 | #include <stdlib.h> |
| 12 | #include <unistd.h> |
| 13 | |
| 14 | #include "libnsfb.h" |
| 15 | #include "libnsfb_plot.h" |
| 16 | #include "libnsfb_event.h" |
| 17 | #include "nsfb.h" |
| 18 | #include "surface.h" |
| 19 | |
| 20 | |
| 21 | bool |
| 22 | nsfb_dump(nsfb_t *nsfb, int fd) |
| 1 | [debug] analyzing from nsfb_dump | |
|
| 23 | { |
| 24 | FILE *outf; |
| 25 | int x; |
| 26 | int y; |
| 27 | |
| 28 | outf = fdopen(dup(fd), "w"); |
| 2 | | Assuming that 'dup' fails | |
|
| 3 | | The 1st argument to 'fdopen' is < 0 but should be >= 0 |
|
| 29 | if (outf == NULL) { |
| 30 | return false; |
| 31 | } |
| 32 | |
| 33 | fprintf(outf,"P3\n#libnsfb buffer dump\n%d %d\n255\n", |
| 34 | nsfb->width, nsfb->height); |
| 35 | for (y=0; y < nsfb->height; y++) { |
| 36 | for (x=0; x < nsfb->width; x++) { |
| 37 | fprintf(outf,"%d %d %d ", |
| 38 | *(nsfb->ptr + (((nsfb->width * y) + x) * 4) + 2), |
| 39 | *(nsfb->ptr + (((nsfb->width * y) + x) * 4) + 1), |
| 40 | *(nsfb->ptr + (((nsfb->width * y) + x) * 4) + 0)); |
| 41 | |
| 42 | } |
| 43 | fprintf(outf,"\n"); |
| 44 | } |
| 45 | |
| 46 | fclose(outf); |
| 47 | |
| 48 | return true; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |