{"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
 "version": "2.1.0",
 "runs": [{"tool": {"driver": {"name": "GNU C23",
                               "fullName": "GNU C23 (GCC) version 16.1.1 20260703 (Red Hat 16.1.1-4) (x86_64-redhat-linux)",
                               "version": "16.1.1 20260703 (Red Hat 16.1.1-4)",
                               "informationUri": "https://gcc.gnu.org/gcc-16/",
                               "rules": [{"id": "-Wanalyzer-fd-leak",
                                          "helpUri": "https://gcc.gnu.org/onlinedocs/gcc-16.1.0/gcc/Static-Analyzer-Options.html#index-Wanalyzer-fd-leak"}]}},
           "taxonomies": [{"name": "CWE",
                           "version": "4.7",
                           "organization": "MITRE",
                           "shortDescription": {"text": "The MITRE Common Weakness Enumeration"},
                           "taxa": [{"id": "775",
                                     "helpUri": "https://cwe.mitre.org/data/definitions/775.html"}]}],
           "invocations": [{"arguments": ["/usr/libexec/gcc/x86_64-redhat-linux/16/cc1",
                                          "-quiet",
                                          "-I",
                                          "../src/include/",
                                          "-D",
                                          "_GNU_SOURCE",
                                          "-D",
                                          "__SANE_USERSPACE_TYPES__",
                                          "-D",
                                          "_LARGEFILE_SOURCE",
                                          "-D",
                                          "_FILE_OFFSET_BITS=64",
                                          "-D",
                                          "LIBURING_BUILD_TEST",
                                          "-include",
                                          "../config-host.h",
                                          "helpers.c",
                                          "-quiet",
                                          "-dumpbase",
                                          "helpers.c",
                                          "-dumpbase-ext",
                                          ".c",
                                          "-m64",
                                          "-mtune=generic",
                                          "-march=x86-64",
                                          "-mtls-dialect=gnu2",
                                          "-O2",
                                          "-Wno-unused-parameter",
                                          "-Wno-sign-compare",
                                          "-Wno-unknown-pragmas",
                                          "-flto=auto",
                                          "-ffat-lto-objects",
                                          "-fexceptions",
                                          "-fstack-protector-strong",
                                          "-fasynchronous-unwind-tables",
                                          "-fstack-clash-protection",
                                          "-fcf-protection=full",
                                          "-fno-omit-frame-pointer",
                                          "-fanalyzer",
                                          "-fdiagnostics-path-format=separate-events",
                                          "-fno-diagnostics-show-caret",
                                          "-fno-lto",
                                          "-fanalyzer-assume-nothrow",
                                          "-fdiagnostics-text-art-charset=none",
                                          "-fdiagnostics-set-output=sarif:file=/builddir/gcc-results/706-kpTy.sarif",
                                          "-o",
                                          "/tmp/ccVMQkUy.s"],
                            "workingDirectory": {"uri": "/builddir/build/BUILD/liburing-2.13-build/liburing-2.13/test"},
                            "startTimeUtc": "2026-08-03T18:01:35Z",
                            "executionSuccessful": true,
                            "toolExecutionNotifications": [],
                            "endTimeUtc": "2026-08-03T18:01:35Z"}],
           "originalUriBaseIds": {"PWD": {"uri": "file:///builddir/build/BUILD/liburing-2.13-build/liburing-2.13/test/"}},
           "artifacts": [{"location": {"uri": "helpers.c",
                                       "uriBaseId": "PWD"},
                          "sourceLanguage": "c",
                          "contents": {"text": "/* SPDX-License-Identifier: MIT */\n/*\n * Description: Helpers for tests.\n */\n#include <stdlib.h>\n#include <assert.h>\n#include <string.h>\n#include <stdio.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <stdarg.h>\n#include <sys/types.h>\n\n#include <arpa/inet.h>\n#include <netinet/ip.h>\n#include <netinet/tcp.h>\n\n#include \"helpers.h\"\n#include \"liburing.h\"\n\n/*\n * Helper for allocating memory in tests.\n */\nvoid *t_malloc(size_t size)\n{\n\tvoid *ret;\n\tret = malloc(size);\n\tassert(ret);\n\treturn ret;\n}\n\n/*\n * Helper for binding socket to an ephemeral port.\n * The port number to be bound is returned in @addr->sin_port.\n */\nint t_bind_ephemeral_port(int fd, struct sockaddr_in *addr)\n{\n\tsocklen_t addrlen;\n\tint ret;\n\n\taddr->sin_port = 0;\n\tif (bind(fd, (struct sockaddr *)addr, sizeof(*addr)))\n\t\treturn -errno;\n\n\taddrlen = sizeof(*addr);\n\tret = getsockname(fd, (struct sockaddr *)addr, &addrlen);\n\tassert(!ret);\n\tassert(addr->sin_port != 0);\n\treturn 0;\n}\n\n/*\n * Helper for allocating size bytes aligned on a boundary.\n */\nvoid t_posix_memalign(void **memptr, size_t alignment, size_t size)\n{\n\tint ret;\n\tret = posix_memalign(memptr, alignment, size);\n\tassert(!ret);\n}\n\n/*\n * Helper for allocating space for an array of nmemb elements\n * with size bytes for each element.\n */\nvoid *t_calloc(size_t nmemb, size_t size)\n{\n\tvoid *ret;\n\tret = calloc(nmemb, size);\n\tassert(ret);\n\treturn ret;\n}\n\n/*\n * Helper for creating file and write @size byte buf with 0xaa value in the file.\n */\nstatic void __t_create_file(const char *file, size_t size, char pattern)\n{\n\tssize_t ret;\n\tchar *buf;\n\tint fd;\n\n\tbuf = t_malloc(size);\n\tmemset(buf, pattern, size);\n\n\tfd = open(file, O_WRONLY | O_CREAT, 0644);\n\tassert(fd >= 0);\n\n\tret = write(fd, buf, size);\n\tfsync(fd);\n\tclose(fd);\n\tfree(buf);\n\tassert(ret == size);\n}\n\nvoid t_create_file(const char *file, size_t size)\n{\n\t__t_create_file(file, size, 0xaa);\n}\n\nvoid t_create_file_pattern(const char *file, size_t size, char pattern)\n{\n\t__t_create_file(file, size, pattern);\n}\n\n/*\n * Helper for creating @buf_num number of iovec\n * with @buf_size bytes buffer of each iovec.\n */\nstruct iovec *t_create_buffers(size_t buf_num, size_t buf_size)\n{\n\tstruct iovec *vecs;\n\tint i;\n\n\tvecs = t_malloc(buf_num * sizeof(struct iovec));\n\tfor (i = 0; i < buf_num; i++) {\n\t\tt_posix_memalign(&vecs[i].iov_base, buf_size, buf_size);\n\t\tvecs[i].iov_len = buf_size;\n\t}\n\treturn vecs;\n}\n\n/*\n * Helper for setting up an io_uring instance, skipping if the given user isn't\n * allowed to.\n */\nenum t_setup_ret t_create_ring_params(int depth, struct io_uring *ring,\n\t\t\t\t      struct io_uring_params *p)\n{\n\tint ret;\n\n\tret = io_uring_queue_init_params(depth, ring, p);\n\tif (!ret)\n\t\treturn T_SETUP_OK;\n\tif ((p->flags & IORING_SETUP_SQPOLL) && ret == -EPERM && geteuid()) {\n\t\tfprintf(stdout, \"SQPOLL skipped for regular user\\n\");\n\t\treturn T_SETUP_SKIP;\n\t}\n\tif (ret == -EINVAL)\n\t\treturn T_SETUP_SKIP;\n\n\tfprintf(stderr, \"queue_init: %s\\n\", strerror(-ret));\n\treturn ret;\n}\n\nenum t_setup_ret t_create_ring(int depth, struct io_uring *ring,\n\t\t\t       unsigned int flags)\n{\n\tstruct io_uring_params p = { };\n\n\tp.flags = flags;\n\treturn t_create_ring_params(depth, ring, &p);\n}\n\nenum t_setup_ret t_register_buffers(struct io_uring *ring,\n\t\t\t\t    const struct iovec *iovecs,\n\t\t\t\t    unsigned nr_iovecs)\n{\n\tint ret;\n\n\tret = io_uring_register_buffers(ring, iovecs, nr_iovecs);\n\tif (!ret)\n\t\treturn T_SETUP_OK;\n\n\tif ((ret == -EPERM || ret == -ENOMEM) && geteuid()) {\n\t\tfprintf(stdout, \"too large non-root buffer registration, skip\\n\");\n\t\treturn T_SETUP_SKIP;\n\t}\n\n\tfprintf(stderr, \"buffer register failed: %s\\n\", strerror(-ret));\n\treturn ret;\n}\n\nint t_create_socket_pair(int fd[2], bool stream)\n{\n\tint ret;\n\tint type = stream ? SOCK_STREAM : SOCK_DGRAM;\n\tint val;\n\tstruct sockaddr_in serv_addr;\n\tstruct sockaddr *paddr;\n\tsocklen_t paddrlen;\n\n\ttype |= SOCK_CLOEXEC;\n\tfd[0] = socket(AF_INET, type, 0);\n\tif (fd[0] < 0)\n\t\treturn errno;\n\tfd[1] = socket(AF_INET, type, 0);\n\tif (fd[1] < 0) {\n\t\tret = errno;\n\t\tclose(fd[0]);\n\t\treturn ret;\n\t}\n\n\tval = 1;\n\tif (setsockopt(fd[0], SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)))\n\t\tgoto errno_cleanup;\n\n\tmemset(&serv_addr, 0, sizeof(serv_addr));\n\tserv_addr.sin_family = AF_INET;\n\tserv_addr.sin_port = 0;\n\tinet_pton(AF_INET, \"127.0.0.1\", &serv_addr.sin_addr);\n\n\tpaddr = (struct sockaddr *)&serv_addr;\n\tpaddrlen = sizeof(serv_addr);\n\n\tif (bind(fd[0], paddr, paddrlen)) {\n\t\tfprintf(stderr, \"bind failed\\n\");\n\t\tgoto errno_cleanup;\n\t}\n\n\tif (stream && listen(fd[0], 16)) {\n\t\tfprintf(stderr, \"listen failed\\n\");\n\t\tgoto errno_cleanup;\n\t}\n\n\tif (getsockname(fd[0], (struct sockaddr *)&serv_addr,\n\t\t\t(socklen_t *)&paddrlen)) {\n\t\tfprintf(stderr, \"getsockname failed\\n\");\n\t\tgoto errno_cleanup;\n\t}\n\tinet_pton(AF_INET, \"127.0.0.1\", &serv_addr.sin_addr);\n\n\tif (connect(fd[1], (struct sockaddr *)&serv_addr, paddrlen)) {\n\t\tfprintf(stderr, \"connect failed\\n\");\n\t\tgoto errno_cleanup;\n\t}\n\n\tif (!stream) {\n\t\t/* connect the other udp side */\n\t\tif (getsockname(fd[1], (struct sockaddr *)&serv_addr,\n\t\t\t\t(socklen_t *)&paddrlen)) {\n\t\t\tfprintf(stderr, \"getsockname failed\\n\");\n\t\t\tgoto errno_cleanup;\n\t\t}\n\t\tinet_pton(AF_INET, \"127.0.0.1\", &serv_addr.sin_addr);\n\n\t\tif (connect(fd[0], (struct sockaddr *)&serv_addr, paddrlen)) {\n\t\t\tfprintf(stderr, \"connect failed\\n\");\n\t\t\tgoto errno_cleanup;\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/* for stream case we must accept and cleanup the listen socket */\n\n\tret = accept(fd[0], NULL, NULL);\n\tif (ret < 0)\n\t\tgoto errno_cleanup;\n\n\tclose(fd[0]);\n\tfd[0] = ret;\n\n\treturn 0;\n\nerrno_cleanup:\n\tret = errno;\n\tclose(fd[0]);\n\tclose(fd[1]);\n\treturn ret;\n}\n\nbool t_probe_defer_taskrun(void)\n{\n\tstruct io_uring ring;\n\tint ret;\n\n\tret = io_uring_queue_init(1, &ring, IORING_SETUP_SINGLE_ISSUER |\n\t\t\t\t\t    IORING_SETUP_DEFER_TASKRUN);\n\tif (ret < 0)\n\t\treturn false;\n\tio_uring_queue_exit(&ring);\n\treturn true;\n}\n\n/*\n * Sync internal state with kernel ring state on the SQ side. Returns the\n * number of pending items in the SQ ring, for the shared ring.\n */\nunsigned __io_uring_flush_sq(struct io_uring *ring)\n{\n\tstruct io_uring_sq *sq = &ring->sq;\n\tunsigned tail = sq->sqe_tail;\n\n\tif (sq->sqe_head != tail) {\n\t\tsq->sqe_head = tail;\n\t\t/*\n\t\t * Ensure kernel sees the SQE updates before the tail update.\n\t\t */\n\t\tif (!(ring->flags & IORING_SETUP_SQPOLL))\n\t\t\t*sq->ktail = tail;\n\t\telse\n\t\t\tio_uring_smp_store_release(sq->ktail, tail);\n\t}\n\t/*\n\t* This load needs to be atomic, since sq->khead is written concurrently\n\t* by the kernel, but it doesn't need to be load_acquire, since the\n\t* kernel doesn't store to the submission queue; it advances khead just\n\t* to indicate that it's finished reading the submission queue entries\n\t* so they're available for us to write to.\n\t*/\n\treturn tail - IO_URING_READ_ONCE(*sq->khead);\n}\n\n/*\n * Implementation of error(3), prints an error message and exits.\n */\nvoid t_error(int status, int errnum, const char *format, ...)\n{\n\tva_list args;\n    \tva_start(args, format);\n\n\tvfprintf(stderr, format, args);\n    \tif (errnum)\n        \tfprintf(stderr, \": %s\", strerror(errnum));\n\n\tfprintf(stderr, \"\\n\");\n\tva_end(args);\n    \texit(status);\n}\n\nunsigned long long mtime_since(const struct timeval *s, const struct timeval *e)\n{\n\tlong long sec, usec;\n\n\tsec = e->tv_sec - s->tv_sec;\n\tusec = (e->tv_usec - s->tv_usec);\n\tif (sec > 0 && usec < 0) {\n\t\tsec--;\n\t\tusec += 1000000;\n\t}\n\n\tsec *= 1000;\n\tusec /= 1000;\n\treturn sec + usec;\n}\n\nunsigned long long mtime_since_now(struct timeval *tv)\n{\n\tstruct timeval end;\n\n\tgettimeofday(&end, NULL);\n\treturn mtime_since(tv, &end);\n}\n\nunsigned long long utime_since(const struct timeval *s, const struct timeval *e)\n{\n\tlong long sec, usec;\n\n\tsec = e->tv_sec - s->tv_sec;\n\tusec = (e->tv_usec - s->tv_usec);\n\tif (sec > 0 && usec < 0) {\n\t\tsec--;\n\t\tusec += 1000000;\n\t}\n\n\tsec *= 1000000;\n\treturn sec + usec;\n}\n\nunsigned long long utime_since_now(struct timeval *tv)\n{\n\tstruct timeval end;\n\n\tgettimeofday(&end, NULL);\n\treturn utime_since(tv, &end);\n}\n\nvoid *t_aligned_alloc(size_t alignment, size_t size)\n{\n\tvoid *ret;\n\n\tif (posix_memalign(&ret, alignment, size))\n\t\treturn NULL;\n\n\treturn ret;\n}\n\nint t_create_socketpair_ip(struct sockaddr_storage *addr,\n\t\t\t\tint *sock_client, int *sock_server,\n\t\t\t\tbool ipv6, bool client_connect,\n\t\t\t\tbool msg_zc, bool tcp, const char *name)\n{\n\tsocklen_t addr_size;\n\tint family, sock, listen_sock = -1;\n\tint ret;\n\n\tmemset(addr, 0, sizeof(*addr));\n\tif (ipv6) {\n\t\tstruct sockaddr_in6 *saddr = (struct sockaddr_in6 *)addr;\n\n\t\tfamily = AF_INET6;\n\t\tsaddr->sin6_family = family;\n\t\tsaddr->sin6_port = htons(0);\n\t\taddr_size = sizeof(*saddr);\n\t} else {\n\t\tstruct sockaddr_in *saddr = (struct sockaddr_in *)addr;\n\n\t\tfamily = AF_INET;\n\t\tsaddr->sin_family = family;\n\t\tsaddr->sin_port = htons(0);\n\t\tsaddr->sin_addr.s_addr = htonl(INADDR_ANY);\n\t\taddr_size = sizeof(*saddr);\n\t}\n\n\t/* server sock setup */\n\tif (tcp) {\n\t\tsock = listen_sock = socket(family, SOCK_STREAM, IPPROTO_TCP);\n\t} else {\n\t\tsock = *sock_server = socket(family, SOCK_DGRAM, 0);\n\t}\n\tif (sock < 0) {\n\t\tperror(\"socket\");\n\t\treturn 1;\n\t}\n\n\tret = bind(sock, (struct sockaddr *)addr, addr_size);\n\tif (ret < 0) {\n\t\tperror(\"bind\");\n\t\treturn 1;\n\t}\n\n\tret = getsockname(sock, (struct sockaddr *)addr, &addr_size);\n\tif (ret < 0) {\n\t\tfprintf(stderr, \"getsockname failed %i\\n\", errno);\n\t\treturn 1;\n\t}\n\n\tif (tcp) {\n\t\tret = listen(sock, 128);\n\t\tassert(ret != -1);\n\t}\n\n\tif (ipv6) {\n\t\tstruct sockaddr_in6 *saddr = (struct sockaddr_in6 *)addr;\n\n\t\tinet_pton(AF_INET6, name, &(saddr->sin6_addr));\n\t} else {\n\t\tstruct sockaddr_in *saddr = (struct sockaddr_in *)addr;\n\n\t\tinet_pton(AF_INET, name, &saddr->sin_addr);\n\t}\n\n\t/* client sock setup */\n\tif (tcp) {\n\t\t*sock_client = socket(family, SOCK_STREAM, IPPROTO_TCP);\n\t\tassert(client_connect);\n\t} else {\n\t\t*sock_client = socket(family, SOCK_DGRAM, 0);\n\t}\n\tif (*sock_client < 0) {\n\t\tperror(\"socket\");\n\t\treturn 1;\n\t}\n\tif (client_connect) {\n\t\tret = connect(*sock_client, (struct sockaddr *)addr, addr_size);\n\t\tif (ret < 0) {\n\t\t\tperror(\"connect\");\n\t\t\treturn 1;\n\t\t}\n\t}\n\tif (msg_zc) {\n#ifdef SO_ZEROCOPY\n\t\tint val = 1;\n\n\t\t/*\n\t\t * NOTE: apps must not set SO_ZEROCOPY when using io_uring zc.\n\t\t * It's only here to test interactions with MSG_ZEROCOPY.\n\t\t */\n\t\tif (setsockopt(*sock_client, SOL_SOCKET, SO_ZEROCOPY, &val, sizeof(val))) {\n\t\t\tperror(\"setsockopt zc\");\n\t\t\treturn 1;\n\t\t}\n#else\n\t\tfprintf(stderr, \"no SO_ZEROCOPY\\n\");\n\t\treturn 1;\n#endif\n\t}\n\tif (tcp) {\n\t\t*sock_server = accept(listen_sock, NULL, NULL);\n\t\tif (!*sock_server) {\n\t\t\tfprintf(stderr, \"can't accept\\n\");\n\t\t\treturn 1;\n\t\t}\n\t\tclose(listen_sock);\n\t}\n\treturn 0;\n}\n\nstatic void __t_toggle_nonblock(int fd, int set)\n{\n\tint flags;\n\n\tflags = fcntl(fd, F_GETFL, 0);\n\tif (flags < 0)\n\t\tt_error(1, errno, \"fcntl F_GETFL\");\n\tif (set)\n\t\tflags |= O_NONBLOCK;\n\telse\n\t\tflags &= ~O_NONBLOCK;\n\tif (fcntl(fd, F_SETFL, flags) < 0)\n\t\tt_error(1, errno, \"fcntl F_SETFL\");\n}\n\nvoid t_set_nonblock(int fd)\n{\n\t__t_toggle_nonblock(fd, 1);\n}\n\nvoid t_clear_nonblock(int fd)\n{\n\t__t_toggle_nonblock(fd, 0);\n}\n\nint t_submit_and_wait_single(struct io_uring *ring, struct io_uring_cqe **cqe)\n{\n\tint ret;\n\n\tret = io_uring_submit(ring);\n\tif (ret <= 0) {\n\t\tfprintf(stderr, \"sqe submit failed: %d\\n\", ret);\n\t\treturn -1;\n\t}\n\tret = io_uring_wait_cqe(ring, cqe);\n\tif (ret < 0) {\n\t\tfprintf(stderr, \"wait completion %d\\n\", ret);\n\t\treturn ret;\n\t}\n\treturn 0;\n}\n\nsize_t t_iovec_data_length(struct iovec *iov, unsigned iov_len)\n{\n\tsize_t sz = 0;\n\tint i;\n\n\tfor (i = 0; i < iov_len; i++)\n\t\tsz += iov[i].iov_len;\n\treturn sz;\n}\n\n#define t_min(a, b) ((a) < (b) ? (a) : (b))\n\nunsigned long t_compare_data_iovec(struct iovec *iov_src, unsigned nr_src,\n\t\t\t\t   struct iovec *iov_dst, unsigned nr_dst)\n{\n\tsize_t src_len = t_iovec_data_length(iov_src, nr_src);\n\tsize_t dst_len = t_iovec_data_length(iov_dst, nr_dst);\n\tsize_t len_left = t_min(src_len, dst_len);\n\tunsigned long src_off = 0, dst_off = 0;\n\tunsigned long offset = 0;\n\n\twhile (offset != len_left) {\n\t\tsize_t len = len_left - offset;\n\t\tunsigned long i;\n\n\t\tlen = t_min(len, iov_src->iov_len - src_off);\n\t\tlen = t_min(len, iov_dst->iov_len - dst_off);\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tchar csrc = ((char *)iov_src->iov_base)[src_off + i];\n\t\t\tchar cdst = ((char *)iov_dst->iov_base)[dst_off + i];\n\n\t\t\tif (csrc != cdst) {\n\t\t\t\tfprintf(stderr, \"data mismatch, %i vs %i\\n\",\n\t\t\t\t\tcsrc, cdst);\n\t\t\t\treturn -EINVAL;\n\t\t\t}\n\t\t}\n\n\t\tsrc_off += len;\n\t\tdst_off += len;\n\t\tif (src_off == iov_src->iov_len) {\n\t\t\tsrc_off = 0;\n\t\t\tiov_src++;\n\t\t}\n\t\tif (dst_off == iov_dst->iov_len) {\n\t\t\tdst_off = 0;\n\t\t\tiov_dst++;\n\t\t}\n\t\toffset += len;\n\t}\n\treturn 0;\n}\n"},
                          "roles": ["analysisTarget",
                                    "tracedFile"]}],
           "results": [{"ruleId": "-Wanalyzer-fd-leak",
                        "taxa": [{"id": "775",
                                  "toolComponent": {"name": "cwe"}}],
                        "properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                       "gcc/analyzer/saved_diagnostic/ploc": {"enode": 973},
                                       "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_1 = socket (2, type_37, 0);, _1)",
                                       "gcc/analyzer/saved_diagnostic/state": "fd-new-unknown-socket",
                                       "gcc/analyzer/saved_diagnostic/idx": 0,
                                       "gcc/analyzer/pending_diagnostic/kind": "fd_leak"},
                        "level": "warning",
                        "message": {"text": "leak of file descriptor"},
                        "locations": [{"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                 "uriBaseId": "PWD"},
                                                            "region": {"startLine": 187,
                                                                       "startColumn": 17,
                                                                       "endColumn": 41},
                                                            "contextRegion": {"startLine": 187,
                                                                              "snippet": {"text": "\tfd[1] = socket(AF_INET, type, 0);\n"}}},
                                       "logicalLocations": [{"index": 0,
                                                             "fullyQualifiedName": "t_create_socket_pair"}]}],
                        "codeFlows": [{"threadFlows": [{"id": "main",
                                                        "locations": [{"properties": {"gcc/analyzer/checker_event/emission_id": "(1)",
                                                                                      "gcc/analyzer/checker_event/kind": "state_change"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 184,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 184,
                                                                                                                           "snippet": {"text": "\tfd[0] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "socket created here"}},
                                                                       "kinds": ["acquire",
                                                                                 "resource"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 1},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(2)",
                                                                                      "gcc/analyzer/checker_event/kind": "custom"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 184,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 184,
                                                                                                                           "snippet": {"text": "\tfd[0] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "when ‘socket’ succeeds"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 2},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(3)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 391,
                                                                                                                                 "dst_id": 395}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 185,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 185,
                                                                                                                           "snippet": {"text": "\tif (fd[0] < 0)\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 3},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(4)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 391,
                                                                                                                                 "dst_id": 395}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 187,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 187,
                                                                                                                           "snippet": {"text": "\tfd[1] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 4},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(5)",
                                                                                      "gcc/analyzer/checker_event/kind": "warning"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 187,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 187,
                                                                                                                           "snippet": {"text": "\tfd[1] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "leaks here"}},
                                                                       "kinds": ["danger"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 5}]}]}]},
                       {"ruleId": "-Wanalyzer-fd-leak",
                        "taxa": [{"id": "775",
                                  "toolComponent": {"name": "cwe"}}],
                        "properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                       "gcc/analyzer/saved_diagnostic/ploc": {"enode": 1008},
                                       "gcc/analyzer/saved_diagnostic/var": "*fd_40(D)",
                                       "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_9 = bind (_8, D.9923, 16);, (*INIT_VAL(fd_40(D))))",
                                       "gcc/analyzer/saved_diagnostic/state": "fd-bound-stream-socket",
                                       "gcc/analyzer/saved_diagnostic/idx": 1,
                                       "gcc/analyzer/saved_diagnostic/duplicates": [{"properties": {"gcc/analyzer/saved_diagnostic/sm": "file-descriptor",
                                                                                                    "gcc/analyzer/saved_diagnostic/ploc": {"enode": 1008},
                                                                                                    "gcc/analyzer/saved_diagnostic/var": "*fd_40(D)",
                                                                                                    "gcc/analyzer/saved_diagnostic/sval": "CONJURED(_9 = bind (_8, D.9923, 16);, (*INIT_VAL(fd_40(D))))",
                                                                                                    "gcc/analyzer/saved_diagnostic/state": "fd-bound-stream-socket",
                                                                                                    "gcc/analyzer/saved_diagnostic/idx": 2,
                                                                                                    "gcc/analyzer/pending_diagnostic/kind": "fd_leak"}}],
                                       "gcc/analyzer/pending_diagnostic/kind": "fd_leak"},
                        "level": "warning",
                        "message": {"text": "leak of file descriptor ‘*fd’"},
                        "locations": [{"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                 "uriBaseId": "PWD"},
                                                            "region": {"startLine": 211,
                                                                       "startColumn": 23,
                                                                       "endColumn": 40},
                                                            "contextRegion": {"startLine": 211,
                                                                              "snippet": {"text": "\tif (stream && listen(fd[0], 16)) {\n"}}},
                                       "logicalLocations": [{"index": 0,
                                                             "fullyQualifiedName": "t_create_socket_pair"}]}],
                        "codeFlows": [{"threadFlows": [{"id": "main",
                                                        "locations": [{"properties": {"gcc/analyzer/checker_event/emission_id": "(1)",
                                                                                      "gcc/analyzer/checker_event/kind": "custom"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 184,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 184,
                                                                                                                           "snippet": {"text": "\tfd[0] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "when ‘socket’ succeeds"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 1},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(2)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 391,
                                                                                                                                 "dst_id": 395}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 185,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 185,
                                                                                                                           "snippet": {"text": "\tif (fd[0] < 0)\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 2},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(3)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 391,
                                                                                                                                 "dst_id": 395}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 187,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 187,
                                                                                                                           "snippet": {"text": "\tfd[1] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 3},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(4)",
                                                                                      "gcc/analyzer/checker_event/kind": "custom"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 187,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 187,
                                                                                                                           "snippet": {"text": "\tfd[1] = socket(AF_INET, type, 0);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "when ‘socket’ succeeds"}},
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 4},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(5)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 397,
                                                                                                                                 "dst_id": 403}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 188,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 188,
                                                                                                                           "snippet": {"text": "\tif (fd[1] < 0) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 5},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(6)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 397,
                                                                                                                                 "dst_id": 403}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 194,
                                                                                                                    "startColumn": 9,
                                                                                                                    "endColumn": 16},
                                                                                                         "contextRegion": {"startLine": 194,
                                                                                                                           "snippet": {"text": "\tval = 1;\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 6},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(7)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 406,
                                                                                                                                 "dst_id": 408}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 195,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 195,
                                                                                                                           "snippet": {"text": "\tif (setsockopt(fd[0], SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)))\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 7},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(8)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 406,
                                                                                                                                 "dst_id": 408}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 198,
                                                                                                                    "startColumn": 9,
                                                                                                                    "endColumn": 49},
                                                                                                         "contextRegion": {"startLine": 198,
                                                                                                                           "snippet": {"text": "\tmemset(&serv_addr, 0, sizeof(serv_addr));\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 8},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(9)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 415,
                                                                                                                                 "dst_id": 419}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 206,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 206,
                                                                                                                           "snippet": {"text": "\tif (bind(fd[0], paddr, paddrlen)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 9},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(10)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 415,
                                                                                                                                 "dst_id": 419}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 211,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 211,
                                                                                                                           "snippet": {"text": "\tif (stream && listen(fd[0], 16)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 10},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(11)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 419,
                                                                                                                                 "dst_id": 420}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 211,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 211,
                                                                                                                           "snippet": {"text": "\tif (stream && listen(fd[0], 16)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "following ‘true’ branch (when ‘stream != 0’)..."}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 11},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(12)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 419,
                                                                                                                                 "dst_id": 420}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 211,
                                                                                                                    "startColumn": 23,
                                                                                                                    "endColumn": 40},
                                                                                                         "contextRegion": {"startLine": 211,
                                                                                                                           "snippet": {"text": "\tif (stream && listen(fd[0], 16)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 12},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(13)",
                                                                                      "gcc/analyzer/checker_event/kind": "warning"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "helpers.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 211,
                                                                                                                    "startColumn": 23,
                                                                                                                    "endColumn": 40},
                                                                                                         "contextRegion": {"startLine": 211,
                                                                                                                           "snippet": {"text": "\tif (stream && listen(fd[0], 16)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "t_create_socket_pair"}],
                                                                                    "message": {"text": "‘*fd’ leaks here"}},
                                                                       "kinds": ["danger"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 13}]}]}]}],
           "logicalLocations": [{"name": "t_create_socket_pair",
                                 "fullyQualifiedName": "t_create_socket_pair",
                                 "decoratedName": "t_create_socket_pair",
                                 "kind": "function",
                                 "index": 0}]}]}
