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 dom_settable_token_list.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-netsurf -fcoverage-compilation-dir=/var/lib/jenkins/workspace/scan-build-netsurf -resource-dir /usr/lib/llvm-19/lib/clang/19 -isystem /usr/include/mit-krb5 -I . -I include -I build/Linux-monkey -I frontends -I content/handlers -D WITH_JPEG -U WITH_PDF_EXPORT -D LIBICONV_PLUG -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -I /usr/include/x86_64-linux-gnu -I /usr/include/p11-kit-1 -D WITH_CURL -D WITH_OPENSSL -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D UTF8PROC_EXPORTS -D WITH_UTF8PROC -I /usr/include/webp -D WITH_WEBP -I /usr/include/libpng16 -D WITH_PNG -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include/ -D WITH_BMP -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D WITH_GIF -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D WITH_NSPSL -I /var/lib/jenkins/artifacts-x86_64-linux-gnu/include -D WITH_NSLOG -D NETSURF_UA_FORMAT_STRING="Mozilla/5.0 (%s) NetSurf/%d.%d" -D NETSURF_HOMEPAGE="about:welcome" -D NETSURF_LOG_LEVEL=VERBOSE -D NETSURF_BUILTIN_LOG_FILTER="(level:WARNING || cat:jserrors)" -D NETSURF_BUILTIN_VERBOSE_FILTER="(level:VERBOSE || cat:jserrors)" -D STMTEXPR=1 -D monkey -D nsmonkey -D MONKEY_RESPATH="/var/lib/jenkins/artifacts-x86_64-linux-gnu/share/netsurf/" -D _POSIX_C_SOURCE=200809L -D _XOPEN_SOURCE=700 -D _BSD_SOURCE -D _DEFAULT_SOURCE -D _NETBSD_SOURCE -D DUK_OPT_HAVE_CUSTOM_H -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 -O2 -Wwrite-strings -Wno-unused-parameter -Wno-unused-but-set-variable -std=c99 -fconst-strings -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -analyzer-display-progress -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/lib/jenkins/workspace/scan-build-netsurf/clangScanBuildReports/2025-11-24-141556-2225918-1 -x c build/Linux-monkey/duktape/dom_settable_token_list.c
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | #include <dom/dom.h> |
| 17 | |
| 18 | #include "utils/log.h" |
| 19 | #include "utils/nsurl.h" |
| 20 | |
| 21 | #include "javascript/duktape/duktape.h" |
| 22 | |
| 23 | struct browser_window; |
| 24 | struct html_content; |
| 25 | struct dom_node; |
| 26 | struct dom_element; |
| 27 | struct dom_document; |
| 28 | struct dom_html_element; |
| 29 | struct dom_node_character_data; |
| 30 | struct dom_node_text; |
| 31 | struct dom_node_list; |
| 32 | struct dom_node_comment; |
| 33 | struct dom_html_collection; |
| 34 | struct dom_html_br_element; |
| 35 | |
| 36 | |
| 37 | #include "build/Linux-monkey/duktape/binding.h" |
| 38 | #include "build/Linux-monkey/duktape/private.h" |
| 39 | #include "build/Linux-monkey/duktape/prototype.h" |
| 40 | |
| 41 | #include "javascript/duktape/dukky.h" |
| 42 | |
| 43 | static void dukky_dom_settable_token_list___init(duk_context *ctx, dom_settable_token_list_private_t *priv, struct dom_tokenlist *tokens) |
| 44 | { |
| 45 | dukky_dom_token_list___init(ctx, &priv->parent, tokens); |
| 46 | #line 15 "DOMSettableTokenList.bnd" |
| 47 | #line 48 "dom_settable_token_list.c" |
| 48 | } |
| 49 | |
| 50 | static void dukky_dom_settable_token_list___fini(duk_context *ctx, dom_settable_token_list_private_t *priv) |
| 51 | { |
| 52 | dukky_dom_token_list___fini(ctx, &priv->parent); |
| 53 | } |
| 54 | |
| 55 | static duk_ret_t dukky_dom_settable_token_list___constructor(duk_context *ctx) |
| 56 | { |
| 57 | |
| 58 | dom_settable_token_list_private_t *priv = calloc(1, sizeof(*priv)); |
| 59 | if (priv == NULL) return 0; |
| 60 | duk_push_pointer(ctx, priv); |
| 61 | duk_put_prop_string(ctx, 0, dukky_magic_string_private); |
| 62 | |
| 63 | dukky_dom_settable_token_list___init(ctx, priv, duk_get_pointer(ctx, 1)); |
| 64 | duk_set_top(ctx, 1); |
| 65 | return 1; |
| 66 | } |
| 67 | |
| 68 | static duk_ret_t dukky_dom_settable_token_list___destructor(duk_context *ctx) |
| 69 | { |
| 70 | dom_settable_token_list_private_t *priv; |
| 71 | duk_get_prop_string(ctx, 0, dukky_magic_string_private); |
| 72 | priv = duk_get_pointer(ctx, -1); |
| 73 | duk_pop(ctx); |
| 74 | if (priv == NULL) return 0; |
| 75 | |
| 76 | dukky_dom_settable_token_list___fini(ctx, priv); |
| 77 | free(priv); |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | static duk_ret_t dukky_dom_settable_token_list_value_getter(duk_context *ctx) |
| 82 | { |
| 83 | |
| 84 | dom_settable_token_list_private_t *priv = NULL; |
| 85 | duk_push_this(ctx); |
| 86 | duk_get_prop_string(ctx, -1, dukky_magic_string_private); |
| 87 | priv = duk_get_pointer(ctx, -1); |
| 88 | duk_pop_2(ctx); |
| 89 | if (priv == NULL) { |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | #line 17 "DOMSettableTokenList.bnd" |
| 94 | |
| 95 | dom_exception exc; |
| 96 | dom_string *value; |
| 97 | |
| 98 | exc = dom_tokenlist_get_value(priv->parent.tokens, &value); |
| 99 | if (exc != DOM_NO_ERR) return 0; |
| 100 | |
| 101 | duk_push_lstring(ctx, dom_string_data(value), dom_string_length(value)); |
| 102 | dom_string_unref(value); |
| 103 | |
| 104 | return 1; |
| 105 | #line 106 "dom_settable_token_list.c" |
| 106 | } |
| 107 | |
| 108 | static duk_ret_t dukky_dom_settable_token_list_value_setter(duk_context *ctx) |
| 1 | [debug] analyzing from dukky_dom_settable_token_list_value_setter | |
|
| 109 | { |
| 110 | |
| 111 | dom_settable_token_list_private_t *priv = NULL; |
| 112 | duk_push_this(ctx); |
| 113 | duk_get_prop_string(ctx, -1, dukky_magic_string_private); |
| 114 | priv = duk_get_pointer(ctx, -1); |
| 115 | duk_pop_2(ctx); |
| 116 | if (priv == NULL) { |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | #line 31 "DOMSettableTokenList.bnd" |
| 121 | |
| 122 | dom_exception exc; |
| 123 | dom_string *value; |
| 124 | duk_size_t slen; |
| 125 | const char *s = duk_require_lstring(ctx, 0, &slen); |
| 126 | |
| 127 | exc = dom_string_create_interned((const uint8_t *)s, slen, &value); |
| 128 | if (exc != DOM_NO_ERR) return 0; |
| 129 | |
| 130 | exc = dom_tokenlist_set_value(priv->parent.tokens, value); |
| 2 | | Value stored to 'exc' is never read |
|
| 131 | dom_string_unref(value); |
| 132 | |
| 133 | return 0; |
| 134 | #line 135 "dom_settable_token_list.c" |
| 135 | } |
| 136 | |
| 137 | duk_ret_t dukky_dom_settable_token_list___proto(duk_context *ctx, void *udata) |
| 138 | { |
| 139 | |
| 140 | |
| 141 | duk_get_global_string(ctx, dukky_magic_string_prototypes); |
| 142 | duk_get_prop_string(ctx, -1, "\xFF\xFFNETSURF_DUKTAPE_PROTOTYPE_DOMTOKENLIST"); |
| 143 | duk_replace(ctx, -2); |
| 144 | duk_set_prototype(ctx, 0); |
| 145 | |
| 146 | |
| 147 | duk_dup(ctx, 0); |
| 148 | duk_push_string(ctx, "value"); |
| 149 | duk_push_c_function(ctx, dukky_dom_settable_token_list_value_getter, 0); |
| 150 | duk_push_c_function(ctx, dukky_dom_settable_token_list_value_setter, 1); |
| 151 | duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER | |
| 152 | DUK_DEFPROP_HAVE_SETTER | |
| 153 | DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE | |
| 154 | DUK_DEFPROP_HAVE_CONFIGURABLE); |
| 155 | duk_pop(ctx); |
| 156 | |
| 157 | |
| 158 | duk_dup(ctx, 0); |
| 159 | duk_push_c_function(ctx, dukky_dom_settable_token_list___destructor, 1); |
| 160 | duk_set_finalizer(ctx, -2); |
| 161 | duk_pop(ctx); |
| 162 | |
| 163 | |
| 164 | duk_dup(ctx, 0); |
| 165 | duk_push_c_function(ctx, dukky_dom_settable_token_list___constructor, 2); |
| 166 | duk_put_prop_string(ctx, -2, "\xFF\xFFNETSURF_DUKTAPE_INIT"); |
| 167 | duk_pop(ctx); |
| 168 | |
| 169 | return 1; |
| 170 | } |
| 171 | |
| 172 | |