clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name output.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -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 -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/security/sandbox/linux -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/security/sandbox/linux -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D NS_NO_XPCOM -I /root/firefox-clang/security/sandbox/linux -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/security/sandbox/linux -I /root/firefox-clang/security/sandbox/linux -I /root/firefox-clang/security/sandbox/chromium-shim -I /root/firefox-clang/security/sandbox/chromium -I /root/firefox-clang/security/sandbox/chromium-shim/base/allocator/partition_allocator/src -I /root/firefox-clang/security/sandbox/chromium/base/allocator/partition_allocator/src -I /root/firefox-clang/third_party/abseil-cpp -I /root/firefox-clang/nsprpub -I /root/firefox-clang/mozglue/baseprofiler/core -I /root/firefox-clang/tools/profiler -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -Wno-error=stack-protector -std=gnu++20 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-09-01-224014-2642839-1 -x c++ /root/firefox-clang/third_party/abseil-cpp/absl/strings/internal/str_format/output.cc
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | #include "absl/strings/internal/str_format/output.h" |
| 16 | |
| 17 | #include <errno.h> |
| 18 | |
| 19 | #include <algorithm> |
| 20 | #include <cstdio> |
| 21 | #include <cstring> |
| 22 | |
| 23 | #include "absl/strings/string_view.h" |
| 24 | |
| 25 | namespace absl { |
| 26 | ABSL_NAMESPACE_BEGIN |
| 27 | namespace str_format_internal { |
| 28 | |
| 29 | namespace { |
| 30 | struct ClearErrnoGuard { |
| 31 | ClearErrnoGuard() : old_value(errno) { errno = 0; } |
| 32 | ~ClearErrnoGuard() { |
| 33 | if (!errno) errno = old_value; |
| 34 | } |
| 35 | int old_value; |
| 36 | }; |
| 37 | } |
| 38 | |
| 39 | void BufferRawSink::Write(string_view v) { |
| 40 | size_t to_write = std::min(v.size(), size_); |
| 41 | if (to_write > 0) { |
| 42 | std::memcpy(buffer_, v.data(), to_write); |
| 43 | buffer_ += to_write; |
| 44 | size_ -= to_write; |
| 45 | } |
| 46 | total_written_ += v.size(); |
| 47 | } |
| 48 | |
| 49 | void FILERawSink::Write(string_view v) { |
| 50 | while (!v.empty() && !error_) { |
| 1 | Assuming the condition is true | |
|
| 2 | | Assuming field 'error_' is 0 | |
|
| 3 | | Loop condition is true. Entering loop body | |
|
| 51 | |
| 52 | |
| 53 | ClearErrnoGuard guard; |
| 54 | |
| 55 | if (size_t result = std::fwrite(v.data(), 1, v.size(), output_)) { |
| 4 | | Assuming that 'fwrite' is successful; 'errno' becomes undefined after the call | |
|
| |
| |
| 56 | |
| 57 | count_ += result; |
| 58 | v.remove_prefix(result); |
| 59 | } else { |
| 60 | if (errno == EINTR) { |
| 7 | | An undefined value may be read from 'errno' |
|
| 61 | continue; |
| 62 | } else if (errno) { |
| 63 | error_ = errno; |
| 64 | } else if (std::ferror(output_)) { |
| 65 | |
| 66 | |
| 67 | error_ = EBADF; |
| 68 | } else { |
| 69 | |
| 70 | |
| 71 | continue; |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | } |
| 78 | ABSL_NAMESPACE_END |
| 79 | } |