prompt
stringclasses 1
value | completions
listlengths 1
63.8k
| labels
listlengths 1
63.8k
| source
stringclasses 1
value | other_info
stringlengths 2.06k
101k
| index
int64 0
6.83k
|
|---|---|---|---|---|---|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * af_llc.c - LLC User Interface SAPs\n * Description:\n * Functions in this module are implementation of socket based llc\n * communications for the Linux operating system. Support of llc class\n * one and class two is provided via SOCK_DGRAM and SOCK_STREAM\n * respectively.\n *\n * An llc2 connection is (mac + sap), only one llc2 sap connection\n * is allowed per mac. Though one sap may have multiple mac + sap\n * connections.\n *\n * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org>\n *\t\t 2002-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>\n *\n * This program can be redistributed or modified under the terms of the\n * GNU General Public License as published by the Free Software Foundation.\n * This program is distributed without any warranty or implied warranty\n * of merchantability or fitness for a particular purpose.\n *\n * See the GNU General Public License for more details.\n */\n#include <linux/compiler.h>\n#include <linux/kernel.h>\n#include <linux/module.h>\n#include <linux/rtnetlink.h>\n#include <linux/init.h>\n#include <linux/slab.h>\n#include <linux/sched/signal.h>",
"#include <net/llc.h>\n#include <net/llc_sap.h>\n#include <net/llc_pdu.h>\n#include <net/llc_conn.h>\n#include <net/tcp_states.h>",
"/* remember: uninitialized global data is zeroed because its in .bss */\nstatic u16 llc_ui_sap_last_autoport = LLC_SAP_DYN_START;\nstatic u16 llc_ui_sap_link_no_max[256];\nstatic struct sockaddr_llc llc_ui_addrnull;\nstatic const struct proto_ops llc_ui_ops;",
"static bool llc_ui_wait_for_conn(struct sock *sk, long timeout);\nstatic int llc_ui_wait_for_disc(struct sock *sk, long timeout);\nstatic int llc_ui_wait_for_busy_core(struct sock *sk, long timeout);",
"#if 0\n#define dprintk(args...) printk(KERN_DEBUG args)\n#else\n#define dprintk(args...) do {} while (0)\n#endif",
"/* Maybe we'll add some more in the future. */\n#define LLC_CMSG_PKTINFO\t1",
"\n/**\n *\tllc_ui_next_link_no - return the next unused link number for a sap\n *\t@sap: Address of sap to get link number from.\n *\n *\tReturn the next unused link number for a given sap.\n */\nstatic inline u16 llc_ui_next_link_no(int sap)\n{\n\treturn llc_ui_sap_link_no_max[sap]++;\n}",
"/**\n *\tllc_proto_type - return eth protocol for ARP header type\n *\t@arphrd: ARP header type.\n *\n *\tGiven an ARP header type return the corresponding ethernet protocol.\n */\nstatic inline __be16 llc_proto_type(u16 arphrd)\n{\n\treturn htons(ETH_P_802_2);\n}",
"/**\n *\tllc_ui_addr_null - determines if a address structure is null\n *\t@addr: Address to test if null.\n */\nstatic inline u8 llc_ui_addr_null(struct sockaddr_llc *addr)\n{\n\treturn !memcmp(addr, &llc_ui_addrnull, sizeof(*addr));\n}",
"/**\n *\tllc_ui_header_len - return length of llc header based on operation\n *\t@sk: Socket which contains a valid llc socket type.\n *\t@addr: Complete sockaddr_llc structure received from the user.\n *\n *\tProvide the length of the llc header depending on what kind of\n *\toperation the user would like to perform and the type of socket.\n *\tReturns the correct llc header length.\n */\nstatic inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr)\n{\n\tu8 rc = LLC_PDU_LEN_U;",
"\tif (addr->sllc_test)\n\t\trc = LLC_PDU_LEN_U;\n\telse if (addr->sllc_xid)\n\t\t/* We need to expand header to sizeof(struct llc_xid_info)\n\t\t * since llc_pdu_init_as_xid_cmd() sets 4,5,6 bytes of LLC header\n\t\t * as XID PDU. In llc_ui_sendmsg() we reserved header size and then\n\t\t * filled all other space with user data. If we won't reserve this\n\t\t * bytes, llc_pdu_init_as_xid_cmd() will overwrite user data\n\t\t */\n\t\trc = LLC_PDU_LEN_U_XID;\n\telse if (sk->sk_type == SOCK_STREAM)\n\t\trc = LLC_PDU_LEN_I;\n\treturn rc;\n}",
"/**\n *\tllc_ui_send_data - send data via reliable llc2 connection\n *\t@sk: Connection the socket is using.\n *\t@skb: Data the user wishes to send.\n *\t@noblock: can we block waiting for data?\n *\n *\tSend data via reliable llc2 connection.\n *\tReturns 0 upon success, non-zero if action did not succeed.\n *\n *\tThis function always consumes a reference to the skb.\n */\nstatic int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)\n{\n\tstruct llc_sock* llc = llc_sk(sk);",
"\tif (unlikely(llc_data_accept_state(llc->state) ||\n\t\t llc->remote_busy_flag ||\n\t\t llc->p_flag)) {\n\t\tlong timeout = sock_sndtimeo(sk, noblock);\n\t\tint rc;",
"\t\trc = llc_ui_wait_for_busy_core(sk, timeout);\n\t\tif (rc) {\n\t\t\tkfree_skb(skb);\n\t\t\treturn rc;\n\t\t}\n\t}\n\treturn llc_build_and_send_pkt(sk, skb);\n}",
"static void llc_ui_sk_init(struct socket *sock, struct sock *sk)\n{\n\tsock_graft(sk, sock);\n\tsk->sk_type\t= sock->type;\n\tsock->ops\t= &llc_ui_ops;\n}",
"static struct proto llc_proto = {\n\t.name\t = \"LLC\",\n\t.owner\t = THIS_MODULE,\n\t.obj_size = sizeof(struct llc_sock),\n\t.slab_flags = SLAB_TYPESAFE_BY_RCU,\n};",
"/**\n *\tllc_ui_create - alloc and init a new llc_ui socket\n *\t@net: network namespace (must be default network)\n *\t@sock: Socket to initialize and attach allocated sk to.\n *\t@protocol: Unused.\n *\t@kern: on behalf of kernel or userspace\n *\n *\tAllocate and initialize a new llc_ui socket, validate the user wants a\n *\tsocket type we have available.\n *\tReturns 0 upon success, negative upon failure.\n */\nstatic int llc_ui_create(struct net *net, struct socket *sock, int protocol,\n\t\t\t int kern)\n{\n\tstruct sock *sk;\n\tint rc = -ESOCKTNOSUPPORT;",
"\tif (!ns_capable(net->user_ns, CAP_NET_RAW))\n\t\treturn -EPERM;",
"\tif (!net_eq(net, &init_net))\n\t\treturn -EAFNOSUPPORT;",
"\tif (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) {\n\t\trc = -ENOMEM;\n\t\tsk = llc_sk_alloc(net, PF_LLC, GFP_KERNEL, &llc_proto, kern);\n\t\tif (sk) {\n\t\t\trc = 0;\n\t\t\tllc_ui_sk_init(sock, sk);\n\t\t}\n\t}\n\treturn rc;\n}",
"/**\n *\tllc_ui_release - shutdown socket\n *\t@sock: Socket to release.\n *\n *\tShutdown and deallocate an existing socket.\n */\nstatic int llc_ui_release(struct socket *sock)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc;",
"\tif (unlikely(sk == NULL))\n\t\tgoto out;\n\tsock_hold(sk);\n\tlock_sock(sk);\n\tllc = llc_sk(sk);\n\tdprintk(\"%s: closing local(%02X) remote(%02X)\\n\", __func__,\n\t\tllc->laddr.lsap, llc->daddr.lsap);\n\tif (!llc_send_disc(sk))\n\t\tllc_ui_wait_for_disc(sk, sk->sk_rcvtimeo);\n\tif (!sock_flag(sk, SOCK_ZAPPED)) {\n\t\tstruct llc_sap *sap = llc->sap;",
"\t\t/* Hold this for release_sock(), so that llc_backlog_rcv()\n\t\t * could still use it.\n\t\t */\n\t\tllc_sap_hold(sap);\n\t\tllc_sap_remove_socket(llc->sap, sk);\n\t\trelease_sock(sk);\n\t\tllc_sap_put(sap);\n\t} else {\n\t\trelease_sock(sk);\n\t}\n\tdev_put_track(llc->dev, &llc->dev_tracker);\n\tsock_put(sk);\n\tllc_sk_free(sk);\nout:\n\treturn 0;\n}",
"/**\n *\tllc_ui_autoport - provide dynamically allocate SAP number\n *\n *\tProvide the caller with a dynamically allocated SAP number according\n *\tto the rules that are set in this function. Returns: 0, upon failure,\n *\tSAP number otherwise.\n */\nstatic int llc_ui_autoport(void)\n{\n\tstruct llc_sap *sap;\n\tint i, tries = 0;",
"\twhile (tries < LLC_SAP_DYN_TRIES) {\n\t\tfor (i = llc_ui_sap_last_autoport;\n\t\t i < LLC_SAP_DYN_STOP; i += 2) {\n\t\t\tsap = llc_sap_find(i);\n\t\t\tif (!sap) {\n\t\t\t\tllc_ui_sap_last_autoport = i + 2;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tllc_sap_put(sap);\n\t\t}\n\t\tllc_ui_sap_last_autoport = LLC_SAP_DYN_START;\n\t\ttries++;\n\t}\n\ti = 0;\nout:\n\treturn i;\n}",
"/**\n *\tllc_ui_autobind - automatically bind a socket to a sap\n *\t@sock: socket to bind\n *\t@addr: address to connect to\n *\n * \tUsed by llc_ui_connect and llc_ui_sendmsg when the user hasn't\n * \tspecifically used llc_ui_bind to bind to an specific address/sap\n *\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tstruct llc_sap *sap;\n\tint rc = -EINVAL;",
"\tif (!sock_flag(sk, SOCK_ZAPPED))\n\t\tgoto out;\n\tif (!addr->sllc_arphrd)\n\t\taddr->sllc_arphrd = ARPHRD_ETHER;\n\tif (addr->sllc_arphrd != ARPHRD_ETHER)\n\t\tgoto out;\n\trc = -ENODEV;\n\tif (sk->sk_bound_dev_if) {\n\t\tllc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if);\n\t\tif (llc->dev && addr->sllc_arphrd != llc->dev->type) {\n\t\t\tdev_put(llc->dev);\n\t\t\tllc->dev = NULL;\n\t\t}\n\t} else\n\t\tllc->dev = dev_getfirstbyhwtype(&init_net, addr->sllc_arphrd);\n\tif (!llc->dev)\n\t\tgoto out;\n\tnetdev_tracker_alloc(llc->dev, &llc->dev_tracker, GFP_KERNEL);\n\trc = -EUSERS;\n\tllc->laddr.lsap = llc_ui_autoport();\n\tif (!llc->laddr.lsap)\n\t\tgoto out;\n\trc = -EBUSY; /* some other network layer is using the sap */\n\tsap = llc_sap_open(llc->laddr.lsap, NULL);\n\tif (!sap)\n\t\tgoto out;\n\tmemcpy(llc->laddr.mac, llc->dev->dev_addr, IFHWADDRLEN);\n\tmemcpy(&llc->addr, addr, sizeof(llc->addr));\n\t/* assign new connection to its SAP */\n\tllc_sap_add_socket(sap, sk);\n\tsock_reset_flag(sk, SOCK_ZAPPED);\n\trc = 0;\nout:",
"",
"\treturn rc;\n}",
"/**\n *\tllc_ui_bind - bind a socket to a specific address.\n *\t@sock: Socket to bind an address to.\n *\t@uaddr: Address the user wants the socket bound to.\n *\t@addrlen: Length of the uaddr structure.\n *\n *\tBind a socket to a specific address. For llc a user is able to bind to\n *\ta specific sap only or mac + sap.\n *\tIf the user desires to bind to a specific mac + sap, it is possible to\n *\thave multiple sap connections via multiple macs.\n *\tBind and autobind for that matter must enforce the correct sap usage\n *\totherwise all hell will break loose.\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)\n{\n\tstruct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tstruct llc_sap *sap;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr)))\n\t\tgoto out;\n\trc = -EAFNOSUPPORT;\n\tif (!addr->sllc_arphrd)\n\t\taddr->sllc_arphrd = ARPHRD_ETHER;\n\tif (unlikely(addr->sllc_family != AF_LLC || addr->sllc_arphrd != ARPHRD_ETHER))\n\t\tgoto out;\n\tdprintk(\"%s: binding %02X\\n\", __func__, addr->sllc_sap);\n\trc = -ENODEV;\n\trcu_read_lock();\n\tif (sk->sk_bound_dev_if) {\n\t\tllc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if);\n\t\tif (llc->dev) {\n\t\t\tif (is_zero_ether_addr(addr->sllc_mac))\n\t\t\t\tmemcpy(addr->sllc_mac, llc->dev->dev_addr,\n\t\t\t\t IFHWADDRLEN);\n\t\t\tif (addr->sllc_arphrd != llc->dev->type ||\n\t\t\t !ether_addr_equal(addr->sllc_mac,\n\t\t\t\t\t llc->dev->dev_addr)) {\n\t\t\t\trc = -EINVAL;\n\t\t\t\tllc->dev = NULL;\n\t\t\t}\n\t\t}\n\t} else\n\t\tllc->dev = dev_getbyhwaddr_rcu(&init_net, addr->sllc_arphrd,\n\t\t\t\t\t addr->sllc_mac);\n\tdev_hold_track(llc->dev, &llc->dev_tracker, GFP_ATOMIC);\n\trcu_read_unlock();\n\tif (!llc->dev)\n\t\tgoto out;\n\tif (!addr->sllc_sap) {\n\t\trc = -EUSERS;\n\t\taddr->sllc_sap = llc_ui_autoport();\n\t\tif (!addr->sllc_sap)\n\t\t\tgoto out;\n\t}\n\tsap = llc_sap_find(addr->sllc_sap);\n\tif (!sap) {\n\t\tsap = llc_sap_open(addr->sllc_sap, NULL);\n\t\trc = -EBUSY; /* some other network layer is using the sap */\n\t\tif (!sap)\n\t\t\tgoto out;\n\t} else {\n\t\tstruct llc_addr laddr, daddr;\n\t\tstruct sock *ask;",
"\t\tmemset(&laddr, 0, sizeof(laddr));\n\t\tmemset(&daddr, 0, sizeof(daddr));\n\t\t/*\n\t\t * FIXME: check if the address is multicast,\n\t\t * \t only SOCK_DGRAM can do this.\n\t\t */\n\t\tmemcpy(laddr.mac, addr->sllc_mac, IFHWADDRLEN);\n\t\tladdr.lsap = addr->sllc_sap;\n\t\trc = -EADDRINUSE; /* mac + sap clash. */\n\t\task = llc_lookup_established(sap, &daddr, &laddr);\n\t\tif (ask) {\n\t\t\tsock_put(ask);\n\t\t\tgoto out_put;\n\t\t}\n\t}\n\tllc->laddr.lsap = addr->sllc_sap;\n\tmemcpy(llc->laddr.mac, addr->sllc_mac, IFHWADDRLEN);\n\tmemcpy(&llc->addr, addr, sizeof(llc->addr));\n\t/* assign new connection to its SAP */\n\tllc_sap_add_socket(sap, sk);\n\tsock_reset_flag(sk, SOCK_ZAPPED);\n\trc = 0;\nout_put:\n\tllc_sap_put(sap);\nout:",
"",
"\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_shutdown - shutdown a connect llc2 socket.\n *\t@sock: Socket to shutdown.\n *\t@how: What part of the socket to shutdown.\n *\n *\tShutdown a connected llc2 socket. Currently this function only supports\n *\tshutting down both sends and receives (2), we could probably make this\n *\tfunction such that a user can shutdown only half the connection but not\n *\tright now.\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_shutdown(struct socket *sock, int how)\n{\n\tstruct sock *sk = sock->sk;\n\tint rc = -ENOTCONN;",
"\tlock_sock(sk);\n\tif (unlikely(sk->sk_state != TCP_ESTABLISHED))\n\t\tgoto out;\n\trc = -EINVAL;\n\tif (how != 2)\n\t\tgoto out;\n\trc = llc_send_disc(sk);\n\tif (!rc)\n\t\trc = llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo);\n\t/* Wake up anyone sleeping in poll */\n\tsk->sk_state_change(sk);\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_connect - Connect to a remote llc2 mac + sap.\n *\t@sock: Socket which will be connected to the remote destination.\n *\t@uaddr: Remote and possibly the local address of the new connection.\n *\t@addrlen: Size of uaddr structure.\n *\t@flags: Operational flags specified by the user.\n *\n *\tConnect to a remote llc2 mac + sap. The caller must specify the\n *\tdestination mac and address to connect to. If the user hasn't previously\n *\tcalled bind(2) with a smac the address of the first interface of the\n *\tspecified arp type will be used.\n *\tThis function will autobind if user did not previously call bind.\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,\n\t\t\t int addrlen, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tstruct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(addrlen != sizeof(*addr)))\n\t\tgoto out;\n\trc = -EAFNOSUPPORT;\n\tif (unlikely(addr->sllc_family != AF_LLC))\n\t\tgoto out;\n\tif (unlikely(sk->sk_type != SOCK_STREAM))\n\t\tgoto out;\n\trc = -EALREADY;\n\tif (unlikely(sock->state == SS_CONNECTING))\n\t\tgoto out;\n\t/* bind connection to sap if user hasn't done it. */\n\tif (sock_flag(sk, SOCK_ZAPPED)) {\n\t\t/* bind to sap with null dev, exclusive */\n\t\trc = llc_ui_autobind(sock, addr);\n\t\tif (rc)\n\t\t\tgoto out;\n\t}\n\tllc->daddr.lsap = addr->sllc_sap;\n\tmemcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN);\n\tsock->state = SS_CONNECTING;\n\tsk->sk_state = TCP_SYN_SENT;\n\tllc->link = llc_ui_next_link_no(llc->sap->laddr.lsap);\n\trc = llc_establish_connection(sk, llc->dev->dev_addr,\n\t\t\t\t addr->sllc_mac, addr->sllc_sap);\n\tif (rc) {\n\t\tdprintk(\"%s: llc_ui_send_conn failed :-(\\n\", __func__);\n\t\tsock->state = SS_UNCONNECTED;\n\t\tsk->sk_state = TCP_CLOSE;\n\t\tgoto out;\n\t}",
"\tif (sk->sk_state == TCP_SYN_SENT) {\n\t\tconst long timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);",
"\t\tif (!timeo || !llc_ui_wait_for_conn(sk, timeo))\n\t\t\tgoto out;",
"\t\trc = sock_intr_errno(timeo);\n\t\tif (signal_pending(current))\n\t\t\tgoto out;\n\t}",
"\tif (sk->sk_state == TCP_CLOSE)\n\t\tgoto sock_error;",
"\tsock->state = SS_CONNECTED;\n\trc = 0;\nout:\n\trelease_sock(sk);\n\treturn rc;\nsock_error:\n\trc = sock_error(sk) ? : -ECONNABORTED;\n\tsock->state = SS_UNCONNECTED;\n\tgoto out;\n}",
"/**\n *\tllc_ui_listen - allow a normal socket to accept incoming connections\n *\t@sock: Socket to allow incoming connections on.\n *\t@backlog: Number of connections to queue.\n *\n *\tAllow a normal socket to accept incoming connections.\n *\tReturns 0 upon success, negative otherwise.\n */\nstatic int llc_ui_listen(struct socket *sock, int backlog)\n{\n\tstruct sock *sk = sock->sk;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(sock->state != SS_UNCONNECTED))\n\t\tgoto out;\n\trc = -EOPNOTSUPP;\n\tif (unlikely(sk->sk_type != SOCK_STREAM))\n\t\tgoto out;\n\trc = -EAGAIN;\n\tif (sock_flag(sk, SOCK_ZAPPED))\n\t\tgoto out;\n\trc = 0;\n\tif (!(unsigned int)backlog)\t/* BSDism */\n\t\tbacklog = 1;\n\tsk->sk_max_ack_backlog = backlog;\n\tif (sk->sk_state != TCP_LISTEN) {\n\t\tsk->sk_ack_backlog = 0;\n\t\tsk->sk_state\t = TCP_LISTEN;\n\t}\n\tsk->sk_socket->flags |= __SO_ACCEPTCON;\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"static int llc_ui_wait_for_disc(struct sock *sk, long timeout)\n{\n\tDEFINE_WAIT_FUNC(wait, woken_wake_function);\n\tint rc = 0;",
"\tadd_wait_queue(sk_sleep(sk), &wait);\n\twhile (1) {\n\t\tif (sk_wait_event(sk, &timeout, sk->sk_state == TCP_CLOSE, &wait))\n\t\t\tbreak;\n\t\trc = -ERESTARTSYS;\n\t\tif (signal_pending(current))\n\t\t\tbreak;\n\t\trc = -EAGAIN;\n\t\tif (!timeout)\n\t\t\tbreak;\n\t\trc = 0;\n\t}\n\tremove_wait_queue(sk_sleep(sk), &wait);\n\treturn rc;\n}",
"static bool llc_ui_wait_for_conn(struct sock *sk, long timeout)\n{\n\tDEFINE_WAIT_FUNC(wait, woken_wake_function);",
"\tadd_wait_queue(sk_sleep(sk), &wait);\n\twhile (1) {\n\t\tif (sk_wait_event(sk, &timeout, sk->sk_state != TCP_SYN_SENT, &wait))\n\t\t\tbreak;\n\t\tif (signal_pending(current) || !timeout)\n\t\t\tbreak;\n\t}\n\tremove_wait_queue(sk_sleep(sk), &wait);\n\treturn timeout;\n}",
"static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout)\n{\n\tDEFINE_WAIT_FUNC(wait, woken_wake_function);\n\tstruct llc_sock *llc = llc_sk(sk);\n\tint rc;",
"\tadd_wait_queue(sk_sleep(sk), &wait);\n\twhile (1) {\n\t\trc = 0;\n\t\tif (sk_wait_event(sk, &timeout,\n\t\t\t\t (sk->sk_shutdown & RCV_SHUTDOWN) ||\n\t\t\t\t (!llc_data_accept_state(llc->state) &&\n\t\t\t\t !llc->remote_busy_flag &&\n\t\t\t\t !llc->p_flag), &wait))\n\t\t\tbreak;\n\t\trc = -ERESTARTSYS;\n\t\tif (signal_pending(current))\n\t\t\tbreak;\n\t\trc = -EAGAIN;\n\t\tif (!timeout)\n\t\t\tbreak;\n\t}\n\tremove_wait_queue(sk_sleep(sk), &wait);\n\treturn rc;\n}",
"static int llc_wait_data(struct sock *sk, long timeo)\n{\n\tint rc;",
"\twhile (1) {\n\t\t/*\n\t\t * POSIX 1003.1g mandates this order.\n\t\t */\n\t\trc = sock_error(sk);\n\t\tif (rc)\n\t\t\tbreak;\n\t\trc = 0;\n\t\tif (sk->sk_shutdown & RCV_SHUTDOWN)\n\t\t\tbreak;\n\t\trc = -EAGAIN;\n\t\tif (!timeo)\n\t\t\tbreak;\n\t\trc = sock_intr_errno(timeo);\n\t\tif (signal_pending(current))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tif (sk_wait_data(sk, &timeo, NULL))\n\t\t\tbreak;\n\t}\n\treturn rc;\n}",
"static void llc_cmsg_rcv(struct msghdr *msg, struct sk_buff *skb)\n{\n\tstruct llc_sock *llc = llc_sk(skb->sk);",
"\tif (llc->cmsg_flags & LLC_CMSG_PKTINFO) {\n\t\tstruct llc_pktinfo info;",
"\t\tmemset(&info, 0, sizeof(info));\n\t\tinfo.lpi_ifindex = llc_sk(skb->sk)->dev->ifindex;\n\t\tllc_pdu_decode_dsap(skb, &info.lpi_sap);\n\t\tllc_pdu_decode_da(skb, info.lpi_mac);\n\t\tput_cmsg(msg, SOL_LLC, LLC_OPT_PKTINFO, sizeof(info), &info);\n\t}\n}",
"/**\n *\tllc_ui_accept - accept a new incoming connection.\n *\t@sock: Socket which connections arrive on.\n *\t@newsock: Socket to move incoming connection to.\n *\t@flags: User specified operational flags.\n *\t@kern: If the socket is kernel internal\n *\n *\tAccept a new incoming connection.\n *\tReturns 0 upon success, negative otherwise.\n */\nstatic int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags,\n\t\t\t bool kern)\n{\n\tstruct sock *sk = sock->sk, *newsk;\n\tstruct llc_sock *llc, *newllc;\n\tstruct sk_buff *skb;\n\tint rc = -EOPNOTSUPP;",
"\tdprintk(\"%s: accepting on %02X\\n\", __func__,\n\t\tllc_sk(sk)->laddr.lsap);\n\tlock_sock(sk);\n\tif (unlikely(sk->sk_type != SOCK_STREAM))\n\t\tgoto out;\n\trc = -EINVAL;\n\tif (unlikely(sock->state != SS_UNCONNECTED ||\n\t\t sk->sk_state != TCP_LISTEN))\n\t\tgoto out;\n\t/* wait for a connection to arrive. */\n\tif (skb_queue_empty(&sk->sk_receive_queue)) {\n\t\trc = llc_wait_data(sk, sk->sk_rcvtimeo);\n\t\tif (rc)\n\t\t\tgoto out;\n\t}\n\tdprintk(\"%s: got a new connection on %02X\\n\", __func__,\n\t\tllc_sk(sk)->laddr.lsap);\n\tskb = skb_dequeue(&sk->sk_receive_queue);\n\trc = -EINVAL;\n\tif (!skb->sk)\n\t\tgoto frees;\n\trc = 0;\n\tnewsk = skb->sk;\n\t/* attach connection to a new socket. */\n\tllc_ui_sk_init(newsock, newsk);\n\tsock_reset_flag(newsk, SOCK_ZAPPED);\n\tnewsk->sk_state\t\t= TCP_ESTABLISHED;\n\tnewsock->state\t\t= SS_CONNECTED;\n\tllc\t\t\t= llc_sk(sk);\n\tnewllc\t\t\t= llc_sk(newsk);\n\tmemcpy(&newllc->addr, &llc->addr, sizeof(newllc->addr));\n\tnewllc->link = llc_ui_next_link_no(newllc->laddr.lsap);",
"\t/* put original socket back into a clean listen state. */\n\tsk->sk_state = TCP_LISTEN;\n\tsk_acceptq_removed(sk);\n\tdprintk(\"%s: ok success on %02X, client on %02X\\n\", __func__,\n\t\tllc_sk(sk)->addr.sllc_sap, newllc->daddr.lsap);\nfrees:\n\tkfree_skb(skb);\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_recvmsg - copy received data to the socket user.\n *\t@sock: Socket to copy data from.\n *\t@msg: Various user space related information.\n *\t@len: Size of user buffer.\n *\t@flags: User specified flags.\n *\n *\tCopy received data to the socket user.\n *\tReturns non-negative upon success, negative otherwise.\n */\nstatic int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,\n\t\t\t int flags)\n{\n\tDECLARE_SOCKADDR(struct sockaddr_llc *, uaddr, msg->msg_name);\n\tconst int nonblock = flags & MSG_DONTWAIT;\n\tstruct sk_buff *skb = NULL;\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tsize_t copied = 0;\n\tu32 peek_seq = 0;\n\tu32 *seq, skb_len;\n\tunsigned long used;\n\tint target;\t/* Read at least this many bytes */\n\tlong timeo;",
"\tlock_sock(sk);\n\tcopied = -ENOTCONN;\n\tif (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))\n\t\tgoto out;",
"\ttimeo = sock_rcvtimeo(sk, nonblock);",
"\tseq = &llc->copied_seq;\n\tif (flags & MSG_PEEK) {\n\t\tpeek_seq = llc->copied_seq;\n\t\tseq = &peek_seq;\n\t}",
"\ttarget = sock_rcvlowat(sk, flags & MSG_WAITALL, len);\n\tcopied = 0;",
"\tdo {\n\t\tu32 offset;",
"\t\t/*\n\t\t * We need to check signals first, to get correct SIGURG\n\t\t * handling. FIXME: Need to check this doesn't impact 1003.1g\n\t\t * and move it down to the bottom of the loop\n\t\t */\n\t\tif (signal_pending(current)) {\n\t\t\tif (copied)\n\t\t\t\tbreak;\n\t\t\tcopied = timeo ? sock_intr_errno(timeo) : -EAGAIN;\n\t\t\tbreak;\n\t\t}",
"\t\t/* Next get a buffer. */",
"\t\tskb = skb_peek(&sk->sk_receive_queue);\n\t\tif (skb) {\n\t\t\toffset = *seq;\n\t\t\tgoto found_ok_skb;\n\t\t}\n\t\t/* Well, if we have backlog, try to process it now yet. */",
"\t\tif (copied >= target && !READ_ONCE(sk->sk_backlog.tail))\n\t\t\tbreak;",
"\t\tif (copied) {\n\t\t\tif (sk->sk_err ||\n\t\t\t sk->sk_state == TCP_CLOSE ||\n\t\t\t (sk->sk_shutdown & RCV_SHUTDOWN) ||\n\t\t\t !timeo ||\n\t\t\t (flags & MSG_PEEK))\n\t\t\t\tbreak;\n\t\t} else {\n\t\t\tif (sock_flag(sk, SOCK_DONE))\n\t\t\t\tbreak;",
"\t\t\tif (sk->sk_err) {\n\t\t\t\tcopied = sock_error(sk);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (sk->sk_shutdown & RCV_SHUTDOWN)\n\t\t\t\tbreak;",
"\t\t\tif (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSE) {\n\t\t\t\tif (!sock_flag(sk, SOCK_DONE)) {\n\t\t\t\t\t/*\n\t\t\t\t\t * This occurs when user tries to read\n\t\t\t\t\t * from never connected socket.\n\t\t\t\t\t */\n\t\t\t\t\tcopied = -ENOTCONN;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!timeo) {\n\t\t\t\tcopied = -EAGAIN;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"\t\tif (copied >= target) { /* Do not sleep, just process backlog. */\n\t\t\trelease_sock(sk);\n\t\t\tlock_sock(sk);\n\t\t} else\n\t\t\tsk_wait_data(sk, &timeo, NULL);",
"\t\tif ((flags & MSG_PEEK) && peek_seq != llc->copied_seq) {\n\t\t\tnet_dbg_ratelimited(\"LLC(%s:%d): Application bug, race in MSG_PEEK\\n\",\n\t\t\t\t\t current->comm,\n\t\t\t\t\t task_pid_nr(current));\n\t\t\tpeek_seq = llc->copied_seq;\n\t\t}\n\t\tcontinue;\n\tfound_ok_skb:\n\t\tskb_len = skb->len;\n\t\t/* Ok so how much can we use? */\n\t\tused = skb->len - offset;\n\t\tif (len < used)\n\t\t\tused = len;",
"\t\tif (!(flags & MSG_TRUNC)) {\n\t\t\tint rc = skb_copy_datagram_msg(skb, offset, msg, used);\n\t\t\tif (rc) {\n\t\t\t\t/* Exception. Bailout! */\n\t\t\t\tif (!copied)\n\t\t\t\t\tcopied = -EFAULT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"\t\t*seq += used;\n\t\tcopied += used;\n\t\tlen -= used;",
"\t\t/* For non stream protcols we get one packet per recvmsg call */\n\t\tif (sk->sk_type != SOCK_STREAM)\n\t\t\tgoto copy_uaddr;",
"\t\tif (!(flags & MSG_PEEK)) {\n\t\t\tskb_unlink(skb, &sk->sk_receive_queue);\n\t\t\tkfree_skb(skb);\n\t\t\t*seq = 0;\n\t\t}",
"\t\t/* Partial read */\n\t\tif (used + offset < skb_len)\n\t\t\tcontinue;\n\t} while (len > 0);",
"out:\n\trelease_sock(sk);\n\treturn copied;\ncopy_uaddr:\n\tif (uaddr != NULL && skb != NULL) {\n\t\tmemcpy(uaddr, llc_ui_skb_cb(skb), sizeof(*uaddr));\n\t\tmsg->msg_namelen = sizeof(*uaddr);\n\t}\n\tif (llc_sk(sk)->cmsg_flags)\n\t\tllc_cmsg_rcv(msg, skb);",
"\tif (!(flags & MSG_PEEK)) {\n\t\tskb_unlink(skb, &sk->sk_receive_queue);\n\t\tkfree_skb(skb);\n\t\t*seq = 0;\n\t}",
"\tgoto out;\n}",
"/**\n *\tllc_ui_sendmsg - Transmit data provided by the socket user.\n *\t@sock: Socket to transmit data from.\n *\t@msg: Various user related information.\n *\t@len: Length of data to transmit.\n *\n *\tTransmit data provided by the socket user.\n *\tReturns non-negative upon success, negative otherwise.\n */\nstatic int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tDECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);\n\tint flags = msg->msg_flags;\n\tint noblock = flags & MSG_DONTWAIT;\n\tstruct sk_buff *skb = NULL;\n\tsize_t size = 0;\n\tint rc = -EINVAL, copied = 0, hdrlen;",
"\tdprintk(\"%s: sending from %02X to %02X\\n\", __func__,\n\t\tllc->laddr.lsap, llc->daddr.lsap);\n\tlock_sock(sk);\n\tif (addr) {\n\t\tif (msg->msg_namelen < sizeof(*addr))\n\t\t\tgoto out;\n\t} else {\n\t\tif (llc_ui_addr_null(&llc->addr))\n\t\t\tgoto out;\n\t\taddr = &llc->addr;\n\t}\n\t/* must bind connection to sap if user hasn't done it. */\n\tif (sock_flag(sk, SOCK_ZAPPED)) {\n\t\t/* bind to sap with null dev, exclusive. */\n\t\trc = llc_ui_autobind(sock, addr);\n\t\tif (rc)\n\t\t\tgoto out;\n\t}\n\thdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);\n\tsize = hdrlen + len;\n\tif (size > llc->dev->mtu)\n\t\tsize = llc->dev->mtu;\n\tcopied = size - hdrlen;\n\trc = -EINVAL;\n\tif (copied < 0)\n\t\tgoto out;\n\trelease_sock(sk);\n\tskb = sock_alloc_send_skb(sk, size, noblock, &rc);\n\tlock_sock(sk);\n\tif (!skb)\n\t\tgoto out;\n\tskb->dev = llc->dev;\n\tskb->protocol = llc_proto_type(addr->sllc_arphrd);\n\tskb_reserve(skb, hdrlen);\n\trc = memcpy_from_msg(skb_put(skb, copied), msg, copied);\n\tif (rc)\n\t\tgoto out;\n\tif (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) {\n\t\tllc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac,\n\t\t\t\t\t addr->sllc_sap);\n\t\tskb = NULL;\n\t\tgoto out;\n\t}\n\tif (addr->sllc_test) {\n\t\tllc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac,\n\t\t\t\t\t addr->sllc_sap);\n\t\tskb = NULL;\n\t\tgoto out;\n\t}\n\tif (addr->sllc_xid) {\n\t\tllc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac,\n\t\t\t\t\t addr->sllc_sap);\n\t\tskb = NULL;\n\t\tgoto out;\n\t}\n\trc = -ENOPROTOOPT;\n\tif (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua))\n\t\tgoto out;\n\trc = llc_ui_send_data(sk, skb, noblock);\n\tskb = NULL;\nout:\n\tkfree_skb(skb);\n\tif (rc)\n\t\tdprintk(\"%s: failed sending from %02X to %02X: %d\\n\",\n\t\t\t__func__, llc->laddr.lsap, llc->daddr.lsap, rc);\n\trelease_sock(sk);\n\treturn rc ? : copied;\n}",
"/**\n *\tllc_ui_getname - return the address info of a socket\n *\t@sock: Socket to get address of.\n *\t@uaddr: Address structure to return information.\n *\t@peer: Does user want local or remote address information.\n *\n *\tReturn the address information of a socket.\n */\nstatic int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,\n\t\t\t int peer)\n{\n\tstruct sockaddr_llc sllc;\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tint rc = -EBADF;",
"\tmemset(&sllc, 0, sizeof(sllc));\n\tlock_sock(sk);\n\tif (sock_flag(sk, SOCK_ZAPPED))\n\t\tgoto out;\n\tif (peer) {\n\t\trc = -ENOTCONN;\n\t\tif (sk->sk_state != TCP_ESTABLISHED)\n\t\t\tgoto out;\n\t\tif(llc->dev)\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\tsllc.sllc_sap = llc->daddr.lsap;\n\t\tmemcpy(&sllc.sllc_mac, &llc->daddr.mac, IFHWADDRLEN);\n\t} else {\n\t\trc = -EINVAL;\n\t\tif (!llc->sap)\n\t\t\tgoto out;\n\t\tsllc.sllc_sap = llc->sap->laddr.lsap;",
"\t\tif (llc->dev) {\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\t\tmemcpy(&sllc.sllc_mac, llc->dev->dev_addr,\n\t\t\t IFHWADDRLEN);\n\t\t}\n\t}\n\tsllc.sllc_family = AF_LLC;\n\tmemcpy(uaddr, &sllc, sizeof(sllc));\n\trc = sizeof(sllc);\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_ioctl - io controls for PF_LLC\n *\t@sock: Socket to get/set info\n *\t@cmd: command\n *\t@arg: optional argument for cmd\n *\n *\tget/set info on llc sockets\n */\nstatic int llc_ui_ioctl(struct socket *sock, unsigned int cmd,\n\t\t\tunsigned long arg)\n{\n\treturn -ENOIOCTLCMD;\n}",
"/**\n *\tllc_ui_setsockopt - set various connection specific parameters.\n *\t@sock: Socket to set options on.\n *\t@level: Socket level user is requesting operations on.\n *\t@optname: Operation name.\n *\t@optval: User provided operation data.\n *\t@optlen: Length of optval.\n *\n *\tSet various connection specific parameters.\n */\nstatic int llc_ui_setsockopt(struct socket *sock, int level, int optname,\n\t\t\t sockptr_t optval, unsigned int optlen)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tunsigned int opt;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(level != SOL_LLC || optlen != sizeof(int)))\n\t\tgoto out;\n\trc = copy_from_sockptr(&opt, optval, sizeof(opt));\n\tif (rc)\n\t\tgoto out;\n\trc = -EINVAL;\n\tswitch (optname) {\n\tcase LLC_OPT_RETRY:\n\t\tif (opt > LLC_OPT_MAX_RETRY)\n\t\t\tgoto out;\n\t\tllc->n2 = opt;\n\t\tbreak;\n\tcase LLC_OPT_SIZE:\n\t\tif (opt > LLC_OPT_MAX_SIZE)\n\t\t\tgoto out;\n\t\tllc->n1 = opt;\n\t\tbreak;\n\tcase LLC_OPT_ACK_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_ACK_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->ack_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_P_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_P_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->pf_cycle_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_REJ_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_REJ_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->rej_sent_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_BUSY_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_BUSY_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->busy_state_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_TX_WIN:\n\t\tif (opt > LLC_OPT_MAX_WIN)\n\t\t\tgoto out;\n\t\tllc->k = opt;\n\t\tbreak;\n\tcase LLC_OPT_RX_WIN:\n\t\tif (opt > LLC_OPT_MAX_WIN)\n\t\t\tgoto out;\n\t\tllc->rw = opt;\n\t\tbreak;\n\tcase LLC_OPT_PKTINFO:\n\t\tif (opt)\n\t\t\tllc->cmsg_flags |= LLC_CMSG_PKTINFO;\n\t\telse\n\t\t\tllc->cmsg_flags &= ~LLC_CMSG_PKTINFO;\n\t\tbreak;\n\tdefault:\n\t\trc = -ENOPROTOOPT;\n\t\tgoto out;\n\t}\n\trc = 0;\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_getsockopt - get connection specific socket info\n *\t@sock: Socket to get information from.\n *\t@level: Socket level user is requesting operations on.\n *\t@optname: Operation name.\n *\t@optval: Variable to return operation data in.\n *\t@optlen: Length of optval.\n *\n *\tGet connection specific socket information.\n */\nstatic int llc_ui_getsockopt(struct socket *sock, int level, int optname,\n\t\t\t char __user *optval, int __user *optlen)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tint val = 0, len = 0, rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(level != SOL_LLC))\n\t\tgoto out;\n\trc = get_user(len, optlen);\n\tif (rc)\n\t\tgoto out;\n\trc = -EINVAL;\n\tif (len != sizeof(int))\n\t\tgoto out;\n\tswitch (optname) {\n\tcase LLC_OPT_RETRY:\n\t\tval = llc->n2;\t\t\t\t\tbreak;\n\tcase LLC_OPT_SIZE:\n\t\tval = llc->n1;\t\t\t\t\tbreak;\n\tcase LLC_OPT_ACK_TMR_EXP:\n\t\tval = llc->ack_timer.expire / HZ;\t\tbreak;\n\tcase LLC_OPT_P_TMR_EXP:\n\t\tval = llc->pf_cycle_timer.expire / HZ;\t\tbreak;\n\tcase LLC_OPT_REJ_TMR_EXP:\n\t\tval = llc->rej_sent_timer.expire / HZ;\t\tbreak;\n\tcase LLC_OPT_BUSY_TMR_EXP:\n\t\tval = llc->busy_state_timer.expire / HZ;\tbreak;\n\tcase LLC_OPT_TX_WIN:\n\t\tval = llc->k;\t\t\t\tbreak;\n\tcase LLC_OPT_RX_WIN:\n\t\tval = llc->rw;\t\t\t\tbreak;\n\tcase LLC_OPT_PKTINFO:\n\t\tval = (llc->cmsg_flags & LLC_CMSG_PKTINFO) != 0;\n\t\tbreak;\n\tdefault:\n\t\trc = -ENOPROTOOPT;\n\t\tgoto out;\n\t}\n\trc = 0;\n\tif (put_user(len, optlen) || copy_to_user(optval, &val, len))\n\t\trc = -EFAULT;\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"static const struct net_proto_family llc_ui_family_ops = {\n\t.family = PF_LLC,\n\t.create = llc_ui_create,\n\t.owner\t= THIS_MODULE,\n};",
"static const struct proto_ops llc_ui_ops = {\n\t.family\t = PF_LLC,\n\t.owner = THIS_MODULE,\n\t.release = llc_ui_release,\n\t.bind\t = llc_ui_bind,\n\t.connect = llc_ui_connect,\n\t.socketpair = sock_no_socketpair,\n\t.accept = llc_ui_accept,\n\t.getname = llc_ui_getname,\n\t.poll\t = datagram_poll,\n\t.ioctl = llc_ui_ioctl,\n\t.listen = llc_ui_listen,\n\t.shutdown = llc_ui_shutdown,\n\t.setsockopt = llc_ui_setsockopt,\n\t.getsockopt = llc_ui_getsockopt,\n\t.sendmsg = llc_ui_sendmsg,\n\t.recvmsg = llc_ui_recvmsg,\n\t.mmap\t = sock_no_mmap,\n\t.sendpage = sock_no_sendpage,\n};",
"static const char llc_proc_err_msg[] __initconst =\n\tKERN_CRIT \"LLC: Unable to register the proc_fs entries\\n\";\nstatic const char llc_sysctl_err_msg[] __initconst =\n\tKERN_CRIT \"LLC: Unable to register the sysctl entries\\n\";\nstatic const char llc_sock_err_msg[] __initconst =\n\tKERN_CRIT \"LLC: Unable to register the network family\\n\";",
"static int __init llc2_init(void)\n{\n\tint rc = proto_register(&llc_proto, 0);",
"\tif (rc != 0)\n\t\tgoto out;",
"\tllc_build_offset_table();\n\tllc_station_init();\n\tllc_ui_sap_last_autoport = LLC_SAP_DYN_START;\n\trc = llc_proc_init();\n\tif (rc != 0) {\n\t\tprintk(llc_proc_err_msg);\n\t\tgoto out_station;\n\t}\n\trc = llc_sysctl_init();\n\tif (rc) {\n\t\tprintk(llc_sysctl_err_msg);\n\t\tgoto out_proc;\n\t}\n\trc = sock_register(&llc_ui_family_ops);\n\tif (rc) {\n\t\tprintk(llc_sock_err_msg);\n\t\tgoto out_sysctl;\n\t}\n\tllc_add_pack(LLC_DEST_SAP, llc_sap_handler);\n\tllc_add_pack(LLC_DEST_CONN, llc_conn_handler);\nout:\n\treturn rc;\nout_sysctl:\n\tllc_sysctl_exit();\nout_proc:\n\tllc_proc_exit();\nout_station:\n\tllc_station_exit();\n\tproto_unregister(&llc_proto);\n\tgoto out;\n}",
"static void __exit llc2_exit(void)\n{\n\tllc_station_exit();\n\tllc_remove_pack(LLC_DEST_SAP);\n\tllc_remove_pack(LLC_DEST_CONN);\n\tsock_unregister(PF_LLC);\n\tllc_proc_exit();\n\tllc_sysctl_exit();\n\tproto_unregister(&llc_proto);\n}",
"module_init(llc2_init);\nmodule_exit(llc2_exit);",
"MODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Procom 1997, Jay Schullist 2001, Arnaldo C. Melo 2001-2003\");\nMODULE_DESCRIPTION(\"IEEE 802.2 PF_LLC support\");\nMODULE_ALIAS_NETPROTO(PF_LLC);"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [410], "buggy_code_start_loc": [313], "filenames": ["net/llc/af_llc.c"], "fixing_code_end_loc": [419], "fixing_code_start_loc": [314], "message": "In the Linux kernel before 5.17.1, a refcount leak bug was found in net/llc/af_llc.c.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "C4C36454-2CDC-4F8D-A717-878F1C39CAD1", "versionEndExcluding": "5.17.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*", "matchCriteriaId": "FA6FEEC2-9F11-4643-8827-749718254FED", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In the Linux kernel before 5.17.1, a refcount leak bug was found in net/llc/af_llc.c."}, {"lang": "es", "value": "En el kernel de Linux versiones anteriores a 5.17.1, se encontr\u00f3 un bug de filtrado de refcount en el archivo net/llc/af_llc.c"}], "evaluatorComment": null, "id": "CVE-2022-28356", "lastModified": "2023-02-03T23:59:15.293", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 2.1, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:L/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-04-02T21:15:09.363", "references": [{"source": "cve@mitre.org", "tags": ["Exploit", "Mailing List", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2022/04/06/1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Release Notes", "Vendor Advisory"], "url": "https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.17.1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/764f4eb6846f5475f1244767d24d25dd86528a4a"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/07/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20220506-0006/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2022/dsa-5127"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2022/dsa-5173"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-Other"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/764f4eb6846f5475f1244767d24d25dd86528a4a"}, "type": "NVD-CWE-Other"}
| 88
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * af_llc.c - LLC User Interface SAPs\n * Description:\n * Functions in this module are implementation of socket based llc\n * communications for the Linux operating system. Support of llc class\n * one and class two is provided via SOCK_DGRAM and SOCK_STREAM\n * respectively.\n *\n * An llc2 connection is (mac + sap), only one llc2 sap connection\n * is allowed per mac. Though one sap may have multiple mac + sap\n * connections.\n *\n * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org>\n *\t\t 2002-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>\n *\n * This program can be redistributed or modified under the terms of the\n * GNU General Public License as published by the Free Software Foundation.\n * This program is distributed without any warranty or implied warranty\n * of merchantability or fitness for a particular purpose.\n *\n * See the GNU General Public License for more details.\n */\n#include <linux/compiler.h>\n#include <linux/kernel.h>\n#include <linux/module.h>\n#include <linux/rtnetlink.h>\n#include <linux/init.h>\n#include <linux/slab.h>\n#include <linux/sched/signal.h>",
"#include <net/llc.h>\n#include <net/llc_sap.h>\n#include <net/llc_pdu.h>\n#include <net/llc_conn.h>\n#include <net/tcp_states.h>",
"/* remember: uninitialized global data is zeroed because its in .bss */\nstatic u16 llc_ui_sap_last_autoport = LLC_SAP_DYN_START;\nstatic u16 llc_ui_sap_link_no_max[256];\nstatic struct sockaddr_llc llc_ui_addrnull;\nstatic const struct proto_ops llc_ui_ops;",
"static bool llc_ui_wait_for_conn(struct sock *sk, long timeout);\nstatic int llc_ui_wait_for_disc(struct sock *sk, long timeout);\nstatic int llc_ui_wait_for_busy_core(struct sock *sk, long timeout);",
"#if 0\n#define dprintk(args...) printk(KERN_DEBUG args)\n#else\n#define dprintk(args...) do {} while (0)\n#endif",
"/* Maybe we'll add some more in the future. */\n#define LLC_CMSG_PKTINFO\t1",
"\n/**\n *\tllc_ui_next_link_no - return the next unused link number for a sap\n *\t@sap: Address of sap to get link number from.\n *\n *\tReturn the next unused link number for a given sap.\n */\nstatic inline u16 llc_ui_next_link_no(int sap)\n{\n\treturn llc_ui_sap_link_no_max[sap]++;\n}",
"/**\n *\tllc_proto_type - return eth protocol for ARP header type\n *\t@arphrd: ARP header type.\n *\n *\tGiven an ARP header type return the corresponding ethernet protocol.\n */\nstatic inline __be16 llc_proto_type(u16 arphrd)\n{\n\treturn htons(ETH_P_802_2);\n}",
"/**\n *\tllc_ui_addr_null - determines if a address structure is null\n *\t@addr: Address to test if null.\n */\nstatic inline u8 llc_ui_addr_null(struct sockaddr_llc *addr)\n{\n\treturn !memcmp(addr, &llc_ui_addrnull, sizeof(*addr));\n}",
"/**\n *\tllc_ui_header_len - return length of llc header based on operation\n *\t@sk: Socket which contains a valid llc socket type.\n *\t@addr: Complete sockaddr_llc structure received from the user.\n *\n *\tProvide the length of the llc header depending on what kind of\n *\toperation the user would like to perform and the type of socket.\n *\tReturns the correct llc header length.\n */\nstatic inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr)\n{\n\tu8 rc = LLC_PDU_LEN_U;",
"\tif (addr->sllc_test)\n\t\trc = LLC_PDU_LEN_U;\n\telse if (addr->sllc_xid)\n\t\t/* We need to expand header to sizeof(struct llc_xid_info)\n\t\t * since llc_pdu_init_as_xid_cmd() sets 4,5,6 bytes of LLC header\n\t\t * as XID PDU. In llc_ui_sendmsg() we reserved header size and then\n\t\t * filled all other space with user data. If we won't reserve this\n\t\t * bytes, llc_pdu_init_as_xid_cmd() will overwrite user data\n\t\t */\n\t\trc = LLC_PDU_LEN_U_XID;\n\telse if (sk->sk_type == SOCK_STREAM)\n\t\trc = LLC_PDU_LEN_I;\n\treturn rc;\n}",
"/**\n *\tllc_ui_send_data - send data via reliable llc2 connection\n *\t@sk: Connection the socket is using.\n *\t@skb: Data the user wishes to send.\n *\t@noblock: can we block waiting for data?\n *\n *\tSend data via reliable llc2 connection.\n *\tReturns 0 upon success, non-zero if action did not succeed.\n *\n *\tThis function always consumes a reference to the skb.\n */\nstatic int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)\n{\n\tstruct llc_sock* llc = llc_sk(sk);",
"\tif (unlikely(llc_data_accept_state(llc->state) ||\n\t\t llc->remote_busy_flag ||\n\t\t llc->p_flag)) {\n\t\tlong timeout = sock_sndtimeo(sk, noblock);\n\t\tint rc;",
"\t\trc = llc_ui_wait_for_busy_core(sk, timeout);\n\t\tif (rc) {\n\t\t\tkfree_skb(skb);\n\t\t\treturn rc;\n\t\t}\n\t}\n\treturn llc_build_and_send_pkt(sk, skb);\n}",
"static void llc_ui_sk_init(struct socket *sock, struct sock *sk)\n{\n\tsock_graft(sk, sock);\n\tsk->sk_type\t= sock->type;\n\tsock->ops\t= &llc_ui_ops;\n}",
"static struct proto llc_proto = {\n\t.name\t = \"LLC\",\n\t.owner\t = THIS_MODULE,\n\t.obj_size = sizeof(struct llc_sock),\n\t.slab_flags = SLAB_TYPESAFE_BY_RCU,\n};",
"/**\n *\tllc_ui_create - alloc and init a new llc_ui socket\n *\t@net: network namespace (must be default network)\n *\t@sock: Socket to initialize and attach allocated sk to.\n *\t@protocol: Unused.\n *\t@kern: on behalf of kernel or userspace\n *\n *\tAllocate and initialize a new llc_ui socket, validate the user wants a\n *\tsocket type we have available.\n *\tReturns 0 upon success, negative upon failure.\n */\nstatic int llc_ui_create(struct net *net, struct socket *sock, int protocol,\n\t\t\t int kern)\n{\n\tstruct sock *sk;\n\tint rc = -ESOCKTNOSUPPORT;",
"\tif (!ns_capable(net->user_ns, CAP_NET_RAW))\n\t\treturn -EPERM;",
"\tif (!net_eq(net, &init_net))\n\t\treturn -EAFNOSUPPORT;",
"\tif (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) {\n\t\trc = -ENOMEM;\n\t\tsk = llc_sk_alloc(net, PF_LLC, GFP_KERNEL, &llc_proto, kern);\n\t\tif (sk) {\n\t\t\trc = 0;\n\t\t\tllc_ui_sk_init(sock, sk);\n\t\t}\n\t}\n\treturn rc;\n}",
"/**\n *\tllc_ui_release - shutdown socket\n *\t@sock: Socket to release.\n *\n *\tShutdown and deallocate an existing socket.\n */\nstatic int llc_ui_release(struct socket *sock)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc;",
"\tif (unlikely(sk == NULL))\n\t\tgoto out;\n\tsock_hold(sk);\n\tlock_sock(sk);\n\tllc = llc_sk(sk);\n\tdprintk(\"%s: closing local(%02X) remote(%02X)\\n\", __func__,\n\t\tllc->laddr.lsap, llc->daddr.lsap);\n\tif (!llc_send_disc(sk))\n\t\tllc_ui_wait_for_disc(sk, sk->sk_rcvtimeo);\n\tif (!sock_flag(sk, SOCK_ZAPPED)) {\n\t\tstruct llc_sap *sap = llc->sap;",
"\t\t/* Hold this for release_sock(), so that llc_backlog_rcv()\n\t\t * could still use it.\n\t\t */\n\t\tllc_sap_hold(sap);\n\t\tllc_sap_remove_socket(llc->sap, sk);\n\t\trelease_sock(sk);\n\t\tllc_sap_put(sap);\n\t} else {\n\t\trelease_sock(sk);\n\t}\n\tdev_put_track(llc->dev, &llc->dev_tracker);\n\tsock_put(sk);\n\tllc_sk_free(sk);\nout:\n\treturn 0;\n}",
"/**\n *\tllc_ui_autoport - provide dynamically allocate SAP number\n *\n *\tProvide the caller with a dynamically allocated SAP number according\n *\tto the rules that are set in this function. Returns: 0, upon failure,\n *\tSAP number otherwise.\n */\nstatic int llc_ui_autoport(void)\n{\n\tstruct llc_sap *sap;\n\tint i, tries = 0;",
"\twhile (tries < LLC_SAP_DYN_TRIES) {\n\t\tfor (i = llc_ui_sap_last_autoport;\n\t\t i < LLC_SAP_DYN_STOP; i += 2) {\n\t\t\tsap = llc_sap_find(i);\n\t\t\tif (!sap) {\n\t\t\t\tllc_ui_sap_last_autoport = i + 2;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t\tllc_sap_put(sap);\n\t\t}\n\t\tllc_ui_sap_last_autoport = LLC_SAP_DYN_START;\n\t\ttries++;\n\t}\n\ti = 0;\nout:\n\treturn i;\n}",
"/**\n *\tllc_ui_autobind - automatically bind a socket to a sap\n *\t@sock: socket to bind\n *\t@addr: address to connect to\n *\n * \tUsed by llc_ui_connect and llc_ui_sendmsg when the user hasn't\n * \tspecifically used llc_ui_bind to bind to an specific address/sap\n *\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tstruct llc_sap *sap;\n\tint rc = -EINVAL;",
"\tif (!sock_flag(sk, SOCK_ZAPPED))\n\t\tgoto out;\n\tif (!addr->sllc_arphrd)\n\t\taddr->sllc_arphrd = ARPHRD_ETHER;\n\tif (addr->sllc_arphrd != ARPHRD_ETHER)\n\t\tgoto out;\n\trc = -ENODEV;\n\tif (sk->sk_bound_dev_if) {\n\t\tllc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if);\n\t\tif (llc->dev && addr->sllc_arphrd != llc->dev->type) {\n\t\t\tdev_put(llc->dev);\n\t\t\tllc->dev = NULL;\n\t\t}\n\t} else\n\t\tllc->dev = dev_getfirstbyhwtype(&init_net, addr->sllc_arphrd);\n\tif (!llc->dev)\n\t\tgoto out;\n\tnetdev_tracker_alloc(llc->dev, &llc->dev_tracker, GFP_KERNEL);\n\trc = -EUSERS;\n\tllc->laddr.lsap = llc_ui_autoport();\n\tif (!llc->laddr.lsap)\n\t\tgoto out;\n\trc = -EBUSY; /* some other network layer is using the sap */\n\tsap = llc_sap_open(llc->laddr.lsap, NULL);\n\tif (!sap)\n\t\tgoto out;\n\tmemcpy(llc->laddr.mac, llc->dev->dev_addr, IFHWADDRLEN);\n\tmemcpy(&llc->addr, addr, sizeof(llc->addr));\n\t/* assign new connection to its SAP */\n\tllc_sap_add_socket(sap, sk);\n\tsock_reset_flag(sk, SOCK_ZAPPED);\n\trc = 0;\nout:",
"\tif (rc) {\n\t\tdev_put_track(llc->dev, &llc->dev_tracker);\n\t\tllc->dev = NULL;\n\t}",
"\treturn rc;\n}",
"/**\n *\tllc_ui_bind - bind a socket to a specific address.\n *\t@sock: Socket to bind an address to.\n *\t@uaddr: Address the user wants the socket bound to.\n *\t@addrlen: Length of the uaddr structure.\n *\n *\tBind a socket to a specific address. For llc a user is able to bind to\n *\ta specific sap only or mac + sap.\n *\tIf the user desires to bind to a specific mac + sap, it is possible to\n *\thave multiple sap connections via multiple macs.\n *\tBind and autobind for that matter must enforce the correct sap usage\n *\totherwise all hell will break loose.\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)\n{\n\tstruct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tstruct llc_sap *sap;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(!sock_flag(sk, SOCK_ZAPPED) || addrlen != sizeof(*addr)))\n\t\tgoto out;\n\trc = -EAFNOSUPPORT;\n\tif (!addr->sllc_arphrd)\n\t\taddr->sllc_arphrd = ARPHRD_ETHER;\n\tif (unlikely(addr->sllc_family != AF_LLC || addr->sllc_arphrd != ARPHRD_ETHER))\n\t\tgoto out;\n\tdprintk(\"%s: binding %02X\\n\", __func__, addr->sllc_sap);\n\trc = -ENODEV;\n\trcu_read_lock();\n\tif (sk->sk_bound_dev_if) {\n\t\tllc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if);\n\t\tif (llc->dev) {\n\t\t\tif (is_zero_ether_addr(addr->sllc_mac))\n\t\t\t\tmemcpy(addr->sllc_mac, llc->dev->dev_addr,\n\t\t\t\t IFHWADDRLEN);\n\t\t\tif (addr->sllc_arphrd != llc->dev->type ||\n\t\t\t !ether_addr_equal(addr->sllc_mac,\n\t\t\t\t\t llc->dev->dev_addr)) {\n\t\t\t\trc = -EINVAL;\n\t\t\t\tllc->dev = NULL;\n\t\t\t}\n\t\t}\n\t} else\n\t\tllc->dev = dev_getbyhwaddr_rcu(&init_net, addr->sllc_arphrd,\n\t\t\t\t\t addr->sllc_mac);\n\tdev_hold_track(llc->dev, &llc->dev_tracker, GFP_ATOMIC);\n\trcu_read_unlock();\n\tif (!llc->dev)\n\t\tgoto out;\n\tif (!addr->sllc_sap) {\n\t\trc = -EUSERS;\n\t\taddr->sllc_sap = llc_ui_autoport();\n\t\tif (!addr->sllc_sap)\n\t\t\tgoto out;\n\t}\n\tsap = llc_sap_find(addr->sllc_sap);\n\tif (!sap) {\n\t\tsap = llc_sap_open(addr->sllc_sap, NULL);\n\t\trc = -EBUSY; /* some other network layer is using the sap */\n\t\tif (!sap)\n\t\t\tgoto out;\n\t} else {\n\t\tstruct llc_addr laddr, daddr;\n\t\tstruct sock *ask;",
"\t\tmemset(&laddr, 0, sizeof(laddr));\n\t\tmemset(&daddr, 0, sizeof(daddr));\n\t\t/*\n\t\t * FIXME: check if the address is multicast,\n\t\t * \t only SOCK_DGRAM can do this.\n\t\t */\n\t\tmemcpy(laddr.mac, addr->sllc_mac, IFHWADDRLEN);\n\t\tladdr.lsap = addr->sllc_sap;\n\t\trc = -EADDRINUSE; /* mac + sap clash. */\n\t\task = llc_lookup_established(sap, &daddr, &laddr);\n\t\tif (ask) {\n\t\t\tsock_put(ask);\n\t\t\tgoto out_put;\n\t\t}\n\t}\n\tllc->laddr.lsap = addr->sllc_sap;\n\tmemcpy(llc->laddr.mac, addr->sllc_mac, IFHWADDRLEN);\n\tmemcpy(&llc->addr, addr, sizeof(llc->addr));\n\t/* assign new connection to its SAP */\n\tllc_sap_add_socket(sap, sk);\n\tsock_reset_flag(sk, SOCK_ZAPPED);\n\trc = 0;\nout_put:\n\tllc_sap_put(sap);\nout:",
"\tif (rc) {\n\t\tdev_put_track(llc->dev, &llc->dev_tracker);\n\t\tllc->dev = NULL;\n\t}",
"\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_shutdown - shutdown a connect llc2 socket.\n *\t@sock: Socket to shutdown.\n *\t@how: What part of the socket to shutdown.\n *\n *\tShutdown a connected llc2 socket. Currently this function only supports\n *\tshutting down both sends and receives (2), we could probably make this\n *\tfunction such that a user can shutdown only half the connection but not\n *\tright now.\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_shutdown(struct socket *sock, int how)\n{\n\tstruct sock *sk = sock->sk;\n\tint rc = -ENOTCONN;",
"\tlock_sock(sk);\n\tif (unlikely(sk->sk_state != TCP_ESTABLISHED))\n\t\tgoto out;\n\trc = -EINVAL;\n\tif (how != 2)\n\t\tgoto out;\n\trc = llc_send_disc(sk);\n\tif (!rc)\n\t\trc = llc_ui_wait_for_disc(sk, sk->sk_rcvtimeo);\n\t/* Wake up anyone sleeping in poll */\n\tsk->sk_state_change(sk);\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_connect - Connect to a remote llc2 mac + sap.\n *\t@sock: Socket which will be connected to the remote destination.\n *\t@uaddr: Remote and possibly the local address of the new connection.\n *\t@addrlen: Size of uaddr structure.\n *\t@flags: Operational flags specified by the user.\n *\n *\tConnect to a remote llc2 mac + sap. The caller must specify the\n *\tdestination mac and address to connect to. If the user hasn't previously\n *\tcalled bind(2) with a smac the address of the first interface of the\n *\tspecified arp type will be used.\n *\tThis function will autobind if user did not previously call bind.\n *\tReturns: 0 upon success, negative otherwise.\n */\nstatic int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,\n\t\t\t int addrlen, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tstruct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(addrlen != sizeof(*addr)))\n\t\tgoto out;\n\trc = -EAFNOSUPPORT;\n\tif (unlikely(addr->sllc_family != AF_LLC))\n\t\tgoto out;\n\tif (unlikely(sk->sk_type != SOCK_STREAM))\n\t\tgoto out;\n\trc = -EALREADY;\n\tif (unlikely(sock->state == SS_CONNECTING))\n\t\tgoto out;\n\t/* bind connection to sap if user hasn't done it. */\n\tif (sock_flag(sk, SOCK_ZAPPED)) {\n\t\t/* bind to sap with null dev, exclusive */\n\t\trc = llc_ui_autobind(sock, addr);\n\t\tif (rc)\n\t\t\tgoto out;\n\t}\n\tllc->daddr.lsap = addr->sllc_sap;\n\tmemcpy(llc->daddr.mac, addr->sllc_mac, IFHWADDRLEN);\n\tsock->state = SS_CONNECTING;\n\tsk->sk_state = TCP_SYN_SENT;\n\tllc->link = llc_ui_next_link_no(llc->sap->laddr.lsap);\n\trc = llc_establish_connection(sk, llc->dev->dev_addr,\n\t\t\t\t addr->sllc_mac, addr->sllc_sap);\n\tif (rc) {\n\t\tdprintk(\"%s: llc_ui_send_conn failed :-(\\n\", __func__);\n\t\tsock->state = SS_UNCONNECTED;\n\t\tsk->sk_state = TCP_CLOSE;\n\t\tgoto out;\n\t}",
"\tif (sk->sk_state == TCP_SYN_SENT) {\n\t\tconst long timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);",
"\t\tif (!timeo || !llc_ui_wait_for_conn(sk, timeo))\n\t\t\tgoto out;",
"\t\trc = sock_intr_errno(timeo);\n\t\tif (signal_pending(current))\n\t\t\tgoto out;\n\t}",
"\tif (sk->sk_state == TCP_CLOSE)\n\t\tgoto sock_error;",
"\tsock->state = SS_CONNECTED;\n\trc = 0;\nout:\n\trelease_sock(sk);\n\treturn rc;\nsock_error:\n\trc = sock_error(sk) ? : -ECONNABORTED;\n\tsock->state = SS_UNCONNECTED;\n\tgoto out;\n}",
"/**\n *\tllc_ui_listen - allow a normal socket to accept incoming connections\n *\t@sock: Socket to allow incoming connections on.\n *\t@backlog: Number of connections to queue.\n *\n *\tAllow a normal socket to accept incoming connections.\n *\tReturns 0 upon success, negative otherwise.\n */\nstatic int llc_ui_listen(struct socket *sock, int backlog)\n{\n\tstruct sock *sk = sock->sk;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(sock->state != SS_UNCONNECTED))\n\t\tgoto out;\n\trc = -EOPNOTSUPP;\n\tif (unlikely(sk->sk_type != SOCK_STREAM))\n\t\tgoto out;\n\trc = -EAGAIN;\n\tif (sock_flag(sk, SOCK_ZAPPED))\n\t\tgoto out;\n\trc = 0;\n\tif (!(unsigned int)backlog)\t/* BSDism */\n\t\tbacklog = 1;\n\tsk->sk_max_ack_backlog = backlog;\n\tif (sk->sk_state != TCP_LISTEN) {\n\t\tsk->sk_ack_backlog = 0;\n\t\tsk->sk_state\t = TCP_LISTEN;\n\t}\n\tsk->sk_socket->flags |= __SO_ACCEPTCON;\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"static int llc_ui_wait_for_disc(struct sock *sk, long timeout)\n{\n\tDEFINE_WAIT_FUNC(wait, woken_wake_function);\n\tint rc = 0;",
"\tadd_wait_queue(sk_sleep(sk), &wait);\n\twhile (1) {\n\t\tif (sk_wait_event(sk, &timeout, sk->sk_state == TCP_CLOSE, &wait))\n\t\t\tbreak;\n\t\trc = -ERESTARTSYS;\n\t\tif (signal_pending(current))\n\t\t\tbreak;\n\t\trc = -EAGAIN;\n\t\tif (!timeout)\n\t\t\tbreak;\n\t\trc = 0;\n\t}\n\tremove_wait_queue(sk_sleep(sk), &wait);\n\treturn rc;\n}",
"static bool llc_ui_wait_for_conn(struct sock *sk, long timeout)\n{\n\tDEFINE_WAIT_FUNC(wait, woken_wake_function);",
"\tadd_wait_queue(sk_sleep(sk), &wait);\n\twhile (1) {\n\t\tif (sk_wait_event(sk, &timeout, sk->sk_state != TCP_SYN_SENT, &wait))\n\t\t\tbreak;\n\t\tif (signal_pending(current) || !timeout)\n\t\t\tbreak;\n\t}\n\tremove_wait_queue(sk_sleep(sk), &wait);\n\treturn timeout;\n}",
"static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout)\n{\n\tDEFINE_WAIT_FUNC(wait, woken_wake_function);\n\tstruct llc_sock *llc = llc_sk(sk);\n\tint rc;",
"\tadd_wait_queue(sk_sleep(sk), &wait);\n\twhile (1) {\n\t\trc = 0;\n\t\tif (sk_wait_event(sk, &timeout,\n\t\t\t\t (sk->sk_shutdown & RCV_SHUTDOWN) ||\n\t\t\t\t (!llc_data_accept_state(llc->state) &&\n\t\t\t\t !llc->remote_busy_flag &&\n\t\t\t\t !llc->p_flag), &wait))\n\t\t\tbreak;\n\t\trc = -ERESTARTSYS;\n\t\tif (signal_pending(current))\n\t\t\tbreak;\n\t\trc = -EAGAIN;\n\t\tif (!timeout)\n\t\t\tbreak;\n\t}\n\tremove_wait_queue(sk_sleep(sk), &wait);\n\treturn rc;\n}",
"static int llc_wait_data(struct sock *sk, long timeo)\n{\n\tint rc;",
"\twhile (1) {\n\t\t/*\n\t\t * POSIX 1003.1g mandates this order.\n\t\t */\n\t\trc = sock_error(sk);\n\t\tif (rc)\n\t\t\tbreak;\n\t\trc = 0;\n\t\tif (sk->sk_shutdown & RCV_SHUTDOWN)\n\t\t\tbreak;\n\t\trc = -EAGAIN;\n\t\tif (!timeo)\n\t\t\tbreak;\n\t\trc = sock_intr_errno(timeo);\n\t\tif (signal_pending(current))\n\t\t\tbreak;\n\t\trc = 0;\n\t\tif (sk_wait_data(sk, &timeo, NULL))\n\t\t\tbreak;\n\t}\n\treturn rc;\n}",
"static void llc_cmsg_rcv(struct msghdr *msg, struct sk_buff *skb)\n{\n\tstruct llc_sock *llc = llc_sk(skb->sk);",
"\tif (llc->cmsg_flags & LLC_CMSG_PKTINFO) {\n\t\tstruct llc_pktinfo info;",
"\t\tmemset(&info, 0, sizeof(info));\n\t\tinfo.lpi_ifindex = llc_sk(skb->sk)->dev->ifindex;\n\t\tllc_pdu_decode_dsap(skb, &info.lpi_sap);\n\t\tllc_pdu_decode_da(skb, info.lpi_mac);\n\t\tput_cmsg(msg, SOL_LLC, LLC_OPT_PKTINFO, sizeof(info), &info);\n\t}\n}",
"/**\n *\tllc_ui_accept - accept a new incoming connection.\n *\t@sock: Socket which connections arrive on.\n *\t@newsock: Socket to move incoming connection to.\n *\t@flags: User specified operational flags.\n *\t@kern: If the socket is kernel internal\n *\n *\tAccept a new incoming connection.\n *\tReturns 0 upon success, negative otherwise.\n */\nstatic int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags,\n\t\t\t bool kern)\n{\n\tstruct sock *sk = sock->sk, *newsk;\n\tstruct llc_sock *llc, *newllc;\n\tstruct sk_buff *skb;\n\tint rc = -EOPNOTSUPP;",
"\tdprintk(\"%s: accepting on %02X\\n\", __func__,\n\t\tllc_sk(sk)->laddr.lsap);\n\tlock_sock(sk);\n\tif (unlikely(sk->sk_type != SOCK_STREAM))\n\t\tgoto out;\n\trc = -EINVAL;\n\tif (unlikely(sock->state != SS_UNCONNECTED ||\n\t\t sk->sk_state != TCP_LISTEN))\n\t\tgoto out;\n\t/* wait for a connection to arrive. */\n\tif (skb_queue_empty(&sk->sk_receive_queue)) {\n\t\trc = llc_wait_data(sk, sk->sk_rcvtimeo);\n\t\tif (rc)\n\t\t\tgoto out;\n\t}\n\tdprintk(\"%s: got a new connection on %02X\\n\", __func__,\n\t\tllc_sk(sk)->laddr.lsap);\n\tskb = skb_dequeue(&sk->sk_receive_queue);\n\trc = -EINVAL;\n\tif (!skb->sk)\n\t\tgoto frees;\n\trc = 0;\n\tnewsk = skb->sk;\n\t/* attach connection to a new socket. */\n\tllc_ui_sk_init(newsock, newsk);\n\tsock_reset_flag(newsk, SOCK_ZAPPED);\n\tnewsk->sk_state\t\t= TCP_ESTABLISHED;\n\tnewsock->state\t\t= SS_CONNECTED;\n\tllc\t\t\t= llc_sk(sk);\n\tnewllc\t\t\t= llc_sk(newsk);\n\tmemcpy(&newllc->addr, &llc->addr, sizeof(newllc->addr));\n\tnewllc->link = llc_ui_next_link_no(newllc->laddr.lsap);",
"\t/* put original socket back into a clean listen state. */\n\tsk->sk_state = TCP_LISTEN;\n\tsk_acceptq_removed(sk);\n\tdprintk(\"%s: ok success on %02X, client on %02X\\n\", __func__,\n\t\tllc_sk(sk)->addr.sllc_sap, newllc->daddr.lsap);\nfrees:\n\tkfree_skb(skb);\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_recvmsg - copy received data to the socket user.\n *\t@sock: Socket to copy data from.\n *\t@msg: Various user space related information.\n *\t@len: Size of user buffer.\n *\t@flags: User specified flags.\n *\n *\tCopy received data to the socket user.\n *\tReturns non-negative upon success, negative otherwise.\n */\nstatic int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,\n\t\t\t int flags)\n{\n\tDECLARE_SOCKADDR(struct sockaddr_llc *, uaddr, msg->msg_name);\n\tconst int nonblock = flags & MSG_DONTWAIT;\n\tstruct sk_buff *skb = NULL;\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tsize_t copied = 0;\n\tu32 peek_seq = 0;\n\tu32 *seq, skb_len;\n\tunsigned long used;\n\tint target;\t/* Read at least this many bytes */\n\tlong timeo;",
"\tlock_sock(sk);\n\tcopied = -ENOTCONN;\n\tif (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))\n\t\tgoto out;",
"\ttimeo = sock_rcvtimeo(sk, nonblock);",
"\tseq = &llc->copied_seq;\n\tif (flags & MSG_PEEK) {\n\t\tpeek_seq = llc->copied_seq;\n\t\tseq = &peek_seq;\n\t}",
"\ttarget = sock_rcvlowat(sk, flags & MSG_WAITALL, len);\n\tcopied = 0;",
"\tdo {\n\t\tu32 offset;",
"\t\t/*\n\t\t * We need to check signals first, to get correct SIGURG\n\t\t * handling. FIXME: Need to check this doesn't impact 1003.1g\n\t\t * and move it down to the bottom of the loop\n\t\t */\n\t\tif (signal_pending(current)) {\n\t\t\tif (copied)\n\t\t\t\tbreak;\n\t\t\tcopied = timeo ? sock_intr_errno(timeo) : -EAGAIN;\n\t\t\tbreak;\n\t\t}",
"\t\t/* Next get a buffer. */",
"\t\tskb = skb_peek(&sk->sk_receive_queue);\n\t\tif (skb) {\n\t\t\toffset = *seq;\n\t\t\tgoto found_ok_skb;\n\t\t}\n\t\t/* Well, if we have backlog, try to process it now yet. */",
"\t\tif (copied >= target && !READ_ONCE(sk->sk_backlog.tail))\n\t\t\tbreak;",
"\t\tif (copied) {\n\t\t\tif (sk->sk_err ||\n\t\t\t sk->sk_state == TCP_CLOSE ||\n\t\t\t (sk->sk_shutdown & RCV_SHUTDOWN) ||\n\t\t\t !timeo ||\n\t\t\t (flags & MSG_PEEK))\n\t\t\t\tbreak;\n\t\t} else {\n\t\t\tif (sock_flag(sk, SOCK_DONE))\n\t\t\t\tbreak;",
"\t\t\tif (sk->sk_err) {\n\t\t\t\tcopied = sock_error(sk);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (sk->sk_shutdown & RCV_SHUTDOWN)\n\t\t\t\tbreak;",
"\t\t\tif (sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_CLOSE) {\n\t\t\t\tif (!sock_flag(sk, SOCK_DONE)) {\n\t\t\t\t\t/*\n\t\t\t\t\t * This occurs when user tries to read\n\t\t\t\t\t * from never connected socket.\n\t\t\t\t\t */\n\t\t\t\t\tcopied = -ENOTCONN;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!timeo) {\n\t\t\t\tcopied = -EAGAIN;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"\t\tif (copied >= target) { /* Do not sleep, just process backlog. */\n\t\t\trelease_sock(sk);\n\t\t\tlock_sock(sk);\n\t\t} else\n\t\t\tsk_wait_data(sk, &timeo, NULL);",
"\t\tif ((flags & MSG_PEEK) && peek_seq != llc->copied_seq) {\n\t\t\tnet_dbg_ratelimited(\"LLC(%s:%d): Application bug, race in MSG_PEEK\\n\",\n\t\t\t\t\t current->comm,\n\t\t\t\t\t task_pid_nr(current));\n\t\t\tpeek_seq = llc->copied_seq;\n\t\t}\n\t\tcontinue;\n\tfound_ok_skb:\n\t\tskb_len = skb->len;\n\t\t/* Ok so how much can we use? */\n\t\tused = skb->len - offset;\n\t\tif (len < used)\n\t\t\tused = len;",
"\t\tif (!(flags & MSG_TRUNC)) {\n\t\t\tint rc = skb_copy_datagram_msg(skb, offset, msg, used);\n\t\t\tif (rc) {\n\t\t\t\t/* Exception. Bailout! */\n\t\t\t\tif (!copied)\n\t\t\t\t\tcopied = -EFAULT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}",
"\t\t*seq += used;\n\t\tcopied += used;\n\t\tlen -= used;",
"\t\t/* For non stream protcols we get one packet per recvmsg call */\n\t\tif (sk->sk_type != SOCK_STREAM)\n\t\t\tgoto copy_uaddr;",
"\t\tif (!(flags & MSG_PEEK)) {\n\t\t\tskb_unlink(skb, &sk->sk_receive_queue);\n\t\t\tkfree_skb(skb);\n\t\t\t*seq = 0;\n\t\t}",
"\t\t/* Partial read */\n\t\tif (used + offset < skb_len)\n\t\t\tcontinue;\n\t} while (len > 0);",
"out:\n\trelease_sock(sk);\n\treturn copied;\ncopy_uaddr:\n\tif (uaddr != NULL && skb != NULL) {\n\t\tmemcpy(uaddr, llc_ui_skb_cb(skb), sizeof(*uaddr));\n\t\tmsg->msg_namelen = sizeof(*uaddr);\n\t}\n\tif (llc_sk(sk)->cmsg_flags)\n\t\tllc_cmsg_rcv(msg, skb);",
"\tif (!(flags & MSG_PEEK)) {\n\t\tskb_unlink(skb, &sk->sk_receive_queue);\n\t\tkfree_skb(skb);\n\t\t*seq = 0;\n\t}",
"\tgoto out;\n}",
"/**\n *\tllc_ui_sendmsg - Transmit data provided by the socket user.\n *\t@sock: Socket to transmit data from.\n *\t@msg: Various user related information.\n *\t@len: Length of data to transmit.\n *\n *\tTransmit data provided by the socket user.\n *\tReturns non-negative upon success, negative otherwise.\n */\nstatic int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tDECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);\n\tint flags = msg->msg_flags;\n\tint noblock = flags & MSG_DONTWAIT;\n\tstruct sk_buff *skb = NULL;\n\tsize_t size = 0;\n\tint rc = -EINVAL, copied = 0, hdrlen;",
"\tdprintk(\"%s: sending from %02X to %02X\\n\", __func__,\n\t\tllc->laddr.lsap, llc->daddr.lsap);\n\tlock_sock(sk);\n\tif (addr) {\n\t\tif (msg->msg_namelen < sizeof(*addr))\n\t\t\tgoto out;\n\t} else {\n\t\tif (llc_ui_addr_null(&llc->addr))\n\t\t\tgoto out;\n\t\taddr = &llc->addr;\n\t}\n\t/* must bind connection to sap if user hasn't done it. */\n\tif (sock_flag(sk, SOCK_ZAPPED)) {\n\t\t/* bind to sap with null dev, exclusive. */\n\t\trc = llc_ui_autobind(sock, addr);\n\t\tif (rc)\n\t\t\tgoto out;\n\t}\n\thdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);\n\tsize = hdrlen + len;\n\tif (size > llc->dev->mtu)\n\t\tsize = llc->dev->mtu;\n\tcopied = size - hdrlen;\n\trc = -EINVAL;\n\tif (copied < 0)\n\t\tgoto out;\n\trelease_sock(sk);\n\tskb = sock_alloc_send_skb(sk, size, noblock, &rc);\n\tlock_sock(sk);\n\tif (!skb)\n\t\tgoto out;\n\tskb->dev = llc->dev;\n\tskb->protocol = llc_proto_type(addr->sllc_arphrd);\n\tskb_reserve(skb, hdrlen);\n\trc = memcpy_from_msg(skb_put(skb, copied), msg, copied);\n\tif (rc)\n\t\tgoto out;\n\tif (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) {\n\t\tllc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac,\n\t\t\t\t\t addr->sllc_sap);\n\t\tskb = NULL;\n\t\tgoto out;\n\t}\n\tif (addr->sllc_test) {\n\t\tllc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac,\n\t\t\t\t\t addr->sllc_sap);\n\t\tskb = NULL;\n\t\tgoto out;\n\t}\n\tif (addr->sllc_xid) {\n\t\tllc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac,\n\t\t\t\t\t addr->sllc_sap);\n\t\tskb = NULL;\n\t\tgoto out;\n\t}\n\trc = -ENOPROTOOPT;\n\tif (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua))\n\t\tgoto out;\n\trc = llc_ui_send_data(sk, skb, noblock);\n\tskb = NULL;\nout:\n\tkfree_skb(skb);\n\tif (rc)\n\t\tdprintk(\"%s: failed sending from %02X to %02X: %d\\n\",\n\t\t\t__func__, llc->laddr.lsap, llc->daddr.lsap, rc);\n\trelease_sock(sk);\n\treturn rc ? : copied;\n}",
"/**\n *\tllc_ui_getname - return the address info of a socket\n *\t@sock: Socket to get address of.\n *\t@uaddr: Address structure to return information.\n *\t@peer: Does user want local or remote address information.\n *\n *\tReturn the address information of a socket.\n */\nstatic int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,\n\t\t\t int peer)\n{\n\tstruct sockaddr_llc sllc;\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tint rc = -EBADF;",
"\tmemset(&sllc, 0, sizeof(sllc));\n\tlock_sock(sk);\n\tif (sock_flag(sk, SOCK_ZAPPED))\n\t\tgoto out;\n\tif (peer) {\n\t\trc = -ENOTCONN;\n\t\tif (sk->sk_state != TCP_ESTABLISHED)\n\t\t\tgoto out;\n\t\tif(llc->dev)\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\tsllc.sllc_sap = llc->daddr.lsap;\n\t\tmemcpy(&sllc.sllc_mac, &llc->daddr.mac, IFHWADDRLEN);\n\t} else {\n\t\trc = -EINVAL;\n\t\tif (!llc->sap)\n\t\t\tgoto out;\n\t\tsllc.sllc_sap = llc->sap->laddr.lsap;",
"\t\tif (llc->dev) {\n\t\t\tsllc.sllc_arphrd = llc->dev->type;\n\t\t\tmemcpy(&sllc.sllc_mac, llc->dev->dev_addr,\n\t\t\t IFHWADDRLEN);\n\t\t}\n\t}\n\tsllc.sllc_family = AF_LLC;\n\tmemcpy(uaddr, &sllc, sizeof(sllc));\n\trc = sizeof(sllc);\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_ioctl - io controls for PF_LLC\n *\t@sock: Socket to get/set info\n *\t@cmd: command\n *\t@arg: optional argument for cmd\n *\n *\tget/set info on llc sockets\n */\nstatic int llc_ui_ioctl(struct socket *sock, unsigned int cmd,\n\t\t\tunsigned long arg)\n{\n\treturn -ENOIOCTLCMD;\n}",
"/**\n *\tllc_ui_setsockopt - set various connection specific parameters.\n *\t@sock: Socket to set options on.\n *\t@level: Socket level user is requesting operations on.\n *\t@optname: Operation name.\n *\t@optval: User provided operation data.\n *\t@optlen: Length of optval.\n *\n *\tSet various connection specific parameters.\n */\nstatic int llc_ui_setsockopt(struct socket *sock, int level, int optname,\n\t\t\t sockptr_t optval, unsigned int optlen)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tunsigned int opt;\n\tint rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(level != SOL_LLC || optlen != sizeof(int)))\n\t\tgoto out;\n\trc = copy_from_sockptr(&opt, optval, sizeof(opt));\n\tif (rc)\n\t\tgoto out;\n\trc = -EINVAL;\n\tswitch (optname) {\n\tcase LLC_OPT_RETRY:\n\t\tif (opt > LLC_OPT_MAX_RETRY)\n\t\t\tgoto out;\n\t\tllc->n2 = opt;\n\t\tbreak;\n\tcase LLC_OPT_SIZE:\n\t\tif (opt > LLC_OPT_MAX_SIZE)\n\t\t\tgoto out;\n\t\tllc->n1 = opt;\n\t\tbreak;\n\tcase LLC_OPT_ACK_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_ACK_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->ack_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_P_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_P_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->pf_cycle_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_REJ_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_REJ_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->rej_sent_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_BUSY_TMR_EXP:\n\t\tif (opt > LLC_OPT_MAX_BUSY_TMR_EXP)\n\t\t\tgoto out;\n\t\tllc->busy_state_timer.expire = opt * HZ;\n\t\tbreak;\n\tcase LLC_OPT_TX_WIN:\n\t\tif (opt > LLC_OPT_MAX_WIN)\n\t\t\tgoto out;\n\t\tllc->k = opt;\n\t\tbreak;\n\tcase LLC_OPT_RX_WIN:\n\t\tif (opt > LLC_OPT_MAX_WIN)\n\t\t\tgoto out;\n\t\tllc->rw = opt;\n\t\tbreak;\n\tcase LLC_OPT_PKTINFO:\n\t\tif (opt)\n\t\t\tllc->cmsg_flags |= LLC_CMSG_PKTINFO;\n\t\telse\n\t\t\tllc->cmsg_flags &= ~LLC_CMSG_PKTINFO;\n\t\tbreak;\n\tdefault:\n\t\trc = -ENOPROTOOPT;\n\t\tgoto out;\n\t}\n\trc = 0;\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"/**\n *\tllc_ui_getsockopt - get connection specific socket info\n *\t@sock: Socket to get information from.\n *\t@level: Socket level user is requesting operations on.\n *\t@optname: Operation name.\n *\t@optval: Variable to return operation data in.\n *\t@optlen: Length of optval.\n *\n *\tGet connection specific socket information.\n */\nstatic int llc_ui_getsockopt(struct socket *sock, int level, int optname,\n\t\t\t char __user *optval, int __user *optlen)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct llc_sock *llc = llc_sk(sk);\n\tint val = 0, len = 0, rc = -EINVAL;",
"\tlock_sock(sk);\n\tif (unlikely(level != SOL_LLC))\n\t\tgoto out;\n\trc = get_user(len, optlen);\n\tif (rc)\n\t\tgoto out;\n\trc = -EINVAL;\n\tif (len != sizeof(int))\n\t\tgoto out;\n\tswitch (optname) {\n\tcase LLC_OPT_RETRY:\n\t\tval = llc->n2;\t\t\t\t\tbreak;\n\tcase LLC_OPT_SIZE:\n\t\tval = llc->n1;\t\t\t\t\tbreak;\n\tcase LLC_OPT_ACK_TMR_EXP:\n\t\tval = llc->ack_timer.expire / HZ;\t\tbreak;\n\tcase LLC_OPT_P_TMR_EXP:\n\t\tval = llc->pf_cycle_timer.expire / HZ;\t\tbreak;\n\tcase LLC_OPT_REJ_TMR_EXP:\n\t\tval = llc->rej_sent_timer.expire / HZ;\t\tbreak;\n\tcase LLC_OPT_BUSY_TMR_EXP:\n\t\tval = llc->busy_state_timer.expire / HZ;\tbreak;\n\tcase LLC_OPT_TX_WIN:\n\t\tval = llc->k;\t\t\t\tbreak;\n\tcase LLC_OPT_RX_WIN:\n\t\tval = llc->rw;\t\t\t\tbreak;\n\tcase LLC_OPT_PKTINFO:\n\t\tval = (llc->cmsg_flags & LLC_CMSG_PKTINFO) != 0;\n\t\tbreak;\n\tdefault:\n\t\trc = -ENOPROTOOPT;\n\t\tgoto out;\n\t}\n\trc = 0;\n\tif (put_user(len, optlen) || copy_to_user(optval, &val, len))\n\t\trc = -EFAULT;\nout:\n\trelease_sock(sk);\n\treturn rc;\n}",
"static const struct net_proto_family llc_ui_family_ops = {\n\t.family = PF_LLC,\n\t.create = llc_ui_create,\n\t.owner\t= THIS_MODULE,\n};",
"static const struct proto_ops llc_ui_ops = {\n\t.family\t = PF_LLC,\n\t.owner = THIS_MODULE,\n\t.release = llc_ui_release,\n\t.bind\t = llc_ui_bind,\n\t.connect = llc_ui_connect,\n\t.socketpair = sock_no_socketpair,\n\t.accept = llc_ui_accept,\n\t.getname = llc_ui_getname,\n\t.poll\t = datagram_poll,\n\t.ioctl = llc_ui_ioctl,\n\t.listen = llc_ui_listen,\n\t.shutdown = llc_ui_shutdown,\n\t.setsockopt = llc_ui_setsockopt,\n\t.getsockopt = llc_ui_getsockopt,\n\t.sendmsg = llc_ui_sendmsg,\n\t.recvmsg = llc_ui_recvmsg,\n\t.mmap\t = sock_no_mmap,\n\t.sendpage = sock_no_sendpage,\n};",
"static const char llc_proc_err_msg[] __initconst =\n\tKERN_CRIT \"LLC: Unable to register the proc_fs entries\\n\";\nstatic const char llc_sysctl_err_msg[] __initconst =\n\tKERN_CRIT \"LLC: Unable to register the sysctl entries\\n\";\nstatic const char llc_sock_err_msg[] __initconst =\n\tKERN_CRIT \"LLC: Unable to register the network family\\n\";",
"static int __init llc2_init(void)\n{\n\tint rc = proto_register(&llc_proto, 0);",
"\tif (rc != 0)\n\t\tgoto out;",
"\tllc_build_offset_table();\n\tllc_station_init();\n\tllc_ui_sap_last_autoport = LLC_SAP_DYN_START;\n\trc = llc_proc_init();\n\tif (rc != 0) {\n\t\tprintk(llc_proc_err_msg);\n\t\tgoto out_station;\n\t}\n\trc = llc_sysctl_init();\n\tif (rc) {\n\t\tprintk(llc_sysctl_err_msg);\n\t\tgoto out_proc;\n\t}\n\trc = sock_register(&llc_ui_family_ops);\n\tif (rc) {\n\t\tprintk(llc_sock_err_msg);\n\t\tgoto out_sysctl;\n\t}\n\tllc_add_pack(LLC_DEST_SAP, llc_sap_handler);\n\tllc_add_pack(LLC_DEST_CONN, llc_conn_handler);\nout:\n\treturn rc;\nout_sysctl:\n\tllc_sysctl_exit();\nout_proc:\n\tllc_proc_exit();\nout_station:\n\tllc_station_exit();\n\tproto_unregister(&llc_proto);\n\tgoto out;\n}",
"static void __exit llc2_exit(void)\n{\n\tllc_station_exit();\n\tllc_remove_pack(LLC_DEST_SAP);\n\tllc_remove_pack(LLC_DEST_CONN);\n\tsock_unregister(PF_LLC);\n\tllc_proc_exit();\n\tllc_sysctl_exit();\n\tproto_unregister(&llc_proto);\n}",
"module_init(llc2_init);\nmodule_exit(llc2_exit);",
"MODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Procom 1997, Jay Schullist 2001, Arnaldo C. Melo 2001-2003\");\nMODULE_DESCRIPTION(\"IEEE 802.2 PF_LLC support\");\nMODULE_ALIAS_NETPROTO(PF_LLC);"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [410], "buggy_code_start_loc": [313], "filenames": ["net/llc/af_llc.c"], "fixing_code_end_loc": [419], "fixing_code_start_loc": [314], "message": "In the Linux kernel before 5.17.1, a refcount leak bug was found in net/llc/af_llc.c.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "C4C36454-2CDC-4F8D-A717-878F1C39CAD1", "versionEndExcluding": "5.17.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*", "matchCriteriaId": "FA6FEEC2-9F11-4643-8827-749718254FED", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In the Linux kernel before 5.17.1, a refcount leak bug was found in net/llc/af_llc.c."}, {"lang": "es", "value": "En el kernel de Linux versiones anteriores a 5.17.1, se encontr\u00f3 un bug de filtrado de refcount en el archivo net/llc/af_llc.c"}], "evaluatorComment": null, "id": "CVE-2022-28356", "lastModified": "2023-02-03T23:59:15.293", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "LOW", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 2.1, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:L/AC:L/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 3.9, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 5.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-04-02T21:15:09.363", "references": [{"source": "cve@mitre.org", "tags": ["Exploit", "Mailing List", "Third Party Advisory"], "url": "http://www.openwall.com/lists/oss-security/2022/04/06/1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Release Notes", "Vendor Advisory"], "url": "https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.17.1"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/764f4eb6846f5475f1244767d24d25dd86528a4a"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/07/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20220506-0006/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2022/dsa-5127"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2022/dsa-5173"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "NVD-CWE-Other"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/764f4eb6846f5475f1244767d24d25dd86528a4a"}, "type": "NVD-CWE-Other"}
| 88
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n/**\n * Query API: WP_Query class\n *\n * @package WordPress\n * @subpackage Query\n * @since 4.7.0\n */",
"/**\n * The WordPress Query class.\n *\n * @link https://codex.wordpress.org/Function_Reference/WP_Query Codex page.\n *\n * @since 1.5.0\n * @since 4.5.0 Removed the `$comments_popup` property.\n */\nclass WP_Query {",
"\t/**\n\t * Query vars set by the user\n\t *\n\t * @since 1.5.0\n\t * @var array\n\t */\n\tpublic $query;",
"\t/**\n\t * Query vars, after parsing\n\t *\n\t * @since 1.5.0\n\t * @var array\n\t */\n\tpublic $query_vars = array();",
"\t/**\n\t * Taxonomy query, as passed to get_tax_sql()\n\t *\n\t * @since 3.1.0\n\t * @var object WP_Tax_Query\n\t */\n\tpublic $tax_query;",
"\t/**\n\t * Metadata query container\n\t *\n\t * @since 3.2.0\n\t * @var object WP_Meta_Query\n\t */\n\tpublic $meta_query = false;",
"\t/**\n\t * Date query container\n\t *\n\t * @since 3.7.0\n\t * @var object WP_Date_Query\n\t */\n\tpublic $date_query = false;",
"\t/**\n\t * Holds the data for a single object that is queried.\n\t *\n\t * Holds the contents of a post, page, category, attachment.\n\t *\n\t * @since 1.5.0\n\t * @var object|array\n\t */\n\tpublic $queried_object;",
"\t/**\n\t * The ID of the queried object.\n\t *\n\t * @since 1.5.0\n\t * @var int\n\t */\n\tpublic $queried_object_id;",
"\t/**\n\t * Get post database query.\n\t *\n\t * @since 2.0.1\n\t * @var string\n\t */\n\tpublic $request;",
"\t/**\n\t * List of posts.\n\t *\n\t * @since 1.5.0\n\t * @var array\n\t */\n\tpublic $posts;",
"\t/**\n\t * The amount of posts for the current query.\n\t *\n\t * @since 1.5.0\n\t * @var int\n\t */\n\tpublic $post_count = 0;",
"\t/**\n\t * Index of the current item in the loop.\n\t *\n\t * @since 1.5.0\n\t * @var int\n\t */\n\tpublic $current_post = -1;",
"\t/**\n\t * Whether the loop has started and the caller is in the loop.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $in_the_loop = false;",
"\t/**\n\t * The current post.\n\t *\n\t * @since 1.5.0\n\t * @var WP_Post\n\t */\n\tpublic $post;",
"\t/**\n\t * The list of comments for current post.\n\t *\n\t * @since 2.2.0\n\t * @var array\n\t */\n\tpublic $comments;",
"\t/**\n\t * The amount of comments for the posts.\n\t *\n\t * @since 2.2.0\n\t * @var int\n\t */\n\tpublic $comment_count = 0;",
"\t/**\n\t * The index of the comment in the comment loop.\n\t *\n\t * @since 2.2.0\n\t * @var int\n\t */\n\tpublic $current_comment = -1;",
"\t/**\n\t * Current comment ID.\n\t *\n\t * @since 2.2.0\n\t * @var int\n\t */\n\tpublic $comment;",
"\t/**\n\t * The amount of found posts for the current query.\n\t *\n\t * If limit clause was not used, equals $post_count.\n\t *\n\t * @since 2.1.0\n\t * @var int\n\t */\n\tpublic $found_posts = 0;",
"\t/**\n\t * The amount of pages.\n\t *\n\t * @since 2.1.0\n\t * @var int\n\t */\n\tpublic $max_num_pages = 0;",
"\t/**\n\t * The amount of comment pages.\n\t *\n\t * @since 2.7.0\n\t * @var int\n\t */\n\tpublic $max_num_comment_pages = 0;",
"\t/**\n\t * Signifies whether the current query is for a single post.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_single = false;",
"\t/**\n\t * Signifies whether the current query is for a preview.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $is_preview = false;",
"\t/**\n\t * Signifies whether the current query is for a page.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_page = false;",
"\t/**\n\t * Signifies whether the current query is for an archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_archive = false;",
"\t/**\n\t * Signifies whether the current query is for a date archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_date = false;",
"\t/**\n\t * Signifies whether the current query is for a year archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_year = false;",
"\t/**\n\t * Signifies whether the current query is for a month archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_month = false;",
"\t/**\n\t * Signifies whether the current query is for a day archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_day = false;",
"\t/**\n\t * Signifies whether the current query is for a specific time.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_time = false;",
"\t/**\n\t * Signifies whether the current query is for an author archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_author = false;",
"\t/**\n\t * Signifies whether the current query is for a category archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_category = false;",
"\t/**\n\t * Signifies whether the current query is for a tag archive.\n\t *\n\t * @since 2.3.0\n\t * @var bool\n\t */\n\tpublic $is_tag = false;",
"\t/**\n\t * Signifies whether the current query is for a taxonomy archive.\n\t *\n\t * @since 2.5.0\n\t * @var bool\n\t */\n\tpublic $is_tax = false;",
"\t/**\n\t * Signifies whether the current query is for a search.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_search = false;",
"\t/**\n\t * Signifies whether the current query is for a feed.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_feed = false;",
"\t/**\n\t * Signifies whether the current query is for a comment feed.\n\t *\n\t * @since 2.2.0\n\t * @var bool\n\t */\n\tpublic $is_comment_feed = false;",
"\t/**\n\t * Signifies whether the current query is for trackback endpoint call.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_trackback = false;",
"\t/**\n\t * Signifies whether the current query is for the site homepage.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_home = false;",
"\t/**\n\t * Signifies whether the current query is for the Privacy Policy page.\n\t *\n\t * @since 5.2.0\n\t * @var bool\n\t */\n\tpublic $is_privacy_policy = false;",
"\t/**\n\t * Signifies whether the current query couldn't find anything.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_404 = false;",
"\t/**\n\t * Signifies whether the current query is for an embed.\n\t *\n\t * @since 4.4.0\n\t * @var bool\n\t */\n\tpublic $is_embed = false;",
"\t/**\n\t * Signifies whether the current query is for a paged result and not for the first page.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_paged = false;",
"\t/**\n\t * Signifies whether the current query is for an administrative interface page.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_admin = false;",
"\t/**\n\t * Signifies whether the current query is for an attachment page.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $is_attachment = false;",
"\t/**\n\t * Signifies whether the current query is for an existing single post of any post type\n\t * (post, attachment, page, custom post types).\n\t *\n\t * @since 2.1.0\n\t * @var bool\n\t */\n\tpublic $is_singular = false;",
"\t/**\n\t * Signifies whether the current query is for the robots.txt file.\n\t *\n\t * @since 2.1.0\n\t * @var bool\n\t */\n\tpublic $is_robots = false;",
"\t/**\n\t * Signifies whether the current query is for the page_for_posts page.\n\t *\n\t * Basically, the homepage if the option isn't set for the static homepage.\n\t *\n\t * @since 2.1.0\n\t * @var bool\n\t */\n\tpublic $is_posts_page = false;",
"\t/**\n\t * Signifies whether the current query is for a post type archive.\n\t *\n\t * @since 3.1.0\n\t * @var bool\n\t */\n\tpublic $is_post_type_archive = false;",
"\t/**\n\t * Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know\n\t * whether we have to re-parse because something has changed\n\t *\n\t * @since 3.1.0\n\t * @var bool|string\n\t */\n\tprivate $query_vars_hash = false;",
"\t/**\n\t * Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made\n\t * via pre_get_posts hooks.\n\t *\n\t * @since 3.1.1\n\t */\n\tprivate $query_vars_changed = true;",
"\t/**\n\t * Set if post thumbnails are cached\n\t *\n\t * @since 3.2.0\n\t * @var bool\n\t */\n\tpublic $thumbnails_cached = false;",
"\t/**\n\t * Cached list of search stopwords.\n\t *\n\t * @since 3.7.0\n\t * @var array\n\t */\n\tprivate $stopwords;",
"\tprivate $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );",
"\tprivate $compat_methods = array( 'init_query_flags', 'parse_tax_query' );",
"\t/**\n\t * Resets query flags to false.\n\t *\n\t * The query flags are what page info WordPress was able to figure out.\n\t *\n\t * @since 2.0.0\n\t */\n\tprivate function init_query_flags() {\n\t\t$this->is_single = false;\n\t\t$this->is_preview = false;\n\t\t$this->is_page = false;\n\t\t$this->is_archive = false;\n\t\t$this->is_date = false;\n\t\t$this->is_year = false;\n\t\t$this->is_month = false;\n\t\t$this->is_day = false;\n\t\t$this->is_time = false;\n\t\t$this->is_author = false;\n\t\t$this->is_category = false;\n\t\t$this->is_tag = false;\n\t\t$this->is_tax = false;\n\t\t$this->is_search = false;\n\t\t$this->is_feed = false;\n\t\t$this->is_comment_feed = false;\n\t\t$this->is_trackback = false;\n\t\t$this->is_home = false;\n\t\t$this->is_privacy_policy = false;\n\t\t$this->is_404 = false;\n\t\t$this->is_paged = false;\n\t\t$this->is_admin = false;\n\t\t$this->is_attachment = false;\n\t\t$this->is_singular = false;\n\t\t$this->is_robots = false;\n\t\t$this->is_posts_page = false;\n\t\t$this->is_post_type_archive = false;\n\t}",
"\t/**\n\t * Initiates object properties and sets default values.\n\t *\n\t * @since 1.5.0\n\t */\n\tpublic function init() {\n\t\tunset( $this->posts );\n\t\tunset( $this->query );\n\t\t$this->query_vars = array();\n\t\tunset( $this->queried_object );\n\t\tunset( $this->queried_object_id );\n\t\t$this->post_count = 0;\n\t\t$this->current_post = -1;\n\t\t$this->in_the_loop = false;\n\t\tunset( $this->request );\n\t\tunset( $this->post );\n\t\tunset( $this->comments );\n\t\tunset( $this->comment );\n\t\t$this->comment_count = 0;\n\t\t$this->current_comment = -1;\n\t\t$this->found_posts = 0;\n\t\t$this->max_num_pages = 0;\n\t\t$this->max_num_comment_pages = 0;",
"\t\t$this->init_query_flags();\n\t}",
"\t/**\n\t * Reparse the query vars.\n\t *\n\t * @since 1.5.0\n\t */\n\tpublic function parse_query_vars() {\n\t\t$this->parse_query();\n\t}",
"\t/**\n\t * Fills in the query variables, which do not exist within the parameter.\n\t *\n\t * @since 2.1.0\n\t * @since 4.4.0 Removed the `comments_popup` public query variable.\n\t *\n\t * @param array $array Defined query variables.\n\t * @return array Complete query variables with undefined ones filled in empty.\n\t */\n\tpublic function fill_query_vars( $array ) {\n\t\t$keys = array(\n\t\t\t'error',\n\t\t\t'm',\n\t\t\t'p',\n\t\t\t'post_parent',\n\t\t\t'subpost',\n\t\t\t'subpost_id',\n\t\t\t'attachment',\n\t\t\t'attachment_id',\n\t\t\t'name',",
"\t\t\t'static',",
"\t\t\t'pagename',\n\t\t\t'page_id',\n\t\t\t'second',\n\t\t\t'minute',\n\t\t\t'hour',\n\t\t\t'day',\n\t\t\t'monthnum',\n\t\t\t'year',\n\t\t\t'w',\n\t\t\t'category_name',\n\t\t\t'tag',\n\t\t\t'cat',\n\t\t\t'tag_id',\n\t\t\t'author',\n\t\t\t'author_name',\n\t\t\t'feed',\n\t\t\t'tb',\n\t\t\t'paged',\n\t\t\t'meta_key',\n\t\t\t'meta_value',\n\t\t\t'preview',\n\t\t\t's',\n\t\t\t'sentence',\n\t\t\t'title',\n\t\t\t'fields',\n\t\t\t'menu_order',\n\t\t\t'embed',\n\t\t);",
"\t\tforeach ( $keys as $key ) {\n\t\t\tif ( ! isset( $array[ $key ] ) ) {\n\t\t\t\t$array[ $key ] = '';\n\t\t\t}\n\t\t}",
"\t\t$array_keys = array(\n\t\t\t'category__in',\n\t\t\t'category__not_in',\n\t\t\t'category__and',\n\t\t\t'post__in',\n\t\t\t'post__not_in',\n\t\t\t'post_name__in',\n\t\t\t'tag__in',\n\t\t\t'tag__not_in',\n\t\t\t'tag__and',\n\t\t\t'tag_slug__in',\n\t\t\t'tag_slug__and',\n\t\t\t'post_parent__in',\n\t\t\t'post_parent__not_in',\n\t\t\t'author__in',\n\t\t\t'author__not_in',\n\t\t);",
"\t\tforeach ( $array_keys as $key ) {\n\t\t\tif ( ! isset( $array[ $key ] ) ) {\n\t\t\t\t$array[ $key ] = array();\n\t\t\t}\n\t\t}\n\t\treturn $array;\n\t}",
"\t/**\n\t * Parse a query string and set query type booleans.\n\t *\n\t * @since 1.5.0\n\t * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause's\n\t * array key to `$orderby`.\n\t * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters. `$s` was updated to support excluded\n\t * search terms, by prepending a hyphen.\n\t * @since 4.5.0 Removed the `$comments_popup` parameter.\n\t * Introduced the `$comment_status` and `$ping_status` parameters.\n\t * Introduced `RAND(x)` syntax for `$orderby`, which allows an integer seed value to random sorts.\n\t * @since 4.6.0 Added 'post_name__in' support for `$orderby`. Introduced the `$lazy_load_term_meta` argument.\n\t * @since 4.9.0 Introduced the `$comment_count` parameter.\n\t * @since 5.1.0 Introduced the `$meta_compare_key` parameter.\n\t *\n\t * @param string|array $query {\n\t * Optional. Array or string of Query parameters.\n\t *\n\t * @type int $attachment_id Attachment post ID. Used for 'attachment' post_type.\n\t * @type int|string $author Author ID, or comma-separated list of IDs.\n\t * @type string $author_name User 'user_nicename'.\n\t * @type array $author__in An array of author IDs to query from.\n\t * @type array $author__not_in An array of author IDs not to query from.\n\t * @type bool $cache_results Whether to cache post information. Default true.\n\t * @type int|string $cat Category ID or comma-separated list of IDs (this or any children).\n\t * @type array $category__and An array of category IDs (AND in).\n\t * @type array $category__in An array of category IDs (OR in, no children).\n\t * @type array $category__not_in An array of category IDs (NOT in).\n\t * @type string $category_name Use category slug (not name, this or any children).\n\t * @type array|int $comment_count Filter results by comment count. Provide an integer to match\n\t * comment count exactly. Provide an array with integer 'value'\n\t * and 'compare' operator ('=', '!=', '>', '>=', '<', '<=' ) to\n\t * compare against comment_count in a specific way.\n\t * @type string $comment_status Comment status.\n\t * @type int $comments_per_page The number of comments to return per page.\n\t * Default 'comments_per_page' option.\n\t * @type array $date_query An associative array of WP_Date_Query arguments.\n\t * See WP_Date_Query::__construct().\n\t * @type int $day Day of the month. Default empty. Accepts numbers 1-31.\n\t * @type bool $exact Whether to search by exact keyword. Default false.\n\t * @type string|array $fields Which fields to return. Single field or all fields (string),\n\t * or array of fields. 'id=>parent' uses 'id' and 'post_parent'.\n\t * Default all fields. Accepts 'ids', 'id=>parent'.\n\t * @type int $hour Hour of the day. Default empty. Accepts numbers 0-23.\n\t * @type int|bool $ignore_sticky_posts Whether to ignore sticky posts or not. Setting this to false\n\t * excludes stickies from 'post__in'. Accepts 1|true, 0|false.\n\t * Default 0|false.\n\t * @type int $m Combination YearMonth. Accepts any four-digit year and month\n\t * numbers 1-12. Default empty.\n\t * @type string $meta_compare Comparison operator to test the 'meta_value'.\n\t * @type string $meta_compare_key Comparison operator to test the 'meta_key'.\n\t * @type string $meta_key Custom field key.\n\t * @type array $meta_query An associative array of WP_Meta_Query arguments. See WP_Meta_Query.\n\t * @type string $meta_value Custom field value.\n\t * @type int $meta_value_num Custom field value number.\n\t * @type int $menu_order The menu order of the posts.\n\t * @type int $monthnum The two-digit month. Default empty. Accepts numbers 1-12.\n\t * @type string $name Post slug.\n\t * @type bool $nopaging Show all posts (true) or paginate (false). Default false.\n\t * @type bool $no_found_rows Whether to skip counting the total rows found. Enabling can improve\n\t * performance. Default false.\n\t * @type int $offset The number of posts to offset before retrieval.\n\t * @type string $order Designates ascending or descending order of posts. Default 'DESC'.\n\t * Accepts 'ASC', 'DESC'.\n\t * @type string|array $orderby Sort retrieved posts by parameter. One or more options may be\n\t * passed. To use 'meta_value', or 'meta_value_num',\n\t * 'meta_key=keyname' must be also be defined. To sort by a\n\t * specific `$meta_query` clause, use that clause's array key.\n\t * Accepts 'none', 'name', 'author', 'date', 'title',\n\t * 'modified', 'menu_order', 'parent', 'ID', 'rand',\n\t * 'relevance', 'RAND(x)' (where 'x' is an integer seed value),\n\t * 'comment_count', 'meta_value', 'meta_value_num', 'post__in',\n\t * 'post_name__in', 'post_parent__in', and the array keys\n\t * of `$meta_query`. Default is 'date', except when a search\n\t * is being performed, when the default is 'relevance'.\n\t *\n\t * @type int $p Post ID.\n\t * @type int $page Show the number of posts that would show up on page X of a\n\t * static front page.\n\t * @type int $paged The number of the current page.\n\t * @type int $page_id Page ID.\n\t * @type string $pagename Page slug.\n\t * @type string $perm Show posts if user has the appropriate capability.\n\t * @type string $ping_status Ping status.\n\t * @type array $post__in An array of post IDs to retrieve, sticky posts will be included\n\t * @type string $post_mime_type The mime type of the post. Used for 'attachment' post_type.\n\t * @type array $post__not_in An array of post IDs not to retrieve. Note: a string of comma-\n\t * separated IDs will NOT work.\n\t * @type int $post_parent Page ID to retrieve child pages for. Use 0 to only retrieve\n\t * top-level pages.\n\t * @type array $post_parent__in An array containing parent page IDs to query child pages from.\n\t * @type array $post_parent__not_in An array containing parent page IDs not to query child pages from.\n\t * @type string|array $post_type A post type slug (string) or array of post type slugs.\n\t * Default 'any' if using 'tax_query'.\n\t * @type string|array $post_status A post status (string) or array of post statuses.\n\t * @type int $posts_per_page The number of posts to query for. Use -1 to request all posts.\n\t * @type int $posts_per_archive_page The number of posts to query for by archive page. Overrides\n\t * 'posts_per_page' when is_archive(), or is_search() are true.\n\t * @type array $post_name__in An array of post slugs that results must match.\n\t * @type string $s Search keyword(s). Prepending a term with a hyphen will\n\t * exclude posts matching that term. Eg, 'pillow -sofa' will\n\t * return posts containing 'pillow' but not 'sofa'. The\n\t * character used for exclusion can be modified using the\n\t * the 'wp_query_search_exclusion_prefix' filter.\n\t * @type int $second Second of the minute. Default empty. Accepts numbers 0-60.\n\t * @type bool $sentence Whether to search by phrase. Default false.\n\t * @type bool $suppress_filters Whether to suppress filters. Default false.\n\t * @type string $tag Tag slug. Comma-separated (either), Plus-separated (all).\n\t * @type array $tag__and An array of tag ids (AND in).\n\t * @type array $tag__in An array of tag ids (OR in).\n\t * @type array $tag__not_in An array of tag ids (NOT in).\n\t * @type int $tag_id Tag id or comma-separated list of IDs.\n\t * @type array $tag_slug__and An array of tag slugs (AND in).\n\t * @type array $tag_slug__in An array of tag slugs (OR in). unless 'ignore_sticky_posts' is\n\t * true. Note: a string of comma-separated IDs will NOT work.\n\t * @type array $tax_query An associative array of WP_Tax_Query arguments.\n\t * See WP_Tax_Query->queries.\n\t * @type string $title Post title.\n\t * @type bool $update_post_meta_cache Whether to update the post meta cache. Default true.\n\t * @type bool $update_post_term_cache Whether to update the post term cache. Default true.\n\t * @type bool $lazy_load_term_meta Whether to lazy-load term meta. Setting to false will\n\t * disable cache priming for term meta, so that each\n\t * get_term_meta() call will hit the database.\n\t * Defaults to the value of `$update_post_term_cache`.\n\t * @type int $w The week number of the year. Default empty. Accepts numbers 0-53.\n\t * @type int $year The four-digit year. Default empty. Accepts any four-digit year.\n\t * }\n\t */\n\tpublic function parse_query( $query = '' ) {\n\t\tif ( ! empty( $query ) ) {\n\t\t\t$this->init();\n\t\t\t$this->query = $this->query_vars = wp_parse_args( $query );\n\t\t} elseif ( ! isset( $this->query ) ) {\n\t\t\t$this->query = $this->query_vars;\n\t\t}",
"\t\t$this->query_vars = $this->fill_query_vars( $this->query_vars );\n\t\t$qv = &$this->query_vars;\n\t\t$this->query_vars_changed = true;",
"\t\tif ( ! empty( $qv['robots'] ) ) {\n\t\t\t$this->is_robots = true;\n\t\t}",
"\t\tif ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) {\n\t\t\t$qv['p'] = 0;\n\t\t\t$qv['error'] = '404';\n\t\t} else {\n\t\t\t$qv['p'] = intval( $qv['p'] );\n\t\t}",
"\t\t$qv['page_id'] = absint( $qv['page_id'] );\n\t\t$qv['year'] = absint( $qv['year'] );\n\t\t$qv['monthnum'] = absint( $qv['monthnum'] );\n\t\t$qv['day'] = absint( $qv['day'] );\n\t\t$qv['w'] = absint( $qv['w'] );\n\t\t$qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : '';\n\t\t$qv['paged'] = absint( $qv['paged'] );\n\t\t$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers\n\t\t$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers\n\t\t$qv['pagename'] = trim( $qv['pagename'] );\n\t\t$qv['name'] = trim( $qv['name'] );\n\t\t$qv['title'] = trim( $qv['title'] );\n\t\tif ( '' !== $qv['hour'] ) {\n\t\t\t$qv['hour'] = absint( $qv['hour'] );\n\t\t}\n\t\tif ( '' !== $qv['minute'] ) {\n\t\t\t$qv['minute'] = absint( $qv['minute'] );\n\t\t}\n\t\tif ( '' !== $qv['second'] ) {\n\t\t\t$qv['second'] = absint( $qv['second'] );\n\t\t}\n\t\tif ( '' !== $qv['menu_order'] ) {\n\t\t\t$qv['menu_order'] = absint( $qv['menu_order'] );\n\t\t}",
"\t\t// Fairly insane upper bound for search string lengths.\n\t\tif ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {\n\t\t\t$qv['s'] = '';\n\t\t}",
"\t\t// Compat. Map subpost to attachment.\n\t\tif ( '' != $qv['subpost'] ) {\n\t\t\t$qv['attachment'] = $qv['subpost'];\n\t\t}\n\t\tif ( '' != $qv['subpost_id'] ) {\n\t\t\t$qv['attachment_id'] = $qv['subpost_id'];\n\t\t}",
"\t\t$qv['attachment_id'] = absint( $qv['attachment_id'] );",
"\t\tif ( ( '' != $qv['attachment'] ) || ! empty( $qv['attachment_id'] ) ) {\n\t\t\t$this->is_single = true;\n\t\t\t$this->is_attachment = true;\n\t\t} elseif ( '' != $qv['name'] ) {\n\t\t\t$this->is_single = true;\n\t\t} elseif ( $qv['p'] ) {\n\t\t\t$this->is_single = true;\n\t\t} elseif ( ( '' !== $qv['hour'] ) && ( '' !== $qv['minute'] ) && ( '' !== $qv['second'] ) && ( '' != $qv['year'] ) && ( '' != $qv['monthnum'] ) && ( '' != $qv['day'] ) ) {\n\t\t\t// If year, month, day, hour, minute, and second are set, a single\n\t\t\t// post is being queried.\n\t\t\t$this->is_single = true;",
"\t\t} elseif ( '' != $qv['static'] || '' != $qv['pagename'] || ! empty( $qv['page_id'] ) ) {",
"\t\t\t$this->is_page = true;\n\t\t\t$this->is_single = false;\n\t\t} else {\n\t\t\t// Look for archive queries. Dates, categories, authors, search, post type archives.",
"\t\t\tif ( isset( $this->query['s'] ) ) {\n\t\t\t\t$this->is_search = true;\n\t\t\t}",
"\t\t\tif ( '' !== $qv['second'] ) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\tif ( '' !== $qv['minute'] ) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\tif ( '' !== $qv['hour'] ) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\tif ( $qv['day'] ) {\n\t\t\t\tif ( ! $this->is_date ) {\n\t\t\t\t\t$date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );\n\t\t\t\t\tif ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {\n\t\t\t\t\t\t$qv['error'] = '404';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->is_day = true;\n\t\t\t\t\t\t$this->is_date = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $qv['monthnum'] ) {\n\t\t\t\tif ( ! $this->is_date ) {\n\t\t\t\t\tif ( 12 < $qv['monthnum'] ) {\n\t\t\t\t\t\t$qv['error'] = '404';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->is_month = true;\n\t\t\t\t\t\t$this->is_date = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $qv['year'] ) {\n\t\t\t\tif ( ! $this->is_date ) {\n\t\t\t\t\t$this->is_year = true;\n\t\t\t\t\t$this->is_date = true;\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $qv['m'] ) {\n\t\t\t\t$this->is_date = true;\n\t\t\t\tif ( strlen( $qv['m'] ) > 9 ) {\n\t\t\t\t\t$this->is_time = true;\n\t\t\t\t} elseif ( strlen( $qv['m'] ) > 7 ) {\n\t\t\t\t\t$this->is_day = true;\n\t\t\t\t} elseif ( strlen( $qv['m'] ) > 5 ) {\n\t\t\t\t\t$this->is_month = true;\n\t\t\t\t} else {\n\t\t\t\t\t$this->is_year = true;\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( '' != $qv['w'] ) {\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\t$this->query_vars_hash = false;\n\t\t\t$this->parse_tax_query( $qv );",
"\t\t\tforeach ( $this->tax_query->queries as $tax_query ) {\n\t\t\t\tif ( ! is_array( $tax_query ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"\t\t\t\tif ( isset( $tax_query['operator'] ) && 'NOT IN' != $tax_query['operator'] ) {\n\t\t\t\t\tswitch ( $tax_query['taxonomy'] ) {\n\t\t\t\t\t\tcase 'category':\n\t\t\t\t\t\t\t$this->is_category = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'post_tag':\n\t\t\t\t\t\t\t$this->is_tag = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$this->is_tax = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tunset( $tax_query );",
"\t\t\tif ( empty( $qv['author'] ) || ( $qv['author'] == '0' ) ) {\n\t\t\t\t$this->is_author = false;\n\t\t\t} else {\n\t\t\t\t$this->is_author = true;\n\t\t\t}",
"\t\t\tif ( '' != $qv['author_name'] ) {\n\t\t\t\t$this->is_author = true;\n\t\t\t}",
"\t\t\tif ( ! empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {\n\t\t\t\t$post_type_obj = get_post_type_object( $qv['post_type'] );\n\t\t\t\tif ( ! empty( $post_type_obj->has_archive ) ) {\n\t\t\t\t\t$this->is_post_type_archive = true;\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) {\n\t\t\t\t$this->is_archive = true;\n\t\t\t}\n\t\t}",
"\t\tif ( '' != $qv['feed'] ) {\n\t\t\t$this->is_feed = true;\n\t\t}",
"\t\tif ( '' != $qv['embed'] ) {\n\t\t\t$this->is_embed = true;\n\t\t}",
"\t\tif ( '' != $qv['tb'] ) {\n\t\t\t$this->is_trackback = true;\n\t\t}",
"\t\tif ( '' != $qv['paged'] && ( intval( $qv['paged'] ) > 1 ) ) {\n\t\t\t$this->is_paged = true;\n\t\t}",
"\t\t// if we're previewing inside the write screen\n\t\tif ( '' != $qv['preview'] ) {\n\t\t\t$this->is_preview = true;\n\t\t}",
"\t\tif ( is_admin() ) {\n\t\t\t$this->is_admin = true;\n\t\t}",
"\t\tif ( false !== strpos( $qv['feed'], 'comments-' ) ) {\n\t\t\t$qv['feed'] = str_replace( 'comments-', '', $qv['feed'] );\n\t\t\t$qv['withcomments'] = 1;\n\t\t}",
"\t\t$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;",
"\t\tif ( $this->is_feed && ( ! empty( $qv['withcomments'] ) || ( empty( $qv['withoutcomments'] ) && $this->is_singular ) ) ) {\n\t\t\t$this->is_comment_feed = true;\n\t\t}",
"\t\tif ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) ) {\n\t\t\t$this->is_home = true;\n\t\t}",
"\t\t// Correct is_* for page_on_front and page_for_posts\n\t\tif ( $this->is_home && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) ) {\n\t\t\t$_query = wp_parse_args( $this->query );\n\t\t\t// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.\n\t\t\tif ( isset( $_query['pagename'] ) && '' == $_query['pagename'] ) {\n\t\t\t\tunset( $_query['pagename'] );\n\t\t\t}",
"\t\t\tunset( $_query['embed'] );",
"\t\t\tif ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage' ) ) ) {\n\t\t\t\t$this->is_page = true;\n\t\t\t\t$this->is_home = false;\n\t\t\t\t$qv['page_id'] = get_option( 'page_on_front' );\n\t\t\t\t// Correct <!--nextpage--> for page_on_front\n\t\t\t\tif ( ! empty( $qv['paged'] ) ) {\n\t\t\t\t\t$qv['page'] = $qv['paged'];\n\t\t\t\t\tunset( $qv['paged'] );\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tif ( '' != $qv['pagename'] ) {\n\t\t\t$this->queried_object = get_page_by_path( $qv['pagename'] );",
"\t\t\tif ( $this->queried_object && 'attachment' == $this->queried_object->post_type ) {\n\t\t\t\tif ( preg_match( '/^[^%]*%(?:postname)%/', get_option( 'permalink_structure' ) ) ) {\n\t\t\t\t\t// See if we also have a post with the same slug\n\t\t\t\t\t$post = get_page_by_path( $qv['pagename'], OBJECT, 'post' );\n\t\t\t\t\tif ( $post ) {\n\t\t\t\t\t\t$this->queried_object = $post;\n\t\t\t\t\t\t$this->is_page = false;\n\t\t\t\t\t\t$this->is_single = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( ! empty( $this->queried_object ) ) {\n\t\t\t\t$this->queried_object_id = (int) $this->queried_object->ID;\n\t\t\t} else {\n\t\t\t\tunset( $this->queried_object );\n\t\t\t}",
"\t\t\tif ( 'page' == get_option( 'show_on_front' ) && isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'page_for_posts' ) ) {\n\t\t\t\t$this->is_page = false;\n\t\t\t\t$this->is_home = true;\n\t\t\t\t$this->is_posts_page = true;\n\t\t\t}",
"\t\t\tif ( isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'wp_page_for_privacy_policy' ) ) {\n\t\t\t\t$this->is_privacy_policy = true;\n\t\t\t}\n\t\t}",
"\t\tif ( $qv['page_id'] ) {\n\t\t\tif ( 'page' == get_option( 'show_on_front' ) && $qv['page_id'] == get_option( 'page_for_posts' ) ) {\n\t\t\t\t$this->is_page = false;\n\t\t\t\t$this->is_home = true;\n\t\t\t\t$this->is_posts_page = true;\n\t\t\t}",
"\t\t\tif ( $qv['page_id'] == get_option( 'wp_page_for_privacy_policy' ) ) {\n\t\t\t\t$this->is_privacy_policy = true;\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $qv['post_type'] ) ) {\n\t\t\tif ( is_array( $qv['post_type'] ) ) {\n\t\t\t\t$qv['post_type'] = array_map( 'sanitize_key', $qv['post_type'] );\n\t\t\t} else {\n\t\t\t\t$qv['post_type'] = sanitize_key( $qv['post_type'] );\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $qv['post_status'] ) ) {\n\t\t\tif ( is_array( $qv['post_status'] ) ) {\n\t\t\t\t$qv['post_status'] = array_map( 'sanitize_key', $qv['post_status'] );\n\t\t\t} else {\n\t\t\t\t$qv['post_status'] = preg_replace( '|[^a-z0-9_,-]|', '', $qv['post_status'] );\n\t\t\t}\n\t\t}",
"\t\tif ( $this->is_posts_page && ( ! isset( $qv['withcomments'] ) || ! $qv['withcomments'] ) ) {\n\t\t\t$this->is_comment_feed = false;\n\t\t}",
"\t\t$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;\n\t\t// Done correcting is_* for page_on_front and page_for_posts",
"\t\tif ( '404' == $qv['error'] ) {\n\t\t\t$this->set_404();\n\t\t}",
"\t\t$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );",
"\t\t$this->query_vars_hash = md5( serialize( $this->query_vars ) );\n\t\t$this->query_vars_changed = false;",
"\t\t/**\n\t\t * Fires after the main query vars have been parsed.\n\t\t *\n\t\t * @since 1.5.0\n\t\t *\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'parse_query', array( &$this ) );\n\t}",
"\t/**\n\t * Parses various taxonomy related query vars.\n\t *\n\t * For BC, this method is not marked as protected. See [28987].\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param array $q The query variables. Passed by reference.\n\t */\n\tpublic function parse_tax_query( &$q ) {\n\t\tif ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {\n\t\t\t$tax_query = $q['tax_query'];\n\t\t} else {\n\t\t\t$tax_query = array();\n\t\t}",
"\t\tif ( ! empty( $q['taxonomy'] ) && ! empty( $q['term'] ) ) {\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => $q['taxonomy'],\n\t\t\t\t'terms' => array( $q['term'] ),\n\t\t\t\t'field' => 'slug',\n\t\t\t);\n\t\t}",
"\t\tforeach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) {\n\t\t\tif ( 'post_tag' == $taxonomy ) {\n\t\t\t\tcontinue; // Handled further down in the $q['tag'] block\n\t\t\t}",
"\t\t\tif ( $t->query_var && ! empty( $q[ $t->query_var ] ) ) {\n\t\t\t\t$tax_query_defaults = array(\n\t\t\t\t\t'taxonomy' => $taxonomy,\n\t\t\t\t\t'field' => 'slug',\n\t\t\t\t);",
"\t\t\t\tif ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {\n\t\t\t\t\t$q[ $t->query_var ] = wp_basename( $q[ $t->query_var ] );\n\t\t\t\t}",
"\t\t\t\t$term = $q[ $t->query_var ];",
"\t\t\t\tif ( is_array( $term ) ) {\n\t\t\t\t\t$term = implode( ',', $term );\n\t\t\t\t}",
"\t\t\t\tif ( strpos( $term, '+' ) !== false ) {\n\t\t\t\t\t$terms = preg_split( '/[+]+/', $term );\n\t\t\t\t\tforeach ( $terms as $term ) {\n\t\t\t\t\t\t$tax_query[] = array_merge(\n\t\t\t\t\t\t\t$tax_query_defaults,\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'terms' => array( $term ),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$tax_query[] = array_merge(\n\t\t\t\t\t\t$tax_query_defaults,\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'terms' => preg_split( '/[,]+/', $term ),\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// If querystring 'cat' is an array, implode it.\n\t\tif ( is_array( $q['cat'] ) ) {\n\t\t\t$q['cat'] = implode( ',', $q['cat'] );\n\t\t}",
"\t\t// Category stuff\n\t\tif ( ! empty( $q['cat'] ) && ! $this->is_singular ) {\n\t\t\t$cat_in = $cat_not_in = array();",
"\t\t\t$cat_array = preg_split( '/[,\\s]+/', urldecode( $q['cat'] ) );\n\t\t\t$cat_array = array_map( 'intval', $cat_array );\n\t\t\t$q['cat'] = implode( ',', $cat_array );",
"\t\t\tforeach ( $cat_array as $cat ) {\n\t\t\t\tif ( $cat > 0 ) {\n\t\t\t\t\t$cat_in[] = $cat;\n\t\t\t\t} elseif ( $cat < 0 ) {\n\t\t\t\t\t$cat_not_in[] = abs( $cat );\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( ! empty( $cat_in ) ) {\n\t\t\t\t$tax_query[] = array(\n\t\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t\t'terms' => $cat_in,\n\t\t\t\t\t'field' => 'term_id',\n\t\t\t\t\t'include_children' => true,\n\t\t\t\t);\n\t\t\t}",
"\t\t\tif ( ! empty( $cat_not_in ) ) {\n\t\t\t\t$tax_query[] = array(\n\t\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t\t'terms' => $cat_not_in,\n\t\t\t\t\t'field' => 'term_id',\n\t\t\t\t\t'operator' => 'NOT IN',\n\t\t\t\t\t'include_children' => true,\n\t\t\t\t);\n\t\t\t}\n\t\t\tunset( $cat_array, $cat_in, $cat_not_in );\n\t\t}",
"\t\tif ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {\n\t\t\t$q['category__and'] = (array) $q['category__and'];\n\t\t\tif ( ! isset( $q['category__in'] ) ) {\n\t\t\t\t$q['category__in'] = array();\n\t\t\t}\n\t\t\t$q['category__in'][] = absint( reset( $q['category__and'] ) );\n\t\t\tunset( $q['category__and'] );\n\t\t}",
"\t\tif ( ! empty( $q['category__in'] ) ) {\n\t\t\t$q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t'terms' => $q['category__in'],\n\t\t\t\t'field' => 'term_id',\n\t\t\t\t'include_children' => false,\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['category__not_in'] ) ) {\n\t\t\t$q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t'terms' => $q['category__not_in'],\n\t\t\t\t'operator' => 'NOT IN',\n\t\t\t\t'include_children' => false,\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['category__and'] ) ) {\n\t\t\t$q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t'terms' => $q['category__and'],\n\t\t\t\t'field' => 'term_id',\n\t\t\t\t'operator' => 'AND',\n\t\t\t\t'include_children' => false,\n\t\t\t);\n\t\t}",
"\t\t// If querystring 'tag' is array, implode it.\n\t\tif ( is_array( $q['tag'] ) ) {\n\t\t\t$q['tag'] = implode( ',', $q['tag'] );\n\t\t}",
"\t\t// Tag stuff\n\t\tif ( '' != $q['tag'] && ! $this->is_singular && $this->query_vars_changed ) {\n\t\t\tif ( strpos( $q['tag'], ',' ) !== false ) {\n\t\t\t\t$tags = preg_split( '/[,\\r\\n\\t ]+/', $q['tag'] );\n\t\t\t\tforeach ( (array) $tags as $tag ) {\n\t\t\t\t\t$tag = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );\n\t\t\t\t\t$q['tag_slug__in'][] = $tag;\n\t\t\t\t}\n\t\t\t} elseif ( preg_match( '/[+\\r\\n\\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) {\n\t\t\t\t$tags = preg_split( '/[+\\r\\n\\t ]+/', $q['tag'] );\n\t\t\t\tforeach ( (array) $tags as $tag ) {\n\t\t\t\t\t$tag = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );\n\t\t\t\t\t$q['tag_slug__and'][] = $tag;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$q['tag'] = sanitize_term_field( 'slug', $q['tag'], 0, 'post_tag', 'db' );\n\t\t\t\t$q['tag_slug__in'][] = $q['tag'];\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $q['tag_id'] ) ) {\n\t\t\t$q['tag_id'] = absint( $q['tag_id'] );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag_id'],\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag__in'] ) ) {\n\t\t\t$q['tag__in'] = array_map( 'absint', array_unique( (array) $q['tag__in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag__in'],\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag__not_in'] ) ) {\n\t\t\t$q['tag__not_in'] = array_map( 'absint', array_unique( (array) $q['tag__not_in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag__not_in'],\n\t\t\t\t'operator' => 'NOT IN',\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag__and'] ) ) {\n\t\t\t$q['tag__and'] = array_map( 'absint', array_unique( (array) $q['tag__and'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag__and'],\n\t\t\t\t'operator' => 'AND',\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag_slug__in'] ) ) {\n\t\t\t$q['tag_slug__in'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag_slug__in'],\n\t\t\t\t'field' => 'slug',\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag_slug__and'] ) ) {\n\t\t\t$q['tag_slug__and'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag_slug__and'],\n\t\t\t\t'field' => 'slug',\n\t\t\t\t'operator' => 'AND',\n\t\t\t);\n\t\t}",
"\t\t$this->tax_query = new WP_Tax_Query( $tax_query );",
"\t\t/**\n\t\t * Fires after taxonomy-related query vars have been parsed.\n\t\t *\n\t\t * @since 3.7.0\n\t\t *\n\t\t * @param WP_Query $this The WP_Query instance.\n\t\t */\n\t\tdo_action( 'parse_tax_query', $this );\n\t}",
"\t/**\n\t * Generates SQL for the WHERE clause based on passed search terms.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @global wpdb $wpdb WordPress database abstraction object.\n\t *\n\t * @param array $q Query variables.\n\t * @return string WHERE clause.\n\t */\n\tprotected function parse_search( &$q ) {\n\t\tglobal $wpdb;",
"\t\t$search = '';",
"\t\t// added slashes screw with quote grouping when done early, so done later\n\t\t$q['s'] = stripslashes( $q['s'] );\n\t\tif ( empty( $_GET['s'] ) && $this->is_main_query() ) {\n\t\t\t$q['s'] = urldecode( $q['s'] );\n\t\t}\n\t\t// there are no line breaks in <input /> fields\n\t\t$q['s'] = str_replace( array( \"\\r\", \"\\n\" ), '', $q['s'] );\n\t\t$q['search_terms_count'] = 1;\n\t\tif ( ! empty( $q['sentence'] ) ) {\n\t\t\t$q['search_terms'] = array( $q['s'] );\n\t\t} else {\n\t\t\tif ( preg_match_all( '/\".*?(\"|$)|((?<=[\\t \",+])|^)[^\\t \",+]+/', $q['s'], $matches ) ) {\n\t\t\t\t$q['search_terms_count'] = count( $matches[0] );\n\t\t\t\t$q['search_terms'] = $this->parse_search_terms( $matches[0] );\n\t\t\t\t// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence\n\t\t\t\tif ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) {\n\t\t\t\t\t$q['search_terms'] = array( $q['s'] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$q['search_terms'] = array( $q['s'] );\n\t\t\t}\n\t\t}",
"\t\t$n = ! empty( $q['exact'] ) ? '' : '%';\n\t\t$searchand = '';\n\t\t$q['search_orderby_title'] = array();",
"\t\t/**\n\t\t * Filters the prefix that indicates that a search term should be excluded from results.\n\t\t *\n\t\t * @since 4.7.0\n\t\t *\n\t\t * @param string $exclusion_prefix The prefix. Default '-'. Returning\n\t\t * an empty value disables exclusions.\n\t\t */\n\t\t$exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' );",
"\t\tforeach ( $q['search_terms'] as $term ) {\n\t\t\t// If there is an $exclusion_prefix, terms prefixed with it should be excluded.\n\t\t\t$exclude = $exclusion_prefix && ( $exclusion_prefix === substr( $term, 0, 1 ) );\n\t\t\tif ( $exclude ) {\n\t\t\t\t$like_op = 'NOT LIKE';\n\t\t\t\t$andor_op = 'AND';\n\t\t\t\t$term = substr( $term, 1 );\n\t\t\t} else {\n\t\t\t\t$like_op = 'LIKE';\n\t\t\t\t$andor_op = 'OR';\n\t\t\t}",
"\t\t\tif ( $n && ! $exclude ) {\n\t\t\t\t$like = '%' . $wpdb->esc_like( $term ) . '%';\n\t\t\t\t$q['search_orderby_title'][] = $wpdb->prepare( \"{$wpdb->posts}.post_title LIKE %s\", $like );\n\t\t\t}",
"\t\t\t$like = $n . $wpdb->esc_like( $term ) . $n;\n\t\t\t$search .= $wpdb->prepare( \"{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))\", $like, $like, $like );\n\t\t\t$searchand = ' AND ';\n\t\t}",
"\t\tif ( ! empty( $search ) ) {\n\t\t\t$search = \" AND ({$search}) \";\n\t\t\tif ( ! is_user_logged_in() ) {\n\t\t\t\t$search .= \" AND ({$wpdb->posts}.post_password = '') \";\n\t\t\t}\n\t\t}",
"\t\treturn $search;\n\t}",
"\t/**\n\t * Check if the terms are suitable for searching.\n\t *\n\t * Uses an array of stopwords (terms) that are excluded from the separate\n\t * term matching when searching for posts. The list of English stopwords is\n\t * the approximate search engines list, and is translatable.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param string[] $terms Array of terms to check.\n\t * @return array Terms that are not stopwords.\n\t */\n\tprotected function parse_search_terms( $terms ) {\n\t\t$strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower';\n\t\t$checked = array();",
"\t\t$stopwords = $this->get_search_stopwords();",
"\t\tforeach ( $terms as $term ) {\n\t\t\t// keep before/after spaces when term is for exact match\n\t\t\tif ( preg_match( '/^\".+\"$/', $term ) ) {\n\t\t\t\t$term = trim( $term, \"\\\"'\" );\n\t\t\t} else {\n\t\t\t\t$term = trim( $term, \"\\\"' \" );\n\t\t\t}",
"\t\t\t// Avoid single A-Z and single dashes.\n\t\t\tif ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\\-]$/i', $term ) ) ) {\n\t\t\t\tcontinue;\n\t\t\t}",
"\t\t\tif ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) {\n\t\t\t\tcontinue;\n\t\t\t}",
"\t\t\t$checked[] = $term;\n\t\t}",
"\t\treturn $checked;\n\t}",
"\t/**\n\t * Retrieve stopwords used when parsing search terms.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return array Stopwords.\n\t */\n\tprotected function get_search_stopwords() {\n\t\tif ( isset( $this->stopwords ) ) {\n\t\t\treturn $this->stopwords;\n\t\t}",
"\t\t/* translators: This is a comma-separated list of very common words that should be excluded from a search,\n\t\t * like a, an, and the. These are usually called \"stopwords\". You should not simply translate these individual\n\t\t * words into your language. Instead, look for and provide commonly accepted stopwords in your language.\n\t\t */\n\t\t$words = explode(\n\t\t\t',',\n\t\t\t_x(\n\t\t\t\t'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',\n\t\t\t\t'Comma-separated list of search stopwords in your language'\n\t\t\t)\n\t\t);",
"\t\t$stopwords = array();\n\t\tforeach ( $words as $word ) {\n\t\t\t$word = trim( $word, \"\\r\\n\\t \" );\n\t\t\tif ( $word ) {\n\t\t\t\t$stopwords[] = $word;\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters stopwords used when parsing search terms.\n\t\t *\n\t\t * @since 3.7.0\n\t\t *\n\t\t * @param string[] $stopwords Array of stopwords.\n\t\t */\n\t\t$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );\n\t\treturn $this->stopwords;\n\t}",
"\t/**\n\t * Generates SQL for the ORDER BY condition based on passed search terms.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @global wpdb $wpdb WordPress database abstraction object.\n\t *\n\t * @param array $q Query variables.\n\t * @return string ORDER BY clause.\n\t */\n\tprotected function parse_search_order( &$q ) {\n\t\tglobal $wpdb;",
"\t\tif ( $q['search_terms_count'] > 1 ) {\n\t\t\t$num_terms = count( $q['search_orderby_title'] );",
"\t\t\t// If the search terms contain negative queries, don't bother ordering by sentence matches.\n\t\t\t$like = '';\n\t\t\tif ( ! preg_match( '/(?:\\s|^)\\-/', $q['s'] ) ) {\n\t\t\t\t$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';\n\t\t\t}",
"\t\t\t$search_orderby = '';",
"\t\t\t// sentence match in 'post_title'\n\t\t\tif ( $like ) {\n\t\t\t\t$search_orderby .= $wpdb->prepare( \"WHEN {$wpdb->posts}.post_title LIKE %s THEN 1 \", $like );\n\t\t\t}",
"\t\t\t// sanity limit, sort as sentence when more than 6 terms\n\t\t\t// (few searches are longer than 6 terms and most titles are not)\n\t\t\tif ( $num_terms < 7 ) {\n\t\t\t\t// all words in title\n\t\t\t\t$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';\n\t\t\t\t// any word in title, not needed when $num_terms == 1\n\t\t\t\tif ( $num_terms > 1 ) {\n\t\t\t\t\t$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// Sentence match in 'post_content' and 'post_excerpt'.\n\t\t\tif ( $like ) {\n\t\t\t\t$search_orderby .= $wpdb->prepare( \"WHEN {$wpdb->posts}.post_excerpt LIKE %s THEN 4 \", $like );\n\t\t\t\t$search_orderby .= $wpdb->prepare( \"WHEN {$wpdb->posts}.post_content LIKE %s THEN 5 \", $like );\n\t\t\t}",
"\t\t\tif ( $search_orderby ) {\n\t\t\t\t$search_orderby = '(CASE ' . $search_orderby . 'ELSE 6 END)';\n\t\t\t}\n\t\t} else {\n\t\t\t// single word or sentence search\n\t\t\t$search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';\n\t\t}",
"\t\treturn $search_orderby;\n\t}",
"\t/**\n\t * Converts the given orderby alias (if allowed) to a properly-prefixed value.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @global wpdb $wpdb WordPress database abstraction object.\n\t *\n\t * @param string $orderby Alias for the field to order by.\n\t * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise.\n\t */\n\tprotected function parse_orderby( $orderby ) {\n\t\tglobal $wpdb;",
"\t\t// Used to filter values.\n\t\t$allowed_keys = array(\n\t\t\t'post_name',\n\t\t\t'post_author',\n\t\t\t'post_date',\n\t\t\t'post_title',\n\t\t\t'post_modified',\n\t\t\t'post_parent',\n\t\t\t'post_type',\n\t\t\t'name',\n\t\t\t'author',\n\t\t\t'date',\n\t\t\t'title',\n\t\t\t'modified',\n\t\t\t'parent',\n\t\t\t'type',\n\t\t\t'ID',\n\t\t\t'menu_order',\n\t\t\t'comment_count',\n\t\t\t'rand',\n\t\t\t'post__in',\n\t\t\t'post_parent__in',\n\t\t\t'post_name__in',\n\t\t);",
"\t\t$primary_meta_key = '';\n\t\t$primary_meta_query = false;\n\t\t$meta_clauses = $this->meta_query->get_clauses();\n\t\tif ( ! empty( $meta_clauses ) ) {\n\t\t\t$primary_meta_query = reset( $meta_clauses );",
"\t\t\tif ( ! empty( $primary_meta_query['key'] ) ) {\n\t\t\t\t$primary_meta_key = $primary_meta_query['key'];\n\t\t\t\t$allowed_keys[] = $primary_meta_key;\n\t\t\t}",
"\t\t\t$allowed_keys[] = 'meta_value';\n\t\t\t$allowed_keys[] = 'meta_value_num';\n\t\t\t$allowed_keys = array_merge( $allowed_keys, array_keys( $meta_clauses ) );\n\t\t}",
"\t\t// If RAND() contains a seed value, sanitize and add to allowed keys.\n\t\t$rand_with_seed = false;\n\t\tif ( preg_match( '/RAND\\(([0-9]+)\\)/i', $orderby, $matches ) ) {\n\t\t\t$orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) );\n\t\t\t$allowed_keys[] = $orderby;\n\t\t\t$rand_with_seed = true;\n\t\t}",
"\t\tif ( ! in_array( $orderby, $allowed_keys, true ) ) {\n\t\t\treturn false;\n\t\t}",
"\t\t$orderby_clause = '';",
"\t\tswitch ( $orderby ) {\n\t\t\tcase 'post_name':\n\t\t\tcase 'post_author':\n\t\t\tcase 'post_date':\n\t\t\tcase 'post_title':\n\t\t\tcase 'post_modified':\n\t\t\tcase 'post_parent':\n\t\t\tcase 'post_type':\n\t\t\tcase 'ID':\n\t\t\tcase 'menu_order':\n\t\t\tcase 'comment_count':\n\t\t\t\t$orderby_clause = \"{$wpdb->posts}.{$orderby}\";\n\t\t\t\tbreak;\n\t\t\tcase 'rand':\n\t\t\t\t$orderby_clause = 'RAND()';\n\t\t\t\tbreak;\n\t\t\tcase $primary_meta_key:\n\t\t\tcase 'meta_value':\n\t\t\t\tif ( ! empty( $primary_meta_query['type'] ) ) {\n\t\t\t\t\t$orderby_clause = \"CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})\";\n\t\t\t\t} else {\n\t\t\t\t\t$orderby_clause = \"{$primary_meta_query['alias']}.meta_value\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'meta_value_num':\n\t\t\t\t$orderby_clause = \"{$primary_meta_query['alias']}.meta_value+0\";\n\t\t\t\tbreak;\n\t\t\tcase 'post__in':\n\t\t\t\tif ( ! empty( $this->query_vars['post__in'] ) ) {\n\t\t\t\t\t$orderby_clause = \"FIELD({$wpdb->posts}.ID,\" . implode( ',', array_map( 'absint', $this->query_vars['post__in'] ) ) . ')';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'post_parent__in':\n\t\t\t\tif ( ! empty( $this->query_vars['post_parent__in'] ) ) {\n\t\t\t\t\t$orderby_clause = \"FIELD( {$wpdb->posts}.post_parent,\" . implode( ', ', array_map( 'absint', $this->query_vars['post_parent__in'] ) ) . ' )';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'post_name__in':\n\t\t\t\tif ( ! empty( $this->query_vars['post_name__in'] ) ) {\n\t\t\t\t\t$post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] );\n\t\t\t\t\t$post_name__in_string = \"'\" . implode( \"','\", $post_name__in ) . \"'\";\n\t\t\t\t\t$orderby_clause = \"FIELD( {$wpdb->posts}.post_name,\" . $post_name__in_string . ' )';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif ( array_key_exists( $orderby, $meta_clauses ) ) {\n\t\t\t\t\t// $orderby corresponds to a meta_query clause.\n\t\t\t\t\t$meta_clause = $meta_clauses[ $orderby ];\n\t\t\t\t\t$orderby_clause = \"CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})\";\n\t\t\t\t} elseif ( $rand_with_seed ) {\n\t\t\t\t\t$orderby_clause = $orderby;\n\t\t\t\t} else {\n\t\t\t\t\t// Default: order by post field.\n\t\t\t\t\t$orderby_clause = \"{$wpdb->posts}.post_\" . sanitize_key( $orderby );\n\t\t\t\t}",
"\t\t\t\tbreak;\n\t\t}",
"\t\treturn $orderby_clause;\n\t}",
"\t/**\n\t * Parse an 'order' query variable and cast it to ASC or DESC as necessary.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $order The 'order' query variable.\n\t * @return string The sanitized 'order' query variable.\n\t */\n\tprotected function parse_order( $order ) {\n\t\tif ( ! is_string( $order ) || empty( $order ) ) {\n\t\t\treturn 'DESC';\n\t\t}",
"\t\tif ( 'ASC' === strtoupper( $order ) ) {\n\t\t\treturn 'ASC';\n\t\t} else {\n\t\t\treturn 'DESC';\n\t\t}\n\t}",
"\t/**\n\t * Sets the 404 property and saves whether query is feed.\n\t *\n\t * @since 2.0.0\n\t */\n\tpublic function set_404() {\n\t\t$is_feed = $this->is_feed;",
"\t\t$this->init_query_flags();\n\t\t$this->is_404 = true;",
"\t\t$this->is_feed = $is_feed;\n\t}",
"\t/**\n\t * Retrieve query variable.\n\t *\n\t * @since 1.5.0\n\t * @since 3.9.0 The `$default` argument was introduced.\n\t *\n\t * @param string $query_var Query variable key.\n\t * @param mixed $default Optional. Value to return if the query variable is not set. Default empty.\n\t * @return mixed Contents of the query variable.\n\t */\n\tpublic function get( $query_var, $default = '' ) {\n\t\tif ( isset( $this->query_vars[ $query_var ] ) ) {\n\t\t\treturn $this->query_vars[ $query_var ];\n\t\t}",
"\t\treturn $default;\n\t}",
"\t/**\n\t * Set query variable.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @param string $query_var Query variable key.\n\t * @param mixed $value Query variable value.\n\t */\n\tpublic function set( $query_var, $value ) {\n\t\t$this->query_vars[ $query_var ] = $value;\n\t}",
"\t/**\n\t * Retrieves an array of posts based on query variables.\n\t *\n\t * There are a few filters and actions that can be used to modify the post\n\t * database query.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return WP_Post[]|int[] Array of post objects or post IDs.\n\t */\n\tpublic function get_posts() {\n\t\tglobal $wpdb;",
"\t\t$this->parse_query();",
"\t\t/**\n\t\t * Fires after the query variable object is created, but before the actual query is run.\n\t\t *\n\t\t * Note: If using conditional tags, use the method versions within the passed instance\n\t\t * (e.g. $this->is_main_query() instead of is_main_query()). This is because the functions\n\t\t * like is_main_query() test against the global $wp_query instance, not the passed one.\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'pre_get_posts', array( &$this ) );",
"\t\t// Shorthand.\n\t\t$q = &$this->query_vars;",
"\t\t// Fill again in case pre_get_posts unset some vars.\n\t\t$q = $this->fill_query_vars( $q );",
"\t\t// Parse meta query\n\t\t$this->meta_query = new WP_Meta_Query();\n\t\t$this->meta_query->parse_query_vars( $q );",
"\t\t// Set a flag if a pre_get_posts hook changed the query vars.\n\t\t$hash = md5( serialize( $this->query_vars ) );\n\t\tif ( $hash != $this->query_vars_hash ) {\n\t\t\t$this->query_vars_changed = true;\n\t\t\t$this->query_vars_hash = $hash;\n\t\t}\n\t\tunset( $hash );",
"\t\t// First let's clear some variables\n\t\t$distinct = '';\n\t\t$whichauthor = '';\n\t\t$whichmimetype = '';\n\t\t$where = '';\n\t\t$limits = '';\n\t\t$join = '';\n\t\t$search = '';\n\t\t$groupby = '';\n\t\t$post_status_join = false;\n\t\t$page = 1;",
"\t\tif ( isset( $q['caller_get_posts'] ) ) {\n\t\t\t_deprecated_argument(\n\t\t\t\t'WP_Query',\n\t\t\t\t'3.1.0',\n\t\t\t\t/* translators: 1: caller_get_posts, 2: ignore_sticky_posts */\n\t\t\t\tsprintf(\n\t\t\t\t\t__( '%1$s is deprecated. Use %2$s instead.' ),\n\t\t\t\t\t'<code>caller_get_posts</code>',\n\t\t\t\t\t'<code>ignore_sticky_posts</code>'\n\t\t\t\t)\n\t\t\t);",
"\t\t\tif ( ! isset( $q['ignore_sticky_posts'] ) ) {\n\t\t\t\t$q['ignore_sticky_posts'] = $q['caller_get_posts'];\n\t\t\t}\n\t\t}",
"\t\tif ( ! isset( $q['ignore_sticky_posts'] ) ) {\n\t\t\t$q['ignore_sticky_posts'] = false;\n\t\t}",
"\t\tif ( ! isset( $q['suppress_filters'] ) ) {\n\t\t\t$q['suppress_filters'] = false;\n\t\t}",
"\t\tif ( ! isset( $q['cache_results'] ) ) {\n\t\t\tif ( wp_using_ext_object_cache() ) {\n\t\t\t\t$q['cache_results'] = false;\n\t\t\t} else {\n\t\t\t\t$q['cache_results'] = true;\n\t\t\t}\n\t\t}",
"\t\tif ( ! isset( $q['update_post_term_cache'] ) ) {\n\t\t\t$q['update_post_term_cache'] = true;\n\t\t}",
"\t\tif ( ! isset( $q['lazy_load_term_meta'] ) ) {\n\t\t\t$q['lazy_load_term_meta'] = $q['update_post_term_cache'];\n\t\t}",
"\t\tif ( ! isset( $q['update_post_meta_cache'] ) ) {\n\t\t\t$q['update_post_meta_cache'] = true;\n\t\t}",
"\t\tif ( ! isset( $q['post_type'] ) ) {\n\t\t\tif ( $this->is_search ) {\n\t\t\t\t$q['post_type'] = 'any';\n\t\t\t} else {\n\t\t\t\t$q['post_type'] = '';\n\t\t\t}\n\t\t}\n\t\t$post_type = $q['post_type'];\n\t\tif ( empty( $q['posts_per_page'] ) ) {\n\t\t\t$q['posts_per_page'] = get_option( 'posts_per_page' );\n\t\t}\n\t\tif ( isset( $q['showposts'] ) && $q['showposts'] ) {\n\t\t\t$q['showposts'] = (int) $q['showposts'];\n\t\t\t$q['posts_per_page'] = $q['showposts'];\n\t\t}\n\t\tif ( ( isset( $q['posts_per_archive_page'] ) && $q['posts_per_archive_page'] != 0 ) && ( $this->is_archive || $this->is_search ) ) {\n\t\t\t$q['posts_per_page'] = $q['posts_per_archive_page'];\n\t\t}\n\t\tif ( ! isset( $q['nopaging'] ) ) {\n\t\t\tif ( $q['posts_per_page'] == -1 ) {\n\t\t\t\t$q['nopaging'] = true;\n\t\t\t} else {\n\t\t\t\t$q['nopaging'] = false;\n\t\t\t}\n\t\t}",
"\t\tif ( $this->is_feed ) {\n\t\t\t// This overrides posts_per_page.\n\t\t\tif ( ! empty( $q['posts_per_rss'] ) ) {\n\t\t\t\t$q['posts_per_page'] = $q['posts_per_rss'];\n\t\t\t} else {\n\t\t\t\t$q['posts_per_page'] = get_option( 'posts_per_rss' );\n\t\t\t}\n\t\t\t$q['nopaging'] = false;\n\t\t}\n\t\t$q['posts_per_page'] = (int) $q['posts_per_page'];\n\t\tif ( $q['posts_per_page'] < -1 ) {\n\t\t\t$q['posts_per_page'] = abs( $q['posts_per_page'] );\n\t\t} elseif ( $q['posts_per_page'] == 0 ) {\n\t\t\t$q['posts_per_page'] = 1;\n\t\t}",
"\t\tif ( ! isset( $q['comments_per_page'] ) || $q['comments_per_page'] == 0 ) {\n\t\t\t$q['comments_per_page'] = get_option( 'comments_per_page' );\n\t\t}",
"\t\tif ( $this->is_home && ( empty( $this->query ) || $q['preview'] == 'true' ) && ( 'page' == get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) {\n\t\t\t$this->is_page = true;\n\t\t\t$this->is_home = false;\n\t\t\t$q['page_id'] = get_option( 'page_on_front' );\n\t\t}",
"\t\tif ( isset( $q['page'] ) ) {\n\t\t\t$q['page'] = trim( $q['page'], '/' );\n\t\t\t$q['page'] = absint( $q['page'] );\n\t\t}",
"\t\t// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.\n\t\tif ( isset( $q['no_found_rows'] ) ) {\n\t\t\t$q['no_found_rows'] = (bool) $q['no_found_rows'];\n\t\t} else {\n\t\t\t$q['no_found_rows'] = false;\n\t\t}",
"\t\tswitch ( $q['fields'] ) {\n\t\t\tcase 'ids':\n\t\t\t\t$fields = \"{$wpdb->posts}.ID\";\n\t\t\t\tbreak;\n\t\t\tcase 'id=>parent':\n\t\t\t\t$fields = \"{$wpdb->posts}.ID, {$wpdb->posts}.post_parent\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$fields = \"{$wpdb->posts}.*\";\n\t\t}",
"\t\tif ( '' !== $q['menu_order'] ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.menu_order = \" . $q['menu_order'];\n\t\t}\n\t\t// The \"m\" parameter is meant for months but accepts datetimes of varying specificity\n\t\tif ( $q['m'] ) {\n\t\t\t$where .= \" AND YEAR({$wpdb->posts}.post_date)=\" . substr( $q['m'], 0, 4 );\n\t\t\tif ( strlen( $q['m'] ) > 5 ) {\n\t\t\t\t$where .= \" AND MONTH({$wpdb->posts}.post_date)=\" . substr( $q['m'], 4, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 7 ) {\n\t\t\t\t$where .= \" AND DAYOFMONTH({$wpdb->posts}.post_date)=\" . substr( $q['m'], 6, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 9 ) {\n\t\t\t\t$where .= \" AND HOUR({$wpdb->posts}.post_date)=\" . substr( $q['m'], 8, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 11 ) {\n\t\t\t\t$where .= \" AND MINUTE({$wpdb->posts}.post_date)=\" . substr( $q['m'], 10, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 13 ) {\n\t\t\t\t$where .= \" AND SECOND({$wpdb->posts}.post_date)=\" . substr( $q['m'], 12, 2 );\n\t\t\t}\n\t\t}",
"\t\t// Handle the other individual date parameters\n\t\t$date_parameters = array();",
"\t\tif ( '' !== $q['hour'] ) {\n\t\t\t$date_parameters['hour'] = $q['hour'];\n\t\t}",
"\t\tif ( '' !== $q['minute'] ) {\n\t\t\t$date_parameters['minute'] = $q['minute'];\n\t\t}",
"\t\tif ( '' !== $q['second'] ) {\n\t\t\t$date_parameters['second'] = $q['second'];\n\t\t}",
"\t\tif ( $q['year'] ) {\n\t\t\t$date_parameters['year'] = $q['year'];\n\t\t}",
"\t\tif ( $q['monthnum'] ) {\n\t\t\t$date_parameters['monthnum'] = $q['monthnum'];\n\t\t}",
"\t\tif ( $q['w'] ) {\n\t\t\t$date_parameters['week'] = $q['w'];\n\t\t}",
"\t\tif ( $q['day'] ) {\n\t\t\t$date_parameters['day'] = $q['day'];\n\t\t}",
"\t\tif ( $date_parameters ) {\n\t\t\t$date_query = new WP_Date_Query( array( $date_parameters ) );\n\t\t\t$where .= $date_query->get_sql();\n\t\t}\n\t\tunset( $date_parameters, $date_query );",
"\t\t// Handle complex date queries\n\t\tif ( ! empty( $q['date_query'] ) ) {\n\t\t\t$this->date_query = new WP_Date_Query( $q['date_query'] );\n\t\t\t$where .= $this->date_query->get_sql();\n\t\t}",
"\t\t// If we've got a post_type AND it's not \"any\" post_type.\n\t\tif ( ! empty( $q['post_type'] ) && 'any' != $q['post_type'] ) {\n\t\t\tforeach ( (array) $q['post_type'] as $_post_type ) {\n\t\t\t\t$ptype_obj = get_post_type_object( $_post_type );\n\t\t\t\tif ( ! $ptype_obj || ! $ptype_obj->query_var || empty( $q[ $ptype_obj->query_var ] ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"\t\t\t\tif ( ! $ptype_obj->hierarchical ) {\n\t\t\t\t\t// Non-hierarchical post types can directly use 'name'.\n\t\t\t\t\t$q['name'] = $q[ $ptype_obj->query_var ];\n\t\t\t\t} else {\n\t\t\t\t\t// Hierarchical post types will operate through 'pagename'.\n\t\t\t\t\t$q['pagename'] = $q[ $ptype_obj->query_var ];\n\t\t\t\t\t$q['name'] = '';\n\t\t\t\t}",
"\t\t\t\t// Only one request for a slug is possible, this is why name & pagename are overwritten above.\n\t\t\t\tbreak;\n\t\t\t} //end foreach\n\t\t\tunset( $ptype_obj );\n\t\t}",
"\t\tif ( '' !== $q['title'] ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_title = %s\", stripslashes( $q['title'] ) );\n\t\t}",
"\t\t// Parameters related to 'post_name'.\n\t\tif ( '' != $q['name'] ) {\n\t\t\t$q['name'] = sanitize_title_for_query( $q['name'] );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_name = '\" . $q['name'] . \"'\";\n\t\t} elseif ( '' != $q['pagename'] ) {\n\t\t\tif ( isset( $this->queried_object_id ) ) {\n\t\t\t\t$reqpage = $this->queried_object_id;\n\t\t\t} else {\n\t\t\t\tif ( 'page' != $q['post_type'] ) {\n\t\t\t\t\tforeach ( (array) $q['post_type'] as $_post_type ) {\n\t\t\t\t\t\t$ptype_obj = get_post_type_object( $_post_type );\n\t\t\t\t\t\tif ( ! $ptype_obj || ! $ptype_obj->hierarchical ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}",
"\t\t\t\t\t\t$reqpage = get_page_by_path( $q['pagename'], OBJECT, $_post_type );\n\t\t\t\t\t\tif ( $reqpage ) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tunset( $ptype_obj );\n\t\t\t\t} else {\n\t\t\t\t\t$reqpage = get_page_by_path( $q['pagename'] );\n\t\t\t\t}\n\t\t\t\tif ( ! empty( $reqpage ) ) {\n\t\t\t\t\t$reqpage = $reqpage->ID;\n\t\t\t\t} else {\n\t\t\t\t\t$reqpage = 0;\n\t\t\t\t}\n\t\t\t}",
"\t\t\t$page_for_posts = get_option( 'page_for_posts' );\n\t\t\tif ( ( 'page' != get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) {\n\t\t\t\t$q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );\n\t\t\t\t$q['name'] = $q['pagename'];\n\t\t\t\t$where .= \" AND ({$wpdb->posts}.ID = '$reqpage')\";\n\t\t\t\t$reqpage_obj = get_post( $reqpage );\n\t\t\t\tif ( is_object( $reqpage_obj ) && 'attachment' == $reqpage_obj->post_type ) {\n\t\t\t\t\t$this->is_attachment = true;\n\t\t\t\t\t$post_type = $q['post_type'] = 'attachment';\n\t\t\t\t\t$this->is_page = true;\n\t\t\t\t\t$q['attachment_id'] = $reqpage;\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif ( '' != $q['attachment'] ) {\n\t\t\t$q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) );\n\t\t\t$q['name'] = $q['attachment'];\n\t\t\t$where .= \" AND {$wpdb->posts}.post_name = '\" . $q['attachment'] . \"'\";\n\t\t} elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) {\n\t\t\t$q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] );\n\t\t\t$post_name__in = \"'\" . implode( \"','\", $q['post_name__in'] ) . \"'\";\n\t\t\t$where .= \" AND {$wpdb->posts}.post_name IN ($post_name__in)\";\n\t\t}",
"\t\t// If an attachment is requested by number, let it supersede any post number.\n\t\tif ( $q['attachment_id'] ) {\n\t\t\t$q['p'] = absint( $q['attachment_id'] );\n\t\t}",
"\t\t// If a post number is specified, load that post\n\t\tif ( $q['p'] ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.ID = \" . $q['p'];\n\t\t} elseif ( $q['post__in'] ) {\n\t\t\t$post__in = implode( ',', array_map( 'absint', $q['post__in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.ID IN ($post__in)\";\n\t\t} elseif ( $q['post__not_in'] ) {\n\t\t\t$post__not_in = implode( ',', array_map( 'absint', $q['post__not_in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.ID NOT IN ($post__not_in)\";\n\t\t}",
"\t\tif ( is_numeric( $q['post_parent'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_parent = %d \", $q['post_parent'] );\n\t\t} elseif ( $q['post_parent__in'] ) {\n\t\t\t$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_parent IN ($post_parent__in)\";\n\t\t} elseif ( $q['post_parent__not_in'] ) {\n\t\t\t$post_parent__not_in = implode( ',', array_map( 'absint', $q['post_parent__not_in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)\";\n\t\t}",
"\t\tif ( $q['page_id'] ) {\n\t\t\tif ( ( 'page' != get_option( 'show_on_front' ) ) || ( $q['page_id'] != get_option( 'page_for_posts' ) ) ) {\n\t\t\t\t$q['p'] = $q['page_id'];\n\t\t\t\t$where = \" AND {$wpdb->posts}.ID = \" . $q['page_id'];\n\t\t\t}\n\t\t}",
"\t\t// If a search pattern is specified, load the posts that match.\n\t\tif ( strlen( $q['s'] ) ) {\n\t\t\t$search = $this->parse_search( $q );\n\t\t}",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the search SQL that is used in the WHERE clause of WP_Query.\n\t\t\t *\n\t\t\t * @since 3.0.0\n\t\t\t *\n\t\t\t * @param string $search Search SQL for WHERE clause.\n\t\t\t * @param WP_Query $this The current WP_Query object.\n\t\t\t */\n\t\t\t$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );\n\t\t}",
"\t\t// Taxonomies\n\t\tif ( ! $this->is_singular ) {\n\t\t\t$this->parse_tax_query( $q );",
"\t\t\t$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );",
"\t\t\t$join .= $clauses['join'];\n\t\t\t$where .= $clauses['where'];\n\t\t}",
"\t\tif ( $this->is_tax ) {\n\t\t\tif ( empty( $post_type ) ) {\n\t\t\t\t// Do a fully inclusive search for currently registered post types of queried taxonomies\n\t\t\t\t$post_type = array();\n\t\t\t\t$taxonomies = array_keys( $this->tax_query->queried_terms );\n\t\t\t\tforeach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {\n\t\t\t\t\t$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );\n\t\t\t\t\tif ( array_intersect( $taxonomies, $object_taxonomies ) ) {\n\t\t\t\t\t\t$post_type[] = $pt;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( ! $post_type ) {\n\t\t\t\t\t$post_type = 'any';\n\t\t\t\t} elseif ( count( $post_type ) == 1 ) {\n\t\t\t\t\t$post_type = $post_type[0];\n\t\t\t\t}",
"\t\t\t\t$post_status_join = true;\n\t\t\t} elseif ( in_array( 'attachment', (array) $post_type ) ) {\n\t\t\t\t$post_status_join = true;\n\t\t\t}\n\t\t}",
"\t\t/*\n\t\t * Ensure that 'taxonomy', 'term', 'term_id', 'cat', and\n\t\t * 'category_name' vars are set for backward compatibility.\n\t\t */\n\t\tif ( ! empty( $this->tax_query->queried_terms ) ) {",
"\t\t\t/*\n\t\t\t * Set 'taxonomy', 'term', and 'term_id' to the\n\t\t\t * first taxonomy other than 'post_tag' or 'category'.\n\t\t\t */\n\t\t\tif ( ! isset( $q['taxonomy'] ) ) {\n\t\t\t\tforeach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {\n\t\t\t\t\tif ( empty( $queried_items['terms'][0] ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}",
"\t\t\t\t\tif ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {\n\t\t\t\t\t\t$q['taxonomy'] = $queried_taxonomy;",
"\t\t\t\t\t\tif ( 'slug' === $queried_items['field'] ) {\n\t\t\t\t\t\t\t$q['term'] = $queried_items['terms'][0];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$q['term_id'] = $queried_items['terms'][0];\n\t\t\t\t\t\t}",
"\t\t\t\t\t\t// Take the first one we find.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// 'cat', 'category_name', 'tag_id'\n\t\t\tforeach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {\n\t\t\t\tif ( empty( $queried_items['terms'][0] ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"\t\t\t\tif ( 'category' === $queried_taxonomy ) {\n\t\t\t\t\t$the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' );\n\t\t\t\t\tif ( $the_cat ) {\n\t\t\t\t\t\t$this->set( 'cat', $the_cat->term_id );\n\t\t\t\t\t\t$this->set( 'category_name', $the_cat->slug );\n\t\t\t\t\t}\n\t\t\t\t\tunset( $the_cat );\n\t\t\t\t}",
"\t\t\t\tif ( 'post_tag' === $queried_taxonomy ) {\n\t\t\t\t\t$the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' );\n\t\t\t\t\tif ( $the_tag ) {\n\t\t\t\t\t\t$this->set( 'tag_id', $the_tag->term_id );\n\t\t\t\t\t}\n\t\t\t\t\tunset( $the_tag );\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) ) {\n\t\t\t$groupby = \"{$wpdb->posts}.ID\";\n\t\t}",
"\t\t// Author/user stuff",
"\t\tif ( ! empty( $q['author'] ) && $q['author'] != '0' ) {\n\t\t\t$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );\n\t\t\t$authors = array_unique( array_map( 'intval', preg_split( '/[,\\s]+/', $q['author'] ) ) );\n\t\t\tforeach ( $authors as $author ) {\n\t\t\t\t$key = $author > 0 ? 'author__in' : 'author__not_in';\n\t\t\t\t$q[ $key ][] = abs( $author );\n\t\t\t}\n\t\t\t$q['author'] = implode( ',', $authors );\n\t\t}",
"\t\tif ( ! empty( $q['author__not_in'] ) ) {\n\t\t\t$author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_author NOT IN ($author__not_in) \";\n\t\t} elseif ( ! empty( $q['author__in'] ) ) {\n\t\t\t$author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_author IN ($author__in) \";\n\t\t}",
"\t\t// Author stuff for nice URLs",
"\t\tif ( '' != $q['author_name'] ) {\n\t\t\tif ( strpos( $q['author_name'], '/' ) !== false ) {\n\t\t\t\t$q['author_name'] = explode( '/', $q['author_name'] );\n\t\t\t\tif ( $q['author_name'][ count( $q['author_name'] ) - 1 ] ) {\n\t\t\t\t\t$q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 1 ]; // no trailing slash\n\t\t\t\t} else {\n\t\t\t\t\t$q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 2 ]; // there was a trailing slash\n\t\t\t\t}\n\t\t\t}\n\t\t\t$q['author_name'] = sanitize_title_for_query( $q['author_name'] );\n\t\t\t$q['author'] = get_user_by( 'slug', $q['author_name'] );\n\t\t\tif ( $q['author'] ) {\n\t\t\t\t$q['author'] = $q['author']->ID;\n\t\t\t}\n\t\t\t$whichauthor .= \" AND ({$wpdb->posts}.post_author = \" . absint( $q['author'] ) . ')';\n\t\t}",
"\t\t// Matching by comment count.\n\t\tif ( isset( $q['comment_count'] ) ) {\n\t\t\t// Numeric comment count is converted to array format.\n\t\t\tif ( is_numeric( $q['comment_count'] ) ) {\n\t\t\t\t$q['comment_count'] = array(\n\t\t\t\t\t'value' => intval( $q['comment_count'] ),\n\t\t\t\t);\n\t\t\t}",
"\t\t\tif ( isset( $q['comment_count']['value'] ) ) {\n\t\t\t\t$q['comment_count'] = array_merge(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'compare' => '=',\n\t\t\t\t\t),\n\t\t\t\t\t$q['comment_count']\n\t\t\t\t);",
"\t\t\t\t// Fallback for invalid compare operators is '='.\n\t\t\t\t$compare_operators = array( '=', '!=', '>', '>=', '<', '<=' );\n\t\t\t\tif ( ! in_array( $q['comment_count']['compare'], $compare_operators, true ) ) {\n\t\t\t\t\t$q['comment_count']['compare'] = '=';\n\t\t\t\t}",
"\t\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.comment_count {$q['comment_count']['compare']} %d\", $q['comment_count']['value'] );\n\t\t\t}\n\t\t}",
"\t\t// MIME-Type stuff for attachment browsing",
"\t\tif ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] ) {\n\t\t\t$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );\n\t\t}\n\t\t$where .= $search . $whichauthor . $whichmimetype;",
"\t\tif ( ! empty( $this->meta_query->queries ) ) {\n\t\t\t$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );\n\t\t\t$join .= $clauses['join'];\n\t\t\t$where .= $clauses['where'];\n\t\t}",
"\t\t$rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );\n\t\tif ( ! isset( $q['order'] ) ) {\n\t\t\t$q['order'] = $rand ? '' : 'DESC';\n\t\t} else {\n\t\t\t$q['order'] = $rand ? '' : $this->parse_order( $q['order'] );\n\t\t}",
"\t\t// These values of orderby should ignore the 'order' parameter.\n\t\t$force_asc = array( 'post__in', 'post_name__in', 'post_parent__in' );\n\t\tif ( isset( $q['orderby'] ) && in_array( $q['orderby'], $force_asc, true ) ) {\n\t\t\t$q['order'] = '';\n\t\t}",
"\t\t// Order by.\n\t\tif ( empty( $q['orderby'] ) ) {\n\t\t\t/*\n\t\t\t * Boolean false or empty array blanks out ORDER BY,\n\t\t\t * while leaving the value unset or otherwise empty sets the default.\n\t\t\t */\n\t\t\tif ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {\n\t\t\t\t$orderby = '';\n\t\t\t} else {\n\t\t\t\t$orderby = \"{$wpdb->posts}.post_date \" . $q['order'];\n\t\t\t}\n\t\t} elseif ( 'none' == $q['orderby'] ) {\n\t\t\t$orderby = '';\n\t\t} else {\n\t\t\t$orderby_array = array();\n\t\t\tif ( is_array( $q['orderby'] ) ) {\n\t\t\t\tforeach ( $q['orderby'] as $_orderby => $order ) {\n\t\t\t\t\t$orderby = addslashes_gpc( urldecode( $_orderby ) );\n\t\t\t\t\t$parsed = $this->parse_orderby( $orderby );",
"\t\t\t\t\tif ( ! $parsed ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}",
"\t\t\t\t\t$orderby_array[] = $parsed . ' ' . $this->parse_order( $order );\n\t\t\t\t}\n\t\t\t\t$orderby = implode( ', ', $orderby_array );",
"\t\t\t} else {\n\t\t\t\t$q['orderby'] = urldecode( $q['orderby'] );\n\t\t\t\t$q['orderby'] = addslashes_gpc( $q['orderby'] );",
"\t\t\t\tforeach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {\n\t\t\t\t\t$parsed = $this->parse_orderby( $orderby );\n\t\t\t\t\t// Only allow certain values for safety.\n\t\t\t\t\tif ( ! $parsed ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}",
"\t\t\t\t\t$orderby_array[] = $parsed;\n\t\t\t\t}\n\t\t\t\t$orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );",
"\t\t\t\tif ( empty( $orderby ) ) {\n\t\t\t\t\t$orderby = \"{$wpdb->posts}.post_date \" . $q['order'];\n\t\t\t\t} elseif ( ! empty( $q['order'] ) ) {\n\t\t\t\t\t$orderby .= \" {$q['order']}\";\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// Order search results by relevance only when another \"orderby\" is not specified in the query.\n\t\tif ( ! empty( $q['s'] ) ) {\n\t\t\t$search_orderby = '';\n\t\t\tif ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) {\n\t\t\t\t$search_orderby = $this->parse_search_order( $q );\n\t\t\t}",
"\t\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t\t/**\n\t\t\t\t * Filters the ORDER BY used when ordering search results.\n\t\t\t\t *\n\t\t\t\t * @since 3.7.0\n\t\t\t\t *\n\t\t\t\t * @param string $search_orderby The ORDER BY clause.\n\t\t\t\t * @param WP_Query $this The current WP_Query instance.\n\t\t\t\t */\n\t\t\t\t$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );\n\t\t\t}",
"\t\t\tif ( $search_orderby ) {\n\t\t\t\t$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;\n\t\t\t}\n\t\t}",
"\t\tif ( is_array( $post_type ) && count( $post_type ) > 1 ) {\n\t\t\t$post_type_cap = 'multiple_post_type';\n\t\t} else {\n\t\t\tif ( is_array( $post_type ) ) {\n\t\t\t\t$post_type = reset( $post_type );\n\t\t\t}\n\t\t\t$post_type_object = get_post_type_object( $post_type );\n\t\t\tif ( empty( $post_type_object ) ) {\n\t\t\t\t$post_type_cap = $post_type;\n\t\t\t}\n\t\t}",
"\t\tif ( isset( $q['post_password'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_password = %s\", $q['post_password'] );\n\t\t\tif ( empty( $q['perm'] ) ) {\n\t\t\t\t$q['perm'] = 'readable';\n\t\t\t}\n\t\t} elseif ( isset( $q['has_password'] ) ) {\n\t\t\t$where .= sprintf( \" AND {$wpdb->posts}.post_password %s ''\", $q['has_password'] ? '!=' : '=' );\n\t\t}",
"\t\tif ( ! empty( $q['comment_status'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.comment_status = %s \", $q['comment_status'] );\n\t\t}",
"\t\tif ( ! empty( $q['ping_status'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.ping_status = %s \", $q['ping_status'] );\n\t\t}",
"\t\tif ( 'any' == $post_type ) {\n\t\t\t$in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) );\n\t\t\tif ( empty( $in_search_post_types ) ) {\n\t\t\t\t$where .= ' AND 1=0 ';\n\t\t\t} else {\n\t\t\t\t$where .= \" AND {$wpdb->posts}.post_type IN ('\" . join( \"', '\", array_map( 'esc_sql', $in_search_post_types ) ) . \"')\";\n\t\t\t}\n\t\t} elseif ( ! empty( $post_type ) && is_array( $post_type ) ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type IN ('\" . join( \"', '\", esc_sql( $post_type ) ) . \"')\";\n\t\t} elseif ( ! empty( $post_type ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_type = %s\", $post_type );\n\t\t\t$post_type_object = get_post_type_object( $post_type );\n\t\t} elseif ( $this->is_attachment ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type = 'attachment'\";\n\t\t\t$post_type_object = get_post_type_object( 'attachment' );\n\t\t} elseif ( $this->is_page ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type = 'page'\";\n\t\t\t$post_type_object = get_post_type_object( 'page' );\n\t\t} else {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type = 'post'\";\n\t\t\t$post_type_object = get_post_type_object( 'post' );\n\t\t}",
"\t\t$edit_cap = 'edit_post';\n\t\t$read_cap = 'read_post';",
"\t\tif ( ! empty( $post_type_object ) ) {\n\t\t\t$edit_others_cap = $post_type_object->cap->edit_others_posts;\n\t\t\t$read_private_cap = $post_type_object->cap->read_private_posts;\n\t\t} else {\n\t\t\t$edit_others_cap = 'edit_others_' . $post_type_cap . 's';\n\t\t\t$read_private_cap = 'read_private_' . $post_type_cap . 's';\n\t\t}",
"\t\t$user_id = get_current_user_id();",
"\t\t$q_status = array();\n\t\tif ( ! empty( $q['post_status'] ) ) {\n\t\t\t$statuswheres = array();\n\t\t\t$q_status = $q['post_status'];\n\t\t\tif ( ! is_array( $q_status ) ) {\n\t\t\t\t$q_status = explode( ',', $q_status );\n\t\t\t}\n\t\t\t$r_status = array();\n\t\t\t$p_status = array();\n\t\t\t$e_status = array();\n\t\t\tif ( in_array( 'any', $q_status ) ) {\n\t\t\t\tforeach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {\n\t\t\t\t\tif ( ! in_array( $status, $q_status ) ) {\n\t\t\t\t\t\t$e_status[] = \"{$wpdb->posts}.post_status <> '$status'\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tforeach ( get_post_stati() as $status ) {\n\t\t\t\t\tif ( in_array( $status, $q_status ) ) {\n\t\t\t\t\t\tif ( 'private' == $status ) {\n\t\t\t\t\t\t\t$p_status[] = \"{$wpdb->posts}.post_status = '$status'\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$r_status[] = \"{$wpdb->posts}.post_status = '$status'\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( empty( $q['perm'] ) || 'readable' != $q['perm'] ) {\n\t\t\t\t$r_status = array_merge( $r_status, $p_status );\n\t\t\t\tunset( $p_status );\n\t\t\t}",
"\t\t\tif ( ! empty( $e_status ) ) {\n\t\t\t\t$statuswheres[] = '(' . join( ' AND ', $e_status ) . ')';\n\t\t\t}\n\t\t\tif ( ! empty( $r_status ) ) {\n\t\t\t\tif ( ! empty( $q['perm'] ) && 'editable' == $q['perm'] && ! current_user_can( $edit_others_cap ) ) {\n\t\t\t\t\t$statuswheres[] = \"({$wpdb->posts}.post_author = $user_id \" . 'AND (' . join( ' OR ', $r_status ) . '))';\n\t\t\t\t} else {\n\t\t\t\t\t$statuswheres[] = '(' . join( ' OR ', $r_status ) . ')';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( ! empty( $p_status ) ) {\n\t\t\t\tif ( ! empty( $q['perm'] ) && 'readable' == $q['perm'] && ! current_user_can( $read_private_cap ) ) {\n\t\t\t\t\t$statuswheres[] = \"({$wpdb->posts}.post_author = $user_id \" . 'AND (' . join( ' OR ', $p_status ) . '))';\n\t\t\t\t} else {\n\t\t\t\t\t$statuswheres[] = '(' . join( ' OR ', $p_status ) . ')';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $post_status_join ) {\n\t\t\t\t$join .= \" LEFT JOIN {$wpdb->posts} AS p2 ON ({$wpdb->posts}.post_parent = p2.ID) \";\n\t\t\t\tforeach ( $statuswheres as $index => $statuswhere ) {\n\t\t\t\t\t$statuswheres[ $index ] = \"($statuswhere OR ({$wpdb->posts}.post_status = 'inherit' AND \" . str_replace( $wpdb->posts, 'p2', $statuswhere ) . '))';\n\t\t\t\t}\n\t\t\t}\n\t\t\t$where_status = implode( ' OR ', $statuswheres );\n\t\t\tif ( ! empty( $where_status ) ) {\n\t\t\t\t$where .= \" AND ($where_status)\";\n\t\t\t}\n\t\t} elseif ( ! $this->is_singular ) {\n\t\t\t$where .= \" AND ({$wpdb->posts}.post_status = 'publish'\";",
"\t\t\t// Add public states.\n\t\t\t$public_states = get_post_stati( array( 'public' => true ) );\n\t\t\tforeach ( (array) $public_states as $state ) {\n\t\t\t\tif ( 'publish' == $state ) { // Publish is hard-coded above.\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$where .= \" OR {$wpdb->posts}.post_status = '$state'\";\n\t\t\t}",
"\t\t\tif ( $this->is_admin ) {\n\t\t\t\t// Add protected states that should show in the admin all list.\n\t\t\t\t$admin_all_states = get_post_stati(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'protected' => true,\n\t\t\t\t\t\t'show_in_admin_all_list' => true,\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tforeach ( (array) $admin_all_states as $state ) {\n\t\t\t\t\t$where .= \" OR {$wpdb->posts}.post_status = '$state'\";\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( is_user_logged_in() ) {\n\t\t\t\t// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.\n\t\t\t\t$private_states = get_post_stati( array( 'private' => true ) );\n\t\t\t\tforeach ( (array) $private_states as $state ) {\n\t\t\t\t\t$where .= current_user_can( $read_private_cap ) ? \" OR {$wpdb->posts}.post_status = '$state'\" : \" OR {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'\";\n\t\t\t\t}\n\t\t\t}",
"\t\t\t$where .= ')';\n\t\t}",
"\t\t/*\n\t\t * Apply filters on where and join prior to paging so that any\n\t\t * manipulations to them are reflected in the paging by day queries.\n\t\t */\n\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the WHERE clause of the query.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $where The WHERE clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the JOIN clause of the query.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $join The JOIN clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );\n\t\t}",
"\t\t// Paging\n\t\tif ( empty( $q['nopaging'] ) && ! $this->is_singular ) {\n\t\t\t$page = absint( $q['paged'] );\n\t\t\tif ( ! $page ) {\n\t\t\t\t$page = 1;\n\t\t\t}",
"\t\t\t// If 'offset' is provided, it takes precedence over 'paged'.\n\t\t\tif ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {\n\t\t\t\t$q['offset'] = absint( $q['offset'] );\n\t\t\t\t$pgstrt = $q['offset'] . ', ';\n\t\t\t} else {\n\t\t\t\t$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';\n\t\t\t}\n\t\t\t$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];\n\t\t}",
"\t\t// Comments feeds\n\t\tif ( $this->is_comment_feed && ! $this->is_singular ) {\n\t\t\tif ( $this->is_archive || $this->is_search ) {\n\t\t\t\t$cjoin = \"JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) $join \";\n\t\t\t\t$cwhere = \"WHERE comment_approved = '1' $where\";\n\t\t\t\t$cgroupby = \"{$wpdb->comments}.comment_id\";\n\t\t\t} else { // Other non singular e.g. front\n\t\t\t\t$cjoin = \"JOIN {$wpdb->posts} ON ( {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID )\";\n\t\t\t\t$cwhere = \"WHERE ( post_status = 'publish' OR ( post_status = 'inherit' AND post_type = 'attachment' ) ) AND comment_approved = '1'\";\n\t\t\t\t$cgroupby = '';\n\t\t\t}",
"\t\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t\t/**\n\t\t\t\t * Filters the JOIN clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.2.0\n\t\t\t\t *\n\t\t\t\t * @param string $cjoin The JOIN clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the WHERE clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.2.0\n\t\t\t\t *\n\t\t\t\t * @param string $cwhere The WHERE clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the GROUP BY clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.2.0\n\t\t\t\t *\n\t\t\t\t * @param string $cgroupby The GROUP BY clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the ORDER BY clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.8.0\n\t\t\t\t *\n\t\t\t\t * @param string $corderby The ORDER BY clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the LIMIT clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.8.0\n\t\t\t\t *\n\t\t\t\t * @param string $climits The JOIN clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );\n\t\t\t}\n\t\t\t$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';\n\t\t\t$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';",
"\t\t\t$comments = (array) $wpdb->get_results( \"SELECT $distinct {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits\" );\n\t\t\t// Convert to WP_Comment\n\t\t\t$this->comments = array_map( 'get_comment', $comments );\n\t\t\t$this->comment_count = count( $this->comments );",
"\t\t\t$post_ids = array();",
"\t\t\tforeach ( $this->comments as $comment ) {\n\t\t\t\t$post_ids[] = (int) $comment->comment_post_ID;\n\t\t\t}",
"\t\t\t$post_ids = join( ',', $post_ids );\n\t\t\t$join = '';\n\t\t\tif ( $post_ids ) {\n\t\t\t\t$where = \"AND {$wpdb->posts}.ID IN ($post_ids) \";\n\t\t\t} else {\n\t\t\t\t$where = 'AND 0';\n\t\t\t}\n\t\t}",
"\t\t$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );",
"\t\t/*\n\t\t * Apply post-paging filters on where and join. Only plugins that\n\t\t * manipulate paging queries should use these hooks.\n\t\t */\n\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the WHERE clause of the query.\n\t\t\t *\n\t\t\t * Specifically for manipulating paging queries.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $where The WHERE clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the GROUP BY clause of the query.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param string $groupby The GROUP BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the JOIN clause of the query.\n\t\t\t *\n\t\t\t * Specifically for manipulating paging queries.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $join The JOIN clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the ORDER BY clause of the query.\n\t\t\t *\n\t\t\t * @since 1.5.1\n\t\t\t *\n\t\t\t * @param string $orderby The ORDER BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the DISTINCT clause of the query.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $distinct The DISTINCT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the LIMIT clause of the query.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $limits The LIMIT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the SELECT clause of the query.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $fields The SELECT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters all query clauses at once, for convenience.\n\t\t\t *\n\t\t\t * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,\n\t\t\t * fields (SELECT), and LIMITS clauses.\n\t\t\t *\n\t\t\t * @since 3.1.0\n\t\t\t *\n\t\t\t * @param string[] $clauses Associative array of the clauses for the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );",
"\t\t\t$where = isset( $clauses['where'] ) ? $clauses['where'] : '';\n\t\t\t$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';\n\t\t\t$join = isset( $clauses['join'] ) ? $clauses['join'] : '';\n\t\t\t$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';\n\t\t\t$distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';\n\t\t\t$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';\n\t\t\t$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';\n\t\t}",
"\t\t/**\n\t\t * Fires to announce the query's current selection parameters.\n\t\t *\n\t\t * For use by caching plugins.\n\t\t *\n\t\t * @since 2.3.0\n\t\t *\n\t\t * @param string $selection The assembled selection query.\n\t\t */\n\t\tdo_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );",
"\t\t/*\n\t\t * Filters again for the benefit of caching plugins.\n\t\t * Regular plugins should use the hooks above.\n\t\t */\n\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the WHERE clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $where The WHERE clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the GROUP BY clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $groupby The GROUP BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the JOIN clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $join The JOIN clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the ORDER BY clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $orderby The ORDER BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the DISTINCT clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $distinct The DISTINCT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the SELECT clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $fields The SELECT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the LIMIT clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $limits The LIMIT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters all query clauses at once, for convenience.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,\n\t\t\t * fields (SELECT), and LIMITS clauses.\n\t\t\t *\n\t\t\t * @since 3.1.0\n\t\t\t *\n\t\t\t * @param string[] $pieces Associative array of the pieces of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );",
"\t\t\t$where = isset( $clauses['where'] ) ? $clauses['where'] : '';\n\t\t\t$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';\n\t\t\t$join = isset( $clauses['join'] ) ? $clauses['join'] : '';\n\t\t\t$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';\n\t\t\t$distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';\n\t\t\t$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';\n\t\t\t$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';\n\t\t}",
"\t\tif ( ! empty( $groupby ) ) {\n\t\t\t$groupby = 'GROUP BY ' . $groupby;\n\t\t}\n\t\tif ( ! empty( $orderby ) ) {\n\t\t\t$orderby = 'ORDER BY ' . $orderby;\n\t\t}",
"\t\t$found_rows = '';\n\t\tif ( ! $q['no_found_rows'] && ! empty( $limits ) ) {\n\t\t\t$found_rows = 'SQL_CALC_FOUND_ROWS';\n\t\t}",
"\t\t$this->request = $old_request = \"SELECT $found_rows $distinct $fields FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits\";",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the completed SQL query before sending.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param string $request The complete SQL query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );\n\t\t}",
"\t\t/**\n\t\t * Filters the posts array before the query takes place.\n\t\t *\n\t\t * Return a non-null value to bypass WordPress's default post queries.\n\t\t *\n\t\t * Filtering functions that require pagination information are encouraged to set\n\t\t * the `found_posts` and `max_num_pages` properties of the WP_Query object,\n\t\t * passed to the filter by reference. If WP_Query does not perform a database\n\t\t * query, it will not have enough information to generate these values itself.\n\t\t *\n\t\t * @since 4.6.0\n\t\t *\n\t\t * @param array|null $posts Return an array of post data to short-circuit WP's query,\n\t\t * or null to allow WP to run its normal queries.\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\t$this->posts = apply_filters_ref_array( 'posts_pre_query', array( null, &$this ) );",
"\t\tif ( 'ids' == $q['fields'] ) {\n\t\t\tif ( null === $this->posts ) {\n\t\t\t\t$this->posts = $wpdb->get_col( $this->request );\n\t\t\t}",
"\t\t\t$this->posts = array_map( 'intval', $this->posts );\n\t\t\t$this->post_count = count( $this->posts );\n\t\t\t$this->set_found_posts( $q, $limits );",
"\t\t\treturn $this->posts;\n\t\t}",
"\t\tif ( 'id=>parent' == $q['fields'] ) {\n\t\t\tif ( null === $this->posts ) {\n\t\t\t\t$this->posts = $wpdb->get_results( $this->request );\n\t\t\t}",
"\t\t\t$this->post_count = count( $this->posts );\n\t\t\t$this->set_found_posts( $q, $limits );",
"\t\t\t$r = array();\n\t\t\tforeach ( $this->posts as $key => $post ) {\n\t\t\t\t$this->posts[ $key ]->ID = (int) $post->ID;\n\t\t\t\t$this->posts[ $key ]->post_parent = (int) $post->post_parent;",
"\t\t\t\t$r[ (int) $post->ID ] = (int) $post->post_parent;\n\t\t\t}",
"\t\t\treturn $r;\n\t\t}",
"\t\tif ( null === $this->posts ) {\n\t\t\t$split_the_query = ( $old_request == $this->request && \"{$wpdb->posts}.*\" == $fields && ! empty( $limits ) && $q['posts_per_page'] < 500 );",
"\t\t\t/**\n\t\t\t * Filters whether to split the query.\n\t\t\t *\n\t\t\t * Splitting the query will cause it to fetch just the IDs of the found posts\n\t\t\t * (and then individually fetch each post by ID), rather than fetching every\n\t\t\t * complete row at once. One massive result vs. many small results.\n\t\t\t *\n\t\t\t * @since 3.4.0\n\t\t\t *\n\t\t\t * @param bool $split_the_query Whether or not to split the query.\n\t\t\t * @param WP_Query $this The WP_Query instance.\n\t\t\t */\n\t\t\t$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );",
"\t\t\tif ( $split_the_query ) {\n\t\t\t\t// First get the IDs and then fill in the objects",
"\t\t\t\t$this->request = \"SELECT $found_rows $distinct {$wpdb->posts}.ID FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits\";",
"\t\t\t\t/**\n\t\t\t\t * Filters the Post IDs SQL request before sending.\n\t\t\t\t *\n\t\t\t\t * @since 3.4.0\n\t\t\t\t *\n\t\t\t\t * @param string $request The post ID request.\n\t\t\t\t * @param WP_Query $this The WP_Query instance.\n\t\t\t\t */\n\t\t\t\t$this->request = apply_filters( 'posts_request_ids', $this->request, $this );",
"\t\t\t\t$ids = $wpdb->get_col( $this->request );",
"\t\t\t\tif ( $ids ) {\n\t\t\t\t\t$this->posts = $ids;\n\t\t\t\t\t$this->set_found_posts( $q, $limits );\n\t\t\t\t\t_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );\n\t\t\t\t} else {\n\t\t\t\t\t$this->posts = array();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->posts = $wpdb->get_results( $this->request );\n\t\t\t\t$this->set_found_posts( $q, $limits );\n\t\t\t}\n\t\t}",
"\t\t// Convert to WP_Post objects.\n\t\tif ( $this->posts ) {\n\t\t\t$this->posts = array_map( 'get_post', $this->posts );\n\t\t}",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the raw post results array, prior to status checks.\n\t\t\t *\n\t\t\t * @since 2.3.0\n\t\t\t *\n\t\t\t * @param WP_Post[] $posts Array of post objects.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );\n\t\t}",
"\t\tif ( ! empty( $this->posts ) && $this->is_comment_feed && $this->is_singular ) {\n\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$cwhere = apply_filters_ref_array( 'comment_feed_where', array( \"WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'\", &$this ) );",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );\n\t\t\t$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );\n\t\t\t$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );",
"\t\t\t$comments_request = \"SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits\";\n\t\t\t$comments = $wpdb->get_results( $comments_request );\n\t\t\t// Convert to WP_Comment\n\t\t\t$this->comments = array_map( 'get_comment', $comments );\n\t\t\t$this->comment_count = count( $this->comments );\n\t\t}",
"\t\t// Check post status to determine if post should be displayed.\n\t\tif ( ! empty( $this->posts ) && ( $this->is_single || $this->is_page ) ) {\n\t\t\t$status = get_post_status( $this->posts[0] );\n\t\t\tif ( 'attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent ) {\n\t\t\t\t$this->is_page = false;\n\t\t\t\t$this->is_single = true;\n\t\t\t\t$this->is_attachment = true;\n\t\t\t}\n\t\t\t$post_status_obj = get_post_status_object( $status );",
"\t\t\t// If the post_status was specifically requested, let it pass through.\n\t\t\tif ( ! $post_status_obj->public && ! in_array( $status, $q_status ) ) {",
"\t\t\t\tif ( ! is_user_logged_in() ) {\n\t\t\t\t\t// User must be logged in to view unpublished posts.\n\t\t\t\t\t$this->posts = array();\n\t\t\t\t} else {\n\t\t\t\t\tif ( $post_status_obj->protected ) {\n\t\t\t\t\t\t// User must have edit permissions on the draft to preview.\n\t\t\t\t\t\tif ( ! current_user_can( $edit_cap, $this->posts[0]->ID ) ) {\n\t\t\t\t\t\t\t$this->posts = array();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this->is_preview = true;\n\t\t\t\t\t\t\tif ( 'future' != $status ) {\n\t\t\t\t\t\t\t\t$this->posts[0]->post_date = current_time( 'mysql' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif ( $post_status_obj->private ) {\n\t\t\t\t\t\tif ( ! current_user_can( $read_cap, $this->posts[0]->ID ) ) {\n\t\t\t\t\t\t\t$this->posts = array();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->posts = array();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) {\n\t\t\t\t/**\n\t\t\t\t * Filters the single post for preview mode.\n\t\t\t\t *\n\t\t\t\t * @since 2.7.0\n\t\t\t\t *\n\t\t\t\t * @param WP_Post $post_preview The Post object.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );\n\t\t\t}\n\t\t}",
"\t\t// Put sticky posts at the top of the posts array\n\t\t$sticky_posts = get_option( 'sticky_posts' );\n\t\tif ( $this->is_home && $page <= 1 && is_array( $sticky_posts ) && ! empty( $sticky_posts ) && ! $q['ignore_sticky_posts'] ) {\n\t\t\t$num_posts = count( $this->posts );\n\t\t\t$sticky_offset = 0;\n\t\t\t// Loop over posts and relocate stickies to the front.\n\t\t\tfor ( $i = 0; $i < $num_posts; $i++ ) {\n\t\t\t\tif ( in_array( $this->posts[ $i ]->ID, $sticky_posts ) ) {\n\t\t\t\t\t$sticky_post = $this->posts[ $i ];\n\t\t\t\t\t// Remove sticky from current position\n\t\t\t\t\tarray_splice( $this->posts, $i, 1 );\n\t\t\t\t\t// Move to front, after other stickies\n\t\t\t\t\tarray_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );\n\t\t\t\t\t// Increment the sticky offset. The next sticky will be placed at this offset.\n\t\t\t\t\t$sticky_offset++;\n\t\t\t\t\t// Remove post from sticky posts array\n\t\t\t\t\t$offset = array_search( $sticky_post->ID, $sticky_posts );\n\t\t\t\t\tunset( $sticky_posts[ $offset ] );\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// If any posts have been excluded specifically, Ignore those that are sticky.\n\t\t\tif ( ! empty( $sticky_posts ) && ! empty( $q['post__not_in'] ) ) {\n\t\t\t\t$sticky_posts = array_diff( $sticky_posts, $q['post__not_in'] );\n\t\t\t}",
"\t\t\t// Fetch sticky posts that weren't in the query results\n\t\t\tif ( ! empty( $sticky_posts ) ) {\n\t\t\t\t$stickies = get_posts(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'post__in' => $sticky_posts,\n\t\t\t\t\t\t'post_type' => $post_type,\n\t\t\t\t\t\t'post_status' => 'publish',\n\t\t\t\t\t\t'nopaging' => true,\n\t\t\t\t\t)\n\t\t\t\t);",
"\t\t\t\tforeach ( $stickies as $sticky_post ) {\n\t\t\t\t\tarray_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );\n\t\t\t\t\t$sticky_offset++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// If comments have been fetched as part of the query, make sure comment meta lazy-loading is set up.\n\t\tif ( ! empty( $this->comments ) ) {\n\t\t\twp_queue_comments_for_comment_meta_lazyload( $this->comments );\n\t\t}",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the array of retrieved posts after they've been fetched and\n\t\t\t * internally processed.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param WP_Post[] $posts Array of post objects.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );\n\t\t}",
"\t\t// Ensure that any posts added/modified via one of the filters above are\n\t\t// of the type WP_Post and are filtered.\n\t\tif ( $this->posts ) {\n\t\t\t$this->post_count = count( $this->posts );",
"\t\t\t$this->posts = array_map( 'get_post', $this->posts );",
"\t\t\tif ( $q['cache_results'] ) {\n\t\t\t\tupdate_post_caches( $this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache'] );\n\t\t\t}",
"\t\t\t$this->post = reset( $this->posts );\n\t\t} else {\n\t\t\t$this->post_count = 0;\n\t\t\t$this->posts = array();\n\t\t}",
"\t\tif ( $q['lazy_load_term_meta'] ) {\n\t\t\twp_queue_posts_for_term_meta_lazyload( $this->posts );\n\t\t}",
"\t\treturn $this->posts;\n\t}",
"\t/**\n\t * Set up the amount of found posts and the number of pages (if limit clause was used)\n\t * for the current query.\n\t *\n\t * @since 3.5.0\n\t *\n\t * @param array $q Query variables.\n\t * @param string $limits LIMIT clauses of the query.\n\t */\n\tprivate function set_found_posts( $q, $limits ) {\n\t\tglobal $wpdb;\n\t\t// Bail if posts is an empty array. Continue if posts is an empty string,\n\t\t// null, or false to accommodate caching plugins that fill posts later.\n\t\tif ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {\n\t\t\treturn;\n\t\t}",
"\t\tif ( ! empty( $limits ) ) {\n\t\t\t/**\n\t\t\t * Filters the query to run for retrieving the found posts.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $found_posts The query to run to find the found posts.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );\n\t\t} else {\n\t\t\tif ( is_array( $this->posts ) ) {\n\t\t\t\t$this->found_posts = count( $this->posts );\n\t\t\t} else {\n\t\t\t\tif ( null === $this->posts ) {\n\t\t\t\t\t$this->found_posts = 0;\n\t\t\t\t} else {\n\t\t\t\t\t$this->found_posts = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters the number of found posts for the query.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param int $found_posts The number of posts found.\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\t$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );",
"\t\tif ( ! empty( $limits ) ) {\n\t\t\t$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );\n\t\t}\n\t}",
"\t/**\n\t * Set up the next post and iterate current post index.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return WP_Post Next post.\n\t */\n\tpublic function next_post() {",
"\t\t$this->current_post++;",
"\t\t$this->post = $this->posts[ $this->current_post ];\n\t\treturn $this->post;\n\t}",
"\t/**\n\t * Sets up the current post.\n\t *\n\t * Retrieves the next post, sets up the post, sets the 'in the loop'\n\t * property to true.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @global WP_Post $post\n\t */\n\tpublic function the_post() {\n\t\tglobal $post;\n\t\t$this->in_the_loop = true;",
"\t\tif ( $this->current_post == -1 ) { // loop has just started\n\t\t\t/**\n\t\t\t * Fires once the loop is started.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\tdo_action_ref_array( 'loop_start', array( &$this ) );\n\t\t}",
"\t\t$post = $this->next_post();\n\t\t$this->setup_postdata( $post );\n\t}",
"\t/**\n\t * Determines whether there are more posts available in the loop.\n\t *\n\t * Calls the {@see 'loop_end'} action when the loop is complete.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return bool True if posts are available, false if end of loop.\n\t */\n\tpublic function have_posts() {\n\t\tif ( $this->current_post + 1 < $this->post_count ) {\n\t\t\treturn true;\n\t\t} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {\n\t\t\t/**\n\t\t\t * Fires once the loop has ended.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\tdo_action_ref_array( 'loop_end', array( &$this ) );\n\t\t\t// Do some cleaning up after the loop\n\t\t\t$this->rewind_posts();\n\t\t} elseif ( 0 === $this->post_count ) {\n\t\t\t/**\n\t\t\t * Fires if no results are found in a post query.\n\t\t\t *\n\t\t\t * @since 4.9.0\n\t\t\t *\n\t\t\t * @param WP_Query $this The WP_Query instance.\n\t\t\t */\n\t\t\tdo_action( 'loop_no_results', $this );\n\t\t}",
"\t\t$this->in_the_loop = false;\n\t\treturn false;\n\t}",
"\t/**\n\t * Rewind the posts and reset post index.\n\t *\n\t * @since 1.5.0\n\t */\n\tpublic function rewind_posts() {\n\t\t$this->current_post = -1;\n\t\tif ( $this->post_count > 0 ) {\n\t\t\t$this->post = $this->posts[0];\n\t\t}\n\t}",
"\t/**\n\t * Iterate current comment index and return WP_Comment object.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @return WP_Comment Comment object.\n\t */\n\tpublic function next_comment() {\n\t\t$this->current_comment++;",
"\t\t$this->comment = $this->comments[ $this->current_comment ];\n\t\treturn $this->comment;\n\t}",
"\t/**\n\t * Sets up the current comment.\n\t *\n\t * @since 2.2.0\n\t * @global WP_Comment $comment Current comment.\n\t */\n\tpublic function the_comment() {\n\t\tglobal $comment;",
"\t\t$comment = $this->next_comment();",
"\t\tif ( $this->current_comment == 0 ) {\n\t\t\t/**\n\t\t\t * Fires once the comment loop is started.\n\t\t\t *\n\t\t\t * @since 2.2.0\n\t\t\t */\n\t\t\tdo_action( 'comment_loop_start' );\n\t\t}\n\t}",
"\t/**\n\t * Whether there are more comments available.\n\t *\n\t * Automatically rewinds comments when finished.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @return bool True, if more comments. False, if no more posts.\n\t */\n\tpublic function have_comments() {\n\t\tif ( $this->current_comment + 1 < $this->comment_count ) {\n\t\t\treturn true;\n\t\t} elseif ( $this->current_comment + 1 == $this->comment_count ) {\n\t\t\t$this->rewind_comments();\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Rewind the comments, resets the comment index and comment to first.\n\t *\n\t * @since 2.2.0\n\t */\n\tpublic function rewind_comments() {\n\t\t$this->current_comment = -1;\n\t\tif ( $this->comment_count > 0 ) {\n\t\t\t$this->comment = $this->comments[0];\n\t\t}\n\t}",
"\t/**\n\t * Sets up the WordPress query by parsing query string.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @param string|array $query URL query string or array of query arguments.\n\t * @return WP_Post[]|int[] Array of post objects or post IDs.\n\t */\n\tpublic function query( $query ) {\n\t\t$this->init();\n\t\t$this->query = $this->query_vars = wp_parse_args( $query );\n\t\treturn $this->get_posts();\n\t}",
"\t/**\n\t * Retrieve queried object.\n\t *\n\t * If queried object is not set, then the queried object will be set from\n\t * the category, tag, taxonomy, posts page, single post, page, or author\n\t * query variable. After it is set up, it will be returned.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return object\n\t */\n\tpublic function get_queried_object() {\n\t\tif ( isset( $this->queried_object ) ) {\n\t\t\treturn $this->queried_object;\n\t\t}",
"\t\t$this->queried_object = null;\n\t\t$this->queried_object_id = null;",
"\t\tif ( $this->is_category || $this->is_tag || $this->is_tax ) {\n\t\t\tif ( $this->is_category ) {\n\t\t\t\tif ( $this->get( 'cat' ) ) {\n\t\t\t\t\t$term = get_term( $this->get( 'cat' ), 'category' );\n\t\t\t\t} elseif ( $this->get( 'category_name' ) ) {\n\t\t\t\t\t$term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );\n\t\t\t\t}\n\t\t\t} elseif ( $this->is_tag ) {\n\t\t\t\tif ( $this->get( 'tag_id' ) ) {\n\t\t\t\t\t$term = get_term( $this->get( 'tag_id' ), 'post_tag' );\n\t\t\t\t} elseif ( $this->get( 'tag' ) ) {\n\t\t\t\t\t$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For other tax queries, grab the first term from the first clause.\n\t\t\t\tif ( ! empty( $this->tax_query->queried_terms ) ) {\n\t\t\t\t\t$queried_taxonomies = array_keys( $this->tax_query->queried_terms );\n\t\t\t\t\t$matched_taxonomy = reset( $queried_taxonomies );\n\t\t\t\t\t$query = $this->tax_query->queried_terms[ $matched_taxonomy ];",
"\t\t\t\t\tif ( ! empty( $query['terms'] ) ) {\n\t\t\t\t\t\tif ( 'term_id' == $query['field'] ) {\n\t\t\t\t\t\t\t$term = get_term( reset( $query['terms'] ), $matched_taxonomy );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( ! empty( $term ) && ! is_wp_error( $term ) ) {\n\t\t\t\t$this->queried_object = $term;\n\t\t\t\t$this->queried_object_id = (int) $term->term_id;",
"\t\t\t\tif ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {\n\t\t\t\t\t_make_cat_compat( $this->queried_object );\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif ( $this->is_post_type_archive ) {\n\t\t\t$post_type = $this->get( 'post_type' );\n\t\t\tif ( is_array( $post_type ) ) {\n\t\t\t\t$post_type = reset( $post_type );\n\t\t\t}\n\t\t\t$this->queried_object = get_post_type_object( $post_type );\n\t\t} elseif ( $this->is_posts_page ) {\n\t\t\t$page_for_posts = get_option( 'page_for_posts' );\n\t\t\t$this->queried_object = get_post( $page_for_posts );\n\t\t\t$this->queried_object_id = (int) $this->queried_object->ID;\n\t\t} elseif ( $this->is_singular && ! empty( $this->post ) ) {\n\t\t\t$this->queried_object = $this->post;\n\t\t\t$this->queried_object_id = (int) $this->post->ID;\n\t\t} elseif ( $this->is_author ) {\n\t\t\t$this->queried_object_id = (int) $this->get( 'author' );\n\t\t\t$this->queried_object = get_userdata( $this->queried_object_id );\n\t\t}",
"\t\treturn $this->queried_object;\n\t}",
"\t/**\n\t * Retrieve ID of the current queried object.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return int\n\t */\n\tpublic function get_queried_object_id() {\n\t\t$this->get_queried_object();",
"\t\tif ( isset( $this->queried_object_id ) ) {\n\t\t\treturn $this->queried_object_id;\n\t\t}",
"\t\treturn 0;\n\t}",
"\t/**\n\t * Constructor.\n\t *\n\t * Sets up the WordPress query, if parameter is not empty.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @param string|array $query URL query string or array of vars.\n\t */\n\tpublic function __construct( $query = '' ) {\n\t\tif ( ! empty( $query ) ) {\n\t\t\t$this->query( $query );\n\t\t}\n\t}",
"\t/**\n\t * Make private properties readable for backward compatibility.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $name Property to get.\n\t * @return mixed Property.\n\t */\n\tpublic function __get( $name ) {\n\t\tif ( in_array( $name, $this->compat_fields ) ) {\n\t\t\treturn $this->$name;\n\t\t}\n\t}",
"\t/**\n\t * Make private properties checkable for backward compatibility.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $name Property to check if set.\n\t * @return bool Whether the property is set.\n\t */\n\tpublic function __isset( $name ) {\n\t\tif ( in_array( $name, $this->compat_fields ) ) {\n\t\t\treturn isset( $this->$name );\n\t\t}\n\t}",
"\t/**\n\t * Make private/protected methods readable for backward compatibility.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $name Method to call.\n\t * @param array $arguments Arguments to pass when calling.\n\t * @return mixed|false Return value of the callback, false otherwise.\n\t */\n\tpublic function __call( $name, $arguments ) {\n\t\tif ( in_array( $name, $this->compat_methods ) ) {\n\t\t\treturn call_user_func_array( array( $this, $name ), $arguments );\n\t\t}\n\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing archive page?\n\t *\n\t * Month, Year, Category, Author, Post Type archive...\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_archive() {\n\t\treturn (bool) $this->is_archive;\n\t}",
"\t/**\n\t * Is the query for an existing post type archive page?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $post_types Optional. Post type or array of posts types to check against.\n\t * @return bool\n\t */\n\tpublic function is_post_type_archive( $post_types = '' ) {\n\t\tif ( empty( $post_types ) || ! $this->is_post_type_archive ) {\n\t\t\treturn (bool) $this->is_post_type_archive;\n\t\t}",
"\t\t$post_type = $this->get( 'post_type' );\n\t\tif ( is_array( $post_type ) ) {\n\t\t\t$post_type = reset( $post_type );\n\t\t}\n\t\t$post_type_object = get_post_type_object( $post_type );",
"\t\treturn in_array( $post_type_object->name, (array) $post_types );\n\t}",
"\t/**\n\t * Is the query for an existing attachment page?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $attachment Attachment ID, title, slug, or array of such.\n\t * @return bool\n\t */\n\tpublic function is_attachment( $attachment = '' ) {\n\t\tif ( ! $this->is_attachment ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $attachment ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$attachment = array_map( 'strval', (array) $attachment );",
"\t\t$post_obj = $this->get_queried_object();",
"\t\tif ( in_array( (string) $post_obj->ID, $attachment ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_title, $attachment ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_name, $attachment ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing author archive page?\n\t *\n\t * If the $author parameter is specified, this function will additionally\n\t * check if the query is for one of the authors specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames\n\t * @return bool\n\t */\n\tpublic function is_author( $author = '' ) {\n\t\tif ( ! $this->is_author ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $author ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$author_obj = $this->get_queried_object();",
"\t\t$author = array_map( 'strval', (array) $author );",
"\t\tif ( in_array( (string) $author_obj->ID, $author ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $author_obj->nickname, $author ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $author_obj->user_nicename, $author ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing category archive page?\n\t *\n\t * If the $category parameter is specified, this function will additionally\n\t * check if the query is for one of the categories specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.\n\t * @return bool\n\t */\n\tpublic function is_category( $category = '' ) {\n\t\tif ( ! $this->is_category ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $category ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$cat_obj = $this->get_queried_object();",
"\t\t$category = array_map( 'strval', (array) $category );",
"\t\tif ( in_array( (string) $cat_obj->term_id, $category ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $cat_obj->name, $category ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $cat_obj->slug, $category ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing tag archive page?\n\t *\n\t * If the $tag parameter is specified, this function will additionally\n\t * check if the query is for one of the tags specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.\n\t * @return bool\n\t */\n\tpublic function is_tag( $tag = '' ) {\n\t\tif ( ! $this->is_tag ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $tag ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$tag_obj = $this->get_queried_object();",
"\t\t$tag = array_map( 'strval', (array) $tag );",
"\t\tif ( in_array( (string) $tag_obj->term_id, $tag ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $tag_obj->name, $tag ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $tag_obj->slug, $tag ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing custom taxonomy archive page?\n\t *\n\t * If the $taxonomy parameter is specified, this function will additionally\n\t * check if the query is for that specific $taxonomy.\n\t *\n\t * If the $term parameter is specified in addition to the $taxonomy parameter,\n\t * this function will additionally check if the query is for one of the terms\n\t * specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @global array $wp_taxonomies\n\t *\n\t * @param mixed $taxonomy Optional. Taxonomy slug or slugs.\n\t * @param mixed $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs.\n\t * @return bool True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives).\n\t */\n\tpublic function is_tax( $taxonomy = '', $term = '' ) {\n\t\tglobal $wp_taxonomies;",
"\t\tif ( ! $this->is_tax ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $taxonomy ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$queried_object = $this->get_queried_object();\n\t\t$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );\n\t\t$term_array = (array) $term;",
"\t\t// Check that the taxonomy matches.\n\t\tif ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) ) {\n\t\t\treturn false;\n\t\t}",
"\t\t// Only a Taxonomy provided.\n\t\tif ( empty( $term ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn isset( $queried_object->term_id ) &&\n\t\t\tcount(\n\t\t\t\tarray_intersect(\n\t\t\t\t\tarray( $queried_object->term_id, $queried_object->name, $queried_object->slug ),\n\t\t\t\t\t$term_array\n\t\t\t\t)\n\t\t\t);\n\t}",
"\t/**\n\t * Whether the current URL is within the comments popup window.\n\t *\n\t * @since 3.1.0\n\t * @deprecated 4.5.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_comments_popup() {\n\t\t_deprecated_function( __FUNCTION__, '4.5.0' );",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing date archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_date() {\n\t\treturn (bool) $this->is_date;\n\t}",
"\t/**\n\t * Is the query for an existing day archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_day() {\n\t\treturn (bool) $this->is_day;\n\t}",
"\t/**\n\t * Is the query for a feed?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param string|array $feeds Optional feed types to check.\n\t * @return bool\n\t */\n\tpublic function is_feed( $feeds = '' ) {\n\t\tif ( empty( $feeds ) || ! $this->is_feed ) {\n\t\t\treturn (bool) $this->is_feed;\n\t\t}\n\t\t$qv = $this->get( 'feed' );\n\t\tif ( 'feed' == $qv ) {\n\t\t\t$qv = get_default_feed();\n\t\t}\n\t\treturn in_array( $qv, (array) $feeds );\n\t}",
"\t/**\n\t * Is the query for a comments feed?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_comment_feed() {\n\t\treturn (bool) $this->is_comment_feed;\n\t}",
"\t/**\n\t * Is the query for the front page of the site?\n\t *\n\t * This is for what is displayed at your site's main URL.\n\t *\n\t * Depends on the site's \"Front page displays\" Reading Settings 'show_on_front' and 'page_on_front'.\n\t *\n\t * If you set a static page for the front page of your site, this function will return\n\t * true when viewing that page.\n\t *\n\t * Otherwise the same as @see WP_Query::is_home()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool True, if front of site.\n\t */\n\tpublic function is_front_page() {\n\t\t// most likely case\n\t\tif ( 'posts' == get_option( 'show_on_front' ) && $this->is_home() ) {\n\t\t\treturn true;\n\t\t} elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"\t/**\n\t * Is the query for the blog homepage?\n\t *\n\t * This is the page which shows the time based blog content of your site.\n\t *\n\t * Depends on the site's \"Front page displays\" Reading Settings 'show_on_front' and 'page_for_posts'.\n\t *\n\t * If you set a static page for the front page of your site, this function will return\n\t * true only on the page you set as the \"Posts page\".\n\t *\n\t * @see WP_Query::is_front_page()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool True if blog view homepage.\n\t */\n\tpublic function is_home() {\n\t\treturn (bool) $this->is_home;\n\t}",
"\t/**\n\t * Is the query for the Privacy Policy page?\n\t *\n\t * This is the page which shows the Privacy Policy content of your site.\n\t *\n\t * Depends on the site's \"Change your Privacy Policy page\" Privacy Settings 'wp_page_for_privacy_policy'.\n\t *\n\t * This function will return true only on the page you set as the \"Privacy Policy page\".\n\t *\n\t * @since 5.2.0\n\t *\n\t * @return bool True, if Privacy Policy page.\n\t */\n\tpublic function is_privacy_policy() {\n\t\tif ( get_option( 'wp_page_for_privacy_policy' ) && $this->is_page( get_option( 'wp_page_for_privacy_policy' ) ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"\t/**\n\t * Is the query for an existing month archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_month() {\n\t\treturn (bool) $this->is_month;\n\t}",
"\t/**\n\t * Is the query for an existing single page?\n\t *\n\t * If the $page parameter is specified, this function will additionally\n\t * check if the query is for one of the pages specified.\n\t *\n\t * @see WP_Query::is_single()\n\t * @see WP_Query::is_singular()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param int|string|array $page Optional. Page ID, title, slug, path, or array of such. Default empty.\n\t * @return bool Whether the query is for an existing single page.\n\t */\n\tpublic function is_page( $page = '' ) {\n\t\tif ( ! $this->is_page ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $page ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$page_obj = $this->get_queried_object();",
"\t\t$page = array_map( 'strval', (array) $page );",
"\t\tif ( in_array( (string) $page_obj->ID, $page ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $page_obj->post_title, $page ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $page_obj->post_name, $page ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tforeach ( $page as $pagepath ) {\n\t\t\t\tif ( ! strpos( $pagepath, '/' ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$pagepath_obj = get_page_by_path( $pagepath );",
"\t\t\t\tif ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for paged result and not for the first page?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_paged() {\n\t\treturn (bool) $this->is_paged;\n\t}",
"\t/**\n\t * Is the query for a post or page preview?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_preview() {\n\t\treturn (bool) $this->is_preview;\n\t}",
"\t/**\n\t * Is the query for the robots file?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_robots() {\n\t\treturn (bool) $this->is_robots;\n\t}",
"\t/**\n\t * Is the query for a search?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_search() {\n\t\treturn (bool) $this->is_search;\n\t}",
"\t/**\n\t * Is the query for an existing single post?\n\t *\n\t * Works for any post type excluding pages.\n\t *\n\t * If the $post parameter is specified, this function will additionally\n\t * check if the query is for one of the Posts specified.\n\t *\n\t * @see WP_Query::is_page()\n\t * @see WP_Query::is_singular()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param int|string|array $post Optional. Post ID, title, slug, path, or array of such. Default empty.\n\t * @return bool Whether the query is for an existing single post.\n\t */\n\tpublic function is_single( $post = '' ) {\n\t\tif ( ! $this->is_single ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $post ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$post_obj = $this->get_queried_object();",
"\t\t$post = array_map( 'strval', (array) $post );",
"\t\tif ( in_array( (string) $post_obj->ID, $post ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_title, $post ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_name, $post ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tforeach ( $post as $postpath ) {\n\t\t\t\tif ( ! strpos( $postpath, '/' ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );",
"\t\t\t\tif ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing single post of any post type (post, attachment, page,\n\t * custom post types)?\n\t *\n\t * If the $post_types parameter is specified, this function will additionally\n\t * check if the query is for one of the Posts Types specified.\n\t *\n\t * @see WP_Query::is_page()\n\t * @see WP_Query::is_single()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param string|array $post_types Optional. Post type or array of post types. Default empty.\n\t * @return bool Whether the query is for an existing single post of any of the given post types.\n\t */\n\tpublic function is_singular( $post_types = '' ) {\n\t\tif ( empty( $post_types ) || ! $this->is_singular ) {\n\t\t\treturn (bool) $this->is_singular;\n\t\t}",
"\t\t$post_obj = $this->get_queried_object();",
"\t\treturn in_array( $post_obj->post_type, (array) $post_types );\n\t}",
"\t/**\n\t * Is the query for a specific time?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_time() {\n\t\treturn (bool) $this->is_time;\n\t}",
"\t/**\n\t * Is the query for a trackback endpoint call?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_trackback() {\n\t\treturn (bool) $this->is_trackback;\n\t}",
"\t/**\n\t * Is the query for an existing year archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_year() {\n\t\treturn (bool) $this->is_year;\n\t}",
"\t/**\n\t * Is the query a 404 (returns no results)?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_404() {\n\t\treturn (bool) $this->is_404;\n\t}",
"\t/**\n\t * Is the query for an embedded post?\n\t *\n\t * @since 4.4.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_embed() {\n\t\treturn (bool) $this->is_embed;\n\t}",
"\t/**\n\t * Is the query the main query?\n\t *\n\t * @since 3.3.0\n\t *\n\t * @global WP_Query $wp_query Global WP_Query instance.\n\t *\n\t * @return bool\n\t */\n\tpublic function is_main_query() {\n\t\tglobal $wp_the_query;\n\t\treturn $wp_the_query === $this;\n\t}",
"\t/**\n\t * Set up global post data.\n\t *\n\t * @since 4.1.0\n\t * @since 4.4.0 Added the ability to pass a post ID to `$post`.\n\t *\n\t * @global int $id\n\t * @global WP_User $authordata\n\t * @global string|int|bool $currentday\n\t * @global string|int|bool $currentmonth\n\t * @global int $page\n\t * @global array $pages\n\t * @global int $multipage\n\t * @global int $more\n\t * @global int $numpages\n\t *\n\t * @param WP_Post|object|int $post WP_Post instance or Post ID/object.\n\t * @return true True when finished.\n\t */\n\tpublic function setup_postdata( $post ) {\n\t\tglobal $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;",
"\t\tif ( ! ( $post instanceof WP_Post ) ) {\n\t\t\t$post = get_post( $post );\n\t\t}",
"\t\tif ( ! $post ) {\n\t\t\treturn;\n\t\t}",
"\t\t$elements = $this->generate_postdata( $post );\n\t\tif ( false === $elements ) {\n\t\t\treturn;\n\t\t}",
"\t\t$id = $elements['id'];\n\t\t$authordata = $elements['authordata'];\n\t\t$currentday = $elements['currentday'];\n\t\t$currentmonth = $elements['currentmonth'];\n\t\t$page = $elements['page'];\n\t\t$pages = $elements['pages'];\n\t\t$multipage = $elements['multipage'];\n\t\t$more = $elements['more'];\n\t\t$numpages = $elements['numpages'];",
"\t\t/**\n\t\t * Fires once the post data has been setup.\n\t\t *\n\t\t * @since 2.8.0\n\t\t * @since 4.1.0 Introduced `$this` parameter.\n\t\t *\n\t\t * @param WP_Post $post The Post object (passed by reference).\n\t\t * @param WP_Query $this The current Query object (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'the_post', array( &$post, &$this ) );",
"\t\treturn true;\n\t}",
"\t/**\n\t * Generate post data.\n\t *\n\t * @since 5.2.0\n\t *\n\t * @param WP_Post|object|int $post WP_Post instance or Post ID/object.\n\t * @return array|bool $elements Elements of post or false on failure.\n\t */\n\tpublic function generate_postdata( $post ) {",
"\t\tif ( ! ( $post instanceof WP_Post ) ) {\n\t\t\t$post = get_post( $post );\n\t\t}",
"\t\tif ( ! $post ) {\n\t\t\treturn false;\n\t\t}",
"\t\t$id = (int) $post->ID;",
"\t\t$authordata = get_userdata( $post->post_author );",
"\t\t$currentday = mysql2date( 'd.m.y', $post->post_date, false );\n\t\t$currentmonth = mysql2date( 'm', $post->post_date, false );\n\t\t$numpages = 1;\n\t\t$multipage = 0;\n\t\t$page = $this->get( 'page' );\n\t\tif ( ! $page ) {\n\t\t\t$page = 1;\n\t\t}",
"\t\t/*\n\t\t * Force full post content when viewing the permalink for the $post,\n\t\t * or when on an RSS feed. Otherwise respect the 'more' tag.\n\t\t */\n\t\tif ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {\n\t\t\t$more = 1;\n\t\t} elseif ( $this->is_feed() ) {\n\t\t\t$more = 1;\n\t\t} else {\n\t\t\t$more = 0;\n\t\t}",
"\t\t$content = $post->post_content;\n\t\tif ( false !== strpos( $content, '<!--nextpage-->' ) ) {\n\t\t\t$content = str_replace( \"\\n<!--nextpage-->\\n\", '<!--nextpage-->', $content );\n\t\t\t$content = str_replace( \"\\n<!--nextpage-->\", '<!--nextpage-->', $content );\n\t\t\t$content = str_replace( \"<!--nextpage-->\\n\", '<!--nextpage-->', $content );",
"\t\t\t// Remove the nextpage block delimiters, to avoid invalid block structures in the split content.\n\t\t\t$content = str_replace( '<!-- wp:nextpage -->', '', $content );\n\t\t\t$content = str_replace( '<!-- /wp:nextpage -->', '', $content );",
"\t\t\t// Ignore nextpage at the beginning of the content.\n\t\t\tif ( 0 === strpos( $content, '<!--nextpage-->' ) ) {\n\t\t\t\t$content = substr( $content, 15 );\n\t\t\t}",
"\t\t\t$pages = explode( '<!--nextpage-->', $content );\n\t\t} else {\n\t\t\t$pages = array( $post->post_content );\n\t\t}",
"\t\t/**\n\t\t * Filters the \"pages\" derived from splitting the post content.\n\t\t *\n\t\t * \"Pages\" are determined by splitting the post content based on the presence\n\t\t * of `<!-- nextpage -->` tags.\n\t\t *\n\t\t * @since 4.4.0\n\t\t *\n\t\t * @param string[] $pages Array of \"pages\" from the post content split by `<!-- nextpage -->` tags.\n\t\t * @param WP_Post $post Current post object.\n\t\t */\n\t\t$pages = apply_filters( 'content_pagination', $pages, $post );",
"\t\t$numpages = count( $pages );",
"\t\tif ( $numpages > 1 ) {\n\t\t\tif ( $page > 1 ) {\n\t\t\t\t$more = 1;\n\t\t\t}\n\t\t\t$multipage = 1;\n\t\t} else {\n\t\t\t$multipage = 0;\n\t\t}",
"\t\t$elements = compact( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );",
"\t\treturn $elements;\n\t}\n\t/**\n\t * After looping through a nested query, this function\n\t * restores the $post global to the current post in this query.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @global WP_Post $post\n\t */\n\tpublic function reset_postdata() {\n\t\tif ( ! empty( $this->post ) ) {\n\t\t\t$GLOBALS['post'] = $this->post;\n\t\t\t$this->setup_postdata( $this->post );\n\t\t}\n\t}",
"\t/**\n\t * Lazyload term meta for posts in the loop.\n\t *\n\t * @since 4.4.0\n\t * @deprecated 4.5.0 See wp_queue_posts_for_term_meta_lazyload().\n\t *\n\t * @param mixed $check\n\t * @param int $term_id\n\t * @return mixed\n\t */\n\tpublic function lazyload_term_meta( $check, $term_id ) {\n\t\t_deprecated_function( __METHOD__, '4.5.0' );\n\t\treturn $check;\n\t}",
"\t/**\n\t * Lazyload comment meta for comments in the loop.\n\t *\n\t * @since 4.4.0\n\t * @deprecated 4.5.0 See wp_queue_comments_for_comment_meta_lazyload().\n\t *\n\t * @param mixed $check\n\t * @param int $comment_id\n\t * @return mixed\n\t */\n\tpublic function lazyload_comment_meta( $check, $comment_id ) {\n\t\t_deprecated_function( __METHOD__, '4.5.0' );\n\t\treturn $check;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [806, 18, 17], "buggy_code_start_loc": [541, 17, 16], "filenames": ["wp-includes/class-wp-query.php", "wp-includes/class-wp.php", "wp-includes/version.php"], "fixing_code_end_loc": [805, 18, 17], "fixing_code_start_loc": [540, 17, 16], "message": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "954E75B0-6B64-4856-B36D-4EBD80FBDC1B", "versionEndExcluding": "5.2.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled."}, {"lang": "es", "value": "En WordPress anterior a 5.2.4, es posible la visualizaci\u00f3n no autenticada de cierto contenido porque la propiedad de consulta est\u00e1tica es manejada inapropiadamente."}], "evaluatorComment": null, "id": "CVE-2019-17671", "lastModified": "2023-02-03T21:54:45.063", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-17T13:15:10.937", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://blog.wpscan.org/wordpress/security/release/2019/10/15/wordpress-524-security-release-breakdown.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://core.trac.wordpress.org/changeset/46474"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/11/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2020/Jan/8"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://wordpress.org/news/2019/10/wordpress-5-2-4-security-release/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://wpvulndb.com/vulnerabilities/9909"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4599"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4677"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, "type": "CWE-200"}
| 89
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n/**\n * Query API: WP_Query class\n *\n * @package WordPress\n * @subpackage Query\n * @since 4.7.0\n */",
"/**\n * The WordPress Query class.\n *\n * @link https://codex.wordpress.org/Function_Reference/WP_Query Codex page.\n *\n * @since 1.5.0\n * @since 4.5.0 Removed the `$comments_popup` property.\n */\nclass WP_Query {",
"\t/**\n\t * Query vars set by the user\n\t *\n\t * @since 1.5.0\n\t * @var array\n\t */\n\tpublic $query;",
"\t/**\n\t * Query vars, after parsing\n\t *\n\t * @since 1.5.0\n\t * @var array\n\t */\n\tpublic $query_vars = array();",
"\t/**\n\t * Taxonomy query, as passed to get_tax_sql()\n\t *\n\t * @since 3.1.0\n\t * @var object WP_Tax_Query\n\t */\n\tpublic $tax_query;",
"\t/**\n\t * Metadata query container\n\t *\n\t * @since 3.2.0\n\t * @var object WP_Meta_Query\n\t */\n\tpublic $meta_query = false;",
"\t/**\n\t * Date query container\n\t *\n\t * @since 3.7.0\n\t * @var object WP_Date_Query\n\t */\n\tpublic $date_query = false;",
"\t/**\n\t * Holds the data for a single object that is queried.\n\t *\n\t * Holds the contents of a post, page, category, attachment.\n\t *\n\t * @since 1.5.0\n\t * @var object|array\n\t */\n\tpublic $queried_object;",
"\t/**\n\t * The ID of the queried object.\n\t *\n\t * @since 1.5.0\n\t * @var int\n\t */\n\tpublic $queried_object_id;",
"\t/**\n\t * Get post database query.\n\t *\n\t * @since 2.0.1\n\t * @var string\n\t */\n\tpublic $request;",
"\t/**\n\t * List of posts.\n\t *\n\t * @since 1.5.0\n\t * @var array\n\t */\n\tpublic $posts;",
"\t/**\n\t * The amount of posts for the current query.\n\t *\n\t * @since 1.5.0\n\t * @var int\n\t */\n\tpublic $post_count = 0;",
"\t/**\n\t * Index of the current item in the loop.\n\t *\n\t * @since 1.5.0\n\t * @var int\n\t */\n\tpublic $current_post = -1;",
"\t/**\n\t * Whether the loop has started and the caller is in the loop.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $in_the_loop = false;",
"\t/**\n\t * The current post.\n\t *\n\t * @since 1.5.0\n\t * @var WP_Post\n\t */\n\tpublic $post;",
"\t/**\n\t * The list of comments for current post.\n\t *\n\t * @since 2.2.0\n\t * @var array\n\t */\n\tpublic $comments;",
"\t/**\n\t * The amount of comments for the posts.\n\t *\n\t * @since 2.2.0\n\t * @var int\n\t */\n\tpublic $comment_count = 0;",
"\t/**\n\t * The index of the comment in the comment loop.\n\t *\n\t * @since 2.2.0\n\t * @var int\n\t */\n\tpublic $current_comment = -1;",
"\t/**\n\t * Current comment ID.\n\t *\n\t * @since 2.2.0\n\t * @var int\n\t */\n\tpublic $comment;",
"\t/**\n\t * The amount of found posts for the current query.\n\t *\n\t * If limit clause was not used, equals $post_count.\n\t *\n\t * @since 2.1.0\n\t * @var int\n\t */\n\tpublic $found_posts = 0;",
"\t/**\n\t * The amount of pages.\n\t *\n\t * @since 2.1.0\n\t * @var int\n\t */\n\tpublic $max_num_pages = 0;",
"\t/**\n\t * The amount of comment pages.\n\t *\n\t * @since 2.7.0\n\t * @var int\n\t */\n\tpublic $max_num_comment_pages = 0;",
"\t/**\n\t * Signifies whether the current query is for a single post.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_single = false;",
"\t/**\n\t * Signifies whether the current query is for a preview.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $is_preview = false;",
"\t/**\n\t * Signifies whether the current query is for a page.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_page = false;",
"\t/**\n\t * Signifies whether the current query is for an archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_archive = false;",
"\t/**\n\t * Signifies whether the current query is for a date archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_date = false;",
"\t/**\n\t * Signifies whether the current query is for a year archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_year = false;",
"\t/**\n\t * Signifies whether the current query is for a month archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_month = false;",
"\t/**\n\t * Signifies whether the current query is for a day archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_day = false;",
"\t/**\n\t * Signifies whether the current query is for a specific time.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_time = false;",
"\t/**\n\t * Signifies whether the current query is for an author archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_author = false;",
"\t/**\n\t * Signifies whether the current query is for a category archive.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_category = false;",
"\t/**\n\t * Signifies whether the current query is for a tag archive.\n\t *\n\t * @since 2.3.0\n\t * @var bool\n\t */\n\tpublic $is_tag = false;",
"\t/**\n\t * Signifies whether the current query is for a taxonomy archive.\n\t *\n\t * @since 2.5.0\n\t * @var bool\n\t */\n\tpublic $is_tax = false;",
"\t/**\n\t * Signifies whether the current query is for a search.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_search = false;",
"\t/**\n\t * Signifies whether the current query is for a feed.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_feed = false;",
"\t/**\n\t * Signifies whether the current query is for a comment feed.\n\t *\n\t * @since 2.2.0\n\t * @var bool\n\t */\n\tpublic $is_comment_feed = false;",
"\t/**\n\t * Signifies whether the current query is for trackback endpoint call.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_trackback = false;",
"\t/**\n\t * Signifies whether the current query is for the site homepage.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_home = false;",
"\t/**\n\t * Signifies whether the current query is for the Privacy Policy page.\n\t *\n\t * @since 5.2.0\n\t * @var bool\n\t */\n\tpublic $is_privacy_policy = false;",
"\t/**\n\t * Signifies whether the current query couldn't find anything.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_404 = false;",
"\t/**\n\t * Signifies whether the current query is for an embed.\n\t *\n\t * @since 4.4.0\n\t * @var bool\n\t */\n\tpublic $is_embed = false;",
"\t/**\n\t * Signifies whether the current query is for a paged result and not for the first page.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_paged = false;",
"\t/**\n\t * Signifies whether the current query is for an administrative interface page.\n\t *\n\t * @since 1.5.0\n\t * @var bool\n\t */\n\tpublic $is_admin = false;",
"\t/**\n\t * Signifies whether the current query is for an attachment page.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $is_attachment = false;",
"\t/**\n\t * Signifies whether the current query is for an existing single post of any post type\n\t * (post, attachment, page, custom post types).\n\t *\n\t * @since 2.1.0\n\t * @var bool\n\t */\n\tpublic $is_singular = false;",
"\t/**\n\t * Signifies whether the current query is for the robots.txt file.\n\t *\n\t * @since 2.1.0\n\t * @var bool\n\t */\n\tpublic $is_robots = false;",
"\t/**\n\t * Signifies whether the current query is for the page_for_posts page.\n\t *\n\t * Basically, the homepage if the option isn't set for the static homepage.\n\t *\n\t * @since 2.1.0\n\t * @var bool\n\t */\n\tpublic $is_posts_page = false;",
"\t/**\n\t * Signifies whether the current query is for a post type archive.\n\t *\n\t * @since 3.1.0\n\t * @var bool\n\t */\n\tpublic $is_post_type_archive = false;",
"\t/**\n\t * Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know\n\t * whether we have to re-parse because something has changed\n\t *\n\t * @since 3.1.0\n\t * @var bool|string\n\t */\n\tprivate $query_vars_hash = false;",
"\t/**\n\t * Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made\n\t * via pre_get_posts hooks.\n\t *\n\t * @since 3.1.1\n\t */\n\tprivate $query_vars_changed = true;",
"\t/**\n\t * Set if post thumbnails are cached\n\t *\n\t * @since 3.2.0\n\t * @var bool\n\t */\n\tpublic $thumbnails_cached = false;",
"\t/**\n\t * Cached list of search stopwords.\n\t *\n\t * @since 3.7.0\n\t * @var array\n\t */\n\tprivate $stopwords;",
"\tprivate $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );",
"\tprivate $compat_methods = array( 'init_query_flags', 'parse_tax_query' );",
"\t/**\n\t * Resets query flags to false.\n\t *\n\t * The query flags are what page info WordPress was able to figure out.\n\t *\n\t * @since 2.0.0\n\t */\n\tprivate function init_query_flags() {\n\t\t$this->is_single = false;\n\t\t$this->is_preview = false;\n\t\t$this->is_page = false;\n\t\t$this->is_archive = false;\n\t\t$this->is_date = false;\n\t\t$this->is_year = false;\n\t\t$this->is_month = false;\n\t\t$this->is_day = false;\n\t\t$this->is_time = false;\n\t\t$this->is_author = false;\n\t\t$this->is_category = false;\n\t\t$this->is_tag = false;\n\t\t$this->is_tax = false;\n\t\t$this->is_search = false;\n\t\t$this->is_feed = false;\n\t\t$this->is_comment_feed = false;\n\t\t$this->is_trackback = false;\n\t\t$this->is_home = false;\n\t\t$this->is_privacy_policy = false;\n\t\t$this->is_404 = false;\n\t\t$this->is_paged = false;\n\t\t$this->is_admin = false;\n\t\t$this->is_attachment = false;\n\t\t$this->is_singular = false;\n\t\t$this->is_robots = false;\n\t\t$this->is_posts_page = false;\n\t\t$this->is_post_type_archive = false;\n\t}",
"\t/**\n\t * Initiates object properties and sets default values.\n\t *\n\t * @since 1.5.0\n\t */\n\tpublic function init() {\n\t\tunset( $this->posts );\n\t\tunset( $this->query );\n\t\t$this->query_vars = array();\n\t\tunset( $this->queried_object );\n\t\tunset( $this->queried_object_id );\n\t\t$this->post_count = 0;\n\t\t$this->current_post = -1;\n\t\t$this->in_the_loop = false;\n\t\tunset( $this->request );\n\t\tunset( $this->post );\n\t\tunset( $this->comments );\n\t\tunset( $this->comment );\n\t\t$this->comment_count = 0;\n\t\t$this->current_comment = -1;\n\t\t$this->found_posts = 0;\n\t\t$this->max_num_pages = 0;\n\t\t$this->max_num_comment_pages = 0;",
"\t\t$this->init_query_flags();\n\t}",
"\t/**\n\t * Reparse the query vars.\n\t *\n\t * @since 1.5.0\n\t */\n\tpublic function parse_query_vars() {\n\t\t$this->parse_query();\n\t}",
"\t/**\n\t * Fills in the query variables, which do not exist within the parameter.\n\t *\n\t * @since 2.1.0\n\t * @since 4.4.0 Removed the `comments_popup` public query variable.\n\t *\n\t * @param array $array Defined query variables.\n\t * @return array Complete query variables with undefined ones filled in empty.\n\t */\n\tpublic function fill_query_vars( $array ) {\n\t\t$keys = array(\n\t\t\t'error',\n\t\t\t'm',\n\t\t\t'p',\n\t\t\t'post_parent',\n\t\t\t'subpost',\n\t\t\t'subpost_id',\n\t\t\t'attachment',\n\t\t\t'attachment_id',\n\t\t\t'name',",
"",
"\t\t\t'pagename',\n\t\t\t'page_id',\n\t\t\t'second',\n\t\t\t'minute',\n\t\t\t'hour',\n\t\t\t'day',\n\t\t\t'monthnum',\n\t\t\t'year',\n\t\t\t'w',\n\t\t\t'category_name',\n\t\t\t'tag',\n\t\t\t'cat',\n\t\t\t'tag_id',\n\t\t\t'author',\n\t\t\t'author_name',\n\t\t\t'feed',\n\t\t\t'tb',\n\t\t\t'paged',\n\t\t\t'meta_key',\n\t\t\t'meta_value',\n\t\t\t'preview',\n\t\t\t's',\n\t\t\t'sentence',\n\t\t\t'title',\n\t\t\t'fields',\n\t\t\t'menu_order',\n\t\t\t'embed',\n\t\t);",
"\t\tforeach ( $keys as $key ) {\n\t\t\tif ( ! isset( $array[ $key ] ) ) {\n\t\t\t\t$array[ $key ] = '';\n\t\t\t}\n\t\t}",
"\t\t$array_keys = array(\n\t\t\t'category__in',\n\t\t\t'category__not_in',\n\t\t\t'category__and',\n\t\t\t'post__in',\n\t\t\t'post__not_in',\n\t\t\t'post_name__in',\n\t\t\t'tag__in',\n\t\t\t'tag__not_in',\n\t\t\t'tag__and',\n\t\t\t'tag_slug__in',\n\t\t\t'tag_slug__and',\n\t\t\t'post_parent__in',\n\t\t\t'post_parent__not_in',\n\t\t\t'author__in',\n\t\t\t'author__not_in',\n\t\t);",
"\t\tforeach ( $array_keys as $key ) {\n\t\t\tif ( ! isset( $array[ $key ] ) ) {\n\t\t\t\t$array[ $key ] = array();\n\t\t\t}\n\t\t}\n\t\treturn $array;\n\t}",
"\t/**\n\t * Parse a query string and set query type booleans.\n\t *\n\t * @since 1.5.0\n\t * @since 4.2.0 Introduced the ability to order by specific clauses of a `$meta_query`, by passing the clause's\n\t * array key to `$orderby`.\n\t * @since 4.4.0 Introduced `$post_name__in` and `$title` parameters. `$s` was updated to support excluded\n\t * search terms, by prepending a hyphen.\n\t * @since 4.5.0 Removed the `$comments_popup` parameter.\n\t * Introduced the `$comment_status` and `$ping_status` parameters.\n\t * Introduced `RAND(x)` syntax for `$orderby`, which allows an integer seed value to random sorts.\n\t * @since 4.6.0 Added 'post_name__in' support for `$orderby`. Introduced the `$lazy_load_term_meta` argument.\n\t * @since 4.9.0 Introduced the `$comment_count` parameter.\n\t * @since 5.1.0 Introduced the `$meta_compare_key` parameter.\n\t *\n\t * @param string|array $query {\n\t * Optional. Array or string of Query parameters.\n\t *\n\t * @type int $attachment_id Attachment post ID. Used for 'attachment' post_type.\n\t * @type int|string $author Author ID, or comma-separated list of IDs.\n\t * @type string $author_name User 'user_nicename'.\n\t * @type array $author__in An array of author IDs to query from.\n\t * @type array $author__not_in An array of author IDs not to query from.\n\t * @type bool $cache_results Whether to cache post information. Default true.\n\t * @type int|string $cat Category ID or comma-separated list of IDs (this or any children).\n\t * @type array $category__and An array of category IDs (AND in).\n\t * @type array $category__in An array of category IDs (OR in, no children).\n\t * @type array $category__not_in An array of category IDs (NOT in).\n\t * @type string $category_name Use category slug (not name, this or any children).\n\t * @type array|int $comment_count Filter results by comment count. Provide an integer to match\n\t * comment count exactly. Provide an array with integer 'value'\n\t * and 'compare' operator ('=', '!=', '>', '>=', '<', '<=' ) to\n\t * compare against comment_count in a specific way.\n\t * @type string $comment_status Comment status.\n\t * @type int $comments_per_page The number of comments to return per page.\n\t * Default 'comments_per_page' option.\n\t * @type array $date_query An associative array of WP_Date_Query arguments.\n\t * See WP_Date_Query::__construct().\n\t * @type int $day Day of the month. Default empty. Accepts numbers 1-31.\n\t * @type bool $exact Whether to search by exact keyword. Default false.\n\t * @type string|array $fields Which fields to return. Single field or all fields (string),\n\t * or array of fields. 'id=>parent' uses 'id' and 'post_parent'.\n\t * Default all fields. Accepts 'ids', 'id=>parent'.\n\t * @type int $hour Hour of the day. Default empty. Accepts numbers 0-23.\n\t * @type int|bool $ignore_sticky_posts Whether to ignore sticky posts or not. Setting this to false\n\t * excludes stickies from 'post__in'. Accepts 1|true, 0|false.\n\t * Default 0|false.\n\t * @type int $m Combination YearMonth. Accepts any four-digit year and month\n\t * numbers 1-12. Default empty.\n\t * @type string $meta_compare Comparison operator to test the 'meta_value'.\n\t * @type string $meta_compare_key Comparison operator to test the 'meta_key'.\n\t * @type string $meta_key Custom field key.\n\t * @type array $meta_query An associative array of WP_Meta_Query arguments. See WP_Meta_Query.\n\t * @type string $meta_value Custom field value.\n\t * @type int $meta_value_num Custom field value number.\n\t * @type int $menu_order The menu order of the posts.\n\t * @type int $monthnum The two-digit month. Default empty. Accepts numbers 1-12.\n\t * @type string $name Post slug.\n\t * @type bool $nopaging Show all posts (true) or paginate (false). Default false.\n\t * @type bool $no_found_rows Whether to skip counting the total rows found. Enabling can improve\n\t * performance. Default false.\n\t * @type int $offset The number of posts to offset before retrieval.\n\t * @type string $order Designates ascending or descending order of posts. Default 'DESC'.\n\t * Accepts 'ASC', 'DESC'.\n\t * @type string|array $orderby Sort retrieved posts by parameter. One or more options may be\n\t * passed. To use 'meta_value', or 'meta_value_num',\n\t * 'meta_key=keyname' must be also be defined. To sort by a\n\t * specific `$meta_query` clause, use that clause's array key.\n\t * Accepts 'none', 'name', 'author', 'date', 'title',\n\t * 'modified', 'menu_order', 'parent', 'ID', 'rand',\n\t * 'relevance', 'RAND(x)' (where 'x' is an integer seed value),\n\t * 'comment_count', 'meta_value', 'meta_value_num', 'post__in',\n\t * 'post_name__in', 'post_parent__in', and the array keys\n\t * of `$meta_query`. Default is 'date', except when a search\n\t * is being performed, when the default is 'relevance'.\n\t *\n\t * @type int $p Post ID.\n\t * @type int $page Show the number of posts that would show up on page X of a\n\t * static front page.\n\t * @type int $paged The number of the current page.\n\t * @type int $page_id Page ID.\n\t * @type string $pagename Page slug.\n\t * @type string $perm Show posts if user has the appropriate capability.\n\t * @type string $ping_status Ping status.\n\t * @type array $post__in An array of post IDs to retrieve, sticky posts will be included\n\t * @type string $post_mime_type The mime type of the post. Used for 'attachment' post_type.\n\t * @type array $post__not_in An array of post IDs not to retrieve. Note: a string of comma-\n\t * separated IDs will NOT work.\n\t * @type int $post_parent Page ID to retrieve child pages for. Use 0 to only retrieve\n\t * top-level pages.\n\t * @type array $post_parent__in An array containing parent page IDs to query child pages from.\n\t * @type array $post_parent__not_in An array containing parent page IDs not to query child pages from.\n\t * @type string|array $post_type A post type slug (string) or array of post type slugs.\n\t * Default 'any' if using 'tax_query'.\n\t * @type string|array $post_status A post status (string) or array of post statuses.\n\t * @type int $posts_per_page The number of posts to query for. Use -1 to request all posts.\n\t * @type int $posts_per_archive_page The number of posts to query for by archive page. Overrides\n\t * 'posts_per_page' when is_archive(), or is_search() are true.\n\t * @type array $post_name__in An array of post slugs that results must match.\n\t * @type string $s Search keyword(s). Prepending a term with a hyphen will\n\t * exclude posts matching that term. Eg, 'pillow -sofa' will\n\t * return posts containing 'pillow' but not 'sofa'. The\n\t * character used for exclusion can be modified using the\n\t * the 'wp_query_search_exclusion_prefix' filter.\n\t * @type int $second Second of the minute. Default empty. Accepts numbers 0-60.\n\t * @type bool $sentence Whether to search by phrase. Default false.\n\t * @type bool $suppress_filters Whether to suppress filters. Default false.\n\t * @type string $tag Tag slug. Comma-separated (either), Plus-separated (all).\n\t * @type array $tag__and An array of tag ids (AND in).\n\t * @type array $tag__in An array of tag ids (OR in).\n\t * @type array $tag__not_in An array of tag ids (NOT in).\n\t * @type int $tag_id Tag id or comma-separated list of IDs.\n\t * @type array $tag_slug__and An array of tag slugs (AND in).\n\t * @type array $tag_slug__in An array of tag slugs (OR in). unless 'ignore_sticky_posts' is\n\t * true. Note: a string of comma-separated IDs will NOT work.\n\t * @type array $tax_query An associative array of WP_Tax_Query arguments.\n\t * See WP_Tax_Query->queries.\n\t * @type string $title Post title.\n\t * @type bool $update_post_meta_cache Whether to update the post meta cache. Default true.\n\t * @type bool $update_post_term_cache Whether to update the post term cache. Default true.\n\t * @type bool $lazy_load_term_meta Whether to lazy-load term meta. Setting to false will\n\t * disable cache priming for term meta, so that each\n\t * get_term_meta() call will hit the database.\n\t * Defaults to the value of `$update_post_term_cache`.\n\t * @type int $w The week number of the year. Default empty. Accepts numbers 0-53.\n\t * @type int $year The four-digit year. Default empty. Accepts any four-digit year.\n\t * }\n\t */\n\tpublic function parse_query( $query = '' ) {\n\t\tif ( ! empty( $query ) ) {\n\t\t\t$this->init();\n\t\t\t$this->query = $this->query_vars = wp_parse_args( $query );\n\t\t} elseif ( ! isset( $this->query ) ) {\n\t\t\t$this->query = $this->query_vars;\n\t\t}",
"\t\t$this->query_vars = $this->fill_query_vars( $this->query_vars );\n\t\t$qv = &$this->query_vars;\n\t\t$this->query_vars_changed = true;",
"\t\tif ( ! empty( $qv['robots'] ) ) {\n\t\t\t$this->is_robots = true;\n\t\t}",
"\t\tif ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) {\n\t\t\t$qv['p'] = 0;\n\t\t\t$qv['error'] = '404';\n\t\t} else {\n\t\t\t$qv['p'] = intval( $qv['p'] );\n\t\t}",
"\t\t$qv['page_id'] = absint( $qv['page_id'] );\n\t\t$qv['year'] = absint( $qv['year'] );\n\t\t$qv['monthnum'] = absint( $qv['monthnum'] );\n\t\t$qv['day'] = absint( $qv['day'] );\n\t\t$qv['w'] = absint( $qv['w'] );\n\t\t$qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : '';\n\t\t$qv['paged'] = absint( $qv['paged'] );\n\t\t$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers\n\t\t$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers\n\t\t$qv['pagename'] = trim( $qv['pagename'] );\n\t\t$qv['name'] = trim( $qv['name'] );\n\t\t$qv['title'] = trim( $qv['title'] );\n\t\tif ( '' !== $qv['hour'] ) {\n\t\t\t$qv['hour'] = absint( $qv['hour'] );\n\t\t}\n\t\tif ( '' !== $qv['minute'] ) {\n\t\t\t$qv['minute'] = absint( $qv['minute'] );\n\t\t}\n\t\tif ( '' !== $qv['second'] ) {\n\t\t\t$qv['second'] = absint( $qv['second'] );\n\t\t}\n\t\tif ( '' !== $qv['menu_order'] ) {\n\t\t\t$qv['menu_order'] = absint( $qv['menu_order'] );\n\t\t}",
"\t\t// Fairly insane upper bound for search string lengths.\n\t\tif ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {\n\t\t\t$qv['s'] = '';\n\t\t}",
"\t\t// Compat. Map subpost to attachment.\n\t\tif ( '' != $qv['subpost'] ) {\n\t\t\t$qv['attachment'] = $qv['subpost'];\n\t\t}\n\t\tif ( '' != $qv['subpost_id'] ) {\n\t\t\t$qv['attachment_id'] = $qv['subpost_id'];\n\t\t}",
"\t\t$qv['attachment_id'] = absint( $qv['attachment_id'] );",
"\t\tif ( ( '' != $qv['attachment'] ) || ! empty( $qv['attachment_id'] ) ) {\n\t\t\t$this->is_single = true;\n\t\t\t$this->is_attachment = true;\n\t\t} elseif ( '' != $qv['name'] ) {\n\t\t\t$this->is_single = true;\n\t\t} elseif ( $qv['p'] ) {\n\t\t\t$this->is_single = true;\n\t\t} elseif ( ( '' !== $qv['hour'] ) && ( '' !== $qv['minute'] ) && ( '' !== $qv['second'] ) && ( '' != $qv['year'] ) && ( '' != $qv['monthnum'] ) && ( '' != $qv['day'] ) ) {\n\t\t\t// If year, month, day, hour, minute, and second are set, a single\n\t\t\t// post is being queried.\n\t\t\t$this->is_single = true;",
"\t\t} elseif ( '' != $qv['pagename'] || ! empty( $qv['page_id'] ) ) {",
"\t\t\t$this->is_page = true;\n\t\t\t$this->is_single = false;\n\t\t} else {\n\t\t\t// Look for archive queries. Dates, categories, authors, search, post type archives.",
"\t\t\tif ( isset( $this->query['s'] ) ) {\n\t\t\t\t$this->is_search = true;\n\t\t\t}",
"\t\t\tif ( '' !== $qv['second'] ) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\tif ( '' !== $qv['minute'] ) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\tif ( '' !== $qv['hour'] ) {\n\t\t\t\t$this->is_time = true;\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\tif ( $qv['day'] ) {\n\t\t\t\tif ( ! $this->is_date ) {\n\t\t\t\t\t$date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );\n\t\t\t\t\tif ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {\n\t\t\t\t\t\t$qv['error'] = '404';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->is_day = true;\n\t\t\t\t\t\t$this->is_date = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $qv['monthnum'] ) {\n\t\t\t\tif ( ! $this->is_date ) {\n\t\t\t\t\tif ( 12 < $qv['monthnum'] ) {\n\t\t\t\t\t\t$qv['error'] = '404';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->is_month = true;\n\t\t\t\t\t\t$this->is_date = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $qv['year'] ) {\n\t\t\t\tif ( ! $this->is_date ) {\n\t\t\t\t\t$this->is_year = true;\n\t\t\t\t\t$this->is_date = true;\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $qv['m'] ) {\n\t\t\t\t$this->is_date = true;\n\t\t\t\tif ( strlen( $qv['m'] ) > 9 ) {\n\t\t\t\t\t$this->is_time = true;\n\t\t\t\t} elseif ( strlen( $qv['m'] ) > 7 ) {\n\t\t\t\t\t$this->is_day = true;\n\t\t\t\t} elseif ( strlen( $qv['m'] ) > 5 ) {\n\t\t\t\t\t$this->is_month = true;\n\t\t\t\t} else {\n\t\t\t\t\t$this->is_year = true;\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( '' != $qv['w'] ) {\n\t\t\t\t$this->is_date = true;\n\t\t\t}",
"\t\t\t$this->query_vars_hash = false;\n\t\t\t$this->parse_tax_query( $qv );",
"\t\t\tforeach ( $this->tax_query->queries as $tax_query ) {\n\t\t\t\tif ( ! is_array( $tax_query ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"\t\t\t\tif ( isset( $tax_query['operator'] ) && 'NOT IN' != $tax_query['operator'] ) {\n\t\t\t\t\tswitch ( $tax_query['taxonomy'] ) {\n\t\t\t\t\t\tcase 'category':\n\t\t\t\t\t\t\t$this->is_category = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'post_tag':\n\t\t\t\t\t\t\t$this->is_tag = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t$this->is_tax = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tunset( $tax_query );",
"\t\t\tif ( empty( $qv['author'] ) || ( $qv['author'] == '0' ) ) {\n\t\t\t\t$this->is_author = false;\n\t\t\t} else {\n\t\t\t\t$this->is_author = true;\n\t\t\t}",
"\t\t\tif ( '' != $qv['author_name'] ) {\n\t\t\t\t$this->is_author = true;\n\t\t\t}",
"\t\t\tif ( ! empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {\n\t\t\t\t$post_type_obj = get_post_type_object( $qv['post_type'] );\n\t\t\t\tif ( ! empty( $post_type_obj->has_archive ) ) {\n\t\t\t\t\t$this->is_post_type_archive = true;\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) {\n\t\t\t\t$this->is_archive = true;\n\t\t\t}\n\t\t}",
"\t\tif ( '' != $qv['feed'] ) {\n\t\t\t$this->is_feed = true;\n\t\t}",
"\t\tif ( '' != $qv['embed'] ) {\n\t\t\t$this->is_embed = true;\n\t\t}",
"\t\tif ( '' != $qv['tb'] ) {\n\t\t\t$this->is_trackback = true;\n\t\t}",
"\t\tif ( '' != $qv['paged'] && ( intval( $qv['paged'] ) > 1 ) ) {\n\t\t\t$this->is_paged = true;\n\t\t}",
"\t\t// if we're previewing inside the write screen\n\t\tif ( '' != $qv['preview'] ) {\n\t\t\t$this->is_preview = true;\n\t\t}",
"\t\tif ( is_admin() ) {\n\t\t\t$this->is_admin = true;\n\t\t}",
"\t\tif ( false !== strpos( $qv['feed'], 'comments-' ) ) {\n\t\t\t$qv['feed'] = str_replace( 'comments-', '', $qv['feed'] );\n\t\t\t$qv['withcomments'] = 1;\n\t\t}",
"\t\t$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;",
"\t\tif ( $this->is_feed && ( ! empty( $qv['withcomments'] ) || ( empty( $qv['withoutcomments'] ) && $this->is_singular ) ) ) {\n\t\t\t$this->is_comment_feed = true;\n\t\t}",
"\t\tif ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) ) {\n\t\t\t$this->is_home = true;\n\t\t}",
"\t\t// Correct is_* for page_on_front and page_for_posts\n\t\tif ( $this->is_home && 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) ) {\n\t\t\t$_query = wp_parse_args( $this->query );\n\t\t\t// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.\n\t\t\tif ( isset( $_query['pagename'] ) && '' == $_query['pagename'] ) {\n\t\t\t\tunset( $_query['pagename'] );\n\t\t\t}",
"\t\t\tunset( $_query['embed'] );",
"\t\t\tif ( empty( $_query ) || ! array_diff( array_keys( $_query ), array( 'preview', 'page', 'paged', 'cpage' ) ) ) {\n\t\t\t\t$this->is_page = true;\n\t\t\t\t$this->is_home = false;\n\t\t\t\t$qv['page_id'] = get_option( 'page_on_front' );\n\t\t\t\t// Correct <!--nextpage--> for page_on_front\n\t\t\t\tif ( ! empty( $qv['paged'] ) ) {\n\t\t\t\t\t$qv['page'] = $qv['paged'];\n\t\t\t\t\tunset( $qv['paged'] );\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tif ( '' != $qv['pagename'] ) {\n\t\t\t$this->queried_object = get_page_by_path( $qv['pagename'] );",
"\t\t\tif ( $this->queried_object && 'attachment' == $this->queried_object->post_type ) {\n\t\t\t\tif ( preg_match( '/^[^%]*%(?:postname)%/', get_option( 'permalink_structure' ) ) ) {\n\t\t\t\t\t// See if we also have a post with the same slug\n\t\t\t\t\t$post = get_page_by_path( $qv['pagename'], OBJECT, 'post' );\n\t\t\t\t\tif ( $post ) {\n\t\t\t\t\t\t$this->queried_object = $post;\n\t\t\t\t\t\t$this->is_page = false;\n\t\t\t\t\t\t$this->is_single = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( ! empty( $this->queried_object ) ) {\n\t\t\t\t$this->queried_object_id = (int) $this->queried_object->ID;\n\t\t\t} else {\n\t\t\t\tunset( $this->queried_object );\n\t\t\t}",
"\t\t\tif ( 'page' == get_option( 'show_on_front' ) && isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'page_for_posts' ) ) {\n\t\t\t\t$this->is_page = false;\n\t\t\t\t$this->is_home = true;\n\t\t\t\t$this->is_posts_page = true;\n\t\t\t}",
"\t\t\tif ( isset( $this->queried_object_id ) && $this->queried_object_id == get_option( 'wp_page_for_privacy_policy' ) ) {\n\t\t\t\t$this->is_privacy_policy = true;\n\t\t\t}\n\t\t}",
"\t\tif ( $qv['page_id'] ) {\n\t\t\tif ( 'page' == get_option( 'show_on_front' ) && $qv['page_id'] == get_option( 'page_for_posts' ) ) {\n\t\t\t\t$this->is_page = false;\n\t\t\t\t$this->is_home = true;\n\t\t\t\t$this->is_posts_page = true;\n\t\t\t}",
"\t\t\tif ( $qv['page_id'] == get_option( 'wp_page_for_privacy_policy' ) ) {\n\t\t\t\t$this->is_privacy_policy = true;\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $qv['post_type'] ) ) {\n\t\t\tif ( is_array( $qv['post_type'] ) ) {\n\t\t\t\t$qv['post_type'] = array_map( 'sanitize_key', $qv['post_type'] );\n\t\t\t} else {\n\t\t\t\t$qv['post_type'] = sanitize_key( $qv['post_type'] );\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $qv['post_status'] ) ) {\n\t\t\tif ( is_array( $qv['post_status'] ) ) {\n\t\t\t\t$qv['post_status'] = array_map( 'sanitize_key', $qv['post_status'] );\n\t\t\t} else {\n\t\t\t\t$qv['post_status'] = preg_replace( '|[^a-z0-9_,-]|', '', $qv['post_status'] );\n\t\t\t}\n\t\t}",
"\t\tif ( $this->is_posts_page && ( ! isset( $qv['withcomments'] ) || ! $qv['withcomments'] ) ) {\n\t\t\t$this->is_comment_feed = false;\n\t\t}",
"\t\t$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;\n\t\t// Done correcting is_* for page_on_front and page_for_posts",
"\t\tif ( '404' == $qv['error'] ) {\n\t\t\t$this->set_404();\n\t\t}",
"\t\t$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );",
"\t\t$this->query_vars_hash = md5( serialize( $this->query_vars ) );\n\t\t$this->query_vars_changed = false;",
"\t\t/**\n\t\t * Fires after the main query vars have been parsed.\n\t\t *\n\t\t * @since 1.5.0\n\t\t *\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'parse_query', array( &$this ) );\n\t}",
"\t/**\n\t * Parses various taxonomy related query vars.\n\t *\n\t * For BC, this method is not marked as protected. See [28987].\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param array $q The query variables. Passed by reference.\n\t */\n\tpublic function parse_tax_query( &$q ) {\n\t\tif ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {\n\t\t\t$tax_query = $q['tax_query'];\n\t\t} else {\n\t\t\t$tax_query = array();\n\t\t}",
"\t\tif ( ! empty( $q['taxonomy'] ) && ! empty( $q['term'] ) ) {\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => $q['taxonomy'],\n\t\t\t\t'terms' => array( $q['term'] ),\n\t\t\t\t'field' => 'slug',\n\t\t\t);\n\t\t}",
"\t\tforeach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) {\n\t\t\tif ( 'post_tag' == $taxonomy ) {\n\t\t\t\tcontinue; // Handled further down in the $q['tag'] block\n\t\t\t}",
"\t\t\tif ( $t->query_var && ! empty( $q[ $t->query_var ] ) ) {\n\t\t\t\t$tax_query_defaults = array(\n\t\t\t\t\t'taxonomy' => $taxonomy,\n\t\t\t\t\t'field' => 'slug',\n\t\t\t\t);",
"\t\t\t\tif ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {\n\t\t\t\t\t$q[ $t->query_var ] = wp_basename( $q[ $t->query_var ] );\n\t\t\t\t}",
"\t\t\t\t$term = $q[ $t->query_var ];",
"\t\t\t\tif ( is_array( $term ) ) {\n\t\t\t\t\t$term = implode( ',', $term );\n\t\t\t\t}",
"\t\t\t\tif ( strpos( $term, '+' ) !== false ) {\n\t\t\t\t\t$terms = preg_split( '/[+]+/', $term );\n\t\t\t\t\tforeach ( $terms as $term ) {\n\t\t\t\t\t\t$tax_query[] = array_merge(\n\t\t\t\t\t\t\t$tax_query_defaults,\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'terms' => array( $term ),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$tax_query[] = array_merge(\n\t\t\t\t\t\t$tax_query_defaults,\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'terms' => preg_split( '/[,]+/', $term ),\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// If querystring 'cat' is an array, implode it.\n\t\tif ( is_array( $q['cat'] ) ) {\n\t\t\t$q['cat'] = implode( ',', $q['cat'] );\n\t\t}",
"\t\t// Category stuff\n\t\tif ( ! empty( $q['cat'] ) && ! $this->is_singular ) {\n\t\t\t$cat_in = $cat_not_in = array();",
"\t\t\t$cat_array = preg_split( '/[,\\s]+/', urldecode( $q['cat'] ) );\n\t\t\t$cat_array = array_map( 'intval', $cat_array );\n\t\t\t$q['cat'] = implode( ',', $cat_array );",
"\t\t\tforeach ( $cat_array as $cat ) {\n\t\t\t\tif ( $cat > 0 ) {\n\t\t\t\t\t$cat_in[] = $cat;\n\t\t\t\t} elseif ( $cat < 0 ) {\n\t\t\t\t\t$cat_not_in[] = abs( $cat );\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( ! empty( $cat_in ) ) {\n\t\t\t\t$tax_query[] = array(\n\t\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t\t'terms' => $cat_in,\n\t\t\t\t\t'field' => 'term_id',\n\t\t\t\t\t'include_children' => true,\n\t\t\t\t);\n\t\t\t}",
"\t\t\tif ( ! empty( $cat_not_in ) ) {\n\t\t\t\t$tax_query[] = array(\n\t\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t\t'terms' => $cat_not_in,\n\t\t\t\t\t'field' => 'term_id',\n\t\t\t\t\t'operator' => 'NOT IN',\n\t\t\t\t\t'include_children' => true,\n\t\t\t\t);\n\t\t\t}\n\t\t\tunset( $cat_array, $cat_in, $cat_not_in );\n\t\t}",
"\t\tif ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {\n\t\t\t$q['category__and'] = (array) $q['category__and'];\n\t\t\tif ( ! isset( $q['category__in'] ) ) {\n\t\t\t\t$q['category__in'] = array();\n\t\t\t}\n\t\t\t$q['category__in'][] = absint( reset( $q['category__and'] ) );\n\t\t\tunset( $q['category__and'] );\n\t\t}",
"\t\tif ( ! empty( $q['category__in'] ) ) {\n\t\t\t$q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t'terms' => $q['category__in'],\n\t\t\t\t'field' => 'term_id',\n\t\t\t\t'include_children' => false,\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['category__not_in'] ) ) {\n\t\t\t$q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t'terms' => $q['category__not_in'],\n\t\t\t\t'operator' => 'NOT IN',\n\t\t\t\t'include_children' => false,\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['category__and'] ) ) {\n\t\t\t$q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'category',\n\t\t\t\t'terms' => $q['category__and'],\n\t\t\t\t'field' => 'term_id',\n\t\t\t\t'operator' => 'AND',\n\t\t\t\t'include_children' => false,\n\t\t\t);\n\t\t}",
"\t\t// If querystring 'tag' is array, implode it.\n\t\tif ( is_array( $q['tag'] ) ) {\n\t\t\t$q['tag'] = implode( ',', $q['tag'] );\n\t\t}",
"\t\t// Tag stuff\n\t\tif ( '' != $q['tag'] && ! $this->is_singular && $this->query_vars_changed ) {\n\t\t\tif ( strpos( $q['tag'], ',' ) !== false ) {\n\t\t\t\t$tags = preg_split( '/[,\\r\\n\\t ]+/', $q['tag'] );\n\t\t\t\tforeach ( (array) $tags as $tag ) {\n\t\t\t\t\t$tag = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );\n\t\t\t\t\t$q['tag_slug__in'][] = $tag;\n\t\t\t\t}\n\t\t\t} elseif ( preg_match( '/[+\\r\\n\\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) {\n\t\t\t\t$tags = preg_split( '/[+\\r\\n\\t ]+/', $q['tag'] );\n\t\t\t\tforeach ( (array) $tags as $tag ) {\n\t\t\t\t\t$tag = sanitize_term_field( 'slug', $tag, 0, 'post_tag', 'db' );\n\t\t\t\t\t$q['tag_slug__and'][] = $tag;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$q['tag'] = sanitize_term_field( 'slug', $q['tag'], 0, 'post_tag', 'db' );\n\t\t\t\t$q['tag_slug__in'][] = $q['tag'];\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $q['tag_id'] ) ) {\n\t\t\t$q['tag_id'] = absint( $q['tag_id'] );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag_id'],\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag__in'] ) ) {\n\t\t\t$q['tag__in'] = array_map( 'absint', array_unique( (array) $q['tag__in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag__in'],\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag__not_in'] ) ) {\n\t\t\t$q['tag__not_in'] = array_map( 'absint', array_unique( (array) $q['tag__not_in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag__not_in'],\n\t\t\t\t'operator' => 'NOT IN',\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag__and'] ) ) {\n\t\t\t$q['tag__and'] = array_map( 'absint', array_unique( (array) $q['tag__and'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag__and'],\n\t\t\t\t'operator' => 'AND',\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag_slug__in'] ) ) {\n\t\t\t$q['tag_slug__in'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag_slug__in'],\n\t\t\t\t'field' => 'slug',\n\t\t\t);\n\t\t}",
"\t\tif ( ! empty( $q['tag_slug__and'] ) ) {\n\t\t\t$q['tag_slug__and'] = array_map( 'sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );\n\t\t\t$tax_query[] = array(\n\t\t\t\t'taxonomy' => 'post_tag',\n\t\t\t\t'terms' => $q['tag_slug__and'],\n\t\t\t\t'field' => 'slug',\n\t\t\t\t'operator' => 'AND',\n\t\t\t);\n\t\t}",
"\t\t$this->tax_query = new WP_Tax_Query( $tax_query );",
"\t\t/**\n\t\t * Fires after taxonomy-related query vars have been parsed.\n\t\t *\n\t\t * @since 3.7.0\n\t\t *\n\t\t * @param WP_Query $this The WP_Query instance.\n\t\t */\n\t\tdo_action( 'parse_tax_query', $this );\n\t}",
"\t/**\n\t * Generates SQL for the WHERE clause based on passed search terms.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @global wpdb $wpdb WordPress database abstraction object.\n\t *\n\t * @param array $q Query variables.\n\t * @return string WHERE clause.\n\t */\n\tprotected function parse_search( &$q ) {\n\t\tglobal $wpdb;",
"\t\t$search = '';",
"\t\t// added slashes screw with quote grouping when done early, so done later\n\t\t$q['s'] = stripslashes( $q['s'] );\n\t\tif ( empty( $_GET['s'] ) && $this->is_main_query() ) {\n\t\t\t$q['s'] = urldecode( $q['s'] );\n\t\t}\n\t\t// there are no line breaks in <input /> fields\n\t\t$q['s'] = str_replace( array( \"\\r\", \"\\n\" ), '', $q['s'] );\n\t\t$q['search_terms_count'] = 1;\n\t\tif ( ! empty( $q['sentence'] ) ) {\n\t\t\t$q['search_terms'] = array( $q['s'] );\n\t\t} else {\n\t\t\tif ( preg_match_all( '/\".*?(\"|$)|((?<=[\\t \",+])|^)[^\\t \",+]+/', $q['s'], $matches ) ) {\n\t\t\t\t$q['search_terms_count'] = count( $matches[0] );\n\t\t\t\t$q['search_terms'] = $this->parse_search_terms( $matches[0] );\n\t\t\t\t// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence\n\t\t\t\tif ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) {\n\t\t\t\t\t$q['search_terms'] = array( $q['s'] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$q['search_terms'] = array( $q['s'] );\n\t\t\t}\n\t\t}",
"\t\t$n = ! empty( $q['exact'] ) ? '' : '%';\n\t\t$searchand = '';\n\t\t$q['search_orderby_title'] = array();",
"\t\t/**\n\t\t * Filters the prefix that indicates that a search term should be excluded from results.\n\t\t *\n\t\t * @since 4.7.0\n\t\t *\n\t\t * @param string $exclusion_prefix The prefix. Default '-'. Returning\n\t\t * an empty value disables exclusions.\n\t\t */\n\t\t$exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' );",
"\t\tforeach ( $q['search_terms'] as $term ) {\n\t\t\t// If there is an $exclusion_prefix, terms prefixed with it should be excluded.\n\t\t\t$exclude = $exclusion_prefix && ( $exclusion_prefix === substr( $term, 0, 1 ) );\n\t\t\tif ( $exclude ) {\n\t\t\t\t$like_op = 'NOT LIKE';\n\t\t\t\t$andor_op = 'AND';\n\t\t\t\t$term = substr( $term, 1 );\n\t\t\t} else {\n\t\t\t\t$like_op = 'LIKE';\n\t\t\t\t$andor_op = 'OR';\n\t\t\t}",
"\t\t\tif ( $n && ! $exclude ) {\n\t\t\t\t$like = '%' . $wpdb->esc_like( $term ) . '%';\n\t\t\t\t$q['search_orderby_title'][] = $wpdb->prepare( \"{$wpdb->posts}.post_title LIKE %s\", $like );\n\t\t\t}",
"\t\t\t$like = $n . $wpdb->esc_like( $term ) . $n;\n\t\t\t$search .= $wpdb->prepare( \"{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))\", $like, $like, $like );\n\t\t\t$searchand = ' AND ';\n\t\t}",
"\t\tif ( ! empty( $search ) ) {\n\t\t\t$search = \" AND ({$search}) \";\n\t\t\tif ( ! is_user_logged_in() ) {\n\t\t\t\t$search .= \" AND ({$wpdb->posts}.post_password = '') \";\n\t\t\t}\n\t\t}",
"\t\treturn $search;\n\t}",
"\t/**\n\t * Check if the terms are suitable for searching.\n\t *\n\t * Uses an array of stopwords (terms) that are excluded from the separate\n\t * term matching when searching for posts. The list of English stopwords is\n\t * the approximate search engines list, and is translatable.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @param string[] $terms Array of terms to check.\n\t * @return array Terms that are not stopwords.\n\t */\n\tprotected function parse_search_terms( $terms ) {\n\t\t$strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower';\n\t\t$checked = array();",
"\t\t$stopwords = $this->get_search_stopwords();",
"\t\tforeach ( $terms as $term ) {\n\t\t\t// keep before/after spaces when term is for exact match\n\t\t\tif ( preg_match( '/^\".+\"$/', $term ) ) {\n\t\t\t\t$term = trim( $term, \"\\\"'\" );\n\t\t\t} else {\n\t\t\t\t$term = trim( $term, \"\\\"' \" );\n\t\t\t}",
"\t\t\t// Avoid single A-Z and single dashes.\n\t\t\tif ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\\-]$/i', $term ) ) ) {\n\t\t\t\tcontinue;\n\t\t\t}",
"\t\t\tif ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) {\n\t\t\t\tcontinue;\n\t\t\t}",
"\t\t\t$checked[] = $term;\n\t\t}",
"\t\treturn $checked;\n\t}",
"\t/**\n\t * Retrieve stopwords used when parsing search terms.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @return array Stopwords.\n\t */\n\tprotected function get_search_stopwords() {\n\t\tif ( isset( $this->stopwords ) ) {\n\t\t\treturn $this->stopwords;\n\t\t}",
"\t\t/* translators: This is a comma-separated list of very common words that should be excluded from a search,\n\t\t * like a, an, and the. These are usually called \"stopwords\". You should not simply translate these individual\n\t\t * words into your language. Instead, look for and provide commonly accepted stopwords in your language.\n\t\t */\n\t\t$words = explode(\n\t\t\t',',\n\t\t\t_x(\n\t\t\t\t'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',\n\t\t\t\t'Comma-separated list of search stopwords in your language'\n\t\t\t)\n\t\t);",
"\t\t$stopwords = array();\n\t\tforeach ( $words as $word ) {\n\t\t\t$word = trim( $word, \"\\r\\n\\t \" );\n\t\t\tif ( $word ) {\n\t\t\t\t$stopwords[] = $word;\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters stopwords used when parsing search terms.\n\t\t *\n\t\t * @since 3.7.0\n\t\t *\n\t\t * @param string[] $stopwords Array of stopwords.\n\t\t */\n\t\t$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );\n\t\treturn $this->stopwords;\n\t}",
"\t/**\n\t * Generates SQL for the ORDER BY condition based on passed search terms.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @global wpdb $wpdb WordPress database abstraction object.\n\t *\n\t * @param array $q Query variables.\n\t * @return string ORDER BY clause.\n\t */\n\tprotected function parse_search_order( &$q ) {\n\t\tglobal $wpdb;",
"\t\tif ( $q['search_terms_count'] > 1 ) {\n\t\t\t$num_terms = count( $q['search_orderby_title'] );",
"\t\t\t// If the search terms contain negative queries, don't bother ordering by sentence matches.\n\t\t\t$like = '';\n\t\t\tif ( ! preg_match( '/(?:\\s|^)\\-/', $q['s'] ) ) {\n\t\t\t\t$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';\n\t\t\t}",
"\t\t\t$search_orderby = '';",
"\t\t\t// sentence match in 'post_title'\n\t\t\tif ( $like ) {\n\t\t\t\t$search_orderby .= $wpdb->prepare( \"WHEN {$wpdb->posts}.post_title LIKE %s THEN 1 \", $like );\n\t\t\t}",
"\t\t\t// sanity limit, sort as sentence when more than 6 terms\n\t\t\t// (few searches are longer than 6 terms and most titles are not)\n\t\t\tif ( $num_terms < 7 ) {\n\t\t\t\t// all words in title\n\t\t\t\t$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';\n\t\t\t\t// any word in title, not needed when $num_terms == 1\n\t\t\t\tif ( $num_terms > 1 ) {\n\t\t\t\t\t$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// Sentence match in 'post_content' and 'post_excerpt'.\n\t\t\tif ( $like ) {\n\t\t\t\t$search_orderby .= $wpdb->prepare( \"WHEN {$wpdb->posts}.post_excerpt LIKE %s THEN 4 \", $like );\n\t\t\t\t$search_orderby .= $wpdb->prepare( \"WHEN {$wpdb->posts}.post_content LIKE %s THEN 5 \", $like );\n\t\t\t}",
"\t\t\tif ( $search_orderby ) {\n\t\t\t\t$search_orderby = '(CASE ' . $search_orderby . 'ELSE 6 END)';\n\t\t\t}\n\t\t} else {\n\t\t\t// single word or sentence search\n\t\t\t$search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';\n\t\t}",
"\t\treturn $search_orderby;\n\t}",
"\t/**\n\t * Converts the given orderby alias (if allowed) to a properly-prefixed value.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @global wpdb $wpdb WordPress database abstraction object.\n\t *\n\t * @param string $orderby Alias for the field to order by.\n\t * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise.\n\t */\n\tprotected function parse_orderby( $orderby ) {\n\t\tglobal $wpdb;",
"\t\t// Used to filter values.\n\t\t$allowed_keys = array(\n\t\t\t'post_name',\n\t\t\t'post_author',\n\t\t\t'post_date',\n\t\t\t'post_title',\n\t\t\t'post_modified',\n\t\t\t'post_parent',\n\t\t\t'post_type',\n\t\t\t'name',\n\t\t\t'author',\n\t\t\t'date',\n\t\t\t'title',\n\t\t\t'modified',\n\t\t\t'parent',\n\t\t\t'type',\n\t\t\t'ID',\n\t\t\t'menu_order',\n\t\t\t'comment_count',\n\t\t\t'rand',\n\t\t\t'post__in',\n\t\t\t'post_parent__in',\n\t\t\t'post_name__in',\n\t\t);",
"\t\t$primary_meta_key = '';\n\t\t$primary_meta_query = false;\n\t\t$meta_clauses = $this->meta_query->get_clauses();\n\t\tif ( ! empty( $meta_clauses ) ) {\n\t\t\t$primary_meta_query = reset( $meta_clauses );",
"\t\t\tif ( ! empty( $primary_meta_query['key'] ) ) {\n\t\t\t\t$primary_meta_key = $primary_meta_query['key'];\n\t\t\t\t$allowed_keys[] = $primary_meta_key;\n\t\t\t}",
"\t\t\t$allowed_keys[] = 'meta_value';\n\t\t\t$allowed_keys[] = 'meta_value_num';\n\t\t\t$allowed_keys = array_merge( $allowed_keys, array_keys( $meta_clauses ) );\n\t\t}",
"\t\t// If RAND() contains a seed value, sanitize and add to allowed keys.\n\t\t$rand_with_seed = false;\n\t\tif ( preg_match( '/RAND\\(([0-9]+)\\)/i', $orderby, $matches ) ) {\n\t\t\t$orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) );\n\t\t\t$allowed_keys[] = $orderby;\n\t\t\t$rand_with_seed = true;\n\t\t}",
"\t\tif ( ! in_array( $orderby, $allowed_keys, true ) ) {\n\t\t\treturn false;\n\t\t}",
"\t\t$orderby_clause = '';",
"\t\tswitch ( $orderby ) {\n\t\t\tcase 'post_name':\n\t\t\tcase 'post_author':\n\t\t\tcase 'post_date':\n\t\t\tcase 'post_title':\n\t\t\tcase 'post_modified':\n\t\t\tcase 'post_parent':\n\t\t\tcase 'post_type':\n\t\t\tcase 'ID':\n\t\t\tcase 'menu_order':\n\t\t\tcase 'comment_count':\n\t\t\t\t$orderby_clause = \"{$wpdb->posts}.{$orderby}\";\n\t\t\t\tbreak;\n\t\t\tcase 'rand':\n\t\t\t\t$orderby_clause = 'RAND()';\n\t\t\t\tbreak;\n\t\t\tcase $primary_meta_key:\n\t\t\tcase 'meta_value':\n\t\t\t\tif ( ! empty( $primary_meta_query['type'] ) ) {\n\t\t\t\t\t$orderby_clause = \"CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})\";\n\t\t\t\t} else {\n\t\t\t\t\t$orderby_clause = \"{$primary_meta_query['alias']}.meta_value\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'meta_value_num':\n\t\t\t\t$orderby_clause = \"{$primary_meta_query['alias']}.meta_value+0\";\n\t\t\t\tbreak;\n\t\t\tcase 'post__in':\n\t\t\t\tif ( ! empty( $this->query_vars['post__in'] ) ) {\n\t\t\t\t\t$orderby_clause = \"FIELD({$wpdb->posts}.ID,\" . implode( ',', array_map( 'absint', $this->query_vars['post__in'] ) ) . ')';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'post_parent__in':\n\t\t\t\tif ( ! empty( $this->query_vars['post_parent__in'] ) ) {\n\t\t\t\t\t$orderby_clause = \"FIELD( {$wpdb->posts}.post_parent,\" . implode( ', ', array_map( 'absint', $this->query_vars['post_parent__in'] ) ) . ' )';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'post_name__in':\n\t\t\t\tif ( ! empty( $this->query_vars['post_name__in'] ) ) {\n\t\t\t\t\t$post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] );\n\t\t\t\t\t$post_name__in_string = \"'\" . implode( \"','\", $post_name__in ) . \"'\";\n\t\t\t\t\t$orderby_clause = \"FIELD( {$wpdb->posts}.post_name,\" . $post_name__in_string . ' )';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif ( array_key_exists( $orderby, $meta_clauses ) ) {\n\t\t\t\t\t// $orderby corresponds to a meta_query clause.\n\t\t\t\t\t$meta_clause = $meta_clauses[ $orderby ];\n\t\t\t\t\t$orderby_clause = \"CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})\";\n\t\t\t\t} elseif ( $rand_with_seed ) {\n\t\t\t\t\t$orderby_clause = $orderby;\n\t\t\t\t} else {\n\t\t\t\t\t// Default: order by post field.\n\t\t\t\t\t$orderby_clause = \"{$wpdb->posts}.post_\" . sanitize_key( $orderby );\n\t\t\t\t}",
"\t\t\t\tbreak;\n\t\t}",
"\t\treturn $orderby_clause;\n\t}",
"\t/**\n\t * Parse an 'order' query variable and cast it to ASC or DESC as necessary.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $order The 'order' query variable.\n\t * @return string The sanitized 'order' query variable.\n\t */\n\tprotected function parse_order( $order ) {\n\t\tif ( ! is_string( $order ) || empty( $order ) ) {\n\t\t\treturn 'DESC';\n\t\t}",
"\t\tif ( 'ASC' === strtoupper( $order ) ) {\n\t\t\treturn 'ASC';\n\t\t} else {\n\t\t\treturn 'DESC';\n\t\t}\n\t}",
"\t/**\n\t * Sets the 404 property and saves whether query is feed.\n\t *\n\t * @since 2.0.0\n\t */\n\tpublic function set_404() {\n\t\t$is_feed = $this->is_feed;",
"\t\t$this->init_query_flags();\n\t\t$this->is_404 = true;",
"\t\t$this->is_feed = $is_feed;\n\t}",
"\t/**\n\t * Retrieve query variable.\n\t *\n\t * @since 1.5.0\n\t * @since 3.9.0 The `$default` argument was introduced.\n\t *\n\t * @param string $query_var Query variable key.\n\t * @param mixed $default Optional. Value to return if the query variable is not set. Default empty.\n\t * @return mixed Contents of the query variable.\n\t */\n\tpublic function get( $query_var, $default = '' ) {\n\t\tif ( isset( $this->query_vars[ $query_var ] ) ) {\n\t\t\treturn $this->query_vars[ $query_var ];\n\t\t}",
"\t\treturn $default;\n\t}",
"\t/**\n\t * Set query variable.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @param string $query_var Query variable key.\n\t * @param mixed $value Query variable value.\n\t */\n\tpublic function set( $query_var, $value ) {\n\t\t$this->query_vars[ $query_var ] = $value;\n\t}",
"\t/**\n\t * Retrieves an array of posts based on query variables.\n\t *\n\t * There are a few filters and actions that can be used to modify the post\n\t * database query.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return WP_Post[]|int[] Array of post objects or post IDs.\n\t */\n\tpublic function get_posts() {\n\t\tglobal $wpdb;",
"\t\t$this->parse_query();",
"\t\t/**\n\t\t * Fires after the query variable object is created, but before the actual query is run.\n\t\t *\n\t\t * Note: If using conditional tags, use the method versions within the passed instance\n\t\t * (e.g. $this->is_main_query() instead of is_main_query()). This is because the functions\n\t\t * like is_main_query() test against the global $wp_query instance, not the passed one.\n\t\t *\n\t\t * @since 2.0.0\n\t\t *\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'pre_get_posts', array( &$this ) );",
"\t\t// Shorthand.\n\t\t$q = &$this->query_vars;",
"\t\t// Fill again in case pre_get_posts unset some vars.\n\t\t$q = $this->fill_query_vars( $q );",
"\t\t// Parse meta query\n\t\t$this->meta_query = new WP_Meta_Query();\n\t\t$this->meta_query->parse_query_vars( $q );",
"\t\t// Set a flag if a pre_get_posts hook changed the query vars.\n\t\t$hash = md5( serialize( $this->query_vars ) );\n\t\tif ( $hash != $this->query_vars_hash ) {\n\t\t\t$this->query_vars_changed = true;\n\t\t\t$this->query_vars_hash = $hash;\n\t\t}\n\t\tunset( $hash );",
"\t\t// First let's clear some variables\n\t\t$distinct = '';\n\t\t$whichauthor = '';\n\t\t$whichmimetype = '';\n\t\t$where = '';\n\t\t$limits = '';\n\t\t$join = '';\n\t\t$search = '';\n\t\t$groupby = '';\n\t\t$post_status_join = false;\n\t\t$page = 1;",
"\t\tif ( isset( $q['caller_get_posts'] ) ) {\n\t\t\t_deprecated_argument(\n\t\t\t\t'WP_Query',\n\t\t\t\t'3.1.0',\n\t\t\t\t/* translators: 1: caller_get_posts, 2: ignore_sticky_posts */\n\t\t\t\tsprintf(\n\t\t\t\t\t__( '%1$s is deprecated. Use %2$s instead.' ),\n\t\t\t\t\t'<code>caller_get_posts</code>',\n\t\t\t\t\t'<code>ignore_sticky_posts</code>'\n\t\t\t\t)\n\t\t\t);",
"\t\t\tif ( ! isset( $q['ignore_sticky_posts'] ) ) {\n\t\t\t\t$q['ignore_sticky_posts'] = $q['caller_get_posts'];\n\t\t\t}\n\t\t}",
"\t\tif ( ! isset( $q['ignore_sticky_posts'] ) ) {\n\t\t\t$q['ignore_sticky_posts'] = false;\n\t\t}",
"\t\tif ( ! isset( $q['suppress_filters'] ) ) {\n\t\t\t$q['suppress_filters'] = false;\n\t\t}",
"\t\tif ( ! isset( $q['cache_results'] ) ) {\n\t\t\tif ( wp_using_ext_object_cache() ) {\n\t\t\t\t$q['cache_results'] = false;\n\t\t\t} else {\n\t\t\t\t$q['cache_results'] = true;\n\t\t\t}\n\t\t}",
"\t\tif ( ! isset( $q['update_post_term_cache'] ) ) {\n\t\t\t$q['update_post_term_cache'] = true;\n\t\t}",
"\t\tif ( ! isset( $q['lazy_load_term_meta'] ) ) {\n\t\t\t$q['lazy_load_term_meta'] = $q['update_post_term_cache'];\n\t\t}",
"\t\tif ( ! isset( $q['update_post_meta_cache'] ) ) {\n\t\t\t$q['update_post_meta_cache'] = true;\n\t\t}",
"\t\tif ( ! isset( $q['post_type'] ) ) {\n\t\t\tif ( $this->is_search ) {\n\t\t\t\t$q['post_type'] = 'any';\n\t\t\t} else {\n\t\t\t\t$q['post_type'] = '';\n\t\t\t}\n\t\t}\n\t\t$post_type = $q['post_type'];\n\t\tif ( empty( $q['posts_per_page'] ) ) {\n\t\t\t$q['posts_per_page'] = get_option( 'posts_per_page' );\n\t\t}\n\t\tif ( isset( $q['showposts'] ) && $q['showposts'] ) {\n\t\t\t$q['showposts'] = (int) $q['showposts'];\n\t\t\t$q['posts_per_page'] = $q['showposts'];\n\t\t}\n\t\tif ( ( isset( $q['posts_per_archive_page'] ) && $q['posts_per_archive_page'] != 0 ) && ( $this->is_archive || $this->is_search ) ) {\n\t\t\t$q['posts_per_page'] = $q['posts_per_archive_page'];\n\t\t}\n\t\tif ( ! isset( $q['nopaging'] ) ) {\n\t\t\tif ( $q['posts_per_page'] == -1 ) {\n\t\t\t\t$q['nopaging'] = true;\n\t\t\t} else {\n\t\t\t\t$q['nopaging'] = false;\n\t\t\t}\n\t\t}",
"\t\tif ( $this->is_feed ) {\n\t\t\t// This overrides posts_per_page.\n\t\t\tif ( ! empty( $q['posts_per_rss'] ) ) {\n\t\t\t\t$q['posts_per_page'] = $q['posts_per_rss'];\n\t\t\t} else {\n\t\t\t\t$q['posts_per_page'] = get_option( 'posts_per_rss' );\n\t\t\t}\n\t\t\t$q['nopaging'] = false;\n\t\t}\n\t\t$q['posts_per_page'] = (int) $q['posts_per_page'];\n\t\tif ( $q['posts_per_page'] < -1 ) {\n\t\t\t$q['posts_per_page'] = abs( $q['posts_per_page'] );\n\t\t} elseif ( $q['posts_per_page'] == 0 ) {\n\t\t\t$q['posts_per_page'] = 1;\n\t\t}",
"\t\tif ( ! isset( $q['comments_per_page'] ) || $q['comments_per_page'] == 0 ) {\n\t\t\t$q['comments_per_page'] = get_option( 'comments_per_page' );\n\t\t}",
"\t\tif ( $this->is_home && ( empty( $this->query ) || $q['preview'] == 'true' ) && ( 'page' == get_option( 'show_on_front' ) ) && get_option( 'page_on_front' ) ) {\n\t\t\t$this->is_page = true;\n\t\t\t$this->is_home = false;\n\t\t\t$q['page_id'] = get_option( 'page_on_front' );\n\t\t}",
"\t\tif ( isset( $q['page'] ) ) {\n\t\t\t$q['page'] = trim( $q['page'], '/' );\n\t\t\t$q['page'] = absint( $q['page'] );\n\t\t}",
"\t\t// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.\n\t\tif ( isset( $q['no_found_rows'] ) ) {\n\t\t\t$q['no_found_rows'] = (bool) $q['no_found_rows'];\n\t\t} else {\n\t\t\t$q['no_found_rows'] = false;\n\t\t}",
"\t\tswitch ( $q['fields'] ) {\n\t\t\tcase 'ids':\n\t\t\t\t$fields = \"{$wpdb->posts}.ID\";\n\t\t\t\tbreak;\n\t\t\tcase 'id=>parent':\n\t\t\t\t$fields = \"{$wpdb->posts}.ID, {$wpdb->posts}.post_parent\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$fields = \"{$wpdb->posts}.*\";\n\t\t}",
"\t\tif ( '' !== $q['menu_order'] ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.menu_order = \" . $q['menu_order'];\n\t\t}\n\t\t// The \"m\" parameter is meant for months but accepts datetimes of varying specificity\n\t\tif ( $q['m'] ) {\n\t\t\t$where .= \" AND YEAR({$wpdb->posts}.post_date)=\" . substr( $q['m'], 0, 4 );\n\t\t\tif ( strlen( $q['m'] ) > 5 ) {\n\t\t\t\t$where .= \" AND MONTH({$wpdb->posts}.post_date)=\" . substr( $q['m'], 4, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 7 ) {\n\t\t\t\t$where .= \" AND DAYOFMONTH({$wpdb->posts}.post_date)=\" . substr( $q['m'], 6, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 9 ) {\n\t\t\t\t$where .= \" AND HOUR({$wpdb->posts}.post_date)=\" . substr( $q['m'], 8, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 11 ) {\n\t\t\t\t$where .= \" AND MINUTE({$wpdb->posts}.post_date)=\" . substr( $q['m'], 10, 2 );\n\t\t\t}\n\t\t\tif ( strlen( $q['m'] ) > 13 ) {\n\t\t\t\t$where .= \" AND SECOND({$wpdb->posts}.post_date)=\" . substr( $q['m'], 12, 2 );\n\t\t\t}\n\t\t}",
"\t\t// Handle the other individual date parameters\n\t\t$date_parameters = array();",
"\t\tif ( '' !== $q['hour'] ) {\n\t\t\t$date_parameters['hour'] = $q['hour'];\n\t\t}",
"\t\tif ( '' !== $q['minute'] ) {\n\t\t\t$date_parameters['minute'] = $q['minute'];\n\t\t}",
"\t\tif ( '' !== $q['second'] ) {\n\t\t\t$date_parameters['second'] = $q['second'];\n\t\t}",
"\t\tif ( $q['year'] ) {\n\t\t\t$date_parameters['year'] = $q['year'];\n\t\t}",
"\t\tif ( $q['monthnum'] ) {\n\t\t\t$date_parameters['monthnum'] = $q['monthnum'];\n\t\t}",
"\t\tif ( $q['w'] ) {\n\t\t\t$date_parameters['week'] = $q['w'];\n\t\t}",
"\t\tif ( $q['day'] ) {\n\t\t\t$date_parameters['day'] = $q['day'];\n\t\t}",
"\t\tif ( $date_parameters ) {\n\t\t\t$date_query = new WP_Date_Query( array( $date_parameters ) );\n\t\t\t$where .= $date_query->get_sql();\n\t\t}\n\t\tunset( $date_parameters, $date_query );",
"\t\t// Handle complex date queries\n\t\tif ( ! empty( $q['date_query'] ) ) {\n\t\t\t$this->date_query = new WP_Date_Query( $q['date_query'] );\n\t\t\t$where .= $this->date_query->get_sql();\n\t\t}",
"\t\t// If we've got a post_type AND it's not \"any\" post_type.\n\t\tif ( ! empty( $q['post_type'] ) && 'any' != $q['post_type'] ) {\n\t\t\tforeach ( (array) $q['post_type'] as $_post_type ) {\n\t\t\t\t$ptype_obj = get_post_type_object( $_post_type );\n\t\t\t\tif ( ! $ptype_obj || ! $ptype_obj->query_var || empty( $q[ $ptype_obj->query_var ] ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"\t\t\t\tif ( ! $ptype_obj->hierarchical ) {\n\t\t\t\t\t// Non-hierarchical post types can directly use 'name'.\n\t\t\t\t\t$q['name'] = $q[ $ptype_obj->query_var ];\n\t\t\t\t} else {\n\t\t\t\t\t// Hierarchical post types will operate through 'pagename'.\n\t\t\t\t\t$q['pagename'] = $q[ $ptype_obj->query_var ];\n\t\t\t\t\t$q['name'] = '';\n\t\t\t\t}",
"\t\t\t\t// Only one request for a slug is possible, this is why name & pagename are overwritten above.\n\t\t\t\tbreak;\n\t\t\t} //end foreach\n\t\t\tunset( $ptype_obj );\n\t\t}",
"\t\tif ( '' !== $q['title'] ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_title = %s\", stripslashes( $q['title'] ) );\n\t\t}",
"\t\t// Parameters related to 'post_name'.\n\t\tif ( '' != $q['name'] ) {\n\t\t\t$q['name'] = sanitize_title_for_query( $q['name'] );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_name = '\" . $q['name'] . \"'\";\n\t\t} elseif ( '' != $q['pagename'] ) {\n\t\t\tif ( isset( $this->queried_object_id ) ) {\n\t\t\t\t$reqpage = $this->queried_object_id;\n\t\t\t} else {\n\t\t\t\tif ( 'page' != $q['post_type'] ) {\n\t\t\t\t\tforeach ( (array) $q['post_type'] as $_post_type ) {\n\t\t\t\t\t\t$ptype_obj = get_post_type_object( $_post_type );\n\t\t\t\t\t\tif ( ! $ptype_obj || ! $ptype_obj->hierarchical ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}",
"\t\t\t\t\t\t$reqpage = get_page_by_path( $q['pagename'], OBJECT, $_post_type );\n\t\t\t\t\t\tif ( $reqpage ) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tunset( $ptype_obj );\n\t\t\t\t} else {\n\t\t\t\t\t$reqpage = get_page_by_path( $q['pagename'] );\n\t\t\t\t}\n\t\t\t\tif ( ! empty( $reqpage ) ) {\n\t\t\t\t\t$reqpage = $reqpage->ID;\n\t\t\t\t} else {\n\t\t\t\t\t$reqpage = 0;\n\t\t\t\t}\n\t\t\t}",
"\t\t\t$page_for_posts = get_option( 'page_for_posts' );\n\t\t\tif ( ( 'page' != get_option( 'show_on_front' ) ) || empty( $page_for_posts ) || ( $reqpage != $page_for_posts ) ) {\n\t\t\t\t$q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );\n\t\t\t\t$q['name'] = $q['pagename'];\n\t\t\t\t$where .= \" AND ({$wpdb->posts}.ID = '$reqpage')\";\n\t\t\t\t$reqpage_obj = get_post( $reqpage );\n\t\t\t\tif ( is_object( $reqpage_obj ) && 'attachment' == $reqpage_obj->post_type ) {\n\t\t\t\t\t$this->is_attachment = true;\n\t\t\t\t\t$post_type = $q['post_type'] = 'attachment';\n\t\t\t\t\t$this->is_page = true;\n\t\t\t\t\t$q['attachment_id'] = $reqpage;\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif ( '' != $q['attachment'] ) {\n\t\t\t$q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) );\n\t\t\t$q['name'] = $q['attachment'];\n\t\t\t$where .= \" AND {$wpdb->posts}.post_name = '\" . $q['attachment'] . \"'\";\n\t\t} elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) {\n\t\t\t$q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] );\n\t\t\t$post_name__in = \"'\" . implode( \"','\", $q['post_name__in'] ) . \"'\";\n\t\t\t$where .= \" AND {$wpdb->posts}.post_name IN ($post_name__in)\";\n\t\t}",
"\t\t// If an attachment is requested by number, let it supersede any post number.\n\t\tif ( $q['attachment_id'] ) {\n\t\t\t$q['p'] = absint( $q['attachment_id'] );\n\t\t}",
"\t\t// If a post number is specified, load that post\n\t\tif ( $q['p'] ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.ID = \" . $q['p'];\n\t\t} elseif ( $q['post__in'] ) {\n\t\t\t$post__in = implode( ',', array_map( 'absint', $q['post__in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.ID IN ($post__in)\";\n\t\t} elseif ( $q['post__not_in'] ) {\n\t\t\t$post__not_in = implode( ',', array_map( 'absint', $q['post__not_in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.ID NOT IN ($post__not_in)\";\n\t\t}",
"\t\tif ( is_numeric( $q['post_parent'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_parent = %d \", $q['post_parent'] );\n\t\t} elseif ( $q['post_parent__in'] ) {\n\t\t\t$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_parent IN ($post_parent__in)\";\n\t\t} elseif ( $q['post_parent__not_in'] ) {\n\t\t\t$post_parent__not_in = implode( ',', array_map( 'absint', $q['post_parent__not_in'] ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)\";\n\t\t}",
"\t\tif ( $q['page_id'] ) {\n\t\t\tif ( ( 'page' != get_option( 'show_on_front' ) ) || ( $q['page_id'] != get_option( 'page_for_posts' ) ) ) {\n\t\t\t\t$q['p'] = $q['page_id'];\n\t\t\t\t$where = \" AND {$wpdb->posts}.ID = \" . $q['page_id'];\n\t\t\t}\n\t\t}",
"\t\t// If a search pattern is specified, load the posts that match.\n\t\tif ( strlen( $q['s'] ) ) {\n\t\t\t$search = $this->parse_search( $q );\n\t\t}",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the search SQL that is used in the WHERE clause of WP_Query.\n\t\t\t *\n\t\t\t * @since 3.0.0\n\t\t\t *\n\t\t\t * @param string $search Search SQL for WHERE clause.\n\t\t\t * @param WP_Query $this The current WP_Query object.\n\t\t\t */\n\t\t\t$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );\n\t\t}",
"\t\t// Taxonomies\n\t\tif ( ! $this->is_singular ) {\n\t\t\t$this->parse_tax_query( $q );",
"\t\t\t$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );",
"\t\t\t$join .= $clauses['join'];\n\t\t\t$where .= $clauses['where'];\n\t\t}",
"\t\tif ( $this->is_tax ) {\n\t\t\tif ( empty( $post_type ) ) {\n\t\t\t\t// Do a fully inclusive search for currently registered post types of queried taxonomies\n\t\t\t\t$post_type = array();\n\t\t\t\t$taxonomies = array_keys( $this->tax_query->queried_terms );\n\t\t\t\tforeach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {\n\t\t\t\t\t$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );\n\t\t\t\t\tif ( array_intersect( $taxonomies, $object_taxonomies ) ) {\n\t\t\t\t\t\t$post_type[] = $pt;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( ! $post_type ) {\n\t\t\t\t\t$post_type = 'any';\n\t\t\t\t} elseif ( count( $post_type ) == 1 ) {\n\t\t\t\t\t$post_type = $post_type[0];\n\t\t\t\t}",
"\t\t\t\t$post_status_join = true;\n\t\t\t} elseif ( in_array( 'attachment', (array) $post_type ) ) {\n\t\t\t\t$post_status_join = true;\n\t\t\t}\n\t\t}",
"\t\t/*\n\t\t * Ensure that 'taxonomy', 'term', 'term_id', 'cat', and\n\t\t * 'category_name' vars are set for backward compatibility.\n\t\t */\n\t\tif ( ! empty( $this->tax_query->queried_terms ) ) {",
"\t\t\t/*\n\t\t\t * Set 'taxonomy', 'term', and 'term_id' to the\n\t\t\t * first taxonomy other than 'post_tag' or 'category'.\n\t\t\t */\n\t\t\tif ( ! isset( $q['taxonomy'] ) ) {\n\t\t\t\tforeach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {\n\t\t\t\t\tif ( empty( $queried_items['terms'][0] ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}",
"\t\t\t\t\tif ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {\n\t\t\t\t\t\t$q['taxonomy'] = $queried_taxonomy;",
"\t\t\t\t\t\tif ( 'slug' === $queried_items['field'] ) {\n\t\t\t\t\t\t\t$q['term'] = $queried_items['terms'][0];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$q['term_id'] = $queried_items['terms'][0];\n\t\t\t\t\t\t}",
"\t\t\t\t\t\t// Take the first one we find.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// 'cat', 'category_name', 'tag_id'\n\t\t\tforeach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {\n\t\t\t\tif ( empty( $queried_items['terms'][0] ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}",
"\t\t\t\tif ( 'category' === $queried_taxonomy ) {\n\t\t\t\t\t$the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' );\n\t\t\t\t\tif ( $the_cat ) {\n\t\t\t\t\t\t$this->set( 'cat', $the_cat->term_id );\n\t\t\t\t\t\t$this->set( 'category_name', $the_cat->slug );\n\t\t\t\t\t}\n\t\t\t\t\tunset( $the_cat );\n\t\t\t\t}",
"\t\t\t\tif ( 'post_tag' === $queried_taxonomy ) {\n\t\t\t\t\t$the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' );\n\t\t\t\t\tif ( $the_tag ) {\n\t\t\t\t\t\t$this->set( 'tag_id', $the_tag->term_id );\n\t\t\t\t\t}\n\t\t\t\t\tunset( $the_tag );\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tif ( ! empty( $this->tax_query->queries ) || ! empty( $this->meta_query->queries ) ) {\n\t\t\t$groupby = \"{$wpdb->posts}.ID\";\n\t\t}",
"\t\t// Author/user stuff",
"\t\tif ( ! empty( $q['author'] ) && $q['author'] != '0' ) {\n\t\t\t$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );\n\t\t\t$authors = array_unique( array_map( 'intval', preg_split( '/[,\\s]+/', $q['author'] ) ) );\n\t\t\tforeach ( $authors as $author ) {\n\t\t\t\t$key = $author > 0 ? 'author__in' : 'author__not_in';\n\t\t\t\t$q[ $key ][] = abs( $author );\n\t\t\t}\n\t\t\t$q['author'] = implode( ',', $authors );\n\t\t}",
"\t\tif ( ! empty( $q['author__not_in'] ) ) {\n\t\t\t$author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_author NOT IN ($author__not_in) \";\n\t\t} elseif ( ! empty( $q['author__in'] ) ) {\n\t\t\t$author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );\n\t\t\t$where .= \" AND {$wpdb->posts}.post_author IN ($author__in) \";\n\t\t}",
"\t\t// Author stuff for nice URLs",
"\t\tif ( '' != $q['author_name'] ) {\n\t\t\tif ( strpos( $q['author_name'], '/' ) !== false ) {\n\t\t\t\t$q['author_name'] = explode( '/', $q['author_name'] );\n\t\t\t\tif ( $q['author_name'][ count( $q['author_name'] ) - 1 ] ) {\n\t\t\t\t\t$q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 1 ]; // no trailing slash\n\t\t\t\t} else {\n\t\t\t\t\t$q['author_name'] = $q['author_name'][ count( $q['author_name'] ) - 2 ]; // there was a trailing slash\n\t\t\t\t}\n\t\t\t}\n\t\t\t$q['author_name'] = sanitize_title_for_query( $q['author_name'] );\n\t\t\t$q['author'] = get_user_by( 'slug', $q['author_name'] );\n\t\t\tif ( $q['author'] ) {\n\t\t\t\t$q['author'] = $q['author']->ID;\n\t\t\t}\n\t\t\t$whichauthor .= \" AND ({$wpdb->posts}.post_author = \" . absint( $q['author'] ) . ')';\n\t\t}",
"\t\t// Matching by comment count.\n\t\tif ( isset( $q['comment_count'] ) ) {\n\t\t\t// Numeric comment count is converted to array format.\n\t\t\tif ( is_numeric( $q['comment_count'] ) ) {\n\t\t\t\t$q['comment_count'] = array(\n\t\t\t\t\t'value' => intval( $q['comment_count'] ),\n\t\t\t\t);\n\t\t\t}",
"\t\t\tif ( isset( $q['comment_count']['value'] ) ) {\n\t\t\t\t$q['comment_count'] = array_merge(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'compare' => '=',\n\t\t\t\t\t),\n\t\t\t\t\t$q['comment_count']\n\t\t\t\t);",
"\t\t\t\t// Fallback for invalid compare operators is '='.\n\t\t\t\t$compare_operators = array( '=', '!=', '>', '>=', '<', '<=' );\n\t\t\t\tif ( ! in_array( $q['comment_count']['compare'], $compare_operators, true ) ) {\n\t\t\t\t\t$q['comment_count']['compare'] = '=';\n\t\t\t\t}",
"\t\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.comment_count {$q['comment_count']['compare']} %d\", $q['comment_count']['value'] );\n\t\t\t}\n\t\t}",
"\t\t// MIME-Type stuff for attachment browsing",
"\t\tif ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] ) {\n\t\t\t$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );\n\t\t}\n\t\t$where .= $search . $whichauthor . $whichmimetype;",
"\t\tif ( ! empty( $this->meta_query->queries ) ) {\n\t\t\t$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );\n\t\t\t$join .= $clauses['join'];\n\t\t\t$where .= $clauses['where'];\n\t\t}",
"\t\t$rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );\n\t\tif ( ! isset( $q['order'] ) ) {\n\t\t\t$q['order'] = $rand ? '' : 'DESC';\n\t\t} else {\n\t\t\t$q['order'] = $rand ? '' : $this->parse_order( $q['order'] );\n\t\t}",
"\t\t// These values of orderby should ignore the 'order' parameter.\n\t\t$force_asc = array( 'post__in', 'post_name__in', 'post_parent__in' );\n\t\tif ( isset( $q['orderby'] ) && in_array( $q['orderby'], $force_asc, true ) ) {\n\t\t\t$q['order'] = '';\n\t\t}",
"\t\t// Order by.\n\t\tif ( empty( $q['orderby'] ) ) {\n\t\t\t/*\n\t\t\t * Boolean false or empty array blanks out ORDER BY,\n\t\t\t * while leaving the value unset or otherwise empty sets the default.\n\t\t\t */\n\t\t\tif ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {\n\t\t\t\t$orderby = '';\n\t\t\t} else {\n\t\t\t\t$orderby = \"{$wpdb->posts}.post_date \" . $q['order'];\n\t\t\t}\n\t\t} elseif ( 'none' == $q['orderby'] ) {\n\t\t\t$orderby = '';\n\t\t} else {\n\t\t\t$orderby_array = array();\n\t\t\tif ( is_array( $q['orderby'] ) ) {\n\t\t\t\tforeach ( $q['orderby'] as $_orderby => $order ) {\n\t\t\t\t\t$orderby = addslashes_gpc( urldecode( $_orderby ) );\n\t\t\t\t\t$parsed = $this->parse_orderby( $orderby );",
"\t\t\t\t\tif ( ! $parsed ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}",
"\t\t\t\t\t$orderby_array[] = $parsed . ' ' . $this->parse_order( $order );\n\t\t\t\t}\n\t\t\t\t$orderby = implode( ', ', $orderby_array );",
"\t\t\t} else {\n\t\t\t\t$q['orderby'] = urldecode( $q['orderby'] );\n\t\t\t\t$q['orderby'] = addslashes_gpc( $q['orderby'] );",
"\t\t\t\tforeach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {\n\t\t\t\t\t$parsed = $this->parse_orderby( $orderby );\n\t\t\t\t\t// Only allow certain values for safety.\n\t\t\t\t\tif ( ! $parsed ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}",
"\t\t\t\t\t$orderby_array[] = $parsed;\n\t\t\t\t}\n\t\t\t\t$orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );",
"\t\t\t\tif ( empty( $orderby ) ) {\n\t\t\t\t\t$orderby = \"{$wpdb->posts}.post_date \" . $q['order'];\n\t\t\t\t} elseif ( ! empty( $q['order'] ) ) {\n\t\t\t\t\t$orderby .= \" {$q['order']}\";\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// Order search results by relevance only when another \"orderby\" is not specified in the query.\n\t\tif ( ! empty( $q['s'] ) ) {\n\t\t\t$search_orderby = '';\n\t\t\tif ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) {\n\t\t\t\t$search_orderby = $this->parse_search_order( $q );\n\t\t\t}",
"\t\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t\t/**\n\t\t\t\t * Filters the ORDER BY used when ordering search results.\n\t\t\t\t *\n\t\t\t\t * @since 3.7.0\n\t\t\t\t *\n\t\t\t\t * @param string $search_orderby The ORDER BY clause.\n\t\t\t\t * @param WP_Query $this The current WP_Query instance.\n\t\t\t\t */\n\t\t\t\t$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );\n\t\t\t}",
"\t\t\tif ( $search_orderby ) {\n\t\t\t\t$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;\n\t\t\t}\n\t\t}",
"\t\tif ( is_array( $post_type ) && count( $post_type ) > 1 ) {\n\t\t\t$post_type_cap = 'multiple_post_type';\n\t\t} else {\n\t\t\tif ( is_array( $post_type ) ) {\n\t\t\t\t$post_type = reset( $post_type );\n\t\t\t}\n\t\t\t$post_type_object = get_post_type_object( $post_type );\n\t\t\tif ( empty( $post_type_object ) ) {\n\t\t\t\t$post_type_cap = $post_type;\n\t\t\t}\n\t\t}",
"\t\tif ( isset( $q['post_password'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_password = %s\", $q['post_password'] );\n\t\t\tif ( empty( $q['perm'] ) ) {\n\t\t\t\t$q['perm'] = 'readable';\n\t\t\t}\n\t\t} elseif ( isset( $q['has_password'] ) ) {\n\t\t\t$where .= sprintf( \" AND {$wpdb->posts}.post_password %s ''\", $q['has_password'] ? '!=' : '=' );\n\t\t}",
"\t\tif ( ! empty( $q['comment_status'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.comment_status = %s \", $q['comment_status'] );\n\t\t}",
"\t\tif ( ! empty( $q['ping_status'] ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.ping_status = %s \", $q['ping_status'] );\n\t\t}",
"\t\tif ( 'any' == $post_type ) {\n\t\t\t$in_search_post_types = get_post_types( array( 'exclude_from_search' => false ) );\n\t\t\tif ( empty( $in_search_post_types ) ) {\n\t\t\t\t$where .= ' AND 1=0 ';\n\t\t\t} else {\n\t\t\t\t$where .= \" AND {$wpdb->posts}.post_type IN ('\" . join( \"', '\", array_map( 'esc_sql', $in_search_post_types ) ) . \"')\";\n\t\t\t}\n\t\t} elseif ( ! empty( $post_type ) && is_array( $post_type ) ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type IN ('\" . join( \"', '\", esc_sql( $post_type ) ) . \"')\";\n\t\t} elseif ( ! empty( $post_type ) ) {\n\t\t\t$where .= $wpdb->prepare( \" AND {$wpdb->posts}.post_type = %s\", $post_type );\n\t\t\t$post_type_object = get_post_type_object( $post_type );\n\t\t} elseif ( $this->is_attachment ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type = 'attachment'\";\n\t\t\t$post_type_object = get_post_type_object( 'attachment' );\n\t\t} elseif ( $this->is_page ) {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type = 'page'\";\n\t\t\t$post_type_object = get_post_type_object( 'page' );\n\t\t} else {\n\t\t\t$where .= \" AND {$wpdb->posts}.post_type = 'post'\";\n\t\t\t$post_type_object = get_post_type_object( 'post' );\n\t\t}",
"\t\t$edit_cap = 'edit_post';\n\t\t$read_cap = 'read_post';",
"\t\tif ( ! empty( $post_type_object ) ) {\n\t\t\t$edit_others_cap = $post_type_object->cap->edit_others_posts;\n\t\t\t$read_private_cap = $post_type_object->cap->read_private_posts;\n\t\t} else {\n\t\t\t$edit_others_cap = 'edit_others_' . $post_type_cap . 's';\n\t\t\t$read_private_cap = 'read_private_' . $post_type_cap . 's';\n\t\t}",
"\t\t$user_id = get_current_user_id();",
"\t\t$q_status = array();\n\t\tif ( ! empty( $q['post_status'] ) ) {\n\t\t\t$statuswheres = array();\n\t\t\t$q_status = $q['post_status'];\n\t\t\tif ( ! is_array( $q_status ) ) {\n\t\t\t\t$q_status = explode( ',', $q_status );\n\t\t\t}\n\t\t\t$r_status = array();\n\t\t\t$p_status = array();\n\t\t\t$e_status = array();\n\t\t\tif ( in_array( 'any', $q_status ) ) {\n\t\t\t\tforeach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {\n\t\t\t\t\tif ( ! in_array( $status, $q_status ) ) {\n\t\t\t\t\t\t$e_status[] = \"{$wpdb->posts}.post_status <> '$status'\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tforeach ( get_post_stati() as $status ) {\n\t\t\t\t\tif ( in_array( $status, $q_status ) ) {\n\t\t\t\t\t\tif ( 'private' == $status ) {\n\t\t\t\t\t\t\t$p_status[] = \"{$wpdb->posts}.post_status = '$status'\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$r_status[] = \"{$wpdb->posts}.post_status = '$status'\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( empty( $q['perm'] ) || 'readable' != $q['perm'] ) {\n\t\t\t\t$r_status = array_merge( $r_status, $p_status );\n\t\t\t\tunset( $p_status );\n\t\t\t}",
"\t\t\tif ( ! empty( $e_status ) ) {\n\t\t\t\t$statuswheres[] = '(' . join( ' AND ', $e_status ) . ')';\n\t\t\t}\n\t\t\tif ( ! empty( $r_status ) ) {\n\t\t\t\tif ( ! empty( $q['perm'] ) && 'editable' == $q['perm'] && ! current_user_can( $edit_others_cap ) ) {\n\t\t\t\t\t$statuswheres[] = \"({$wpdb->posts}.post_author = $user_id \" . 'AND (' . join( ' OR ', $r_status ) . '))';\n\t\t\t\t} else {\n\t\t\t\t\t$statuswheres[] = '(' . join( ' OR ', $r_status ) . ')';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( ! empty( $p_status ) ) {\n\t\t\t\tif ( ! empty( $q['perm'] ) && 'readable' == $q['perm'] && ! current_user_can( $read_private_cap ) ) {\n\t\t\t\t\t$statuswheres[] = \"({$wpdb->posts}.post_author = $user_id \" . 'AND (' . join( ' OR ', $p_status ) . '))';\n\t\t\t\t} else {\n\t\t\t\t\t$statuswheres[] = '(' . join( ' OR ', $p_status ) . ')';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $post_status_join ) {\n\t\t\t\t$join .= \" LEFT JOIN {$wpdb->posts} AS p2 ON ({$wpdb->posts}.post_parent = p2.ID) \";\n\t\t\t\tforeach ( $statuswheres as $index => $statuswhere ) {\n\t\t\t\t\t$statuswheres[ $index ] = \"($statuswhere OR ({$wpdb->posts}.post_status = 'inherit' AND \" . str_replace( $wpdb->posts, 'p2', $statuswhere ) . '))';\n\t\t\t\t}\n\t\t\t}\n\t\t\t$where_status = implode( ' OR ', $statuswheres );\n\t\t\tif ( ! empty( $where_status ) ) {\n\t\t\t\t$where .= \" AND ($where_status)\";\n\t\t\t}\n\t\t} elseif ( ! $this->is_singular ) {\n\t\t\t$where .= \" AND ({$wpdb->posts}.post_status = 'publish'\";",
"\t\t\t// Add public states.\n\t\t\t$public_states = get_post_stati( array( 'public' => true ) );\n\t\t\tforeach ( (array) $public_states as $state ) {\n\t\t\t\tif ( 'publish' == $state ) { // Publish is hard-coded above.\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$where .= \" OR {$wpdb->posts}.post_status = '$state'\";\n\t\t\t}",
"\t\t\tif ( $this->is_admin ) {\n\t\t\t\t// Add protected states that should show in the admin all list.\n\t\t\t\t$admin_all_states = get_post_stati(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'protected' => true,\n\t\t\t\t\t\t'show_in_admin_all_list' => true,\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tforeach ( (array) $admin_all_states as $state ) {\n\t\t\t\t\t$where .= \" OR {$wpdb->posts}.post_status = '$state'\";\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( is_user_logged_in() ) {\n\t\t\t\t// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.\n\t\t\t\t$private_states = get_post_stati( array( 'private' => true ) );\n\t\t\t\tforeach ( (array) $private_states as $state ) {\n\t\t\t\t\t$where .= current_user_can( $read_private_cap ) ? \" OR {$wpdb->posts}.post_status = '$state'\" : \" OR {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'\";\n\t\t\t\t}\n\t\t\t}",
"\t\t\t$where .= ')';\n\t\t}",
"\t\t/*\n\t\t * Apply filters on where and join prior to paging so that any\n\t\t * manipulations to them are reflected in the paging by day queries.\n\t\t */\n\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the WHERE clause of the query.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $where The WHERE clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the JOIN clause of the query.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $join The JOIN clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );\n\t\t}",
"\t\t// Paging\n\t\tif ( empty( $q['nopaging'] ) && ! $this->is_singular ) {\n\t\t\t$page = absint( $q['paged'] );\n\t\t\tif ( ! $page ) {\n\t\t\t\t$page = 1;\n\t\t\t}",
"\t\t\t// If 'offset' is provided, it takes precedence over 'paged'.\n\t\t\tif ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {\n\t\t\t\t$q['offset'] = absint( $q['offset'] );\n\t\t\t\t$pgstrt = $q['offset'] . ', ';\n\t\t\t} else {\n\t\t\t\t$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';\n\t\t\t}\n\t\t\t$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];\n\t\t}",
"\t\t// Comments feeds\n\t\tif ( $this->is_comment_feed && ! $this->is_singular ) {\n\t\t\tif ( $this->is_archive || $this->is_search ) {\n\t\t\t\t$cjoin = \"JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) $join \";\n\t\t\t\t$cwhere = \"WHERE comment_approved = '1' $where\";\n\t\t\t\t$cgroupby = \"{$wpdb->comments}.comment_id\";\n\t\t\t} else { // Other non singular e.g. front\n\t\t\t\t$cjoin = \"JOIN {$wpdb->posts} ON ( {$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID )\";\n\t\t\t\t$cwhere = \"WHERE ( post_status = 'publish' OR ( post_status = 'inherit' AND post_type = 'attachment' ) ) AND comment_approved = '1'\";\n\t\t\t\t$cgroupby = '';\n\t\t\t}",
"\t\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t\t/**\n\t\t\t\t * Filters the JOIN clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.2.0\n\t\t\t\t *\n\t\t\t\t * @param string $cjoin The JOIN clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the WHERE clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.2.0\n\t\t\t\t *\n\t\t\t\t * @param string $cwhere The WHERE clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the GROUP BY clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.2.0\n\t\t\t\t *\n\t\t\t\t * @param string $cgroupby The GROUP BY clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the ORDER BY clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.8.0\n\t\t\t\t *\n\t\t\t\t * @param string $corderby The ORDER BY clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );",
"\t\t\t\t/**\n\t\t\t\t * Filters the LIMIT clause of the comments feed query before sending.\n\t\t\t\t *\n\t\t\t\t * @since 2.8.0\n\t\t\t\t *\n\t\t\t\t * @param string $climits The JOIN clause of the query.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );\n\t\t\t}\n\t\t\t$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';\n\t\t\t$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';",
"\t\t\t$comments = (array) $wpdb->get_results( \"SELECT $distinct {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits\" );\n\t\t\t// Convert to WP_Comment\n\t\t\t$this->comments = array_map( 'get_comment', $comments );\n\t\t\t$this->comment_count = count( $this->comments );",
"\t\t\t$post_ids = array();",
"\t\t\tforeach ( $this->comments as $comment ) {\n\t\t\t\t$post_ids[] = (int) $comment->comment_post_ID;\n\t\t\t}",
"\t\t\t$post_ids = join( ',', $post_ids );\n\t\t\t$join = '';\n\t\t\tif ( $post_ids ) {\n\t\t\t\t$where = \"AND {$wpdb->posts}.ID IN ($post_ids) \";\n\t\t\t} else {\n\t\t\t\t$where = 'AND 0';\n\t\t\t}\n\t\t}",
"\t\t$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );",
"\t\t/*\n\t\t * Apply post-paging filters on where and join. Only plugins that\n\t\t * manipulate paging queries should use these hooks.\n\t\t */\n\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the WHERE clause of the query.\n\t\t\t *\n\t\t\t * Specifically for manipulating paging queries.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $where The WHERE clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the GROUP BY clause of the query.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param string $groupby The GROUP BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the JOIN clause of the query.\n\t\t\t *\n\t\t\t * Specifically for manipulating paging queries.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param string $join The JOIN clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the ORDER BY clause of the query.\n\t\t\t *\n\t\t\t * @since 1.5.1\n\t\t\t *\n\t\t\t * @param string $orderby The ORDER BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the DISTINCT clause of the query.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $distinct The DISTINCT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the LIMIT clause of the query.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $limits The LIMIT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the SELECT clause of the query.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $fields The SELECT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters all query clauses at once, for convenience.\n\t\t\t *\n\t\t\t * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,\n\t\t\t * fields (SELECT), and LIMITS clauses.\n\t\t\t *\n\t\t\t * @since 3.1.0\n\t\t\t *\n\t\t\t * @param string[] $clauses Associative array of the clauses for the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );",
"\t\t\t$where = isset( $clauses['where'] ) ? $clauses['where'] : '';\n\t\t\t$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';\n\t\t\t$join = isset( $clauses['join'] ) ? $clauses['join'] : '';\n\t\t\t$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';\n\t\t\t$distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';\n\t\t\t$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';\n\t\t\t$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';\n\t\t}",
"\t\t/**\n\t\t * Fires to announce the query's current selection parameters.\n\t\t *\n\t\t * For use by caching plugins.\n\t\t *\n\t\t * @since 2.3.0\n\t\t *\n\t\t * @param string $selection The assembled selection query.\n\t\t */\n\t\tdo_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );",
"\t\t/*\n\t\t * Filters again for the benefit of caching plugins.\n\t\t * Regular plugins should use the hooks above.\n\t\t */\n\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the WHERE clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $where The WHERE clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the GROUP BY clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $groupby The GROUP BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the JOIN clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $join The JOIN clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the ORDER BY clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $orderby The ORDER BY clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the DISTINCT clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $distinct The DISTINCT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the SELECT clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $fields The SELECT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters the LIMIT clause of the query.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * @since 2.5.0\n\t\t\t *\n\t\t\t * @param string $limits The LIMIT clause of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );",
"\t\t\t/**\n\t\t\t * Filters all query clauses at once, for convenience.\n\t\t\t *\n\t\t\t * For use by caching plugins.\n\t\t\t *\n\t\t\t * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,\n\t\t\t * fields (SELECT), and LIMITS clauses.\n\t\t\t *\n\t\t\t * @since 3.1.0\n\t\t\t *\n\t\t\t * @param string[] $pieces Associative array of the pieces of the query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );",
"\t\t\t$where = isset( $clauses['where'] ) ? $clauses['where'] : '';\n\t\t\t$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';\n\t\t\t$join = isset( $clauses['join'] ) ? $clauses['join'] : '';\n\t\t\t$orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';\n\t\t\t$distinct = isset( $clauses['distinct'] ) ? $clauses['distinct'] : '';\n\t\t\t$fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';\n\t\t\t$limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';\n\t\t}",
"\t\tif ( ! empty( $groupby ) ) {\n\t\t\t$groupby = 'GROUP BY ' . $groupby;\n\t\t}\n\t\tif ( ! empty( $orderby ) ) {\n\t\t\t$orderby = 'ORDER BY ' . $orderby;\n\t\t}",
"\t\t$found_rows = '';\n\t\tif ( ! $q['no_found_rows'] && ! empty( $limits ) ) {\n\t\t\t$found_rows = 'SQL_CALC_FOUND_ROWS';\n\t\t}",
"\t\t$this->request = $old_request = \"SELECT $found_rows $distinct $fields FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits\";",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the completed SQL query before sending.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param string $request The complete SQL query.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );\n\t\t}",
"\t\t/**\n\t\t * Filters the posts array before the query takes place.\n\t\t *\n\t\t * Return a non-null value to bypass WordPress's default post queries.\n\t\t *\n\t\t * Filtering functions that require pagination information are encouraged to set\n\t\t * the `found_posts` and `max_num_pages` properties of the WP_Query object,\n\t\t * passed to the filter by reference. If WP_Query does not perform a database\n\t\t * query, it will not have enough information to generate these values itself.\n\t\t *\n\t\t * @since 4.6.0\n\t\t *\n\t\t * @param array|null $posts Return an array of post data to short-circuit WP's query,\n\t\t * or null to allow WP to run its normal queries.\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\t$this->posts = apply_filters_ref_array( 'posts_pre_query', array( null, &$this ) );",
"\t\tif ( 'ids' == $q['fields'] ) {\n\t\t\tif ( null === $this->posts ) {\n\t\t\t\t$this->posts = $wpdb->get_col( $this->request );\n\t\t\t}",
"\t\t\t$this->posts = array_map( 'intval', $this->posts );\n\t\t\t$this->post_count = count( $this->posts );\n\t\t\t$this->set_found_posts( $q, $limits );",
"\t\t\treturn $this->posts;\n\t\t}",
"\t\tif ( 'id=>parent' == $q['fields'] ) {\n\t\t\tif ( null === $this->posts ) {\n\t\t\t\t$this->posts = $wpdb->get_results( $this->request );\n\t\t\t}",
"\t\t\t$this->post_count = count( $this->posts );\n\t\t\t$this->set_found_posts( $q, $limits );",
"\t\t\t$r = array();\n\t\t\tforeach ( $this->posts as $key => $post ) {\n\t\t\t\t$this->posts[ $key ]->ID = (int) $post->ID;\n\t\t\t\t$this->posts[ $key ]->post_parent = (int) $post->post_parent;",
"\t\t\t\t$r[ (int) $post->ID ] = (int) $post->post_parent;\n\t\t\t}",
"\t\t\treturn $r;\n\t\t}",
"\t\tif ( null === $this->posts ) {\n\t\t\t$split_the_query = ( $old_request == $this->request && \"{$wpdb->posts}.*\" == $fields && ! empty( $limits ) && $q['posts_per_page'] < 500 );",
"\t\t\t/**\n\t\t\t * Filters whether to split the query.\n\t\t\t *\n\t\t\t * Splitting the query will cause it to fetch just the IDs of the found posts\n\t\t\t * (and then individually fetch each post by ID), rather than fetching every\n\t\t\t * complete row at once. One massive result vs. many small results.\n\t\t\t *\n\t\t\t * @since 3.4.0\n\t\t\t *\n\t\t\t * @param bool $split_the_query Whether or not to split the query.\n\t\t\t * @param WP_Query $this The WP_Query instance.\n\t\t\t */\n\t\t\t$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );",
"\t\t\tif ( $split_the_query ) {\n\t\t\t\t// First get the IDs and then fill in the objects",
"\t\t\t\t$this->request = \"SELECT $found_rows $distinct {$wpdb->posts}.ID FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits\";",
"\t\t\t\t/**\n\t\t\t\t * Filters the Post IDs SQL request before sending.\n\t\t\t\t *\n\t\t\t\t * @since 3.4.0\n\t\t\t\t *\n\t\t\t\t * @param string $request The post ID request.\n\t\t\t\t * @param WP_Query $this The WP_Query instance.\n\t\t\t\t */\n\t\t\t\t$this->request = apply_filters( 'posts_request_ids', $this->request, $this );",
"\t\t\t\t$ids = $wpdb->get_col( $this->request );",
"\t\t\t\tif ( $ids ) {\n\t\t\t\t\t$this->posts = $ids;\n\t\t\t\t\t$this->set_found_posts( $q, $limits );\n\t\t\t\t\t_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );\n\t\t\t\t} else {\n\t\t\t\t\t$this->posts = array();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->posts = $wpdb->get_results( $this->request );\n\t\t\t\t$this->set_found_posts( $q, $limits );\n\t\t\t}\n\t\t}",
"\t\t// Convert to WP_Post objects.\n\t\tif ( $this->posts ) {\n\t\t\t$this->posts = array_map( 'get_post', $this->posts );\n\t\t}",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the raw post results array, prior to status checks.\n\t\t\t *\n\t\t\t * @since 2.3.0\n\t\t\t *\n\t\t\t * @param WP_Post[] $posts Array of post objects.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );\n\t\t}",
"\t\tif ( ! empty( $this->posts ) && $this->is_comment_feed && $this->is_singular ) {\n\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$cwhere = apply_filters_ref_array( 'comment_feed_where', array( \"WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'\", &$this ) );",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );\n\t\t\t$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );\n\t\t\t$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';",
"\t\t\t/** This filter is documented in wp-includes/query.php */\n\t\t\t$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );",
"\t\t\t$comments_request = \"SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits\";\n\t\t\t$comments = $wpdb->get_results( $comments_request );\n\t\t\t// Convert to WP_Comment\n\t\t\t$this->comments = array_map( 'get_comment', $comments );\n\t\t\t$this->comment_count = count( $this->comments );\n\t\t}",
"\t\t// Check post status to determine if post should be displayed.\n\t\tif ( ! empty( $this->posts ) && ( $this->is_single || $this->is_page ) ) {\n\t\t\t$status = get_post_status( $this->posts[0] );\n\t\t\tif ( 'attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent ) {\n\t\t\t\t$this->is_page = false;\n\t\t\t\t$this->is_single = true;\n\t\t\t\t$this->is_attachment = true;\n\t\t\t}\n\t\t\t$post_status_obj = get_post_status_object( $status );",
"\t\t\t// If the post_status was specifically requested, let it pass through.\n\t\t\tif ( ! $post_status_obj->public && ! in_array( $status, $q_status ) ) {",
"\t\t\t\tif ( ! is_user_logged_in() ) {\n\t\t\t\t\t// User must be logged in to view unpublished posts.\n\t\t\t\t\t$this->posts = array();\n\t\t\t\t} else {\n\t\t\t\t\tif ( $post_status_obj->protected ) {\n\t\t\t\t\t\t// User must have edit permissions on the draft to preview.\n\t\t\t\t\t\tif ( ! current_user_can( $edit_cap, $this->posts[0]->ID ) ) {\n\t\t\t\t\t\t\t$this->posts = array();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this->is_preview = true;\n\t\t\t\t\t\t\tif ( 'future' != $status ) {\n\t\t\t\t\t\t\t\t$this->posts[0]->post_date = current_time( 'mysql' );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} elseif ( $post_status_obj->private ) {\n\t\t\t\t\t\tif ( ! current_user_can( $read_cap, $this->posts[0]->ID ) ) {\n\t\t\t\t\t\t\t$this->posts = array();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$this->posts = array();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) {\n\t\t\t\t/**\n\t\t\t\t * Filters the single post for preview mode.\n\t\t\t\t *\n\t\t\t\t * @since 2.7.0\n\t\t\t\t *\n\t\t\t\t * @param WP_Post $post_preview The Post object.\n\t\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t\t */\n\t\t\t\t$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );\n\t\t\t}\n\t\t}",
"\t\t// Put sticky posts at the top of the posts array\n\t\t$sticky_posts = get_option( 'sticky_posts' );\n\t\tif ( $this->is_home && $page <= 1 && is_array( $sticky_posts ) && ! empty( $sticky_posts ) && ! $q['ignore_sticky_posts'] ) {\n\t\t\t$num_posts = count( $this->posts );\n\t\t\t$sticky_offset = 0;\n\t\t\t// Loop over posts and relocate stickies to the front.\n\t\t\tfor ( $i = 0; $i < $num_posts; $i++ ) {\n\t\t\t\tif ( in_array( $this->posts[ $i ]->ID, $sticky_posts ) ) {\n\t\t\t\t\t$sticky_post = $this->posts[ $i ];\n\t\t\t\t\t// Remove sticky from current position\n\t\t\t\t\tarray_splice( $this->posts, $i, 1 );\n\t\t\t\t\t// Move to front, after other stickies\n\t\t\t\t\tarray_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );\n\t\t\t\t\t// Increment the sticky offset. The next sticky will be placed at this offset.\n\t\t\t\t\t$sticky_offset++;\n\t\t\t\t\t// Remove post from sticky posts array\n\t\t\t\t\t$offset = array_search( $sticky_post->ID, $sticky_posts );\n\t\t\t\t\tunset( $sticky_posts[ $offset ] );\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// If any posts have been excluded specifically, Ignore those that are sticky.\n\t\t\tif ( ! empty( $sticky_posts ) && ! empty( $q['post__not_in'] ) ) {\n\t\t\t\t$sticky_posts = array_diff( $sticky_posts, $q['post__not_in'] );\n\t\t\t}",
"\t\t\t// Fetch sticky posts that weren't in the query results\n\t\t\tif ( ! empty( $sticky_posts ) ) {\n\t\t\t\t$stickies = get_posts(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'post__in' => $sticky_posts,\n\t\t\t\t\t\t'post_type' => $post_type,\n\t\t\t\t\t\t'post_status' => 'publish',\n\t\t\t\t\t\t'nopaging' => true,\n\t\t\t\t\t)\n\t\t\t\t);",
"\t\t\t\tforeach ( $stickies as $sticky_post ) {\n\t\t\t\t\tarray_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );\n\t\t\t\t\t$sticky_offset++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// If comments have been fetched as part of the query, make sure comment meta lazy-loading is set up.\n\t\tif ( ! empty( $this->comments ) ) {\n\t\t\twp_queue_comments_for_comment_meta_lazyload( $this->comments );\n\t\t}",
"\t\tif ( ! $q['suppress_filters'] ) {\n\t\t\t/**\n\t\t\t * Filters the array of retrieved posts after they've been fetched and\n\t\t\t * internally processed.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t *\n\t\t\t * @param WP_Post[] $posts Array of post objects.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );\n\t\t}",
"\t\t// Ensure that any posts added/modified via one of the filters above are\n\t\t// of the type WP_Post and are filtered.\n\t\tif ( $this->posts ) {\n\t\t\t$this->post_count = count( $this->posts );",
"\t\t\t$this->posts = array_map( 'get_post', $this->posts );",
"\t\t\tif ( $q['cache_results'] ) {\n\t\t\t\tupdate_post_caches( $this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache'] );\n\t\t\t}",
"\t\t\t$this->post = reset( $this->posts );\n\t\t} else {\n\t\t\t$this->post_count = 0;\n\t\t\t$this->posts = array();\n\t\t}",
"\t\tif ( $q['lazy_load_term_meta'] ) {\n\t\t\twp_queue_posts_for_term_meta_lazyload( $this->posts );\n\t\t}",
"\t\treturn $this->posts;\n\t}",
"\t/**\n\t * Set up the amount of found posts and the number of pages (if limit clause was used)\n\t * for the current query.\n\t *\n\t * @since 3.5.0\n\t *\n\t * @param array $q Query variables.\n\t * @param string $limits LIMIT clauses of the query.\n\t */\n\tprivate function set_found_posts( $q, $limits ) {\n\t\tglobal $wpdb;\n\t\t// Bail if posts is an empty array. Continue if posts is an empty string,\n\t\t// null, or false to accommodate caching plugins that fill posts later.\n\t\tif ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {\n\t\t\treturn;\n\t\t}",
"\t\tif ( ! empty( $limits ) ) {\n\t\t\t/**\n\t\t\t * Filters the query to run for retrieving the found posts.\n\t\t\t *\n\t\t\t * @since 2.1.0\n\t\t\t *\n\t\t\t * @param string $found_posts The query to run to find the found posts.\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\t$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );\n\t\t} else {\n\t\t\tif ( is_array( $this->posts ) ) {\n\t\t\t\t$this->found_posts = count( $this->posts );\n\t\t\t} else {\n\t\t\t\tif ( null === $this->posts ) {\n\t\t\t\t\t$this->found_posts = 0;\n\t\t\t\t} else {\n\t\t\t\t\t$this->found_posts = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters the number of found posts for the query.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param int $found_posts The number of posts found.\n\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t */\n\t\t$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );",
"\t\tif ( ! empty( $limits ) ) {\n\t\t\t$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );\n\t\t}\n\t}",
"\t/**\n\t * Set up the next post and iterate current post index.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return WP_Post Next post.\n\t */\n\tpublic function next_post() {",
"\t\t$this->current_post++;",
"\t\t$this->post = $this->posts[ $this->current_post ];\n\t\treturn $this->post;\n\t}",
"\t/**\n\t * Sets up the current post.\n\t *\n\t * Retrieves the next post, sets up the post, sets the 'in the loop'\n\t * property to true.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @global WP_Post $post\n\t */\n\tpublic function the_post() {\n\t\tglobal $post;\n\t\t$this->in_the_loop = true;",
"\t\tif ( $this->current_post == -1 ) { // loop has just started\n\t\t\t/**\n\t\t\t * Fires once the loop is started.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\tdo_action_ref_array( 'loop_start', array( &$this ) );\n\t\t}",
"\t\t$post = $this->next_post();\n\t\t$this->setup_postdata( $post );\n\t}",
"\t/**\n\t * Determines whether there are more posts available in the loop.\n\t *\n\t * Calls the {@see 'loop_end'} action when the loop is complete.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return bool True if posts are available, false if end of loop.\n\t */\n\tpublic function have_posts() {\n\t\tif ( $this->current_post + 1 < $this->post_count ) {\n\t\t\treturn true;\n\t\t} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {\n\t\t\t/**\n\t\t\t * Fires once the loop has ended.\n\t\t\t *\n\t\t\t * @since 2.0.0\n\t\t\t *\n\t\t\t * @param WP_Query $this The WP_Query instance (passed by reference).\n\t\t\t */\n\t\t\tdo_action_ref_array( 'loop_end', array( &$this ) );\n\t\t\t// Do some cleaning up after the loop\n\t\t\t$this->rewind_posts();\n\t\t} elseif ( 0 === $this->post_count ) {\n\t\t\t/**\n\t\t\t * Fires if no results are found in a post query.\n\t\t\t *\n\t\t\t * @since 4.9.0\n\t\t\t *\n\t\t\t * @param WP_Query $this The WP_Query instance.\n\t\t\t */\n\t\t\tdo_action( 'loop_no_results', $this );\n\t\t}",
"\t\t$this->in_the_loop = false;\n\t\treturn false;\n\t}",
"\t/**\n\t * Rewind the posts and reset post index.\n\t *\n\t * @since 1.5.0\n\t */\n\tpublic function rewind_posts() {\n\t\t$this->current_post = -1;\n\t\tif ( $this->post_count > 0 ) {\n\t\t\t$this->post = $this->posts[0];\n\t\t}\n\t}",
"\t/**\n\t * Iterate current comment index and return WP_Comment object.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @return WP_Comment Comment object.\n\t */\n\tpublic function next_comment() {\n\t\t$this->current_comment++;",
"\t\t$this->comment = $this->comments[ $this->current_comment ];\n\t\treturn $this->comment;\n\t}",
"\t/**\n\t * Sets up the current comment.\n\t *\n\t * @since 2.2.0\n\t * @global WP_Comment $comment Current comment.\n\t */\n\tpublic function the_comment() {\n\t\tglobal $comment;",
"\t\t$comment = $this->next_comment();",
"\t\tif ( $this->current_comment == 0 ) {\n\t\t\t/**\n\t\t\t * Fires once the comment loop is started.\n\t\t\t *\n\t\t\t * @since 2.2.0\n\t\t\t */\n\t\t\tdo_action( 'comment_loop_start' );\n\t\t}\n\t}",
"\t/**\n\t * Whether there are more comments available.\n\t *\n\t * Automatically rewinds comments when finished.\n\t *\n\t * @since 2.2.0\n\t *\n\t * @return bool True, if more comments. False, if no more posts.\n\t */\n\tpublic function have_comments() {\n\t\tif ( $this->current_comment + 1 < $this->comment_count ) {\n\t\t\treturn true;\n\t\t} elseif ( $this->current_comment + 1 == $this->comment_count ) {\n\t\t\t$this->rewind_comments();\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Rewind the comments, resets the comment index and comment to first.\n\t *\n\t * @since 2.2.0\n\t */\n\tpublic function rewind_comments() {\n\t\t$this->current_comment = -1;\n\t\tif ( $this->comment_count > 0 ) {\n\t\t\t$this->comment = $this->comments[0];\n\t\t}\n\t}",
"\t/**\n\t * Sets up the WordPress query by parsing query string.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @param string|array $query URL query string or array of query arguments.\n\t * @return WP_Post[]|int[] Array of post objects or post IDs.\n\t */\n\tpublic function query( $query ) {\n\t\t$this->init();\n\t\t$this->query = $this->query_vars = wp_parse_args( $query );\n\t\treturn $this->get_posts();\n\t}",
"\t/**\n\t * Retrieve queried object.\n\t *\n\t * If queried object is not set, then the queried object will be set from\n\t * the category, tag, taxonomy, posts page, single post, page, or author\n\t * query variable. After it is set up, it will be returned.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return object\n\t */\n\tpublic function get_queried_object() {\n\t\tif ( isset( $this->queried_object ) ) {\n\t\t\treturn $this->queried_object;\n\t\t}",
"\t\t$this->queried_object = null;\n\t\t$this->queried_object_id = null;",
"\t\tif ( $this->is_category || $this->is_tag || $this->is_tax ) {\n\t\t\tif ( $this->is_category ) {\n\t\t\t\tif ( $this->get( 'cat' ) ) {\n\t\t\t\t\t$term = get_term( $this->get( 'cat' ), 'category' );\n\t\t\t\t} elseif ( $this->get( 'category_name' ) ) {\n\t\t\t\t\t$term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );\n\t\t\t\t}\n\t\t\t} elseif ( $this->is_tag ) {\n\t\t\t\tif ( $this->get( 'tag_id' ) ) {\n\t\t\t\t\t$term = get_term( $this->get( 'tag_id' ), 'post_tag' );\n\t\t\t\t} elseif ( $this->get( 'tag' ) ) {\n\t\t\t\t\t$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For other tax queries, grab the first term from the first clause.\n\t\t\t\tif ( ! empty( $this->tax_query->queried_terms ) ) {\n\t\t\t\t\t$queried_taxonomies = array_keys( $this->tax_query->queried_terms );\n\t\t\t\t\t$matched_taxonomy = reset( $queried_taxonomies );\n\t\t\t\t\t$query = $this->tax_query->queried_terms[ $matched_taxonomy ];",
"\t\t\t\t\tif ( ! empty( $query['terms'] ) ) {\n\t\t\t\t\t\tif ( 'term_id' == $query['field'] ) {\n\t\t\t\t\t\t\t$term = get_term( reset( $query['terms'] ), $matched_taxonomy );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( ! empty( $term ) && ! is_wp_error( $term ) ) {\n\t\t\t\t$this->queried_object = $term;\n\t\t\t\t$this->queried_object_id = (int) $term->term_id;",
"\t\t\t\tif ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {\n\t\t\t\t\t_make_cat_compat( $this->queried_object );\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif ( $this->is_post_type_archive ) {\n\t\t\t$post_type = $this->get( 'post_type' );\n\t\t\tif ( is_array( $post_type ) ) {\n\t\t\t\t$post_type = reset( $post_type );\n\t\t\t}\n\t\t\t$this->queried_object = get_post_type_object( $post_type );\n\t\t} elseif ( $this->is_posts_page ) {\n\t\t\t$page_for_posts = get_option( 'page_for_posts' );\n\t\t\t$this->queried_object = get_post( $page_for_posts );\n\t\t\t$this->queried_object_id = (int) $this->queried_object->ID;\n\t\t} elseif ( $this->is_singular && ! empty( $this->post ) ) {\n\t\t\t$this->queried_object = $this->post;\n\t\t\t$this->queried_object_id = (int) $this->post->ID;\n\t\t} elseif ( $this->is_author ) {\n\t\t\t$this->queried_object_id = (int) $this->get( 'author' );\n\t\t\t$this->queried_object = get_userdata( $this->queried_object_id );\n\t\t}",
"\t\treturn $this->queried_object;\n\t}",
"\t/**\n\t * Retrieve ID of the current queried object.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @return int\n\t */\n\tpublic function get_queried_object_id() {\n\t\t$this->get_queried_object();",
"\t\tif ( isset( $this->queried_object_id ) ) {\n\t\t\treturn $this->queried_object_id;\n\t\t}",
"\t\treturn 0;\n\t}",
"\t/**\n\t * Constructor.\n\t *\n\t * Sets up the WordPress query, if parameter is not empty.\n\t *\n\t * @since 1.5.0\n\t *\n\t * @param string|array $query URL query string or array of vars.\n\t */\n\tpublic function __construct( $query = '' ) {\n\t\tif ( ! empty( $query ) ) {\n\t\t\t$this->query( $query );\n\t\t}\n\t}",
"\t/**\n\t * Make private properties readable for backward compatibility.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $name Property to get.\n\t * @return mixed Property.\n\t */\n\tpublic function __get( $name ) {\n\t\tif ( in_array( $name, $this->compat_fields ) ) {\n\t\t\treturn $this->$name;\n\t\t}\n\t}",
"\t/**\n\t * Make private properties checkable for backward compatibility.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $name Property to check if set.\n\t * @return bool Whether the property is set.\n\t */\n\tpublic function __isset( $name ) {\n\t\tif ( in_array( $name, $this->compat_fields ) ) {\n\t\t\treturn isset( $this->$name );\n\t\t}\n\t}",
"\t/**\n\t * Make private/protected methods readable for backward compatibility.\n\t *\n\t * @since 4.0.0\n\t *\n\t * @param string $name Method to call.\n\t * @param array $arguments Arguments to pass when calling.\n\t * @return mixed|false Return value of the callback, false otherwise.\n\t */\n\tpublic function __call( $name, $arguments ) {\n\t\tif ( in_array( $name, $this->compat_methods ) ) {\n\t\t\treturn call_user_func_array( array( $this, $name ), $arguments );\n\t\t}\n\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing archive page?\n\t *\n\t * Month, Year, Category, Author, Post Type archive...\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_archive() {\n\t\treturn (bool) $this->is_archive;\n\t}",
"\t/**\n\t * Is the query for an existing post type archive page?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $post_types Optional. Post type or array of posts types to check against.\n\t * @return bool\n\t */\n\tpublic function is_post_type_archive( $post_types = '' ) {\n\t\tif ( empty( $post_types ) || ! $this->is_post_type_archive ) {\n\t\t\treturn (bool) $this->is_post_type_archive;\n\t\t}",
"\t\t$post_type = $this->get( 'post_type' );\n\t\tif ( is_array( $post_type ) ) {\n\t\t\t$post_type = reset( $post_type );\n\t\t}\n\t\t$post_type_object = get_post_type_object( $post_type );",
"\t\treturn in_array( $post_type_object->name, (array) $post_types );\n\t}",
"\t/**\n\t * Is the query for an existing attachment page?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $attachment Attachment ID, title, slug, or array of such.\n\t * @return bool\n\t */\n\tpublic function is_attachment( $attachment = '' ) {\n\t\tif ( ! $this->is_attachment ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $attachment ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$attachment = array_map( 'strval', (array) $attachment );",
"\t\t$post_obj = $this->get_queried_object();",
"\t\tif ( in_array( (string) $post_obj->ID, $attachment ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_title, $attachment ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_name, $attachment ) ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing author archive page?\n\t *\n\t * If the $author parameter is specified, this function will additionally\n\t * check if the query is for one of the authors specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames\n\t * @return bool\n\t */\n\tpublic function is_author( $author = '' ) {\n\t\tif ( ! $this->is_author ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $author ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$author_obj = $this->get_queried_object();",
"\t\t$author = array_map( 'strval', (array) $author );",
"\t\tif ( in_array( (string) $author_obj->ID, $author ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $author_obj->nickname, $author ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $author_obj->user_nicename, $author ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing category archive page?\n\t *\n\t * If the $category parameter is specified, this function will additionally\n\t * check if the query is for one of the categories specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.\n\t * @return bool\n\t */\n\tpublic function is_category( $category = '' ) {\n\t\tif ( ! $this->is_category ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $category ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$cat_obj = $this->get_queried_object();",
"\t\t$category = array_map( 'strval', (array) $category );",
"\t\tif ( in_array( (string) $cat_obj->term_id, $category ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $cat_obj->name, $category ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $cat_obj->slug, $category ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing tag archive page?\n\t *\n\t * If the $tag parameter is specified, this function will additionally\n\t * check if the query is for one of the tags specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.\n\t * @return bool\n\t */\n\tpublic function is_tag( $tag = '' ) {\n\t\tif ( ! $this->is_tag ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $tag ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$tag_obj = $this->get_queried_object();",
"\t\t$tag = array_map( 'strval', (array) $tag );",
"\t\tif ( in_array( (string) $tag_obj->term_id, $tag ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $tag_obj->name, $tag ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $tag_obj->slug, $tag ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing custom taxonomy archive page?\n\t *\n\t * If the $taxonomy parameter is specified, this function will additionally\n\t * check if the query is for that specific $taxonomy.\n\t *\n\t * If the $term parameter is specified in addition to the $taxonomy parameter,\n\t * this function will additionally check if the query is for one of the terms\n\t * specified.\n\t *\n\t * @since 3.1.0\n\t *\n\t * @global array $wp_taxonomies\n\t *\n\t * @param mixed $taxonomy Optional. Taxonomy slug or slugs.\n\t * @param mixed $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs.\n\t * @return bool True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives).\n\t */\n\tpublic function is_tax( $taxonomy = '', $term = '' ) {\n\t\tglobal $wp_taxonomies;",
"\t\tif ( ! $this->is_tax ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $taxonomy ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$queried_object = $this->get_queried_object();\n\t\t$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );\n\t\t$term_array = (array) $term;",
"\t\t// Check that the taxonomy matches.\n\t\tif ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) ) {\n\t\t\treturn false;\n\t\t}",
"\t\t// Only a Taxonomy provided.\n\t\tif ( empty( $term ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\treturn isset( $queried_object->term_id ) &&\n\t\t\tcount(\n\t\t\t\tarray_intersect(\n\t\t\t\t\tarray( $queried_object->term_id, $queried_object->name, $queried_object->slug ),\n\t\t\t\t\t$term_array\n\t\t\t\t)\n\t\t\t);\n\t}",
"\t/**\n\t * Whether the current URL is within the comments popup window.\n\t *\n\t * @since 3.1.0\n\t * @deprecated 4.5.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_comments_popup() {\n\t\t_deprecated_function( __FUNCTION__, '4.5.0' );",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing date archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_date() {\n\t\treturn (bool) $this->is_date;\n\t}",
"\t/**\n\t * Is the query for an existing day archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_day() {\n\t\treturn (bool) $this->is_day;\n\t}",
"\t/**\n\t * Is the query for a feed?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param string|array $feeds Optional feed types to check.\n\t * @return bool\n\t */\n\tpublic function is_feed( $feeds = '' ) {\n\t\tif ( empty( $feeds ) || ! $this->is_feed ) {\n\t\t\treturn (bool) $this->is_feed;\n\t\t}\n\t\t$qv = $this->get( 'feed' );\n\t\tif ( 'feed' == $qv ) {\n\t\t\t$qv = get_default_feed();\n\t\t}\n\t\treturn in_array( $qv, (array) $feeds );\n\t}",
"\t/**\n\t * Is the query for a comments feed?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_comment_feed() {\n\t\treturn (bool) $this->is_comment_feed;\n\t}",
"\t/**\n\t * Is the query for the front page of the site?\n\t *\n\t * This is for what is displayed at your site's main URL.\n\t *\n\t * Depends on the site's \"Front page displays\" Reading Settings 'show_on_front' and 'page_on_front'.\n\t *\n\t * If you set a static page for the front page of your site, this function will return\n\t * true when viewing that page.\n\t *\n\t * Otherwise the same as @see WP_Query::is_home()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool True, if front of site.\n\t */\n\tpublic function is_front_page() {\n\t\t// most likely case\n\t\tif ( 'posts' == get_option( 'show_on_front' ) && $this->is_home() ) {\n\t\t\treturn true;\n\t\t} elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"\t/**\n\t * Is the query for the blog homepage?\n\t *\n\t * This is the page which shows the time based blog content of your site.\n\t *\n\t * Depends on the site's \"Front page displays\" Reading Settings 'show_on_front' and 'page_for_posts'.\n\t *\n\t * If you set a static page for the front page of your site, this function will return\n\t * true only on the page you set as the \"Posts page\".\n\t *\n\t * @see WP_Query::is_front_page()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool True if blog view homepage.\n\t */\n\tpublic function is_home() {\n\t\treturn (bool) $this->is_home;\n\t}",
"\t/**\n\t * Is the query for the Privacy Policy page?\n\t *\n\t * This is the page which shows the Privacy Policy content of your site.\n\t *\n\t * Depends on the site's \"Change your Privacy Policy page\" Privacy Settings 'wp_page_for_privacy_policy'.\n\t *\n\t * This function will return true only on the page you set as the \"Privacy Policy page\".\n\t *\n\t * @since 5.2.0\n\t *\n\t * @return bool True, if Privacy Policy page.\n\t */\n\tpublic function is_privacy_policy() {\n\t\tif ( get_option( 'wp_page_for_privacy_policy' ) && $this->is_page( get_option( 'wp_page_for_privacy_policy' ) ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}",
"\t/**\n\t * Is the query for an existing month archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_month() {\n\t\treturn (bool) $this->is_month;\n\t}",
"\t/**\n\t * Is the query for an existing single page?\n\t *\n\t * If the $page parameter is specified, this function will additionally\n\t * check if the query is for one of the pages specified.\n\t *\n\t * @see WP_Query::is_single()\n\t * @see WP_Query::is_singular()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param int|string|array $page Optional. Page ID, title, slug, path, or array of such. Default empty.\n\t * @return bool Whether the query is for an existing single page.\n\t */\n\tpublic function is_page( $page = '' ) {\n\t\tif ( ! $this->is_page ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $page ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$page_obj = $this->get_queried_object();",
"\t\t$page = array_map( 'strval', (array) $page );",
"\t\tif ( in_array( (string) $page_obj->ID, $page ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $page_obj->post_title, $page ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $page_obj->post_name, $page ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tforeach ( $page as $pagepath ) {\n\t\t\t\tif ( ! strpos( $pagepath, '/' ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$pagepath_obj = get_page_by_path( $pagepath );",
"\t\t\t\tif ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for paged result and not for the first page?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_paged() {\n\t\treturn (bool) $this->is_paged;\n\t}",
"\t/**\n\t * Is the query for a post or page preview?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_preview() {\n\t\treturn (bool) $this->is_preview;\n\t}",
"\t/**\n\t * Is the query for the robots file?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_robots() {\n\t\treturn (bool) $this->is_robots;\n\t}",
"\t/**\n\t * Is the query for a search?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_search() {\n\t\treturn (bool) $this->is_search;\n\t}",
"\t/**\n\t * Is the query for an existing single post?\n\t *\n\t * Works for any post type excluding pages.\n\t *\n\t * If the $post parameter is specified, this function will additionally\n\t * check if the query is for one of the Posts specified.\n\t *\n\t * @see WP_Query::is_page()\n\t * @see WP_Query::is_singular()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param int|string|array $post Optional. Post ID, title, slug, path, or array of such. Default empty.\n\t * @return bool Whether the query is for an existing single post.\n\t */\n\tpublic function is_single( $post = '' ) {\n\t\tif ( ! $this->is_single ) {\n\t\t\treturn false;\n\t\t}",
"\t\tif ( empty( $post ) ) {\n\t\t\treturn true;\n\t\t}",
"\t\t$post_obj = $this->get_queried_object();",
"\t\t$post = array_map( 'strval', (array) $post );",
"\t\tif ( in_array( (string) $post_obj->ID, $post ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_title, $post ) ) {\n\t\t\treturn true;\n\t\t} elseif ( in_array( $post_obj->post_name, $post ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tforeach ( $post as $postpath ) {\n\t\t\t\tif ( ! strpos( $postpath, '/' ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );",
"\t\t\t\tif ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}",
"\t/**\n\t * Is the query for an existing single post of any post type (post, attachment, page,\n\t * custom post types)?\n\t *\n\t * If the $post_types parameter is specified, this function will additionally\n\t * check if the query is for one of the Posts Types specified.\n\t *\n\t * @see WP_Query::is_page()\n\t * @see WP_Query::is_single()\n\t *\n\t * @since 3.1.0\n\t *\n\t * @param string|array $post_types Optional. Post type or array of post types. Default empty.\n\t * @return bool Whether the query is for an existing single post of any of the given post types.\n\t */\n\tpublic function is_singular( $post_types = '' ) {\n\t\tif ( empty( $post_types ) || ! $this->is_singular ) {\n\t\t\treturn (bool) $this->is_singular;\n\t\t}",
"\t\t$post_obj = $this->get_queried_object();",
"\t\treturn in_array( $post_obj->post_type, (array) $post_types );\n\t}",
"\t/**\n\t * Is the query for a specific time?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_time() {\n\t\treturn (bool) $this->is_time;\n\t}",
"\t/**\n\t * Is the query for a trackback endpoint call?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_trackback() {\n\t\treturn (bool) $this->is_trackback;\n\t}",
"\t/**\n\t * Is the query for an existing year archive?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_year() {\n\t\treturn (bool) $this->is_year;\n\t}",
"\t/**\n\t * Is the query a 404 (returns no results)?\n\t *\n\t * @since 3.1.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_404() {\n\t\treturn (bool) $this->is_404;\n\t}",
"\t/**\n\t * Is the query for an embedded post?\n\t *\n\t * @since 4.4.0\n\t *\n\t * @return bool\n\t */\n\tpublic function is_embed() {\n\t\treturn (bool) $this->is_embed;\n\t}",
"\t/**\n\t * Is the query the main query?\n\t *\n\t * @since 3.3.0\n\t *\n\t * @global WP_Query $wp_query Global WP_Query instance.\n\t *\n\t * @return bool\n\t */\n\tpublic function is_main_query() {\n\t\tglobal $wp_the_query;\n\t\treturn $wp_the_query === $this;\n\t}",
"\t/**\n\t * Set up global post data.\n\t *\n\t * @since 4.1.0\n\t * @since 4.4.0 Added the ability to pass a post ID to `$post`.\n\t *\n\t * @global int $id\n\t * @global WP_User $authordata\n\t * @global string|int|bool $currentday\n\t * @global string|int|bool $currentmonth\n\t * @global int $page\n\t * @global array $pages\n\t * @global int $multipage\n\t * @global int $more\n\t * @global int $numpages\n\t *\n\t * @param WP_Post|object|int $post WP_Post instance or Post ID/object.\n\t * @return true True when finished.\n\t */\n\tpublic function setup_postdata( $post ) {\n\t\tglobal $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;",
"\t\tif ( ! ( $post instanceof WP_Post ) ) {\n\t\t\t$post = get_post( $post );\n\t\t}",
"\t\tif ( ! $post ) {\n\t\t\treturn;\n\t\t}",
"\t\t$elements = $this->generate_postdata( $post );\n\t\tif ( false === $elements ) {\n\t\t\treturn;\n\t\t}",
"\t\t$id = $elements['id'];\n\t\t$authordata = $elements['authordata'];\n\t\t$currentday = $elements['currentday'];\n\t\t$currentmonth = $elements['currentmonth'];\n\t\t$page = $elements['page'];\n\t\t$pages = $elements['pages'];\n\t\t$multipage = $elements['multipage'];\n\t\t$more = $elements['more'];\n\t\t$numpages = $elements['numpages'];",
"\t\t/**\n\t\t * Fires once the post data has been setup.\n\t\t *\n\t\t * @since 2.8.0\n\t\t * @since 4.1.0 Introduced `$this` parameter.\n\t\t *\n\t\t * @param WP_Post $post The Post object (passed by reference).\n\t\t * @param WP_Query $this The current Query object (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'the_post', array( &$post, &$this ) );",
"\t\treturn true;\n\t}",
"\t/**\n\t * Generate post data.\n\t *\n\t * @since 5.2.0\n\t *\n\t * @param WP_Post|object|int $post WP_Post instance or Post ID/object.\n\t * @return array|bool $elements Elements of post or false on failure.\n\t */\n\tpublic function generate_postdata( $post ) {",
"\t\tif ( ! ( $post instanceof WP_Post ) ) {\n\t\t\t$post = get_post( $post );\n\t\t}",
"\t\tif ( ! $post ) {\n\t\t\treturn false;\n\t\t}",
"\t\t$id = (int) $post->ID;",
"\t\t$authordata = get_userdata( $post->post_author );",
"\t\t$currentday = mysql2date( 'd.m.y', $post->post_date, false );\n\t\t$currentmonth = mysql2date( 'm', $post->post_date, false );\n\t\t$numpages = 1;\n\t\t$multipage = 0;\n\t\t$page = $this->get( 'page' );\n\t\tif ( ! $page ) {\n\t\t\t$page = 1;\n\t\t}",
"\t\t/*\n\t\t * Force full post content when viewing the permalink for the $post,\n\t\t * or when on an RSS feed. Otherwise respect the 'more' tag.\n\t\t */\n\t\tif ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {\n\t\t\t$more = 1;\n\t\t} elseif ( $this->is_feed() ) {\n\t\t\t$more = 1;\n\t\t} else {\n\t\t\t$more = 0;\n\t\t}",
"\t\t$content = $post->post_content;\n\t\tif ( false !== strpos( $content, '<!--nextpage-->' ) ) {\n\t\t\t$content = str_replace( \"\\n<!--nextpage-->\\n\", '<!--nextpage-->', $content );\n\t\t\t$content = str_replace( \"\\n<!--nextpage-->\", '<!--nextpage-->', $content );\n\t\t\t$content = str_replace( \"<!--nextpage-->\\n\", '<!--nextpage-->', $content );",
"\t\t\t// Remove the nextpage block delimiters, to avoid invalid block structures in the split content.\n\t\t\t$content = str_replace( '<!-- wp:nextpage -->', '', $content );\n\t\t\t$content = str_replace( '<!-- /wp:nextpage -->', '', $content );",
"\t\t\t// Ignore nextpage at the beginning of the content.\n\t\t\tif ( 0 === strpos( $content, '<!--nextpage-->' ) ) {\n\t\t\t\t$content = substr( $content, 15 );\n\t\t\t}",
"\t\t\t$pages = explode( '<!--nextpage-->', $content );\n\t\t} else {\n\t\t\t$pages = array( $post->post_content );\n\t\t}",
"\t\t/**\n\t\t * Filters the \"pages\" derived from splitting the post content.\n\t\t *\n\t\t * \"Pages\" are determined by splitting the post content based on the presence\n\t\t * of `<!-- nextpage -->` tags.\n\t\t *\n\t\t * @since 4.4.0\n\t\t *\n\t\t * @param string[] $pages Array of \"pages\" from the post content split by `<!-- nextpage -->` tags.\n\t\t * @param WP_Post $post Current post object.\n\t\t */\n\t\t$pages = apply_filters( 'content_pagination', $pages, $post );",
"\t\t$numpages = count( $pages );",
"\t\tif ( $numpages > 1 ) {\n\t\t\tif ( $page > 1 ) {\n\t\t\t\t$more = 1;\n\t\t\t}\n\t\t\t$multipage = 1;\n\t\t} else {\n\t\t\t$multipage = 0;\n\t\t}",
"\t\t$elements = compact( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );",
"\t\treturn $elements;\n\t}\n\t/**\n\t * After looping through a nested query, this function\n\t * restores the $post global to the current post in this query.\n\t *\n\t * @since 3.7.0\n\t *\n\t * @global WP_Post $post\n\t */\n\tpublic function reset_postdata() {\n\t\tif ( ! empty( $this->post ) ) {\n\t\t\t$GLOBALS['post'] = $this->post;\n\t\t\t$this->setup_postdata( $this->post );\n\t\t}\n\t}",
"\t/**\n\t * Lazyload term meta for posts in the loop.\n\t *\n\t * @since 4.4.0\n\t * @deprecated 4.5.0 See wp_queue_posts_for_term_meta_lazyload().\n\t *\n\t * @param mixed $check\n\t * @param int $term_id\n\t * @return mixed\n\t */\n\tpublic function lazyload_term_meta( $check, $term_id ) {\n\t\t_deprecated_function( __METHOD__, '4.5.0' );\n\t\treturn $check;\n\t}",
"\t/**\n\t * Lazyload comment meta for comments in the loop.\n\t *\n\t * @since 4.4.0\n\t * @deprecated 4.5.0 See wp_queue_comments_for_comment_meta_lazyload().\n\t *\n\t * @param mixed $check\n\t * @param int $comment_id\n\t * @return mixed\n\t */\n\tpublic function lazyload_comment_meta( $check, $comment_id ) {\n\t\t_deprecated_function( __METHOD__, '4.5.0' );\n\t\treturn $check;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [806, 18, 17], "buggy_code_start_loc": [541, 17, 16], "filenames": ["wp-includes/class-wp-query.php", "wp-includes/class-wp.php", "wp-includes/version.php"], "fixing_code_end_loc": [805, 18, 17], "fixing_code_start_loc": [540, 17, 16], "message": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "954E75B0-6B64-4856-B36D-4EBD80FBDC1B", "versionEndExcluding": "5.2.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled."}, {"lang": "es", "value": "En WordPress anterior a 5.2.4, es posible la visualizaci\u00f3n no autenticada de cierto contenido porque la propiedad de consulta est\u00e1tica es manejada inapropiadamente."}], "evaluatorComment": null, "id": "CVE-2019-17671", "lastModified": "2023-02-03T21:54:45.063", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-17T13:15:10.937", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://blog.wpscan.org/wordpress/security/release/2019/10/15/wordpress-524-security-release-breakdown.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://core.trac.wordpress.org/changeset/46474"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/11/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2020/Jan/8"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://wordpress.org/news/2019/10/wordpress-5-2-4-security-release/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://wpvulndb.com/vulnerabilities/9909"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4599"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4677"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, "type": "CWE-200"}
| 89
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n/**\n * WordPress environment setup class.\n *\n * @package WordPress\n * @since 2.0.0\n */\nclass WP {\n\t/**\n\t * Public query variables.\n\t *\n\t * Long list of public query variables.\n\t *\n\t * @since 2.0.0\n\t * @var string[]\n\t */",
"\tpublic $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'embed' );",
"\n\t/**\n\t * Private query variables.\n\t *\n\t * Long list of private query variables.\n\t *\n\t * @since 2.0.0\n\t * @var string[]\n\t */\n\tpublic $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in', 'title', 'fields' );",
"\t/**\n\t * Extra query variables set by the user.\n\t *\n\t * @since 2.1.0\n\t * @var array\n\t */\n\tpublic $extra_query_vars = array();",
"\t/**\n\t * Query variables for setting up the WordPress Query Loop.\n\t *\n\t * @since 2.0.0\n\t * @var array\n\t */\n\tpublic $query_vars;",
"\t/**\n\t * String parsed to set the query variables.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $query_string;",
"\t/**\n\t * The request path, e.g. 2015/05/06.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $request;",
"\t/**\n\t * Rewrite rule the request matched.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $matched_rule;",
"\t/**\n\t * Rewrite query the request matched.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $matched_query;",
"\t/**\n\t * Whether already did the permalink.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $did_permalink = false;",
"\t/**\n\t * Add name to list of public query variables.\n\t *\n\t * @since 2.1.0\n\t *\n\t * @param string $qv Query variable name.\n\t */\n\tpublic function add_query_var( $qv ) {\n\t\tif ( ! in_array( $qv, $this->public_query_vars ) ) {\n\t\t\t$this->public_query_vars[] = $qv;\n\t\t}\n\t}",
"\t/**\n\t * Removes a query variable from a list of public query variables.\n\t *\n\t * @since 4.5.0\n\t *\n\t * @param string $name Query variable name.\n\t */\n\tpublic function remove_query_var( $name ) {\n\t\t$this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) );\n\t}",
"\t/**\n\t * Set the value of a query variable.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param string $key Query variable name.\n\t * @param mixed $value Query variable value.\n\t */\n\tpublic function set_query_var( $key, $value ) {\n\t\t$this->query_vars[ $key ] = $value;\n\t}",
"\t/**\n\t * Parse request to find correct WordPress query.\n\t *\n\t * Sets up the query variables based on the request. There are also many\n\t * filters and actions that can be used to further manipulate the result.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Rewrite $wp_rewrite\n\t *\n\t * @param array|string $extra_query_vars Set the extra query variables.\n\t */\n\tpublic function parse_request( $extra_query_vars = '' ) {\n\t\tglobal $wp_rewrite;",
"\t\t/**\n\t\t * Filters whether to parse the request.\n\t\t *\n\t\t * @since 3.5.0\n\t\t *\n\t\t * @param bool $bool Whether or not to parse the request. Default true.\n\t\t * @param WP $this Current WordPress environment instance.\n\t\t * @param array|string $extra_query_vars Extra passed query variables.\n\t\t */\n\t\tif ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) ) {\n\t\t\treturn;\n\t\t}",
"\t\t$this->query_vars = array();\n\t\t$post_type_query_vars = array();",
"\t\tif ( is_array( $extra_query_vars ) ) {\n\t\t\t$this->extra_query_vars = & $extra_query_vars;\n\t\t} elseif ( ! empty( $extra_query_vars ) ) {\n\t\t\tparse_str( $extra_query_vars, $this->extra_query_vars );\n\t\t}\n\t\t// Process PATH_INFO, REQUEST_URI, and 404 for permalinks.",
"\t\t// Fetch the rewrite rules.\n\t\t$rewrite = $wp_rewrite->wp_rewrite_rules();",
"\t\tif ( ! empty( $rewrite ) ) {\n\t\t\t// If we match a rewrite rule, this will be cleared.\n\t\t\t$error = '404';\n\t\t\t$this->did_permalink = true;",
"\t\t\t$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';\n\t\t\tlist( $pathinfo ) = explode( '?', $pathinfo );\n\t\t\t$pathinfo = str_replace( '%', '%25', $pathinfo );",
"\t\t\tlist( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );\n\t\t\t$self = $_SERVER['PHP_SELF'];\n\t\t\t$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );\n\t\t\t$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );",
"\t\t\t// Trim path info from the end and the leading home path from the\n\t\t\t// front. For path info requests, this leaves us with the requesting\n\t\t\t// filename, if any. For 404 requests, this leaves us with the\n\t\t\t// requested permalink.\n\t\t\t$req_uri = str_replace( $pathinfo, '', $req_uri );\n\t\t\t$req_uri = trim( $req_uri, '/' );\n\t\t\t$req_uri = preg_replace( $home_path_regex, '', $req_uri );\n\t\t\t$req_uri = trim( $req_uri, '/' );\n\t\t\t$pathinfo = trim( $pathinfo, '/' );\n\t\t\t$pathinfo = preg_replace( $home_path_regex, '', $pathinfo );\n\t\t\t$pathinfo = trim( $pathinfo, '/' );\n\t\t\t$self = trim( $self, '/' );\n\t\t\t$self = preg_replace( $home_path_regex, '', $self );\n\t\t\t$self = trim( $self, '/' );",
"\t\t\t// The requested permalink is in $pathinfo for path info requests and\n\t\t\t// $req_uri for other requests.\n\t\t\tif ( ! empty( $pathinfo ) && ! preg_match( '|^.*' . $wp_rewrite->index . '$|', $pathinfo ) ) {\n\t\t\t\t$requested_path = $pathinfo;\n\t\t\t} else {\n\t\t\t\t// If the request uri is the index, blank it out so that we don't try to match it against a rule.\n\t\t\t\tif ( $req_uri == $wp_rewrite->index ) {\n\t\t\t\t\t$req_uri = '';\n\t\t\t\t}\n\t\t\t\t$requested_path = $req_uri;\n\t\t\t}\n\t\t\t$requested_file = $req_uri;",
"\t\t\t$this->request = $requested_path;",
"\t\t\t// Look for matches.\n\t\t\t$request_match = $requested_path;\n\t\t\tif ( empty( $request_match ) ) {\n\t\t\t\t// An empty request could only match against ^$ regex\n\t\t\t\tif ( isset( $rewrite['$'] ) ) {\n\t\t\t\t\t$this->matched_rule = '$';\n\t\t\t\t\t$query = $rewrite['$'];\n\t\t\t\t\t$matches = array( '' );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tforeach ( (array) $rewrite as $match => $query ) {\n\t\t\t\t\t// If the requested file is the anchor of the match, prepend it to the path info.\n\t\t\t\t\tif ( ! empty( $requested_file ) && strpos( $match, $requested_file ) === 0 && $requested_file != $requested_path ) {\n\t\t\t\t\t\t$request_match = $requested_file . '/' . $requested_path;\n\t\t\t\t\t}",
"\t\t\t\t\tif ( preg_match( \"#^$match#\", $request_match, $matches ) ||\n\t\t\t\t\t\tpreg_match( \"#^$match#\", urldecode( $request_match ), $matches ) ) {",
"\t\t\t\t\t\tif ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\\$matches\\[([0-9]+)\\]/', $query, $varmatch ) ) {\n\t\t\t\t\t\t\t// This is a verbose page match, let's check to be sure about it.\n\t\t\t\t\t\t\t$page = get_page_by_path( $matches[ $varmatch[1] ] );\n\t\t\t\t\t\t\tif ( ! $page ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}",
"\t\t\t\t\t\t\t$post_status_obj = get_post_status_object( $page->post_status );\n\t\t\t\t\t\t\tif ( ! $post_status_obj->public && ! $post_status_obj->protected\n\t\t\t\t\t\t\t\t&& ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}",
"\t\t\t\t\t\t// Got a match.\n\t\t\t\t\t\t$this->matched_rule = $match;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( isset( $this->matched_rule ) ) {\n\t\t\t\t// Trim the query of everything up to the '?'.\n\t\t\t\t$query = preg_replace( '!^.+\\?!', '', $query );",
"\t\t\t\t// Substitute the substring matches into the query.\n\t\t\t\t$query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) );",
"\t\t\t\t$this->matched_query = $query;",
"\t\t\t\t// Parse the query.\n\t\t\t\tparse_str( $query, $perma_query_vars );",
"\t\t\t\t// If we're processing a 404 request, clear the error var since we found something.\n\t\t\t\tif ( '404' == $error ) {\n\t\t\t\t\tunset( $error, $_GET['error'] );\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// If req_uri is empty or if it is a request for ourself, unset error.\n\t\t\tif ( empty( $requested_path ) || $requested_file == $self || strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) {\n\t\t\t\tunset( $error, $_GET['error'] );",
"\t\t\t\tif ( isset( $perma_query_vars ) && strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) {\n\t\t\t\t\tunset( $perma_query_vars );\n\t\t\t\t}",
"\t\t\t\t$this->did_permalink = false;\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters the query variables whitelist before processing.\n\t\t *\n\t\t * Allows (publicly allowed) query vars to be added, removed, or changed prior\n\t\t * to executing the query. Needed to allow custom rewrite rules using your own arguments\n\t\t * to work, or any other custom query variables you want to be publicly available.\n\t\t *\n\t\t * @since 1.5.0\n\t\t *\n\t\t * @param string[] $public_query_vars The array of whitelisted query variable names.\n\t\t */\n\t\t$this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars );",
"\t\tforeach ( get_post_types( array(), 'objects' ) as $post_type => $t ) {\n\t\t\tif ( is_post_type_viewable( $t ) && $t->query_var ) {\n\t\t\t\t$post_type_query_vars[ $t->query_var ] = $post_type;\n\t\t\t}\n\t\t}",
"\t\tforeach ( $this->public_query_vars as $wpvar ) {\n\t\t\tif ( isset( $this->extra_query_vars[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $this->extra_query_vars[ $wpvar ];\n\t\t\t} elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) {\n\t\t\t\twp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );\n\t\t\t} elseif ( isset( $_POST[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $_POST[ $wpvar ];\n\t\t\t} elseif ( isset( $_GET[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $_GET[ $wpvar ];\n\t\t\t} elseif ( isset( $perma_query_vars[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $perma_query_vars[ $wpvar ];\n\t\t\t}",
"\t\t\tif ( ! empty( $this->query_vars[ $wpvar ] ) ) {\n\t\t\t\tif ( ! is_array( $this->query_vars[ $wpvar ] ) ) {\n\t\t\t\t\t$this->query_vars[ $wpvar ] = (string) $this->query_vars[ $wpvar ];\n\t\t\t\t} else {\n\t\t\t\t\tforeach ( $this->query_vars[ $wpvar ] as $vkey => $v ) {\n\t\t\t\t\t\tif ( is_scalar( $v ) ) {\n\t\t\t\t\t\t\t$this->query_vars[ $wpvar ][ $vkey ] = (string) $v;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}",
"\t\t\t\tif ( isset( $post_type_query_vars[ $wpvar ] ) ) {\n\t\t\t\t\t$this->query_vars['post_type'] = $post_type_query_vars[ $wpvar ];\n\t\t\t\t\t$this->query_vars['name'] = $this->query_vars[ $wpvar ];\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// Convert urldecoded spaces back into +\n\t\tforeach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) {\n\t\t\tif ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) {\n\t\t\t\t$this->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->query_vars[ $t->query_var ] );\n\t\t\t}\n\t\t}",
"\t\t// Don't allow non-publicly queryable taxonomies to be queried from the front end.\n\t\tif ( ! is_admin() ) {\n\t\t\tforeach ( get_taxonomies( array( 'publicly_queryable' => false ), 'objects' ) as $taxonomy => $t ) {\n\t\t\t\t/*\n\t\t\t\t * Disallow when set to the 'taxonomy' query var.\n\t\t\t\t * Non-publicly queryable taxonomies cannot register custom query vars. See register_taxonomy().\n\t\t\t\t */\n\t\t\t\tif ( isset( $this->query_vars['taxonomy'] ) && $taxonomy === $this->query_vars['taxonomy'] ) {\n\t\t\t\t\tunset( $this->query_vars['taxonomy'], $this->query_vars['term'] );\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// Limit publicly queried post_types to those that are publicly_queryable\n\t\tif ( isset( $this->query_vars['post_type'] ) ) {\n\t\t\t$queryable_post_types = get_post_types( array( 'publicly_queryable' => true ) );\n\t\t\tif ( ! is_array( $this->query_vars['post_type'] ) ) {\n\t\t\t\tif ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) {\n\t\t\t\t\tunset( $this->query_vars['post_type'] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );\n\t\t\t}\n\t\t}",
"\t\t// Resolve conflicts between posts with numeric slugs and date archive queries.\n\t\t$this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars );",
"\t\tforeach ( (array) $this->private_query_vars as $var ) {\n\t\t\tif ( isset( $this->extra_query_vars[ $var ] ) ) {\n\t\t\t\t$this->query_vars[ $var ] = $this->extra_query_vars[ $var ];\n\t\t\t}\n\t\t}",
"\t\tif ( isset( $error ) ) {\n\t\t\t$this->query_vars['error'] = $error;\n\t\t}",
"\t\t/**\n\t\t * Filters the array of parsed query variables.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param array $query_vars The array of requested query variables.\n\t\t */\n\t\t$this->query_vars = apply_filters( 'request', $this->query_vars );",
"\t\t/**\n\t\t * Fires once all query variables for the current request have been parsed.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param WP $this Current WordPress environment instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'parse_request', array( &$this ) );\n\t}",
"\t/**\n\t * Sends additional HTTP headers for caching, content type, etc.\n\t *\n\t * Sets the Content-Type header. Sets the 'error' status (if passed) and optionally exits.\n\t * If showing a feed, it will also send Last-Modified, ETag, and 304 status if needed.\n\t *\n\t * @since 2.0.0\n\t * @since 4.4.0 `X-Pingback` header is added conditionally after posts have been queried in handle_404().\n\t */\n\tpublic function send_headers() {\n\t\t$headers = array();\n\t\t$status = null;\n\t\t$exit_required = false;",
"\t\tif ( is_user_logged_in() ) {\n\t\t\t$headers = array_merge( $headers, wp_get_nocache_headers() );\n\t\t}\n\t\tif ( ! empty( $this->query_vars['error'] ) ) {\n\t\t\t$status = (int) $this->query_vars['error'];\n\t\t\tif ( 404 === $status ) {\n\t\t\t\tif ( ! is_user_logged_in() ) {\n\t\t\t\t\t$headers = array_merge( $headers, wp_get_nocache_headers() );\n\t\t\t\t}\n\t\t\t\t$headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' );\n\t\t\t} elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {\n\t\t\t\t$exit_required = true;\n\t\t\t}\n\t\t} elseif ( empty( $this->query_vars['feed'] ) ) {\n\t\t\t$headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' );\n\t\t} else {\n\t\t\t// Set the correct content type for feeds\n\t\t\t$type = $this->query_vars['feed'];\n\t\t\tif ( 'feed' == $this->query_vars['feed'] ) {\n\t\t\t\t$type = get_default_feed();\n\t\t\t}\n\t\t\t$headers['Content-Type'] = feed_content_type( $type ) . '; charset=' . get_option( 'blog_charset' );",
"\t\t\t// We're showing a feed, so WP is indeed the only thing that last changed.\n\t\t\tif ( ! empty( $this->query_vars['withcomments'] )\n\t\t\t\t|| false !== strpos( $this->query_vars['feed'], 'comments-' )\n\t\t\t\t|| ( empty( $this->query_vars['withoutcomments'] )\n\t\t\t\t\t&& ( ! empty( $this->query_vars['p'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['name'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['page_id'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['pagename'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['attachment'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['attachment_id'] )\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t$wp_last_modified = mysql2date( 'D, d M Y H:i:s', get_lastcommentmodified( 'GMT' ), false );\n\t\t\t} else {\n\t\t\t\t$wp_last_modified = mysql2date( 'D, d M Y H:i:s', get_lastpostmodified( 'GMT' ), false );\n\t\t\t}",
"\t\t\tif ( ! $wp_last_modified ) {\n\t\t\t\t$wp_last_modified = date( 'D, d M Y H:i:s' );\n\t\t\t}",
"\t\t\t$wp_last_modified .= ' GMT';",
"\t\t\t$wp_etag = '\"' . md5( $wp_last_modified ) . '\"';\n\t\t\t$headers['Last-Modified'] = $wp_last_modified;\n\t\t\t$headers['ETag'] = $wp_etag;",
"\t\t\t// Support for Conditional GET\n\t\t\tif ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) {\n\t\t\t\t$client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );\n\t\t\t} else {\n\t\t\t\t$client_etag = false;\n\t\t\t}",
"\t\t\t$client_last_modified = empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ? '' : trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );\n\t\t\t// If string is empty, return 0. If not, attempt to parse into a timestamp\n\t\t\t$client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0;",
"\t\t\t// Make a timestamp for our most recent modification...\n\t\t\t$wp_modified_timestamp = strtotime( $wp_last_modified );",
"\t\t\tif ( ( $client_last_modified && $client_etag ) ?\n\t\t\t\t\t( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag == $wp_etag ) ) :\n\t\t\t\t\t( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag == $wp_etag ) ) ) {\n\t\t\t\t$status = 304;\n\t\t\t\t$exit_required = true;\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters the HTTP headers before they're sent to the browser.\n\t\t *\n\t\t * @since 2.8.0\n\t\t *\n\t\t * @param string[] $headers Associative array of headers to be sent.\n\t\t * @param WP $this Current WordPress environment instance.\n\t\t */\n\t\t$headers = apply_filters( 'wp_headers', $headers, $this );",
"\t\tif ( ! empty( $status ) ) {\n\t\t\tstatus_header( $status );\n\t\t}",
"\t\t// If Last-Modified is set to false, it should not be sent (no-cache situation).\n\t\tif ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) {\n\t\t\tunset( $headers['Last-Modified'] );",
"\t\t\t// In PHP 5.3+, make sure we are not sending a Last-Modified header.\n\t\t\tif ( function_exists( 'header_remove' ) ) {\n\t\t\t\t@header_remove( 'Last-Modified' );\n\t\t\t} else {\n\t\t\t\t// In PHP 5.2, send an empty Last-Modified header, but only as a\n\t\t\t\t// last resort to override a header already sent. #WP23021\n\t\t\t\tforeach ( headers_list() as $header ) {\n\t\t\t\t\tif ( 0 === stripos( $header, 'Last-Modified' ) ) {\n\t\t\t\t\t\t$headers['Last-Modified'] = '';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tforeach ( (array) $headers as $name => $field_value ) {\n\t\t\t@header( \"{$name}: {$field_value}\" );\n\t\t}",
"\t\tif ( $exit_required ) {\n\t\t\texit();\n\t\t}",
"\t\t/**\n\t\t * Fires once the requested HTTP headers for caching, content type, etc. have been sent.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param WP $this Current WordPress environment instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'send_headers', array( &$this ) );\n\t}",
"\t/**\n\t * Sets the query string property based off of the query variable property.\n\t *\n\t * The {@see 'query_string'} filter is deprecated, but still works. Plugins should\n\t * use the {@see 'request'} filter instead.\n\t *\n\t * @since 2.0.0\n\t */\n\tpublic function build_query_string() {\n\t\t$this->query_string = '';\n\t\tforeach ( (array) array_keys( $this->query_vars ) as $wpvar ) {\n\t\t\tif ( '' != $this->query_vars[ $wpvar ] ) {\n\t\t\t\t$this->query_string .= ( strlen( $this->query_string ) < 1 ) ? '' : '&';\n\t\t\t\tif ( ! is_scalar( $this->query_vars[ $wpvar ] ) ) { // Discard non-scalars.\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$this->query_string .= $wpvar . '=' . rawurlencode( $this->query_vars[ $wpvar ] );\n\t\t\t}\n\t\t}",
"\t\tif ( has_filter( 'query_string' ) ) { // Don't bother filtering and parsing if no plugins are hooked in.\n\t\t\t/**\n\t\t\t * Filters the query string before parsing.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t * @deprecated 2.1.0 Use 'query_vars' or 'request' filters instead.\n\t\t\t *\n\t\t\t * @param string $query_string The query string to modify.\n\t\t\t */\n\t\t\t$this->query_string = apply_filters( 'query_string', $this->query_string );\n\t\t\tparse_str( $this->query_string, $this->query_vars );\n\t\t}\n\t}",
"\t/**\n\t * Set up the WordPress Globals.\n\t *\n\t * The query_vars property will be extracted to the GLOBALS. So care should\n\t * be taken when naming global variables that might interfere with the\n\t * WordPress environment.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Query $wp_query\n\t * @global string $query_string Query string for the loop.\n\t * @global array $posts The found posts.\n\t * @global WP_Post|null $post The current post, if available.\n\t * @global string $request The SQL statement for the request.\n\t * @global int $more Only set, if single page or post.\n\t * @global int $single If single page or post. Only set, if single page or post.\n\t * @global WP_User $authordata Only set, if author archive.\n\t */\n\tpublic function register_globals() {\n\t\tglobal $wp_query;",
"\t\t// Extract updated query vars back into global namespace.\n\t\tforeach ( (array) $wp_query->query_vars as $key => $value ) {\n\t\t\t$GLOBALS[ $key ] = $value;\n\t\t}",
"\t\t$GLOBALS['query_string'] = $this->query_string;\n\t\t$GLOBALS['posts'] = & $wp_query->posts;\n\t\t$GLOBALS['post'] = isset( $wp_query->post ) ? $wp_query->post : null;\n\t\t$GLOBALS['request'] = $wp_query->request;",
"\t\tif ( $wp_query->is_single() || $wp_query->is_page() ) {\n\t\t\t$GLOBALS['more'] = 1;\n\t\t\t$GLOBALS['single'] = 1;\n\t\t}",
"\t\tif ( $wp_query->is_author() && isset( $wp_query->post ) ) {\n\t\t\t$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );\n\t\t}\n\t}",
"\t/**\n\t * Set up the current user.\n\t *\n\t * @since 2.0.0\n\t */\n\tpublic function init() {\n\t\twp_get_current_user();\n\t}",
"\t/**\n\t * Set up the Loop based on the query variables.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Query $wp_the_query\n\t */\n\tpublic function query_posts() {\n\t\tglobal $wp_the_query;\n\t\t$this->build_query_string();\n\t\t$wp_the_query->query( $this->query_vars );\n\t}",
"\t/**\n\t * Set the Headers for 404, if nothing is found for requested URL.\n\t *\n\t * Issue a 404 if a request doesn't match any posts and doesn't match\n\t * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already\n\t * issued, and if the request was not a search or the homepage.\n\t *\n\t * Otherwise, issue a 200.\n\t *\n\t * This sets headers after posts have been queried. handle_404() really means \"handle status.\"\n\t * By inspecting the result of querying posts, seemingly successful requests can be switched to\n\t * a 404 so that canonical redirection logic can kick in.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Query $wp_query\n\t */\n\tpublic function handle_404() {\n\t\tglobal $wp_query;",
"\t\t/**\n\t\t * Filters whether to short-circuit default header status handling.\n\t\t *\n\t\t * Returning a non-false value from the filter will short-circuit the handling\n\t\t * and return early.\n\t\t *\n\t\t * @since 4.5.0\n\t\t *\n\t\t * @param bool $preempt Whether to short-circuit default header status handling. Default false.\n\t\t * @param WP_Query $wp_query WordPress Query object.\n\t\t */\n\t\tif ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) {\n\t\t\treturn;\n\t\t}",
"\t\t// If we've already issued a 404, bail.\n\t\tif ( is_404() ) {\n\t\t\treturn;\n\t\t}",
"\t\t// Never 404 for the admin, robots, or if we found posts.\n\t\tif ( is_admin() || is_robots() || $wp_query->posts ) {",
"\t\t\t$success = true;\n\t\t\tif ( is_singular() ) {\n\t\t\t\t$p = false;",
"\t\t\t\tif ( $wp_query->post instanceof WP_Post ) {\n\t\t\t\t\t$p = clone $wp_query->post;\n\t\t\t\t}",
"\t\t\t\t// Only set X-Pingback for single posts that allow pings.\n\t\t\t\tif ( $p && pings_open( $p ) ) {\n\t\t\t\t\t@header( 'X-Pingback: ' . get_bloginfo( 'pingback_url', 'display' ) );\n\t\t\t\t}",
"\t\t\t\t// check for paged content that exceeds the max number of pages\n\t\t\t\t$next = '<!--nextpage-->';\n\t\t\t\tif ( $p && false !== strpos( $p->post_content, $next ) && ! empty( $this->query_vars['page'] ) ) {\n\t\t\t\t\t$page = trim( $this->query_vars['page'], '/' );\n\t\t\t\t\t$success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 );\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $success ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"\t\t// We will 404 for paged queries, as no posts were found.\n\t\tif ( ! is_paged() ) {",
"\t\t\t// Don't 404 for authors without posts as long as they matched an author on this site.\n\t\t\t$author = get_query_var( 'author' );\n\t\t\tif ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}",
"\t\t\t// Don't 404 for these queries if they matched an object.\n\t\t\tif ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}",
"\t\t\t// Don't 404 for these queries either.\n\t\t\tif ( is_home() || is_search() || is_feed() ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"\t\t// Guess it's time to 404.\n\t\t$wp_query->set_404();\n\t\tstatus_header( 404 );\n\t\tnocache_headers();\n\t}",
"\t/**\n\t * Sets up all of the variables required by the WordPress environment.\n\t *\n\t * The action {@see 'wp'} has one parameter that references the WP object. It\n\t * allows for accessing the properties and methods to further manipulate the\n\t * object.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @param string|array $query_args Passed to parse_request().\n\t */\n\tpublic function main( $query_args = '' ) {\n\t\t$this->init();\n\t\t$this->parse_request( $query_args );\n\t\t$this->send_headers();\n\t\t$this->query_posts();\n\t\t$this->handle_404();\n\t\t$this->register_globals();",
"\t\t/**\n\t\t * Fires once the WordPress environment has been set up.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param WP $this Current WordPress environment instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'wp', array( &$this ) );\n\t}\n}"
] |
[
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [806, 18, 17], "buggy_code_start_loc": [541, 17, 16], "filenames": ["wp-includes/class-wp-query.php", "wp-includes/class-wp.php", "wp-includes/version.php"], "fixing_code_end_loc": [805, 18, 17], "fixing_code_start_loc": [540, 17, 16], "message": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "954E75B0-6B64-4856-B36D-4EBD80FBDC1B", "versionEndExcluding": "5.2.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled."}, {"lang": "es", "value": "En WordPress anterior a 5.2.4, es posible la visualizaci\u00f3n no autenticada de cierto contenido porque la propiedad de consulta est\u00e1tica es manejada inapropiadamente."}], "evaluatorComment": null, "id": "CVE-2019-17671", "lastModified": "2023-02-03T21:54:45.063", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-17T13:15:10.937", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://blog.wpscan.org/wordpress/security/release/2019/10/15/wordpress-524-security-release-breakdown.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://core.trac.wordpress.org/changeset/46474"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/11/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2020/Jan/8"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://wordpress.org/news/2019/10/wordpress-5-2-4-security-release/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://wpvulndb.com/vulnerabilities/9909"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4599"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4677"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, "type": "CWE-200"}
| 89
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n/**\n * WordPress environment setup class.\n *\n * @package WordPress\n * @since 2.0.0\n */\nclass WP {\n\t/**\n\t * Public query variables.\n\t *\n\t * Long list of public query variables.\n\t *\n\t * @since 2.0.0\n\t * @var string[]\n\t */",
"\tpublic $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'embed' );",
"\n\t/**\n\t * Private query variables.\n\t *\n\t * Long list of private query variables.\n\t *\n\t * @since 2.0.0\n\t * @var string[]\n\t */\n\tpublic $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in', 'title', 'fields' );",
"\t/**\n\t * Extra query variables set by the user.\n\t *\n\t * @since 2.1.0\n\t * @var array\n\t */\n\tpublic $extra_query_vars = array();",
"\t/**\n\t * Query variables for setting up the WordPress Query Loop.\n\t *\n\t * @since 2.0.0\n\t * @var array\n\t */\n\tpublic $query_vars;",
"\t/**\n\t * String parsed to set the query variables.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $query_string;",
"\t/**\n\t * The request path, e.g. 2015/05/06.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $request;",
"\t/**\n\t * Rewrite rule the request matched.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $matched_rule;",
"\t/**\n\t * Rewrite query the request matched.\n\t *\n\t * @since 2.0.0\n\t * @var string\n\t */\n\tpublic $matched_query;",
"\t/**\n\t * Whether already did the permalink.\n\t *\n\t * @since 2.0.0\n\t * @var bool\n\t */\n\tpublic $did_permalink = false;",
"\t/**\n\t * Add name to list of public query variables.\n\t *\n\t * @since 2.1.0\n\t *\n\t * @param string $qv Query variable name.\n\t */\n\tpublic function add_query_var( $qv ) {\n\t\tif ( ! in_array( $qv, $this->public_query_vars ) ) {\n\t\t\t$this->public_query_vars[] = $qv;\n\t\t}\n\t}",
"\t/**\n\t * Removes a query variable from a list of public query variables.\n\t *\n\t * @since 4.5.0\n\t *\n\t * @param string $name Query variable name.\n\t */\n\tpublic function remove_query_var( $name ) {\n\t\t$this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) );\n\t}",
"\t/**\n\t * Set the value of a query variable.\n\t *\n\t * @since 2.3.0\n\t *\n\t * @param string $key Query variable name.\n\t * @param mixed $value Query variable value.\n\t */\n\tpublic function set_query_var( $key, $value ) {\n\t\t$this->query_vars[ $key ] = $value;\n\t}",
"\t/**\n\t * Parse request to find correct WordPress query.\n\t *\n\t * Sets up the query variables based on the request. There are also many\n\t * filters and actions that can be used to further manipulate the result.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Rewrite $wp_rewrite\n\t *\n\t * @param array|string $extra_query_vars Set the extra query variables.\n\t */\n\tpublic function parse_request( $extra_query_vars = '' ) {\n\t\tglobal $wp_rewrite;",
"\t\t/**\n\t\t * Filters whether to parse the request.\n\t\t *\n\t\t * @since 3.5.0\n\t\t *\n\t\t * @param bool $bool Whether or not to parse the request. Default true.\n\t\t * @param WP $this Current WordPress environment instance.\n\t\t * @param array|string $extra_query_vars Extra passed query variables.\n\t\t */\n\t\tif ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) ) {\n\t\t\treturn;\n\t\t}",
"\t\t$this->query_vars = array();\n\t\t$post_type_query_vars = array();",
"\t\tif ( is_array( $extra_query_vars ) ) {\n\t\t\t$this->extra_query_vars = & $extra_query_vars;\n\t\t} elseif ( ! empty( $extra_query_vars ) ) {\n\t\t\tparse_str( $extra_query_vars, $this->extra_query_vars );\n\t\t}\n\t\t// Process PATH_INFO, REQUEST_URI, and 404 for permalinks.",
"\t\t// Fetch the rewrite rules.\n\t\t$rewrite = $wp_rewrite->wp_rewrite_rules();",
"\t\tif ( ! empty( $rewrite ) ) {\n\t\t\t// If we match a rewrite rule, this will be cleared.\n\t\t\t$error = '404';\n\t\t\t$this->did_permalink = true;",
"\t\t\t$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';\n\t\t\tlist( $pathinfo ) = explode( '?', $pathinfo );\n\t\t\t$pathinfo = str_replace( '%', '%25', $pathinfo );",
"\t\t\tlist( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );\n\t\t\t$self = $_SERVER['PHP_SELF'];\n\t\t\t$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );\n\t\t\t$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );",
"\t\t\t// Trim path info from the end and the leading home path from the\n\t\t\t// front. For path info requests, this leaves us with the requesting\n\t\t\t// filename, if any. For 404 requests, this leaves us with the\n\t\t\t// requested permalink.\n\t\t\t$req_uri = str_replace( $pathinfo, '', $req_uri );\n\t\t\t$req_uri = trim( $req_uri, '/' );\n\t\t\t$req_uri = preg_replace( $home_path_regex, '', $req_uri );\n\t\t\t$req_uri = trim( $req_uri, '/' );\n\t\t\t$pathinfo = trim( $pathinfo, '/' );\n\t\t\t$pathinfo = preg_replace( $home_path_regex, '', $pathinfo );\n\t\t\t$pathinfo = trim( $pathinfo, '/' );\n\t\t\t$self = trim( $self, '/' );\n\t\t\t$self = preg_replace( $home_path_regex, '', $self );\n\t\t\t$self = trim( $self, '/' );",
"\t\t\t// The requested permalink is in $pathinfo for path info requests and\n\t\t\t// $req_uri for other requests.\n\t\t\tif ( ! empty( $pathinfo ) && ! preg_match( '|^.*' . $wp_rewrite->index . '$|', $pathinfo ) ) {\n\t\t\t\t$requested_path = $pathinfo;\n\t\t\t} else {\n\t\t\t\t// If the request uri is the index, blank it out so that we don't try to match it against a rule.\n\t\t\t\tif ( $req_uri == $wp_rewrite->index ) {\n\t\t\t\t\t$req_uri = '';\n\t\t\t\t}\n\t\t\t\t$requested_path = $req_uri;\n\t\t\t}\n\t\t\t$requested_file = $req_uri;",
"\t\t\t$this->request = $requested_path;",
"\t\t\t// Look for matches.\n\t\t\t$request_match = $requested_path;\n\t\t\tif ( empty( $request_match ) ) {\n\t\t\t\t// An empty request could only match against ^$ regex\n\t\t\t\tif ( isset( $rewrite['$'] ) ) {\n\t\t\t\t\t$this->matched_rule = '$';\n\t\t\t\t\t$query = $rewrite['$'];\n\t\t\t\t\t$matches = array( '' );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tforeach ( (array) $rewrite as $match => $query ) {\n\t\t\t\t\t// If the requested file is the anchor of the match, prepend it to the path info.\n\t\t\t\t\tif ( ! empty( $requested_file ) && strpos( $match, $requested_file ) === 0 && $requested_file != $requested_path ) {\n\t\t\t\t\t\t$request_match = $requested_file . '/' . $requested_path;\n\t\t\t\t\t}",
"\t\t\t\t\tif ( preg_match( \"#^$match#\", $request_match, $matches ) ||\n\t\t\t\t\t\tpreg_match( \"#^$match#\", urldecode( $request_match ), $matches ) ) {",
"\t\t\t\t\t\tif ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\\$matches\\[([0-9]+)\\]/', $query, $varmatch ) ) {\n\t\t\t\t\t\t\t// This is a verbose page match, let's check to be sure about it.\n\t\t\t\t\t\t\t$page = get_page_by_path( $matches[ $varmatch[1] ] );\n\t\t\t\t\t\t\tif ( ! $page ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}",
"\t\t\t\t\t\t\t$post_status_obj = get_post_status_object( $page->post_status );\n\t\t\t\t\t\t\tif ( ! $post_status_obj->public && ! $post_status_obj->protected\n\t\t\t\t\t\t\t\t&& ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}",
"\t\t\t\t\t\t// Got a match.\n\t\t\t\t\t\t$this->matched_rule = $match;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( isset( $this->matched_rule ) ) {\n\t\t\t\t// Trim the query of everything up to the '?'.\n\t\t\t\t$query = preg_replace( '!^.+\\?!', '', $query );",
"\t\t\t\t// Substitute the substring matches into the query.\n\t\t\t\t$query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) );",
"\t\t\t\t$this->matched_query = $query;",
"\t\t\t\t// Parse the query.\n\t\t\t\tparse_str( $query, $perma_query_vars );",
"\t\t\t\t// If we're processing a 404 request, clear the error var since we found something.\n\t\t\t\tif ( '404' == $error ) {\n\t\t\t\t\tunset( $error, $_GET['error'] );\n\t\t\t\t}\n\t\t\t}",
"\t\t\t// If req_uri is empty or if it is a request for ourself, unset error.\n\t\t\tif ( empty( $requested_path ) || $requested_file == $self || strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) {\n\t\t\t\tunset( $error, $_GET['error'] );",
"\t\t\t\tif ( isset( $perma_query_vars ) && strpos( $_SERVER['PHP_SELF'], 'wp-admin/' ) !== false ) {\n\t\t\t\t\tunset( $perma_query_vars );\n\t\t\t\t}",
"\t\t\t\t$this->did_permalink = false;\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters the query variables whitelist before processing.\n\t\t *\n\t\t * Allows (publicly allowed) query vars to be added, removed, or changed prior\n\t\t * to executing the query. Needed to allow custom rewrite rules using your own arguments\n\t\t * to work, or any other custom query variables you want to be publicly available.\n\t\t *\n\t\t * @since 1.5.0\n\t\t *\n\t\t * @param string[] $public_query_vars The array of whitelisted query variable names.\n\t\t */\n\t\t$this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars );",
"\t\tforeach ( get_post_types( array(), 'objects' ) as $post_type => $t ) {\n\t\t\tif ( is_post_type_viewable( $t ) && $t->query_var ) {\n\t\t\t\t$post_type_query_vars[ $t->query_var ] = $post_type;\n\t\t\t}\n\t\t}",
"\t\tforeach ( $this->public_query_vars as $wpvar ) {\n\t\t\tif ( isset( $this->extra_query_vars[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $this->extra_query_vars[ $wpvar ];\n\t\t\t} elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) {\n\t\t\t\twp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );\n\t\t\t} elseif ( isset( $_POST[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $_POST[ $wpvar ];\n\t\t\t} elseif ( isset( $_GET[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $_GET[ $wpvar ];\n\t\t\t} elseif ( isset( $perma_query_vars[ $wpvar ] ) ) {\n\t\t\t\t$this->query_vars[ $wpvar ] = $perma_query_vars[ $wpvar ];\n\t\t\t}",
"\t\t\tif ( ! empty( $this->query_vars[ $wpvar ] ) ) {\n\t\t\t\tif ( ! is_array( $this->query_vars[ $wpvar ] ) ) {\n\t\t\t\t\t$this->query_vars[ $wpvar ] = (string) $this->query_vars[ $wpvar ];\n\t\t\t\t} else {\n\t\t\t\t\tforeach ( $this->query_vars[ $wpvar ] as $vkey => $v ) {\n\t\t\t\t\t\tif ( is_scalar( $v ) ) {\n\t\t\t\t\t\t\t$this->query_vars[ $wpvar ][ $vkey ] = (string) $v;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}",
"\t\t\t\tif ( isset( $post_type_query_vars[ $wpvar ] ) ) {\n\t\t\t\t\t$this->query_vars['post_type'] = $post_type_query_vars[ $wpvar ];\n\t\t\t\t\t$this->query_vars['name'] = $this->query_vars[ $wpvar ];\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// Convert urldecoded spaces back into +\n\t\tforeach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) {\n\t\t\tif ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) {\n\t\t\t\t$this->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->query_vars[ $t->query_var ] );\n\t\t\t}\n\t\t}",
"\t\t// Don't allow non-publicly queryable taxonomies to be queried from the front end.\n\t\tif ( ! is_admin() ) {\n\t\t\tforeach ( get_taxonomies( array( 'publicly_queryable' => false ), 'objects' ) as $taxonomy => $t ) {\n\t\t\t\t/*\n\t\t\t\t * Disallow when set to the 'taxonomy' query var.\n\t\t\t\t * Non-publicly queryable taxonomies cannot register custom query vars. See register_taxonomy().\n\t\t\t\t */\n\t\t\t\tif ( isset( $this->query_vars['taxonomy'] ) && $taxonomy === $this->query_vars['taxonomy'] ) {\n\t\t\t\t\tunset( $this->query_vars['taxonomy'], $this->query_vars['term'] );\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\t// Limit publicly queried post_types to those that are publicly_queryable\n\t\tif ( isset( $this->query_vars['post_type'] ) ) {\n\t\t\t$queryable_post_types = get_post_types( array( 'publicly_queryable' => true ) );\n\t\t\tif ( ! is_array( $this->query_vars['post_type'] ) ) {\n\t\t\t\tif ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) {\n\t\t\t\t\tunset( $this->query_vars['post_type'] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );\n\t\t\t}\n\t\t}",
"\t\t// Resolve conflicts between posts with numeric slugs and date archive queries.\n\t\t$this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars );",
"\t\tforeach ( (array) $this->private_query_vars as $var ) {\n\t\t\tif ( isset( $this->extra_query_vars[ $var ] ) ) {\n\t\t\t\t$this->query_vars[ $var ] = $this->extra_query_vars[ $var ];\n\t\t\t}\n\t\t}",
"\t\tif ( isset( $error ) ) {\n\t\t\t$this->query_vars['error'] = $error;\n\t\t}",
"\t\t/**\n\t\t * Filters the array of parsed query variables.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param array $query_vars The array of requested query variables.\n\t\t */\n\t\t$this->query_vars = apply_filters( 'request', $this->query_vars );",
"\t\t/**\n\t\t * Fires once all query variables for the current request have been parsed.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param WP $this Current WordPress environment instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'parse_request', array( &$this ) );\n\t}",
"\t/**\n\t * Sends additional HTTP headers for caching, content type, etc.\n\t *\n\t * Sets the Content-Type header. Sets the 'error' status (if passed) and optionally exits.\n\t * If showing a feed, it will also send Last-Modified, ETag, and 304 status if needed.\n\t *\n\t * @since 2.0.0\n\t * @since 4.4.0 `X-Pingback` header is added conditionally after posts have been queried in handle_404().\n\t */\n\tpublic function send_headers() {\n\t\t$headers = array();\n\t\t$status = null;\n\t\t$exit_required = false;",
"\t\tif ( is_user_logged_in() ) {\n\t\t\t$headers = array_merge( $headers, wp_get_nocache_headers() );\n\t\t}\n\t\tif ( ! empty( $this->query_vars['error'] ) ) {\n\t\t\t$status = (int) $this->query_vars['error'];\n\t\t\tif ( 404 === $status ) {\n\t\t\t\tif ( ! is_user_logged_in() ) {\n\t\t\t\t\t$headers = array_merge( $headers, wp_get_nocache_headers() );\n\t\t\t\t}\n\t\t\t\t$headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' );\n\t\t\t} elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {\n\t\t\t\t$exit_required = true;\n\t\t\t}\n\t\t} elseif ( empty( $this->query_vars['feed'] ) ) {\n\t\t\t$headers['Content-Type'] = get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' );\n\t\t} else {\n\t\t\t// Set the correct content type for feeds\n\t\t\t$type = $this->query_vars['feed'];\n\t\t\tif ( 'feed' == $this->query_vars['feed'] ) {\n\t\t\t\t$type = get_default_feed();\n\t\t\t}\n\t\t\t$headers['Content-Type'] = feed_content_type( $type ) . '; charset=' . get_option( 'blog_charset' );",
"\t\t\t// We're showing a feed, so WP is indeed the only thing that last changed.\n\t\t\tif ( ! empty( $this->query_vars['withcomments'] )\n\t\t\t\t|| false !== strpos( $this->query_vars['feed'], 'comments-' )\n\t\t\t\t|| ( empty( $this->query_vars['withoutcomments'] )\n\t\t\t\t\t&& ( ! empty( $this->query_vars['p'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['name'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['page_id'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['pagename'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['attachment'] )\n\t\t\t\t\t\t|| ! empty( $this->query_vars['attachment_id'] )\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t$wp_last_modified = mysql2date( 'D, d M Y H:i:s', get_lastcommentmodified( 'GMT' ), false );\n\t\t\t} else {\n\t\t\t\t$wp_last_modified = mysql2date( 'D, d M Y H:i:s', get_lastpostmodified( 'GMT' ), false );\n\t\t\t}",
"\t\t\tif ( ! $wp_last_modified ) {\n\t\t\t\t$wp_last_modified = date( 'D, d M Y H:i:s' );\n\t\t\t}",
"\t\t\t$wp_last_modified .= ' GMT';",
"\t\t\t$wp_etag = '\"' . md5( $wp_last_modified ) . '\"';\n\t\t\t$headers['Last-Modified'] = $wp_last_modified;\n\t\t\t$headers['ETag'] = $wp_etag;",
"\t\t\t// Support for Conditional GET\n\t\t\tif ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) {\n\t\t\t\t$client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );\n\t\t\t} else {\n\t\t\t\t$client_etag = false;\n\t\t\t}",
"\t\t\t$client_last_modified = empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ? '' : trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );\n\t\t\t// If string is empty, return 0. If not, attempt to parse into a timestamp\n\t\t\t$client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0;",
"\t\t\t// Make a timestamp for our most recent modification...\n\t\t\t$wp_modified_timestamp = strtotime( $wp_last_modified );",
"\t\t\tif ( ( $client_last_modified && $client_etag ) ?\n\t\t\t\t\t( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag == $wp_etag ) ) :\n\t\t\t\t\t( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag == $wp_etag ) ) ) {\n\t\t\t\t$status = 304;\n\t\t\t\t$exit_required = true;\n\t\t\t}\n\t\t}",
"\t\t/**\n\t\t * Filters the HTTP headers before they're sent to the browser.\n\t\t *\n\t\t * @since 2.8.0\n\t\t *\n\t\t * @param string[] $headers Associative array of headers to be sent.\n\t\t * @param WP $this Current WordPress environment instance.\n\t\t */\n\t\t$headers = apply_filters( 'wp_headers', $headers, $this );",
"\t\tif ( ! empty( $status ) ) {\n\t\t\tstatus_header( $status );\n\t\t}",
"\t\t// If Last-Modified is set to false, it should not be sent (no-cache situation).\n\t\tif ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) {\n\t\t\tunset( $headers['Last-Modified'] );",
"\t\t\t// In PHP 5.3+, make sure we are not sending a Last-Modified header.\n\t\t\tif ( function_exists( 'header_remove' ) ) {\n\t\t\t\t@header_remove( 'Last-Modified' );\n\t\t\t} else {\n\t\t\t\t// In PHP 5.2, send an empty Last-Modified header, but only as a\n\t\t\t\t// last resort to override a header already sent. #WP23021\n\t\t\t\tforeach ( headers_list() as $header ) {\n\t\t\t\t\tif ( 0 === stripos( $header, 'Last-Modified' ) ) {\n\t\t\t\t\t\t$headers['Last-Modified'] = '';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"\t\tforeach ( (array) $headers as $name => $field_value ) {\n\t\t\t@header( \"{$name}: {$field_value}\" );\n\t\t}",
"\t\tif ( $exit_required ) {\n\t\t\texit();\n\t\t}",
"\t\t/**\n\t\t * Fires once the requested HTTP headers for caching, content type, etc. have been sent.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param WP $this Current WordPress environment instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'send_headers', array( &$this ) );\n\t}",
"\t/**\n\t * Sets the query string property based off of the query variable property.\n\t *\n\t * The {@see 'query_string'} filter is deprecated, but still works. Plugins should\n\t * use the {@see 'request'} filter instead.\n\t *\n\t * @since 2.0.0\n\t */\n\tpublic function build_query_string() {\n\t\t$this->query_string = '';\n\t\tforeach ( (array) array_keys( $this->query_vars ) as $wpvar ) {\n\t\t\tif ( '' != $this->query_vars[ $wpvar ] ) {\n\t\t\t\t$this->query_string .= ( strlen( $this->query_string ) < 1 ) ? '' : '&';\n\t\t\t\tif ( ! is_scalar( $this->query_vars[ $wpvar ] ) ) { // Discard non-scalars.\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$this->query_string .= $wpvar . '=' . rawurlencode( $this->query_vars[ $wpvar ] );\n\t\t\t}\n\t\t}",
"\t\tif ( has_filter( 'query_string' ) ) { // Don't bother filtering and parsing if no plugins are hooked in.\n\t\t\t/**\n\t\t\t * Filters the query string before parsing.\n\t\t\t *\n\t\t\t * @since 1.5.0\n\t\t\t * @deprecated 2.1.0 Use 'query_vars' or 'request' filters instead.\n\t\t\t *\n\t\t\t * @param string $query_string The query string to modify.\n\t\t\t */\n\t\t\t$this->query_string = apply_filters( 'query_string', $this->query_string );\n\t\t\tparse_str( $this->query_string, $this->query_vars );\n\t\t}\n\t}",
"\t/**\n\t * Set up the WordPress Globals.\n\t *\n\t * The query_vars property will be extracted to the GLOBALS. So care should\n\t * be taken when naming global variables that might interfere with the\n\t * WordPress environment.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Query $wp_query\n\t * @global string $query_string Query string for the loop.\n\t * @global array $posts The found posts.\n\t * @global WP_Post|null $post The current post, if available.\n\t * @global string $request The SQL statement for the request.\n\t * @global int $more Only set, if single page or post.\n\t * @global int $single If single page or post. Only set, if single page or post.\n\t * @global WP_User $authordata Only set, if author archive.\n\t */\n\tpublic function register_globals() {\n\t\tglobal $wp_query;",
"\t\t// Extract updated query vars back into global namespace.\n\t\tforeach ( (array) $wp_query->query_vars as $key => $value ) {\n\t\t\t$GLOBALS[ $key ] = $value;\n\t\t}",
"\t\t$GLOBALS['query_string'] = $this->query_string;\n\t\t$GLOBALS['posts'] = & $wp_query->posts;\n\t\t$GLOBALS['post'] = isset( $wp_query->post ) ? $wp_query->post : null;\n\t\t$GLOBALS['request'] = $wp_query->request;",
"\t\tif ( $wp_query->is_single() || $wp_query->is_page() ) {\n\t\t\t$GLOBALS['more'] = 1;\n\t\t\t$GLOBALS['single'] = 1;\n\t\t}",
"\t\tif ( $wp_query->is_author() && isset( $wp_query->post ) ) {\n\t\t\t$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );\n\t\t}\n\t}",
"\t/**\n\t * Set up the current user.\n\t *\n\t * @since 2.0.0\n\t */\n\tpublic function init() {\n\t\twp_get_current_user();\n\t}",
"\t/**\n\t * Set up the Loop based on the query variables.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Query $wp_the_query\n\t */\n\tpublic function query_posts() {\n\t\tglobal $wp_the_query;\n\t\t$this->build_query_string();\n\t\t$wp_the_query->query( $this->query_vars );\n\t}",
"\t/**\n\t * Set the Headers for 404, if nothing is found for requested URL.\n\t *\n\t * Issue a 404 if a request doesn't match any posts and doesn't match\n\t * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already\n\t * issued, and if the request was not a search or the homepage.\n\t *\n\t * Otherwise, issue a 200.\n\t *\n\t * This sets headers after posts have been queried. handle_404() really means \"handle status.\"\n\t * By inspecting the result of querying posts, seemingly successful requests can be switched to\n\t * a 404 so that canonical redirection logic can kick in.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @global WP_Query $wp_query\n\t */\n\tpublic function handle_404() {\n\t\tglobal $wp_query;",
"\t\t/**\n\t\t * Filters whether to short-circuit default header status handling.\n\t\t *\n\t\t * Returning a non-false value from the filter will short-circuit the handling\n\t\t * and return early.\n\t\t *\n\t\t * @since 4.5.0\n\t\t *\n\t\t * @param bool $preempt Whether to short-circuit default header status handling. Default false.\n\t\t * @param WP_Query $wp_query WordPress Query object.\n\t\t */\n\t\tif ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) {\n\t\t\treturn;\n\t\t}",
"\t\t// If we've already issued a 404, bail.\n\t\tif ( is_404() ) {\n\t\t\treturn;\n\t\t}",
"\t\t// Never 404 for the admin, robots, or if we found posts.\n\t\tif ( is_admin() || is_robots() || $wp_query->posts ) {",
"\t\t\t$success = true;\n\t\t\tif ( is_singular() ) {\n\t\t\t\t$p = false;",
"\t\t\t\tif ( $wp_query->post instanceof WP_Post ) {\n\t\t\t\t\t$p = clone $wp_query->post;\n\t\t\t\t}",
"\t\t\t\t// Only set X-Pingback for single posts that allow pings.\n\t\t\t\tif ( $p && pings_open( $p ) ) {\n\t\t\t\t\t@header( 'X-Pingback: ' . get_bloginfo( 'pingback_url', 'display' ) );\n\t\t\t\t}",
"\t\t\t\t// check for paged content that exceeds the max number of pages\n\t\t\t\t$next = '<!--nextpage-->';\n\t\t\t\tif ( $p && false !== strpos( $p->post_content, $next ) && ! empty( $this->query_vars['page'] ) ) {\n\t\t\t\t\t$page = trim( $this->query_vars['page'], '/' );\n\t\t\t\t\t$success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 );\n\t\t\t\t}\n\t\t\t}",
"\t\t\tif ( $success ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"\t\t// We will 404 for paged queries, as no posts were found.\n\t\tif ( ! is_paged() ) {",
"\t\t\t// Don't 404 for authors without posts as long as they matched an author on this site.\n\t\t\t$author = get_query_var( 'author' );\n\t\t\tif ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}",
"\t\t\t// Don't 404 for these queries if they matched an object.\n\t\t\tif ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}",
"\t\t\t// Don't 404 for these queries either.\n\t\t\tif ( is_home() || is_search() || is_feed() ) {\n\t\t\t\tstatus_header( 200 );\n\t\t\t\treturn;\n\t\t\t}\n\t\t}",
"\t\t// Guess it's time to 404.\n\t\t$wp_query->set_404();\n\t\tstatus_header( 404 );\n\t\tnocache_headers();\n\t}",
"\t/**\n\t * Sets up all of the variables required by the WordPress environment.\n\t *\n\t * The action {@see 'wp'} has one parameter that references the WP object. It\n\t * allows for accessing the properties and methods to further manipulate the\n\t * object.\n\t *\n\t * @since 2.0.0\n\t *\n\t * @param string|array $query_args Passed to parse_request().\n\t */\n\tpublic function main( $query_args = '' ) {\n\t\t$this->init();\n\t\t$this->parse_request( $query_args );\n\t\t$this->send_headers();\n\t\t$this->query_posts();\n\t\t$this->handle_404();\n\t\t$this->register_globals();",
"\t\t/**\n\t\t * Fires once the WordPress environment has been set up.\n\t\t *\n\t\t * @since 2.1.0\n\t\t *\n\t\t * @param WP $this Current WordPress environment instance (passed by reference).\n\t\t */\n\t\tdo_action_ref_array( 'wp', array( &$this ) );\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [806, 18, 17], "buggy_code_start_loc": [541, 17, 16], "filenames": ["wp-includes/class-wp-query.php", "wp-includes/class-wp.php", "wp-includes/version.php"], "fixing_code_end_loc": [805, 18, 17], "fixing_code_start_loc": [540, 17, 16], "message": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "954E75B0-6B64-4856-B36D-4EBD80FBDC1B", "versionEndExcluding": "5.2.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled."}, {"lang": "es", "value": "En WordPress anterior a 5.2.4, es posible la visualizaci\u00f3n no autenticada de cierto contenido porque la propiedad de consulta est\u00e1tica es manejada inapropiadamente."}], "evaluatorComment": null, "id": "CVE-2019-17671", "lastModified": "2023-02-03T21:54:45.063", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-17T13:15:10.937", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://blog.wpscan.org/wordpress/security/release/2019/10/15/wordpress-524-security-release-breakdown.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://core.trac.wordpress.org/changeset/46474"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/11/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2020/Jan/8"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://wordpress.org/news/2019/10/wordpress-5-2-4-security-release/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://wpvulndb.com/vulnerabilities/9909"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4599"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4677"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, "type": "CWE-200"}
| 89
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n/**\n * WordPress Version\n *\n * Contains version information for the current WordPress release.\n *\n * @package WordPress\n * @since 1.1.0\n */",
"/**\n * The WordPress version string\n *\n * @global string $wp_version\n */",
"$wp_version = '5.2.4-alpha-46473';",
"\n/**\n * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.\n *\n * @global int $wp_db_version\n */\n$wp_db_version = 44719;",
"/**\n * Holds the TinyMCE version\n *\n * @global string $tinymce_version\n */\n$tinymce_version = '4940-20190515';",
"/**\n * Holds the required PHP version\n *\n * @global string $required_php_version\n */\n$required_php_version = '5.6.20';",
"/**\n * Holds the required MySQL version\n *\n * @global string $required_mysql_version\n */\n$required_mysql_version = '5.0';"
] |
[
1,
1,
0,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [806, 18, 17], "buggy_code_start_loc": [541, 17, 16], "filenames": ["wp-includes/class-wp-query.php", "wp-includes/class-wp.php", "wp-includes/version.php"], "fixing_code_end_loc": [805, 18, 17], "fixing_code_start_loc": [540, 17, 16], "message": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "954E75B0-6B64-4856-B36D-4EBD80FBDC1B", "versionEndExcluding": "5.2.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled."}, {"lang": "es", "value": "En WordPress anterior a 5.2.4, es posible la visualizaci\u00f3n no autenticada de cierto contenido porque la propiedad de consulta est\u00e1tica es manejada inapropiadamente."}], "evaluatorComment": null, "id": "CVE-2019-17671", "lastModified": "2023-02-03T21:54:45.063", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-17T13:15:10.937", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://blog.wpscan.org/wordpress/security/release/2019/10/15/wordpress-524-security-release-breakdown.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://core.trac.wordpress.org/changeset/46474"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/11/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2020/Jan/8"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://wordpress.org/news/2019/10/wordpress-5-2-4-security-release/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://wpvulndb.com/vulnerabilities/9909"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4599"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4677"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, "type": "CWE-200"}
| 89
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php\n/**\n * WordPress Version\n *\n * Contains version information for the current WordPress release.\n *\n * @package WordPress\n * @since 1.1.0\n */",
"/**\n * The WordPress version string\n *\n * @global string $wp_version\n */",
"$wp_version = '5.2.4-alpha-46479';",
"\n/**\n * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.\n *\n * @global int $wp_db_version\n */\n$wp_db_version = 44719;",
"/**\n * Holds the TinyMCE version\n *\n * @global string $tinymce_version\n */\n$tinymce_version = '4940-20190515';",
"/**\n * Holds the required PHP version\n *\n * @global string $required_php_version\n */\n$required_php_version = '5.6.20';",
"/**\n * Holds the required MySQL version\n *\n * @global string $required_mysql_version\n */\n$required_mysql_version = '5.0';"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [806, 18, 17], "buggy_code_start_loc": [541, 17, 16], "filenames": ["wp-includes/class-wp-query.php", "wp-includes/class-wp.php", "wp-includes/version.php"], "fixing_code_end_loc": [805, 18, 17], "fixing_code_start_loc": [540, 17, 16], "message": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:wordpress:wordpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "954E75B0-6B64-4856-B36D-4EBD80FBDC1B", "versionEndExcluding": "5.2.4", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:8.0:*:*:*:*:*:*:*", "matchCriteriaId": "C11E6FB0-C8C0-4527-9AA0-CB9B316F8F43", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In WordPress before 5.2.4, unauthenticated viewing of certain content is possible because the static query property is mishandled."}, {"lang": "es", "value": "En WordPress anterior a 5.2.4, es posible la visualizaci\u00f3n no autenticada de cierto contenido porque la propiedad de consulta est\u00e1tica es manejada inapropiadamente."}], "evaluatorComment": null, "id": "CVE-2019-17671", "lastModified": "2023-02-03T21:54:45.063", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 5.0, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:L/Au:N/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-10-17T13:15:10.937", "references": [{"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://blog.wpscan.org/wordpress/security/release/2019/10/15/wordpress-524-security-release-breakdown.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Vendor Advisory"], "url": "https://core.trac.wordpress.org/changeset/46474"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2019/11/msg00000.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://seclists.org/bugtraq/2020/Jan/8"}, {"source": "cve@mitre.org", "tags": ["Release Notes", "Vendor Advisory"], "url": "https://wordpress.org/news/2019/10/wordpress-5-2-4-security-release/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://wpvulndb.com/vulnerabilities/9909"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4599"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4677"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/WordPress/WordPress/commit/f82ed753cf00329a5e41f2cb6dc521085136f308"}, "type": "CWE-200"}
| 89
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"--- occu/WebUI/www/config/cp_maintenance.cgi.orig\n+++ occu/WebUI/www/config/cp_maintenance.cgi\n@@ -61,10 +61,14 @@\n puts \"conInfo(\\\"EULA found\\\");\"\n puts \"jQuery('#fwUpload').hide();\"\n puts \"var dlg = new EulaDialog(translateKey('dialogEulaTitle'), data, function(result) {\"\n+ puts \"var dlgPopup = parent.top.dlgPopup;\"\n+ puts \"if (dlgPopup === undefined) {\"\n+ puts \"dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+ puts \"}\"\n puts \"if (result == 1) {\"\n- puts \"parent.top.dlgPopup.hide();\"\n- puts \"parent.top.dlgPopup.setWidth(450);\"\n- puts \"parent.top.dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n+ puts \"dlgPopup.hide();\"\n+ puts \"dlgPopup.setWidth(450);\"\n+ puts \"dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n puts \"} else {\"\n puts \"jQuery('#fwUpload').hide();\"\n puts \"dlgPopup.hide();\"\n@@ -77,16 +81,19 @@\n \n puts \"req.fail(function(data) {\"\n puts \"conInfo(\\\"EULA not available\\\");\"\n- puts \"parent.top.dlgPopup.hide();\"\n- puts \"parent.top.dlgPopup.setWidth(450);\"\n- puts \"parent.top.dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n+ puts \"var dlgPopup = parent.top.dlgPopup;\"\n+ puts \"if (dlgPopup === undefined) {\"\n+ puts \"dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+ puts \"}\"\n+ puts \"dlgPopup.hide();\"\n+ puts \"dlgPopup.setWidth(450);\"\n+ puts \"dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n puts \"});\"\n }\n }\n \n proc action_firmware_update_confirm {} {\n global env\n- cgi_debug -on\n http_head\n division {class=\"popupTitle\"} {\n #puts \"Softwareupdate - Bestätigung\"\n@@ -266,7 +273,7 @@\n }\n \n proc action_firmware_update_cancel {} {\n- global env\n+ global env filename\n \n if {[getProduct] < 3} {\n catch {exec rm /var/new_firmware.tar.gz}\n@@ -432,9 +439,7 @@\n table_row {\n td {width=\"20\"} {}\n table_data {colspan=\"2\"} {\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=firmware_form {target=firmware_upload_iframe} enctype=multipart/form-data method=post {\n- export action=firmware_upload\n- export downloadOnly=$downloadOnly\n+ form \"/config/fileupload.ccc?sid=$sid&action=firmware_upload&downloadOnly=$downloadOnly&url=$env(SCRIPT_NAME)\" {target=firmware_upload_iframe} name=firmware_form enctype=multipart/form-data method=post {\n file_button firmware_file size=30 maxlength=1000000\n }\n puts {<iframe name=\"firmware_upload_iframe\" style=\"display: none;\"></iframe>}\n@@ -1020,7 +1025,7 @@\n \n proc action_firmware_upload {} {\n \n- global env sid downloadOnly\n+ global env sid downloadOnly filename\n \n if { [catch { import directDownload } error] } {\n set directDownload false\n@@ -1029,10 +1034,7 @@\n http_head\n \n if { $directDownload } {\n- set filename \"/tmp/fup.tgz\"\n- } else {\n- import_file -client firmware_file\n- set filename [lindex $firmware_file 0]\n+ set filename \"/usr/local/tmp/firmwareUpdateFile\"\n }\n \n if {[getProduct] < 3} {\n@@ -1102,10 +1104,14 @@\n \n cgi_javascript {\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n- puts \"parent.top.dlgPopup.hide();\"\n- puts \"parent.top.dlgPopup.setWidth(450);\"\n- puts \"parent.top.dlgPopup.downloadOnly = $downloadOnly;\"\n- puts \"parent.top.dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n+ puts \"var dlgPopup = parent.top.dlgPopup;\"\n+ puts \"if (dlgPopup === undefined) {\"\n+ puts \"dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+ puts \"}\"\n+ puts \"dlgPopup.hide();\"\n+ puts \"dlgPopup.setWidth(450);\"\n+ puts \"dlgPopup.downloadOnly = $downloadOnly;\"\n+ puts \"dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n }\n }\n \n@@ -1393,10 +1399,10 @@\n cgi_eval {\n #cgi_debug -on\n cgi_input\n- catch {\n- import debug\n- cgi_debug -on\n- }\n+ #catch {\n+ # import debug\n+ # cgi_debug -on\n+ #}\n \n set action \"put_page\"\n set downloadOnly 0\n--- occu/WebUI/www/config/cp_network.cgi.orig\n+++ occu/WebUI/www/config/cp_network.cgi\n@@ -149,6 +149,8 @@\n \n http_head\n \n+ file rename -force -- \"/usr/local/tmp/server.pem\" \"/etc/config/server.pem\"\n+\n put_message \"\\${dialogSettingsNetworkMessageCertificateTitle}\" \"\\${dialogSettingsNetworkMessageCertificateCCURestart}\" {\\${btnNewLogin} \"window.location.href='/';\"}\n \n #save DOM\n@@ -245,37 +247,43 @@\n }\n \n proc action_cert_upload {} {\n- global env sid\n- cd /tmp/\n+ global env sid filename\n+ cd /usr/local/tmp/\n \n http_head\n- import_file -client cert_file\n- file rename -force -- [lindex $cert_file 0] \"/var/server.pem\"\n- \n- set filename [open \"/var/server.pem\" r]\n- gets $filename line\n- close $filename\n+ set fp [open \"$filename\" r]\n+ gets $fp line\n+ close $fp\n #puts $line;\n if { [string equal $line \"-----BEGIN RSA PRIVATE KEY-----\"] == 1 || [string equal $line \"-----BEGIN PRIVATE KEY-----\"] == 1} {\n- file copy -force -- \"/var/server.pem\" \"/etc/config/server.pem\"\n- file delete \"/var/server.pem\"\n+ file rename -force -- $filename \"/usr/local/tmp/server.pem\"\n \n cgi_javascript {\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n puts {\n- parent.top.dlgPopup.hide();\n- parent.top.dlgPopup.setWidth(600);\n- parent.top.dlgPopup.LoadFromFile(url, \"action=cert_update_confirm\");\n+ var dlgPopup = parent.top.dlgPopup;\n+ if (dlgPopup === undefined) {\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\n+ }\n+ dlgPopup.hide();\n+ dlgPopup.setWidth(600);\n+ dlgPopup.LoadFromFile(url, \"action=cert_update_confirm\");\n }\n }\n } else {\n+ file delete -force -- $filename\n+\n cgi_javascript {\n- puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n- puts {\n- parent.top.dlgPopup.hide();\n- parent.top.dlgPopup.setWidth(600);\n- parent.top.dlgPopup.LoadFromFile(url, \"action=cert_update_failed\");\n- }\n+ puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n+ puts {\n+ var dlgPopup = parent.top.dlgPopup;\n+ if (dlgPopup === undefined) {\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\n+ }\n+ dlgPopup.hide();\n+ dlgPopup.setWidth(600);\n+ dlgPopup.LoadFromFile(url, \"action=cert_update_failed\");\n+ }\n }\n }\n }\n@@ -459,8 +467,7 @@\n table_row {\n table_data {width=\"20\"} {}\n table_data {colspan=\"2\"} {\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=cert_form {target=cert_upload_iframe} enctype=multipart/form-data method=post {\n- export action=cert_upload\n+ form \"/config/fileupload.ccc?sid=$sid&action=cert_upload&url=$env(SCRIPT_NAME)\" name=cert_form {target=cert_upload_iframe} enctype=multipart/form-data method=post {\n file_button cert_file size=30 maxlength=1000000\n }\n puts {<iframe name=\"cert_upload_iframe\" style=\"display: none;\"></iframe>}\n@@ -774,13 +781,16 @@\n cgi_eval {\n #cgi_debug -on\n cgi_input\n- catch {\n- import debug\n- cgi_debug -on\n- }\n+ #catch {\n+ # import debug\n+ # cgi_debug -on\n+ #}\n set action \"put_page\"\n+ set filename \"\"\n \n catch { import action }\n+ catch { import filename }\n+\n if {[session_requestisvalid 8] > 0} then action_$action\n }\n \n--- occu/WebUI/www/config/cp_security.cgi.orig\n+++ occu/WebUI/www/config/cp_security.cgi\n@@ -928,8 +928,6 @@\n proc action_put_page {} {\n global env sid\n \n- cgi_debug -on\n-\n http_head\n division {class=\"popupTitle j_translate\"} {\n puts \"\\${dialogSettingsSecurityTitle}\"\n@@ -1022,8 +1020,7 @@\n table_row {\n td {width=\"20\"} {}\n table_data {align=\"left\"} {colspan=\"2\"} {\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=backup_form {target=config_upload_iframe} enctype=multipart/form-data method=post {\n- export action=backup_upload\n+ form \"/config/fileupload.ccc?sid=$sid&action=backup_upload&url=$env(SCRIPT_NAME)\" name=backup_form {target=config_upload_iframe} enctype=multipart/form-data method=post {\n file_button backup_file size=20 maxlength=1000000\n }\n puts {<iframe name=\"config_upload_iframe\" class=\"CLASS20820\" style=\"display: none;\"></iframe>}\n@@ -1536,19 +1533,21 @@\n }\n \n proc action_backup_upload {} {\n- global env sid\n- cd /tmp/\n+ global env sid filename\n+ cd /usr/local/tmp/\n \n+ file rename -force -- $filename \"/usr/local/tmp/new_config.tar\"\n http_head\n- import_file -client backup_file\n- file rename -force -- [lindex $backup_file 0] \"/tmp/new_config.tar\"\n cgi_javascript {\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n puts {",
"- //parent.top.ProgressBar.IncCounter(\"Backup wurde 嚙箭ertragen.\");",
"- parent.top.dlgPopup.hide();\n- parent.top.dlgPopup.setWidth(400);\n- parent.top.dlgPopup.LoadFromFile(url, \"action=backup_restore_check\");\n+ var dlgPopup = parent.top.dlgPopup;\n+ if (dlgPopup === undefined) {\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\n+ }\n+ dlgPopup.hide();\n+ dlgPopup.setWidth(400);\n+ dlgPopup.LoadFromFile(url, \"action=backup_restore_check\");\n }\n }\n }\n@@ -1617,14 +1616,16 @@\n cgi_eval {\n #cgi_debug -on\n cgi_input\n- catch {\n- import debug\n- cgi_debug -on\n- }\n+ #catch {\n+ # import debug\n+ # cgi_debug -on\n+ #}\n \n set action \"put_page\"\n+ set filename \"\"\n \n catch { import action }\n+ catch { import filename }\n \n if {[session_requestisvalid 8] > 0} then action_$action\n }\n--- occu/WebUI/www/config/cp_software.cgi.orig\n+++ occu/WebUI/www/config/cp_software.cgi\n@@ -353,8 +353,7 @@\n puts \"\\${dialogSettingsExtraSoftwareLblSelectExtraSoftware}\"\r\n }\r\n table_data {\r\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=upload_form {target=image_upload_iframe} enctype=multipart/form-data method=post {\r\n- export action=image_upload\r\n+ form \"/config/fileupload.ccc?sid=$sid&action=image_upload&url=$env(SCRIPT_NAME)\" name=upload_form {target=image_upload_iframe} enctype=multipart/form-data method=post {\r\n file_button firmware_file size=30 maxlength=1000000\r\n }\r\n puts {<iframe name=\"image_upload_iframe\" style=\"display: none;\"></iframe>}\r\n@@ -487,24 +486,27 @@\n }\r\n \r\n proc action_image_upload {} {\r\n- global env sid\r\n- cd /tmp/\r\n+ global env sid filename\r\n+ cd /usr/local/tmp/\r\n \r\n http_head\r\n- import_file -client firmware_file\r\n if {[getProduct] < 3} {\r\n # CCU2\r\n- file rename -force -- [lindex $firmware_file 0] \"/var/new_firmware.tar.gz\"\r\n+ file rename -force -- $filename \"/var/new_firmware.tar.gz\"\r\n } else {\r\n # CCU3\r\n- file rename -force -- [lindex $firmware_file 0] \"/usr/local/tmp/new_addon.tar.gz\"\r\n+ file rename -force -- $filename \"/usr/local/tmp/new_addon.tar.gz\"\r\n }\r\n cgi_javascript {\r\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\r\n puts {\r\n- parent.top.dlgPopup.hide();\r\n- parent.top.dlgPopup.setWidth(600);\r\n- parent.top.dlgPopup.LoadFromFile(url, \"action=install_confirm\");\r\n+ var dlgPopup = parent.top.dlgPopup;\r\n+ if (dlgPopup === undefined) {\r\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\r\n+ }\r\n+ dlgPopup.hide();\r\n+ dlgPopup.setWidth(600);\r\n+ dlgPopup.LoadFromFile(url, \"action=install_confirm\");\r\n }\r\n }\r\n }\r\n@@ -519,14 +521,16 @@\n cgi_eval {\r\n #cgi_debug -on\r\n cgi_input\r\n- catch {\r\n- import debug\r\n- cgi_debug -on\r\n- }\r\n+ #catch {\r\n+ # import debug\r\n+ # cgi_debug -on\r\n+ #}\r\n \r\n set action \"put_page\"\r\n+ set filename \"\"\r\n \r\n catch { import action }\r\n+ catch { import filename }\r\n \r\n if {[session_requestisvalid 8] > 0} then action_$action\r\n }\r\n--- occu/WebUI/www/config/fileupload.ccc.orig\n+++ occu/WebUI/www/config/fileupload.ccc",
"@@ -0,0 +1,61 @@",
"+#!/bin/sh",
"+# shellcheck shell=dash disable=SC2169,SC2034,SC2154",
"+\n+echo -ne \"Content-Type: text/html; charset=iso-8859-1\\r\\n\\r\\n\"",
"",
"+\n+# fake read boundary+disposition, etc.\n+read -r boundary\n+read -r disposition\n+read -r ctype\n+read -r junk\n+\n+# get length\n+a=${#boundary}\n+b=${#disposition}\n+c=${#ctype}\n+d=0\n+\n+# Due to \\n\\r line breaks we have 2 extra bytes per line read,\n+# 6 + 2 newlines == 10 junk bytes\n+a=$((a*2+b+c+d+10))\n+",
"+# extract all params from QUERY_STRING\n+# shellcheck disable=SC2046,SC2116,SC2086\n+eval $(echo ${QUERY_STRING//&/;})\n+",
"+# calculate the expected content length using\n+# HTTP_CONTENT_LENGTH or CONTENT_LENGTH",
"+if [ -z \"${HTTP_CONTENT_LENGTH}\" ]; then",
"+ HTTP_CONTENT_LENGTH=${CONTENT_LENGTH}\n+fi\n+SIZE=$((HTTP_CONTENT_LENGTH-a))\n+",
"",
"+# write out the data\n+filename=$(mktemp -p /usr/local/tmp)\n+if ! /usr/bin/head -q -c ${SIZE} >\"${filename}\"; then",
"+ echo \"ERROR (head)\"",
"+fi\n+\n+echo \"<html>\"\n+echo \" <head>\"\n+echo \" <script>\"\n+echo \" <!--- Hide script from browsers that don't understand JavaScript\"\n+echo \" var url = '${url}?sid=${sid}';\"\n+echo \" var dlgPopup = parent.top.dlgPopup;\"\n+echo \" if (dlgPopup === undefined) {\"\n+echo \" dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+echo \" }\"\n+echo \" if (dlgPopup !== undefined) {\"\n+echo \" dlgPopup.hide();\"\n+echo \" dlgPopup.setWidth(450);\"\n+if [[ -n \"${downloadOnly}\" ]]; then\n+ echo \" dlgPopup.downloadOnly=${downloadOnly};\"\n+fi\n+echo \" dlgPopup.LoadFromFile(url, 'action=${action}&filename=${filename}');\"\n+echo \" }\"\n+echo \" // End hiding -->\"\n+echo \" </script>\"\n+echo \" </head>\"\n+echo \"</html>\"\n+\n+exit 0\n--- occu/WebUI/www/tcl/extern/cgi.tcl.orig\n+++ occu/WebUI/www/tcl/extern/cgi.tcl\n@@ -3,15 +3,11 @@\n # cgi.tcl - routines for writing CGI scripts in Tcl\n # Author: Don Libes <libes@nist.gov>, January '95\n #\n-# Minor changes by Lars Reemts, eQ-3\n-#\n # These routines implement the code described in the paper\n # \"Writing CGI scripts in Tcl\" which appeared in the Tcl '96 conference.\n # Please read the paper before using this code. The paper is:\n # http://expect.nist.gov/doc/cgi.pdf\n #\n-# F. Werner:\n-# add \"charset=iso-8859-1\" to header Content-Type\n ##################################################\n \n ##################################################\n@@ -27,12 +23,10 @@\n \n if {0 == [llength $args]} {\n \tcgi_content_type\n- cgi_puts \"Expires: Sun, 06 Nov 1994 00:00:00 GMT\"\n } else {\n \tif {[catch {uplevel 1 [lindex $args 0]} errMsg]} {\n \t set savedInfo $errorInfo\n \t cgi_content_type\n- cgi_puts \"Expires: Sun, 06 Nov 1994 00:00:00 GMT\"\n \t}\n }\n cgi_puts \"\"\n@@ -310,7 +304,7 @@\n \t\t\t catch {cgi_mail_add \"HTTP_HOST: $env(HTTP_HOST)\"}\n \t\t\t catch {cgi_mail_add \"REMOTE_HOST: $env(REMOTE_HOST)\"}\n \t\t\t catch {cgi_mail_add \"REMOTE_ADDR: $env(REMOTE_ADDR)\"}\n-\t\t\t cgi_mail_add \"cgi.tcl version: 1.8.0\"\n+\t\t\t cgi_mail_add \"cgi.tcl version: 1.10.0\"\n \t\t\t cgi_mail_add \"input:\"\n \t\t\t catch {cgi_mail_add $_cgi(input)}\n \t\t\t cgi_mail_add \"cookie:\"\n@@ -472,10 +466,9 @@\n foreach a [lrange $args 1 end] {\n append buf \" $a\"\n }\n- return \"$buf ></iframe>\"\n+ return \"$buf />\"\n }\n \n-\n # generate an image reference (<img ...>)\n # first arg is image url\n # other args are passed through into <img> tag\n@@ -497,7 +490,7 @@\n \n # names an anchor so that it can be linked to\n proc cgi_anchor_name {name} {\n- return \"<a name=\\\"$name\\\"></a>\"\n+ return \"<a name=\\\"$name\\\"/>\"\n }\n \n proc cgi_base {args} {\n@@ -513,7 +506,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_puts \" / >\"\n+ cgi_puts \" />\"\n }\n \n ##################################################\n@@ -531,7 +524,8 @@\n \tregsub -all -nocase {%([a-f0-9][a-f0-9])} $buf {\\\\u00\\1} buf\n \n \t# process \\u unicode mapped chars\n-\tencoding convertfrom [subst -novar -nocommand $buf]\n+\tencoding convertfrom $::_cgi(queryencoding) \\\n+\t\t [subst -novar -nocommand $buf]\n }\n } elseif {[info tclversion] >= 8.1} {\n proc cgi_unquote_input buf {\n@@ -982,7 +976,7 @@\n # from cgi_http_head.\n proc cgi_http_equiv {type contents} {\n _cgi_http_head_implicit\n- cgi_puts \"<meta http-equiv=\\\"$type\\\" content=[cgi_dquote_html $contents]></meta>\"\n+ cgi_puts \"<meta http-equiv=\\\"$type\\\" content=[cgi_dquote_html $contents]/>\"\n }\n \n # Do whatever you want with meta tags.\n@@ -1010,7 +1004,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_puts \"></link>\"\n+ cgi_puts \"/>\"\n }\n \n proc cgi_name {args} {\n@@ -1114,7 +1108,7 @@\n \n proc cgi_noscript {args} {\n cgi_puts \"<noscript[_cgi_lrange $args 0 [expr [llength $args]-2]]>\"\n- _cgi_close_proc_push {puts \"</noscript>\"}\n+ _cgi_close_proc_push {cgi_puts \"</noscript>\"}\n \n uplevel 1 [lindex $args end]\n \n@@ -1135,7 +1129,7 @@\n if {$q != \"=\"} {\n \tset value \"\"\n }\n- cgi_puts \"<param name=\\\"$name\\\" value=[cgi_dquote_html $value]></param>\"\n+ cgi_puts \"<param name=\\\"$name\\\" value=[cgi_dquote_html $value]/>\"\n }\n \n # record any proc's that must be called prior to displaying an error\n@@ -1254,7 +1248,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_put \"></isindex>\"\n+ cgi_put \"/>\"\n }\n \n ##################################################\n@@ -1294,15 +1288,31 @@\n \t} else {\n \t set length $env(CONTENT_LENGTH)\n \t if {0!=[string compare $length \"-1\"]} {\n- if { $length } {\n-\t\t set input [read stdin $env(CONTENT_LENGTH)]\t\t\n- } else {\n- set input \"\"\n- }\n+\t\tset input [read stdin $env(CONTENT_LENGTH)]\t\t\n \t } else {\n \t\tset _cgi(client_error) 1\n \t\terror \"Your browser generated a content-length of -1 during a POST method.\"\n \t }\n+\t if {[info tclversion] >= 8.1} {\n+ # guess query encoding from Content-Type header\n+ if {[info exists env(CONTENT_TYPE)] \\\n+ && [regexp -nocase -- {charset=([^[:space:]]+)} $env(CONTENT_TYPE) m cs]} {\n+ if {[regexp -nocase -- {iso-?8859-([[:digit:]]+)} $cs m d]} {\n+ set _cgi(queryencoding) \"iso8859-$d\"\n+ } elseif {[regexp -nocase -- {windows-([[:digit:]]+)} $cs m d]} {\n+ set _cgi(queryencoding) \"cp$d\"\n+ } elseif {0==[string compare -nocase $cs \"utf-8\"]} {\n+ set _cgi(queryencoding) \"utf-8\"\n+ } elseif {0==[string compare -nocase $cs \"utf-16\"]} {\n+ set _cgi(queryencoding) \"unicode\"\n+ }\n+ if { [lsearch -exact [encoding names] _cgi(queryencoding)] == -1} {\n+ set _cgi(queryencoding) [encoding system]\n+ }\n+ } else {\n+ set _cgi(queryencoding) [encoding system]\n+ }\n+ }\n \t}\n \t# save input for possible diagnostics later\n \tset _cgi(input) $input\n@@ -1345,30 +1355,6 @@\n }\n }\n \n-set _cgi_read_line_buffer \"\"\n-proc _cgi_read_line {fin bufvar crlfvar} {\n- global _cgi_read_line_buffer\n- upvar $bufvar buffer\n- upvar $crlfvar crlf\n- set line_end [string first \"\\r\\n\" $_cgi_read_line_buffer]\n- while {($line_end < 0 ) && ![eof $fin]} {\n- append _cgi_read_line_buffer [read $fin 65536]\n- set line_end [string first \"\\r\\n\" $_cgi_read_line_buffer]\n- }\n- if {$line_end >= 0} { \n- incr line_end -1\n- set buffer [string range $_cgi_read_line_buffer 0 $line_end]\n- set crlf \"\\r\\n\"\n- set _cgi_read_line_buffer [string range $_cgi_read_line_buffer [expr $line_end + 3] end]\n- return 1\n- } else {\n- set buffer $_cgi_read_line_buffer\n- set crlf \"\"\n- set _cgi_read_line_buffer \"\"\n- return [expr ([string length $buffer] > 0)]\n- }\n-}\n-\n proc _cgi_input_multipart {fin} {\n global env _cgi _cgi_uservar _cgi_userfile\n \n@@ -1379,121 +1365,7 @@\n \t# can hang and we won't get to the termination code\n \tset dbg_fout [open $dbg_filename w]\n \tset _cgi(input) $dbg_filename\n-\tcatch {fconfigure $dbg_fout -translation binary -encoding binary}\n- }\n-\n- # figure out boundary\n- if {0==[regexp boundary=(.*) $env(CONTENT_TYPE) dummy boundary]} {\n-\tset _cgi(client_error) 1\n-\terror \"Your browser failed to generate a \\\"boundary=\\\" line in a multipart response (CONTENT_TYPE: $env(CONTENT_TYPE)). Please upgrade (or fix) your browser.\"\n- }\n-\n- set boundary \"--$boundary\"\n- set boundary_length [string length $boundary]\n- \n- # don't corrupt or modify uploads yet allow Tcl 7.4 to work\n- catch {fconfigure $fin -translation binary -encoding binary}\n-\n- # get first boundary line\n- gets $fin buf\n- if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}\n-\n- set filecount 0\n- set crlf \"\"\n- while {1} {\n-\t# process Content-Disposition:\n-\tif { ! [_cgi_read_line $fin buf crlf] } break\n-\tif {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n-\tcatch {unset filename}\n-\tcatch {unset varname}\n-\tforeach b $buf {\n-\t regexp {^name=\"(.*)\"} $b dummy varname\n-\t}\n-\tif {0==[info exists varname]} {\n-\t set _cgi(client_error) 1\n-\t error \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n-\t}\t \n-\t# Lame-o encoding (on Netscape at least) doesn't escape field\n-\t# delimiters (like quotes)!! Since all we've ever seen is filename=\n-\t# at end of line, assuming nothing follows. Sigh.\n-\tregexp {filename=\"(.*)\"} $buf dummy filename\n-\n-\t# Skip remaining headers until blank line.\n-\t# Content-Type: can appear here.\n-\tset conttype \"\"\n-\twhile {1} {\n- if { ! [_cgi_read_line $fin buf crlf] } break\n-\t if {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n-\t if {0==[string compare $buf \"\"]} break\n-\t regexp -nocase \"^Content-Type:\\[ \\t]+(.*)\\r\\n\" $buf$crlf x conttype\n-\t}\n-\n-\tif {[info exists filename]} {\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>Reading file $filename\"; flush $dbg_fout}\n-\t # read the part into a file\n-\t set foutname /tmp/CGI[pid].[incr filecount]\n-\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]\n-\t set fout [open $foutname w]\n-\t # \"catch\" permits this to work with Tcl 7.4\n-\t catch {fconfigure $fout -translation binary -encoding binary}\n-\t _cgi_set_uservar $varname [list $foutname $filename $conttype]\n-\t set _cgi_userfile($varname) [list $foutname $filename $conttype]\n- \n- set leftover \"\"\n- while { 1 } {\n- if { ! [_cgi_read_line $fin buf crlf] } {\n- set _cgi(client_error) 1\n- error \"Unexpected end of input data.\"\n- }\n-\t\tif {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n- if {[string compare -length $boundary_length $buf $boundary] == 0} {\n- if {[string first \"--\" $buf $boundary_length]>=0} {set eof 1}\n- break;\n- }\n- puts -nonewline $fout $leftover$buf\n- set leftover $crlf\n- }\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>Read file $filename\"; flush $dbg_fout}\n-\t close $fout\n-\t unset fout\n- \n-\t} else {\n-\t # read the part into a variable\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>Reading variable $varname\"; flush $dbg_fout}\n-\t set val \"\"\n- set leftover \"\"\n- while { 1 } {\n- if { ! [_cgi_read_line $fin buf crlf] } {\n- set _cgi(client_error) 1\n- error \"Unexpected end of input data.\"\n- }\n-\t\tif {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n- if {[string compare -length $boundary_length $buf $boundary] == 0} {\n- if {[string first \"--\" $buf $boundary_length]>=0} {set eof 1}\n- break;\n- }\n- append val $leftover$buf\n- set leftover $crlf\n-\t }\n-\t _cgi_set_uservar $varname $val\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>$varname=$val\"; flush $dbg_fout}\n-\t}\n- if {[info exists eof]} break\n- }\n- if {[info exists dbg_fout]} {close $dbg_fout}\n-}\n-\n-proc _cgi_input_multipart_buggy {fin} {\n- global env _cgi _cgi_uservar _cgi_userfile\n-\n- cgi_debug -noprint {\n-\t# save file for debugging purposes\n-\tset dbg_filename [file join $_cgi(tmpdir) CGIdbg.[pid]]\n-\t# explicitly flush all writes to fout, because sometimes the writer\n-\t# can hang and we won't get to the termination code\n-\tset dbg_fout [open $dbg_filename w]\n-\tset _cgi(input) $dbg_filename\n-\tcatch {fconfigure $dbg_fout -translation binary -encoding binary}\n+\tcatch {fconfigure $dbg_fout -translation binary}\n }\n \n # figure out boundary\n@@ -1513,24 +1385,28 @@\n set boundary --$boundary\n \n # don't corrupt or modify uploads yet allow Tcl 7.4 to work\n- catch {fconfigure $fin -translation binary -encoding binary}\n+ catch {fconfigure $fin -translation binary}\n \n # get first boundary line\n gets $fin buf\n if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}\n \n- set filecount 0\n+ set _cgi(file,filecount) 0\n+\n while {1} {\n \t# process Content-Disposition:\n \tif {-1 == [gets $fin buf]} break\n \tif {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}\n \tcatch {unset filename}\n-\tforeach b $buf {\n-\t regexp {^name=\"(.*)\"} $b dummy varname\n-\t}\n+\tregexp {name=\"([^\"]*)\"} $buf dummy varname\n \tif {0==[info exists varname]} {\n-\t set _cgi(client_error) 1\n-\t error \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n+\t # lynx violates spec and doesn't use quotes, so try again but\n+\t # assume space is delimiter\n+\t regexp {name=([^ ]*)} $buf dummy varname\n+\t if {0==[info exists varname]} {\n+\t\tset _cgi(client_error) 1\n+\t\terror \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n+\t }\n \t}\t \n \t# Lame-o encoding (on Netscape at least) doesn't escape field\n \t# delimiters (like quotes)!! Since all we've ever seen is filename=\n@@ -1548,14 +1424,18 @@\n \t}\n \n \tif {[info exists filename]} {\n+\t if {$_cgi(file,filecount) > $_cgi(file,filelimit)} {\n+\t\terror \"Too many files submitted. Max files allowed: $_cgi(file,filelimit)\"\n+\t }\n+\n \t # read the part into a file\n-\t set foutname /tmp/CGI[pid].[incr filecount]\n-\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]\n+\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr _cgi(file,filecount)]]\n \t set fout [open $foutname w]\n \t # \"catch\" permits this to work with Tcl 7.4\n-\t catch {fconfigure $fout -translation binary -encoding binary}\n+\t catch {fconfigure $fout -translation binary}\n \t _cgi_set_uservar $varname [list $foutname $filename $conttype]\n \t set _cgi_userfile($varname) [list $foutname $filename $conttype]\n+\n \t #\n \t # Look for a boundary line preceded by \\r\\n.\n \t #\n@@ -1583,10 +1463,13 @@\n \t\t puts -nonewline $fout $leftover$buf\n \t\t set leftover \"\\n\"\n \t\t}\n+ \t\tif {[file size $foutname] > $_cgi(file,charlimit)} {\n+\t\t error \"File size exceeded. Max file size allowed: $_cgi(file,charlimit)\"\n+\t\t}\n \t }\n+\n \t close $fout\n \t unset fout\n- \n \t} else {\n \t # read the part into a variable\n \t set val \"\"\n@@ -1672,7 +1555,8 @@\n \t}\n }\n \n- set filecount 0\n+ set _cgi(file,filecount) 0\n+\n while {1} {\n \t# process Content-Disposition:\n \texpect {\n@@ -1684,9 +1568,7 @@\n \t eof break\n \t}\n \tcatch {unset filename}\n-\tforeach b $buf {\n-\t regexp {^name=\"(.*)\"} $b dummy varname\n-\t}\n+\tregexp {name=\"([^\"]*)\"} $buf dummy varname\n \tif {0==[info exists varname]} {\n \t set _cgi(client_error) 1\n \t error \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n@@ -1712,8 +1594,12 @@\n \t}\n \n \tif {[info exists filename]} {\n+\t if {$_cgi(file,filecount) > $_cgi(file,filelimit)} {\n+\t\terror \"Too many files submitted. Max files allowed: $_cgi(file,filelimit)\"\n+\t }\n+\n \t # read the part into a file\n-\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]\n+\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr _cgi(file,filecount)]]\n \t spawn -open [open $foutname w]\n \t set fout_sid $spawn_id\n \n@@ -1967,6 +1853,23 @@\n }\n }\n \n+# set the urlencoding\n+proc cgi_urlencoding {{encoding \"\"}} {\n+ global _cgi \n+ \n+ set result [expr {[info exists _cgi(queryencoding)]\n+ ? $_cgi(queryencoding)\n+ : \"\"}]\n+\n+ # check if the encoding is available \n+ if {[info tclversion] >= 8.1\n+ && [lsearch -exact [encoding names] $encoding] != -1 } {\t\n+ set _cgi(queryencoding) $encoding\n+ }\n+\n+ return $result\n+}\n+\n ##################################################\n # button support\n ##################################################\n@@ -2088,7 +1991,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_put \"></area>\"\n+ cgi_put \"/>\"\n }\n \n ##################################################\n@@ -2182,6 +2085,15 @@\n cgi_put \"<input type=file name=\\\"$name\\\"[_cgi_list_to_string $args]/>\"\n }\n \n+# establish a per-file limit for uploads\n+\n+proc cgi_file_limit {files chars} {\n+ global _cgi\n+\n+ set _cgi(file,filelimit) $files\n+ set _cgi(file,charlimit) $chars\n+}\n+\n ##################################################\n # select support\n ##################################################\n@@ -2224,7 +2136,7 @@\n }\n if {[info exists selected_if_equal]} {\n \tif {0 == [string compare $selected_if_equal $value]} {\n-\t cgi_put \" selected=\\\"selected\\\"\"\n+\t cgi_put \" selected\"\n \t}\n }\n cgi_puts \">[cgi_quote_html $o]</option>\"\n@@ -2251,7 +2163,7 @@\n \t }\n \t}\n }\n- cgi_put \"></embed>\"\n+ cgi_put \"/>\"\n }\n \n ##################################################\n@@ -2525,7 +2437,7 @@\n ##################################################\n \n proc cgi_stylesheet {href} {\n- puts \"<link rel=stylesheet href=\\\"$href\\\" type=\\\"text/css\\\"></link>\"\n+ puts \"<link rel=stylesheet href=\\\"$href\\\" type=\\\"text/css\\\"/>\"\n }\n \n proc cgi_span {args} {\n@@ -2584,7 +2496,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_puts \"></frame>\"\n+ cgi_puts \"/>\"\n }\n \n proc cgi_noframes {args} {\n@@ -2672,33 +2584,50 @@\n \n # User-defined procedure to generate DOCTYPE declaration\n proc cgi_doctype {} {",
"-\t#Zeile hinzugef垐t: 22.02.2007, Badberg, ELV",
"-\t#puts \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Transitional//EN\\\" \\\"http://www.w3.org/TR/html4/loose.dtd\\\">\"\n-\n- # AG, eQ-3, 29.01.2013\n-\tputs \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\"\t\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\"\n-\n-\t#quirks puts \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Transitional//EN\\\">\"\n+ # AG, eQ-3, 29.01.2013\n+ puts \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\"\n }\n \n ##################################################\n # do some initialization\n ##################################################\n \n-cgi_name \"\"\n-cgi_root \"\"\n-cgi_body_args \"\"\n+# cgi_init initializes to a known state.\n+\n+proc cgi_init {} {\n+ global _cgi\n+ unset _cgi\n+\n+ # set explicitly for speed\n+ set _cgi(debug) -off\n+ set _cgi(buffer_nl) \"\\n\"\n \n-# email addr of person responsible for this service\n-cgi_admin_mail_addr \"root\"\t;# you should override this!\n+ cgi_name \"\"\n+ cgi_root \"\"\n+ cgi_body_args \"\"\n+ cgi_file_limit 10 100000000\n \n-# most services won't have an actual email addr\n-cgi_mail_addr \"CGI script - do not reply\"\n+ if {[info tclversion] >= 8.1} {\n+\t# set initial urlencoding\n+\tif { [lsearch -exact [encoding names] \"utf-8\"] != -1} {\n+\t cgi_urlencoding \"utf-8\"\n+\t} else {\n+\t cgi_urlencoding [encoding system]\n+\t}\n+ }\n+\n+ # email addr of person responsible for this service\n+ cgi_admin_mail_addr \"root\"\t;# you should override this!\n+\n+ # most services won't have an actual email addr\n+ cgi_mail_addr \"CGI script - do not reply\"\n+}\n+cgi_init\n \n # deduce tmp directory\n switch $tcl_platform(platform) {\n unix {\n-\tset _cgi(tmpdir) /tmp\n+\tset _cgi(tmpdir) /usr/local/tmp\n } macintosh {\n \tset _cgi(tmpdir) [pwd]\n } default {\n@@ -2711,4 +2640,4 @@\n # regexp for matching attr=val\n set _cgi(attr,regexp) \"^(\\[^=]*)=(\\[^\\\"].*)\"\n \n-package provide cgi 1.8.0\n+package provide cgi 1.10.0\n--- occu/WebUI/www/webui/webui.js.orig\n+++ occu/WebUI/www/webui/webui.js\n@@ -7365,6 +7365,7 @@\n this.currentPageOptions = options;\n \n this.currentPage.enter(options);\n+ window.name = 'ccu-main-window';\n },\n \n reload: function()"
] |
[
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [944, 37], "buggy_code_start_loc": [262, 2], "filenames": ["buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload.patch", "buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload/occu/WebUI/www/config/fileupload.ccc"], "fixing_code_end_loc": [992, 85], "fixing_code_start_loc": [262, 2], "message": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:raspberrymatic:raspberrymatic:*:*:*:*:*:*:*:*", "matchCriteriaId": "A097A067-7101-442C-B36A-1C351163BE0B", "versionEndExcluding": "3.63.8.20220330", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.25.20180428", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available."}, {"lang": "es", "value": "RaspberryMatic es un sistema operativo libre y de c\u00f3digo abierto para ejecutar una casa inteligente sin nube usando la l\u00ednea de hardware homematicIP / HomeMatic de dispositivos IoT. Se presenta una vulnerabilidad de ejecuci\u00f3n de c\u00f3digo remota (RCE) en la funci\u00f3n de carga de archivos de la interfaz WebUI de RaspberryMatic. Una falta de comprobaci\u00f3n/saneo de la entrada en el mecanismo de carga de archivos permite a atacantes remotos y no autenticados con acceso a la red a la interfaz WebUI lograr la ejecuci\u00f3n arbitraria de comandos del sistema operativo por medio de metacaracteres de shell en la cadena de consulta HTTP. Los comandos inyectados son ejecutados como root, conllevando as\u00ed a un compromiso total del sistema subyacente y todos sus componentes. Las versiones posteriores a la \"2.31.25.20180428\" y anteriores a \"3.63.8.20220330\" est\u00e1n afectadas. Es recomendado a usuarios actualizar a versi\u00f3n \"3.63.8.20220330\" o m\u00e1s reciente. Actualmente no se conocen medidas para mitigar el impacto de seguridad y es recomendado a usuarios actualizar a la \u00faltima versi\u00f3n disponible"}], "evaluatorComment": null, "id": "CVE-2022-24796", "lastModified": "2022-04-08T17:01:32.593", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 10.0, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 10.0, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 6.0, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-31T23:15:08.187", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/security/advisories/GHSA-g7vv-7rmf-mff7"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-78"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, "type": "CWE-78"}
| 90
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"--- occu/WebUI/www/config/cp_maintenance.cgi.orig\n+++ occu/WebUI/www/config/cp_maintenance.cgi\n@@ -61,10 +61,14 @@\n puts \"conInfo(\\\"EULA found\\\");\"\n puts \"jQuery('#fwUpload').hide();\"\n puts \"var dlg = new EulaDialog(translateKey('dialogEulaTitle'), data, function(result) {\"\n+ puts \"var dlgPopup = parent.top.dlgPopup;\"\n+ puts \"if (dlgPopup === undefined) {\"\n+ puts \"dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+ puts \"}\"\n puts \"if (result == 1) {\"\n- puts \"parent.top.dlgPopup.hide();\"\n- puts \"parent.top.dlgPopup.setWidth(450);\"\n- puts \"parent.top.dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n+ puts \"dlgPopup.hide();\"\n+ puts \"dlgPopup.setWidth(450);\"\n+ puts \"dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n puts \"} else {\"\n puts \"jQuery('#fwUpload').hide();\"\n puts \"dlgPopup.hide();\"\n@@ -77,16 +81,19 @@\n \n puts \"req.fail(function(data) {\"\n puts \"conInfo(\\\"EULA not available\\\");\"\n- puts \"parent.top.dlgPopup.hide();\"\n- puts \"parent.top.dlgPopup.setWidth(450);\"\n- puts \"parent.top.dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n+ puts \"var dlgPopup = parent.top.dlgPopup;\"\n+ puts \"if (dlgPopup === undefined) {\"\n+ puts \"dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+ puts \"}\"\n+ puts \"dlgPopup.hide();\"\n+ puts \"dlgPopup.setWidth(450);\"\n+ puts \"dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n puts \"});\"\n }\n }\n \n proc action_firmware_update_confirm {} {\n global env\n- cgi_debug -on\n http_head\n division {class=\"popupTitle\"} {\n #puts \"Softwareupdate - Bestätigung\"\n@@ -266,7 +273,7 @@\n }\n \n proc action_firmware_update_cancel {} {\n- global env\n+ global env filename\n \n if {[getProduct] < 3} {\n catch {exec rm /var/new_firmware.tar.gz}\n@@ -432,9 +439,7 @@\n table_row {\n td {width=\"20\"} {}\n table_data {colspan=\"2\"} {\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=firmware_form {target=firmware_upload_iframe} enctype=multipart/form-data method=post {\n- export action=firmware_upload\n- export downloadOnly=$downloadOnly\n+ form \"/config/fileupload.ccc?sid=$sid&action=firmware_upload&downloadOnly=$downloadOnly&url=$env(SCRIPT_NAME)\" {target=firmware_upload_iframe} name=firmware_form enctype=multipart/form-data method=post {\n file_button firmware_file size=30 maxlength=1000000\n }\n puts {<iframe name=\"firmware_upload_iframe\" style=\"display: none;\"></iframe>}\n@@ -1020,7 +1025,7 @@\n \n proc action_firmware_upload {} {\n \n- global env sid downloadOnly\n+ global env sid downloadOnly filename\n \n if { [catch { import directDownload } error] } {\n set directDownload false\n@@ -1029,10 +1034,7 @@\n http_head\n \n if { $directDownload } {\n- set filename \"/tmp/fup.tgz\"\n- } else {\n- import_file -client firmware_file\n- set filename [lindex $firmware_file 0]\n+ set filename \"/usr/local/tmp/firmwareUpdateFile\"\n }\n \n if {[getProduct] < 3} {\n@@ -1102,10 +1104,14 @@\n \n cgi_javascript {\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n- puts \"parent.top.dlgPopup.hide();\"\n- puts \"parent.top.dlgPopup.setWidth(450);\"\n- puts \"parent.top.dlgPopup.downloadOnly = $downloadOnly;\"\n- puts \"parent.top.dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n+ puts \"var dlgPopup = parent.top.dlgPopup;\"\n+ puts \"if (dlgPopup === undefined) {\"\n+ puts \"dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+ puts \"}\"\n+ puts \"dlgPopup.hide();\"\n+ puts \"dlgPopup.setWidth(450);\"\n+ puts \"dlgPopup.downloadOnly = $downloadOnly;\"\n+ puts \"dlgPopup.LoadFromFile(url, \\\"action=$action\\\");\"\n }\n }\n \n@@ -1393,10 +1399,10 @@\n cgi_eval {\n #cgi_debug -on\n cgi_input\n- catch {\n- import debug\n- cgi_debug -on\n- }\n+ #catch {\n+ # import debug\n+ # cgi_debug -on\n+ #}\n \n set action \"put_page\"\n set downloadOnly 0\n--- occu/WebUI/www/config/cp_network.cgi.orig\n+++ occu/WebUI/www/config/cp_network.cgi\n@@ -149,6 +149,8 @@\n \n http_head\n \n+ file rename -force -- \"/usr/local/tmp/server.pem\" \"/etc/config/server.pem\"\n+\n put_message \"\\${dialogSettingsNetworkMessageCertificateTitle}\" \"\\${dialogSettingsNetworkMessageCertificateCCURestart}\" {\\${btnNewLogin} \"window.location.href='/';\"}\n \n #save DOM\n@@ -245,37 +247,43 @@\n }\n \n proc action_cert_upload {} {\n- global env sid\n- cd /tmp/\n+ global env sid filename\n+ cd /usr/local/tmp/\n \n http_head\n- import_file -client cert_file\n- file rename -force -- [lindex $cert_file 0] \"/var/server.pem\"\n- \n- set filename [open \"/var/server.pem\" r]\n- gets $filename line\n- close $filename\n+ set fp [open \"$filename\" r]\n+ gets $fp line\n+ close $fp\n #puts $line;\n if { [string equal $line \"-----BEGIN RSA PRIVATE KEY-----\"] == 1 || [string equal $line \"-----BEGIN PRIVATE KEY-----\"] == 1} {\n- file copy -force -- \"/var/server.pem\" \"/etc/config/server.pem\"\n- file delete \"/var/server.pem\"\n+ file rename -force -- $filename \"/usr/local/tmp/server.pem\"\n \n cgi_javascript {\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n puts {\n- parent.top.dlgPopup.hide();\n- parent.top.dlgPopup.setWidth(600);\n- parent.top.dlgPopup.LoadFromFile(url, \"action=cert_update_confirm\");\n+ var dlgPopup = parent.top.dlgPopup;\n+ if (dlgPopup === undefined) {\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\n+ }\n+ dlgPopup.hide();\n+ dlgPopup.setWidth(600);\n+ dlgPopup.LoadFromFile(url, \"action=cert_update_confirm\");\n }\n }\n } else {\n+ file delete -force -- $filename\n+\n cgi_javascript {\n- puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n- puts {\n- parent.top.dlgPopup.hide();\n- parent.top.dlgPopup.setWidth(600);\n- parent.top.dlgPopup.LoadFromFile(url, \"action=cert_update_failed\");\n- }\n+ puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n+ puts {\n+ var dlgPopup = parent.top.dlgPopup;\n+ if (dlgPopup === undefined) {\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\n+ }\n+ dlgPopup.hide();\n+ dlgPopup.setWidth(600);\n+ dlgPopup.LoadFromFile(url, \"action=cert_update_failed\");\n+ }\n }\n }\n }\n@@ -459,8 +467,7 @@\n table_row {\n table_data {width=\"20\"} {}\n table_data {colspan=\"2\"} {\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=cert_form {target=cert_upload_iframe} enctype=multipart/form-data method=post {\n- export action=cert_upload\n+ form \"/config/fileupload.ccc?sid=$sid&action=cert_upload&url=$env(SCRIPT_NAME)\" name=cert_form {target=cert_upload_iframe} enctype=multipart/form-data method=post {\n file_button cert_file size=30 maxlength=1000000\n }\n puts {<iframe name=\"cert_upload_iframe\" style=\"display: none;\"></iframe>}\n@@ -774,13 +781,16 @@\n cgi_eval {\n #cgi_debug -on\n cgi_input\n- catch {\n- import debug\n- cgi_debug -on\n- }\n+ #catch {\n+ # import debug\n+ # cgi_debug -on\n+ #}\n set action \"put_page\"\n+ set filename \"\"\n \n catch { import action }\n+ catch { import filename }\n+\n if {[session_requestisvalid 8] > 0} then action_$action\n }\n \n--- occu/WebUI/www/config/cp_security.cgi.orig\n+++ occu/WebUI/www/config/cp_security.cgi\n@@ -928,8 +928,6 @@\n proc action_put_page {} {\n global env sid\n \n- cgi_debug -on\n-\n http_head\n division {class=\"popupTitle j_translate\"} {\n puts \"\\${dialogSettingsSecurityTitle}\"\n@@ -1022,8 +1020,7 @@\n table_row {\n td {width=\"20\"} {}\n table_data {align=\"left\"} {colspan=\"2\"} {\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=backup_form {target=config_upload_iframe} enctype=multipart/form-data method=post {\n- export action=backup_upload\n+ form \"/config/fileupload.ccc?sid=$sid&action=backup_upload&url=$env(SCRIPT_NAME)\" name=backup_form {target=config_upload_iframe} enctype=multipart/form-data method=post {\n file_button backup_file size=20 maxlength=1000000\n }\n puts {<iframe name=\"config_upload_iframe\" class=\"CLASS20820\" style=\"display: none;\"></iframe>}\n@@ -1536,19 +1533,21 @@\n }\n \n proc action_backup_upload {} {\n- global env sid\n- cd /tmp/\n+ global env sid filename\n+ cd /usr/local/tmp/\n \n+ file rename -force -- $filename \"/usr/local/tmp/new_config.tar\"\n http_head\n- import_file -client backup_file\n- file rename -force -- [lindex $backup_file 0] \"/tmp/new_config.tar\"\n cgi_javascript {\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\n puts {",
"- //parent.top.ProgressBar.IncCounter(\"Backup wurde �bertragen.\");",
"- parent.top.dlgPopup.hide();\n- parent.top.dlgPopup.setWidth(400);\n- parent.top.dlgPopup.LoadFromFile(url, \"action=backup_restore_check\");\n+ var dlgPopup = parent.top.dlgPopup;\n+ if (dlgPopup === undefined) {\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\n+ }\n+ dlgPopup.hide();\n+ dlgPopup.setWidth(400);\n+ dlgPopup.LoadFromFile(url, \"action=backup_restore_check\");\n }\n }\n }\n@@ -1617,14 +1616,16 @@\n cgi_eval {\n #cgi_debug -on\n cgi_input\n- catch {\n- import debug\n- cgi_debug -on\n- }\n+ #catch {\n+ # import debug\n+ # cgi_debug -on\n+ #}\n \n set action \"put_page\"\n+ set filename \"\"\n \n catch { import action }\n+ catch { import filename }\n \n if {[session_requestisvalid 8] > 0} then action_$action\n }\n--- occu/WebUI/www/config/cp_software.cgi.orig\n+++ occu/WebUI/www/config/cp_software.cgi\n@@ -353,8 +353,7 @@\n puts \"\\${dialogSettingsExtraSoftwareLblSelectExtraSoftware}\"\r\n }\r\n table_data {\r\n- form \"$env(SCRIPT_NAME)?sid=$sid\" name=upload_form {target=image_upload_iframe} enctype=multipart/form-data method=post {\r\n- export action=image_upload\r\n+ form \"/config/fileupload.ccc?sid=$sid&action=image_upload&url=$env(SCRIPT_NAME)\" name=upload_form {target=image_upload_iframe} enctype=multipart/form-data method=post {\r\n file_button firmware_file size=30 maxlength=1000000\r\n }\r\n puts {<iframe name=\"image_upload_iframe\" style=\"display: none;\"></iframe>}\r\n@@ -487,24 +486,27 @@\n }\r\n \r\n proc action_image_upload {} {\r\n- global env sid\r\n- cd /tmp/\r\n+ global env sid filename\r\n+ cd /usr/local/tmp/\r\n \r\n http_head\r\n- import_file -client firmware_file\r\n if {[getProduct] < 3} {\r\n # CCU2\r\n- file rename -force -- [lindex $firmware_file 0] \"/var/new_firmware.tar.gz\"\r\n+ file rename -force -- $filename \"/var/new_firmware.tar.gz\"\r\n } else {\r\n # CCU3\r\n- file rename -force -- [lindex $firmware_file 0] \"/usr/local/tmp/new_addon.tar.gz\"\r\n+ file rename -force -- $filename \"/usr/local/tmp/new_addon.tar.gz\"\r\n }\r\n cgi_javascript {\r\n puts \"var url = \\\"$env(SCRIPT_NAME)?sid=$sid\\\";\"\r\n puts {\r\n- parent.top.dlgPopup.hide();\r\n- parent.top.dlgPopup.setWidth(600);\r\n- parent.top.dlgPopup.LoadFromFile(url, \"action=install_confirm\");\r\n+ var dlgPopup = parent.top.dlgPopup;\r\n+ if (dlgPopup === undefined) {\r\n+ dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\r\n+ }\r\n+ dlgPopup.hide();\r\n+ dlgPopup.setWidth(600);\r\n+ dlgPopup.LoadFromFile(url, \"action=install_confirm\");\r\n }\r\n }\r\n }\r\n@@ -519,14 +521,16 @@\n cgi_eval {\r\n #cgi_debug -on\r\n cgi_input\r\n- catch {\r\n- import debug\r\n- cgi_debug -on\r\n- }\r\n+ #catch {\r\n+ # import debug\r\n+ # cgi_debug -on\r\n+ #}\r\n \r\n set action \"put_page\"\r\n+ set filename \"\"\r\n \r\n catch { import action }\r\n+ catch { import filename }\r\n \r\n if {[session_requestisvalid 8] > 0} then action_$action\r\n }\r\n--- occu/WebUI/www/config/fileupload.ccc.orig\n+++ occu/WebUI/www/config/fileupload.ccc",
"@@ -0,0 +1,109 @@",
"+#!/bin/sh",
"+# shellcheck shell=dash disable=SC3036,SC3010,SC2034,SC3060,SC2116,SC3045 source=/dev/null",
"+\n+echo -ne \"Content-Type: text/html; charset=iso-8859-1\\r\\n\\r\\n\"",
"+\n+# allow only POST requests\n+if [[ \"${REQUEST_METHOD}\" != \"POST\" ]]; then\n+ echo \"ERROR: no POST request\"\n+ exit 1\n+fi",
"+\n+# fake read boundary+disposition, etc.\n+read -r boundary\n+read -r disposition\n+read -r ctype\n+read -r junk\n+\n+# get length\n+a=${#boundary}\n+b=${#disposition}\n+c=${#ctype}\n+d=0\n+\n+# Due to \\n\\r line breaks we have 2 extra bytes per line read,\n+# 6 + 2 newlines == 10 junk bytes\n+a=$((a*2+b+c+d+10))\n+",
"",
"+# calculate the expected content length using\n+# HTTP_CONTENT_LENGTH or CONTENT_LENGTH",
"+if [[ -z \"${HTTP_CONTENT_LENGTH}\" ]]; then",
"+ HTTP_CONTENT_LENGTH=${CONTENT_LENGTH}\n+fi\n+SIZE=$((HTTP_CONTENT_LENGTH-a))\n+",
"+# continue only if SIZE > 0\n+if [[ \"${SIZE}\" -le 0 ]]; then\n+ echo \"ERROR: POST size <= 0\"\n+ exit 1\n+fi\n+\n+# extract known params from QUERY_STRING only\n+while IFS= read -r -d '&' KEYVAL && [[ -n \"$KEYVAL\" ]]; do\n+ case ${KEYVAL%%=*} in\n+ url) url=${KEYVAL#*=} ;;\n+ sid) sid=${KEYVAL#*=} ;;\n+ action) action=${KEYVAL#*=} ;;\n+ downloadOnly) downloadOnly=${KEYVAL#*=} ;;\n+ esac\n+done <<END\n+$(echo \"${QUERY_STRING}&\")\n+END\n+\n+# check for url and action parameter\n+if [[ -z \"${url}\" ]] || [[ -z \"${action}\" ]]; then\n+ echo \"ERROR: missing required URL parameters\"\n+ exit 1\n+fi\n+\n+# check for a valid ADMIN session id\n+if [[ \"${#sid}\" -eq 12 ]]; then\n+ # parse the current version\n+ [[ -r /VERSION ]] && . /VERSION\n+\n+ # use CCU.getVersion which is allowed only for Admins\n+ RES=$(/usr/bin/curl http://127.0.0.1/api/homematic.cgi \\\n+ -H 'Content-Type: application/json' \\\n+ -d \"{\\\"method\\\":\\\"CCU.getVersion\\\",\\\"params\\\":{\\\"_session_id_\\\": \\\"${sid//@}\\\"}}\")\n+\n+ # check the curl result contains the current\n+ # version number or not\n+ if ! echo \"${RES}\" | grep -q \"${VERSION}\"; then\n+ echo \"ERROR: no valid admin session id\"\n+ exit 1\n+ fi\n+else\n+ echo \"ERROR: invalid session id\"\n+ exit 1\n+fi\n+",
"+# write out the data\n+filename=$(mktemp -p /usr/local/tmp)\n+if ! /usr/bin/head -q -c ${SIZE} >\"${filename}\"; then",
"+ echo \"ERROR: head failure\"\n+ exit 1",
"+fi\n+\n+echo \"<html>\"\n+echo \" <head>\"\n+echo \" <script>\"\n+echo \" <!--- Hide script from browsers that don't understand JavaScript\"\n+echo \" var url = '${url}?sid=${sid}';\"\n+echo \" var dlgPopup = parent.top.dlgPopup;\"\n+echo \" if (dlgPopup === undefined) {\"\n+echo \" dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\n+echo \" }\"\n+echo \" if (dlgPopup !== undefined) {\"\n+echo \" dlgPopup.hide();\"\n+echo \" dlgPopup.setWidth(450);\"\n+if [[ -n \"${downloadOnly}\" ]]; then\n+ echo \" dlgPopup.downloadOnly=${downloadOnly};\"\n+fi\n+echo \" dlgPopup.LoadFromFile(url, 'action=${action}&filename=${filename}');\"\n+echo \" }\"\n+echo \" // End hiding -->\"\n+echo \" </script>\"\n+echo \" </head>\"\n+echo \"</html>\"\n+\n+exit 0\n--- occu/WebUI/www/tcl/extern/cgi.tcl.orig\n+++ occu/WebUI/www/tcl/extern/cgi.tcl\n@@ -3,15 +3,11 @@\n # cgi.tcl - routines for writing CGI scripts in Tcl\n # Author: Don Libes <libes@nist.gov>, January '95\n #\n-# Minor changes by Lars Reemts, eQ-3\n-#\n # These routines implement the code described in the paper\n # \"Writing CGI scripts in Tcl\" which appeared in the Tcl '96 conference.\n # Please read the paper before using this code. The paper is:\n # http://expect.nist.gov/doc/cgi.pdf\n #\n-# F. Werner:\n-# add \"charset=iso-8859-1\" to header Content-Type\n ##################################################\n \n ##################################################\n@@ -27,12 +23,10 @@\n \n if {0 == [llength $args]} {\n \tcgi_content_type\n- cgi_puts \"Expires: Sun, 06 Nov 1994 00:00:00 GMT\"\n } else {\n \tif {[catch {uplevel 1 [lindex $args 0]} errMsg]} {\n \t set savedInfo $errorInfo\n \t cgi_content_type\n- cgi_puts \"Expires: Sun, 06 Nov 1994 00:00:00 GMT\"\n \t}\n }\n cgi_puts \"\"\n@@ -310,7 +304,7 @@\n \t\t\t catch {cgi_mail_add \"HTTP_HOST: $env(HTTP_HOST)\"}\n \t\t\t catch {cgi_mail_add \"REMOTE_HOST: $env(REMOTE_HOST)\"}\n \t\t\t catch {cgi_mail_add \"REMOTE_ADDR: $env(REMOTE_ADDR)\"}\n-\t\t\t cgi_mail_add \"cgi.tcl version: 1.8.0\"\n+\t\t\t cgi_mail_add \"cgi.tcl version: 1.10.0\"\n \t\t\t cgi_mail_add \"input:\"\n \t\t\t catch {cgi_mail_add $_cgi(input)}\n \t\t\t cgi_mail_add \"cookie:\"\n@@ -472,10 +466,9 @@\n foreach a [lrange $args 1 end] {\n append buf \" $a\"\n }\n- return \"$buf ></iframe>\"\n+ return \"$buf />\"\n }\n \n-\n # generate an image reference (<img ...>)\n # first arg is image url\n # other args are passed through into <img> tag\n@@ -497,7 +490,7 @@\n \n # names an anchor so that it can be linked to\n proc cgi_anchor_name {name} {\n- return \"<a name=\\\"$name\\\"></a>\"\n+ return \"<a name=\\\"$name\\\"/>\"\n }\n \n proc cgi_base {args} {\n@@ -513,7 +506,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_puts \" / >\"\n+ cgi_puts \" />\"\n }\n \n ##################################################\n@@ -531,7 +524,8 @@\n \tregsub -all -nocase {%([a-f0-9][a-f0-9])} $buf {\\\\u00\\1} buf\n \n \t# process \\u unicode mapped chars\n-\tencoding convertfrom [subst -novar -nocommand $buf]\n+\tencoding convertfrom $::_cgi(queryencoding) \\\n+\t\t [subst -novar -nocommand $buf]\n }\n } elseif {[info tclversion] >= 8.1} {\n proc cgi_unquote_input buf {\n@@ -982,7 +976,7 @@\n # from cgi_http_head.\n proc cgi_http_equiv {type contents} {\n _cgi_http_head_implicit\n- cgi_puts \"<meta http-equiv=\\\"$type\\\" content=[cgi_dquote_html $contents]></meta>\"\n+ cgi_puts \"<meta http-equiv=\\\"$type\\\" content=[cgi_dquote_html $contents]/>\"\n }\n \n # Do whatever you want with meta tags.\n@@ -1010,7 +1004,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_puts \"></link>\"\n+ cgi_puts \"/>\"\n }\n \n proc cgi_name {args} {\n@@ -1114,7 +1108,7 @@\n \n proc cgi_noscript {args} {\n cgi_puts \"<noscript[_cgi_lrange $args 0 [expr [llength $args]-2]]>\"\n- _cgi_close_proc_push {puts \"</noscript>\"}\n+ _cgi_close_proc_push {cgi_puts \"</noscript>\"}\n \n uplevel 1 [lindex $args end]\n \n@@ -1135,7 +1129,7 @@\n if {$q != \"=\"} {\n \tset value \"\"\n }\n- cgi_puts \"<param name=\\\"$name\\\" value=[cgi_dquote_html $value]></param>\"\n+ cgi_puts \"<param name=\\\"$name\\\" value=[cgi_dquote_html $value]/>\"\n }\n \n # record any proc's that must be called prior to displaying an error\n@@ -1254,7 +1248,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_put \"></isindex>\"\n+ cgi_put \"/>\"\n }\n \n ##################################################\n@@ -1294,15 +1288,31 @@\n \t} else {\n \t set length $env(CONTENT_LENGTH)\n \t if {0!=[string compare $length \"-1\"]} {\n- if { $length } {\n-\t\t set input [read stdin $env(CONTENT_LENGTH)]\t\t\n- } else {\n- set input \"\"\n- }\n+\t\tset input [read stdin $env(CONTENT_LENGTH)]\t\t\n \t } else {\n \t\tset _cgi(client_error) 1\n \t\terror \"Your browser generated a content-length of -1 during a POST method.\"\n \t }\n+\t if {[info tclversion] >= 8.1} {\n+ # guess query encoding from Content-Type header\n+ if {[info exists env(CONTENT_TYPE)] \\\n+ && [regexp -nocase -- {charset=([^[:space:]]+)} $env(CONTENT_TYPE) m cs]} {\n+ if {[regexp -nocase -- {iso-?8859-([[:digit:]]+)} $cs m d]} {\n+ set _cgi(queryencoding) \"iso8859-$d\"\n+ } elseif {[regexp -nocase -- {windows-([[:digit:]]+)} $cs m d]} {\n+ set _cgi(queryencoding) \"cp$d\"\n+ } elseif {0==[string compare -nocase $cs \"utf-8\"]} {\n+ set _cgi(queryencoding) \"utf-8\"\n+ } elseif {0==[string compare -nocase $cs \"utf-16\"]} {\n+ set _cgi(queryencoding) \"unicode\"\n+ }\n+ if { [lsearch -exact [encoding names] _cgi(queryencoding)] == -1} {\n+ set _cgi(queryencoding) [encoding system]\n+ }\n+ } else {\n+ set _cgi(queryencoding) [encoding system]\n+ }\n+ }\n \t}\n \t# save input for possible diagnostics later\n \tset _cgi(input) $input\n@@ -1345,30 +1355,6 @@\n }\n }\n \n-set _cgi_read_line_buffer \"\"\n-proc _cgi_read_line {fin bufvar crlfvar} {\n- global _cgi_read_line_buffer\n- upvar $bufvar buffer\n- upvar $crlfvar crlf\n- set line_end [string first \"\\r\\n\" $_cgi_read_line_buffer]\n- while {($line_end < 0 ) && ![eof $fin]} {\n- append _cgi_read_line_buffer [read $fin 65536]\n- set line_end [string first \"\\r\\n\" $_cgi_read_line_buffer]\n- }\n- if {$line_end >= 0} { \n- incr line_end -1\n- set buffer [string range $_cgi_read_line_buffer 0 $line_end]\n- set crlf \"\\r\\n\"\n- set _cgi_read_line_buffer [string range $_cgi_read_line_buffer [expr $line_end + 3] end]\n- return 1\n- } else {\n- set buffer $_cgi_read_line_buffer\n- set crlf \"\"\n- set _cgi_read_line_buffer \"\"\n- return [expr ([string length $buffer] > 0)]\n- }\n-}\n-\n proc _cgi_input_multipart {fin} {\n global env _cgi _cgi_uservar _cgi_userfile\n \n@@ -1379,121 +1365,7 @@\n \t# can hang and we won't get to the termination code\n \tset dbg_fout [open $dbg_filename w]\n \tset _cgi(input) $dbg_filename\n-\tcatch {fconfigure $dbg_fout -translation binary -encoding binary}\n- }\n-\n- # figure out boundary\n- if {0==[regexp boundary=(.*) $env(CONTENT_TYPE) dummy boundary]} {\n-\tset _cgi(client_error) 1\n-\terror \"Your browser failed to generate a \\\"boundary=\\\" line in a multipart response (CONTENT_TYPE: $env(CONTENT_TYPE)). Please upgrade (or fix) your browser.\"\n- }\n-\n- set boundary \"--$boundary\"\n- set boundary_length [string length $boundary]\n- \n- # don't corrupt or modify uploads yet allow Tcl 7.4 to work\n- catch {fconfigure $fin -translation binary -encoding binary}\n-\n- # get first boundary line\n- gets $fin buf\n- if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}\n-\n- set filecount 0\n- set crlf \"\"\n- while {1} {\n-\t# process Content-Disposition:\n-\tif { ! [_cgi_read_line $fin buf crlf] } break\n-\tif {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n-\tcatch {unset filename}\n-\tcatch {unset varname}\n-\tforeach b $buf {\n-\t regexp {^name=\"(.*)\"} $b dummy varname\n-\t}\n-\tif {0==[info exists varname]} {\n-\t set _cgi(client_error) 1\n-\t error \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n-\t}\t \n-\t# Lame-o encoding (on Netscape at least) doesn't escape field\n-\t# delimiters (like quotes)!! Since all we've ever seen is filename=\n-\t# at end of line, assuming nothing follows. Sigh.\n-\tregexp {filename=\"(.*)\"} $buf dummy filename\n-\n-\t# Skip remaining headers until blank line.\n-\t# Content-Type: can appear here.\n-\tset conttype \"\"\n-\twhile {1} {\n- if { ! [_cgi_read_line $fin buf crlf] } break\n-\t if {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n-\t if {0==[string compare $buf \"\"]} break\n-\t regexp -nocase \"^Content-Type:\\[ \\t]+(.*)\\r\\n\" $buf$crlf x conttype\n-\t}\n-\n-\tif {[info exists filename]} {\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>Reading file $filename\"; flush $dbg_fout}\n-\t # read the part into a file\n-\t set foutname /tmp/CGI[pid].[incr filecount]\n-\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]\n-\t set fout [open $foutname w]\n-\t # \"catch\" permits this to work with Tcl 7.4\n-\t catch {fconfigure $fout -translation binary -encoding binary}\n-\t _cgi_set_uservar $varname [list $foutname $filename $conttype]\n-\t set _cgi_userfile($varname) [list $foutname $filename $conttype]\n- \n- set leftover \"\"\n- while { 1 } {\n- if { ! [_cgi_read_line $fin buf crlf] } {\n- set _cgi(client_error) 1\n- error \"Unexpected end of input data.\"\n- }\n-\t\tif {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n- if {[string compare -length $boundary_length $buf $boundary] == 0} {\n- if {[string first \"--\" $buf $boundary_length]>=0} {set eof 1}\n- break;\n- }\n- puts -nonewline $fout $leftover$buf\n- set leftover $crlf\n- }\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>Read file $filename\"; flush $dbg_fout}\n-\t close $fout\n-\t unset fout\n- \n-\t} else {\n-\t # read the part into a variable\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>Reading variable $varname\"; flush $dbg_fout}\n-\t set val \"\"\n- set leftover \"\"\n- while { 1 } {\n- if { ! [_cgi_read_line $fin buf crlf] } {\n- set _cgi(client_error) 1\n- error \"Unexpected end of input data.\"\n- }\n-\t\tif {[info exists dbg_fout]} {puts -nonewline $dbg_fout $buf$crlf; flush $dbg_fout}\n- if {[string compare -length $boundary_length $buf $boundary] == 0} {\n- if {[string first \"--\" $buf $boundary_length]>=0} {set eof 1}\n- break;\n- }\n- append val $leftover$buf\n- set leftover $crlf\n-\t }\n-\t _cgi_set_uservar $varname $val\n- if {[info exists dbg_fout]} {puts $dbg_fout \">>>>>$varname=$val\"; flush $dbg_fout}\n-\t}\n- if {[info exists eof]} break\n- }\n- if {[info exists dbg_fout]} {close $dbg_fout}\n-}\n-\n-proc _cgi_input_multipart_buggy {fin} {\n- global env _cgi _cgi_uservar _cgi_userfile\n-\n- cgi_debug -noprint {\n-\t# save file for debugging purposes\n-\tset dbg_filename [file join $_cgi(tmpdir) CGIdbg.[pid]]\n-\t# explicitly flush all writes to fout, because sometimes the writer\n-\t# can hang and we won't get to the termination code\n-\tset dbg_fout [open $dbg_filename w]\n-\tset _cgi(input) $dbg_filename\n-\tcatch {fconfigure $dbg_fout -translation binary -encoding binary}\n+\tcatch {fconfigure $dbg_fout -translation binary}\n }\n \n # figure out boundary\n@@ -1513,24 +1385,28 @@\n set boundary --$boundary\n \n # don't corrupt or modify uploads yet allow Tcl 7.4 to work\n- catch {fconfigure $fin -translation binary -encoding binary}\n+ catch {fconfigure $fin -translation binary}\n \n # get first boundary line\n gets $fin buf\n if {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}\n \n- set filecount 0\n+ set _cgi(file,filecount) 0\n+\n while {1} {\n \t# process Content-Disposition:\n \tif {-1 == [gets $fin buf]} break\n \tif {[info exists dbg_fout]} {puts $dbg_fout $buf; flush $dbg_fout}\n \tcatch {unset filename}\n-\tforeach b $buf {\n-\t regexp {^name=\"(.*)\"} $b dummy varname\n-\t}\n+\tregexp {name=\"([^\"]*)\"} $buf dummy varname\n \tif {0==[info exists varname]} {\n-\t set _cgi(client_error) 1\n-\t error \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n+\t # lynx violates spec and doesn't use quotes, so try again but\n+\t # assume space is delimiter\n+\t regexp {name=([^ ]*)} $buf dummy varname\n+\t if {0==[info exists varname]} {\n+\t\tset _cgi(client_error) 1\n+\t\terror \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n+\t }\n \t}\t \n \t# Lame-o encoding (on Netscape at least) doesn't escape field\n \t# delimiters (like quotes)!! Since all we've ever seen is filename=\n@@ -1548,14 +1424,18 @@\n \t}\n \n \tif {[info exists filename]} {\n+\t if {$_cgi(file,filecount) > $_cgi(file,filelimit)} {\n+\t\terror \"Too many files submitted. Max files allowed: $_cgi(file,filelimit)\"\n+\t }\n+\n \t # read the part into a file\n-\t set foutname /tmp/CGI[pid].[incr filecount]\n-\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]\n+\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr _cgi(file,filecount)]]\n \t set fout [open $foutname w]\n \t # \"catch\" permits this to work with Tcl 7.4\n-\t catch {fconfigure $fout -translation binary -encoding binary}\n+\t catch {fconfigure $fout -translation binary}\n \t _cgi_set_uservar $varname [list $foutname $filename $conttype]\n \t set _cgi_userfile($varname) [list $foutname $filename $conttype]\n+\n \t #\n \t # Look for a boundary line preceded by \\r\\n.\n \t #\n@@ -1583,10 +1463,13 @@\n \t\t puts -nonewline $fout $leftover$buf\n \t\t set leftover \"\\n\"\n \t\t}\n+ \t\tif {[file size $foutname] > $_cgi(file,charlimit)} {\n+\t\t error \"File size exceeded. Max file size allowed: $_cgi(file,charlimit)\"\n+\t\t}\n \t }\n+\n \t close $fout\n \t unset fout\n- \n \t} else {\n \t # read the part into a variable\n \t set val \"\"\n@@ -1672,7 +1555,8 @@\n \t}\n }\n \n- set filecount 0\n+ set _cgi(file,filecount) 0\n+\n while {1} {\n \t# process Content-Disposition:\n \texpect {\n@@ -1684,9 +1568,7 @@\n \t eof break\n \t}\n \tcatch {unset filename}\n-\tforeach b $buf {\n-\t regexp {^name=\"(.*)\"} $b dummy varname\n-\t}\n+\tregexp {name=\"([^\"]*)\"} $buf dummy varname\n \tif {0==[info exists varname]} {\n \t set _cgi(client_error) 1\n \t error \"In response to a request for a multipart form, your browser generated a part header without a name field. Please upgrade (or fix) your browser.\"\n@@ -1712,8 +1594,12 @@\n \t}\n \n \tif {[info exists filename]} {\n+\t if {$_cgi(file,filecount) > $_cgi(file,filelimit)} {\n+\t\terror \"Too many files submitted. Max files allowed: $_cgi(file,filelimit)\"\n+\t }\n+\n \t # read the part into a file\n-\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr filecount]]\n+\t set foutname [file join $_cgi(tmpdir) CGI[pid].[incr _cgi(file,filecount)]]\n \t spawn -open [open $foutname w]\n \t set fout_sid $spawn_id\n \n@@ -1967,6 +1853,23 @@\n }\n }\n \n+# set the urlencoding\n+proc cgi_urlencoding {{encoding \"\"}} {\n+ global _cgi \n+ \n+ set result [expr {[info exists _cgi(queryencoding)]\n+ ? $_cgi(queryencoding)\n+ : \"\"}]\n+\n+ # check if the encoding is available \n+ if {[info tclversion] >= 8.1\n+ && [lsearch -exact [encoding names] $encoding] != -1 } {\t\n+ set _cgi(queryencoding) $encoding\n+ }\n+\n+ return $result\n+}\n+\n ##################################################\n # button support\n ##################################################\n@@ -2088,7 +1991,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_put \"></area>\"\n+ cgi_put \"/>\"\n }\n \n ##################################################\n@@ -2182,6 +2085,15 @@\n cgi_put \"<input type=file name=\\\"$name\\\"[_cgi_list_to_string $args]/>\"\n }\n \n+# establish a per-file limit for uploads\n+\n+proc cgi_file_limit {files chars} {\n+ global _cgi\n+\n+ set _cgi(file,filelimit) $files\n+ set _cgi(file,charlimit) $chars\n+}\n+\n ##################################################\n # select support\n ##################################################\n@@ -2224,7 +2136,7 @@\n }\n if {[info exists selected_if_equal]} {\n \tif {0 == [string compare $selected_if_equal $value]} {\n-\t cgi_put \" selected=\\\"selected\\\"\"\n+\t cgi_put \" selected\"\n \t}\n }\n cgi_puts \">[cgi_quote_html $o]</option>\"\n@@ -2251,7 +2163,7 @@\n \t }\n \t}\n }\n- cgi_put \"></embed>\"\n+ cgi_put \"/>\"\n }\n \n ##################################################\n@@ -2525,7 +2437,7 @@\n ##################################################\n \n proc cgi_stylesheet {href} {\n- puts \"<link rel=stylesheet href=\\\"$href\\\" type=\\\"text/css\\\"></link>\"\n+ puts \"<link rel=stylesheet href=\\\"$href\\\" type=\\\"text/css\\\"/>\"\n }\n \n proc cgi_span {args} {\n@@ -2584,7 +2496,7 @@\n \t cgi_put \" $a\"\n \t}\n }\n- cgi_puts \"></frame>\"\n+ cgi_puts \"/>\"\n }\n \n proc cgi_noframes {args} {\n@@ -2672,33 +2584,50 @@\n \n # User-defined procedure to generate DOCTYPE declaration\n proc cgi_doctype {} {",
"-\t#Zeile hinzugefügt: 22.02.2007, Badberg, ELV",
"-\t#puts \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Transitional//EN\\\" \\\"http://www.w3.org/TR/html4/loose.dtd\\\">\"\n-\n- # AG, eQ-3, 29.01.2013\n-\tputs \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\"\t\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\"\n-\n-\t#quirks puts \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01 Transitional//EN\\\">\"\n+ # AG, eQ-3, 29.01.2013\n+ puts \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\"\n }\n \n ##################################################\n # do some initialization\n ##################################################\n \n-cgi_name \"\"\n-cgi_root \"\"\n-cgi_body_args \"\"\n+# cgi_init initializes to a known state.\n+\n+proc cgi_init {} {\n+ global _cgi\n+ unset _cgi\n+\n+ # set explicitly for speed\n+ set _cgi(debug) -off\n+ set _cgi(buffer_nl) \"\\n\"\n \n-# email addr of person responsible for this service\n-cgi_admin_mail_addr \"root\"\t;# you should override this!\n+ cgi_name \"\"\n+ cgi_root \"\"\n+ cgi_body_args \"\"\n+ cgi_file_limit 10 100000000\n \n-# most services won't have an actual email addr\n-cgi_mail_addr \"CGI script - do not reply\"\n+ if {[info tclversion] >= 8.1} {\n+\t# set initial urlencoding\n+\tif { [lsearch -exact [encoding names] \"utf-8\"] != -1} {\n+\t cgi_urlencoding \"utf-8\"\n+\t} else {\n+\t cgi_urlencoding [encoding system]\n+\t}\n+ }\n+\n+ # email addr of person responsible for this service\n+ cgi_admin_mail_addr \"root\"\t;# you should override this!\n+\n+ # most services won't have an actual email addr\n+ cgi_mail_addr \"CGI script - do not reply\"\n+}\n+cgi_init\n \n # deduce tmp directory\n switch $tcl_platform(platform) {\n unix {\n-\tset _cgi(tmpdir) /tmp\n+\tset _cgi(tmpdir) /usr/local/tmp\n } macintosh {\n \tset _cgi(tmpdir) [pwd]\n } default {\n@@ -2711,4 +2640,4 @@\n # regexp for matching attr=val\n set _cgi(attr,regexp) \"^(\\[^=]*)=(\\[^\\\"].*)\"\n \n-package provide cgi 1.8.0\n+package provide cgi 1.10.0\n--- occu/WebUI/www/webui/webui.js.orig\n+++ occu/WebUI/www/webui/webui.js\n@@ -7365,6 +7365,7 @@\n this.currentPageOptions = options;\n \n this.currentPage.enter(options);\n+ window.name = 'ccu-main-window';\n },\n \n reload: function()"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [944, 37], "buggy_code_start_loc": [262, 2], "filenames": ["buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload.patch", "buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload/occu/WebUI/www/config/fileupload.ccc"], "fixing_code_end_loc": [992, 85], "fixing_code_start_loc": [262, 2], "message": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:raspberrymatic:raspberrymatic:*:*:*:*:*:*:*:*", "matchCriteriaId": "A097A067-7101-442C-B36A-1C351163BE0B", "versionEndExcluding": "3.63.8.20220330", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.25.20180428", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available."}, {"lang": "es", "value": "RaspberryMatic es un sistema operativo libre y de c\u00f3digo abierto para ejecutar una casa inteligente sin nube usando la l\u00ednea de hardware homematicIP / HomeMatic de dispositivos IoT. Se presenta una vulnerabilidad de ejecuci\u00f3n de c\u00f3digo remota (RCE) en la funci\u00f3n de carga de archivos de la interfaz WebUI de RaspberryMatic. Una falta de comprobaci\u00f3n/saneo de la entrada en el mecanismo de carga de archivos permite a atacantes remotos y no autenticados con acceso a la red a la interfaz WebUI lograr la ejecuci\u00f3n arbitraria de comandos del sistema operativo por medio de metacaracteres de shell en la cadena de consulta HTTP. Los comandos inyectados son ejecutados como root, conllevando as\u00ed a un compromiso total del sistema subyacente y todos sus componentes. Las versiones posteriores a la \"2.31.25.20180428\" y anteriores a \"3.63.8.20220330\" est\u00e1n afectadas. Es recomendado a usuarios actualizar a versi\u00f3n \"3.63.8.20220330\" o m\u00e1s reciente. Actualmente no se conocen medidas para mitigar el impacto de seguridad y es recomendado a usuarios actualizar a la \u00faltima versi\u00f3n disponible"}], "evaluatorComment": null, "id": "CVE-2022-24796", "lastModified": "2022-04-08T17:01:32.593", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 10.0, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 10.0, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 6.0, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-31T23:15:08.187", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/security/advisories/GHSA-g7vv-7rmf-mff7"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-78"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, "type": "CWE-78"}
| 90
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"#!/bin/sh",
"# shellcheck shell=dash disable=SC2169,SC2034,SC2154",
"\necho -ne \"Content-Type: text/html; charset=iso-8859-1\\r\\n\\r\\n\"",
"",
"\n# fake read boundary+disposition, etc.\nread -r boundary\nread -r disposition\nread -r ctype\nread -r junk",
"# get length\na=${#boundary}\nb=${#disposition}\nc=${#ctype}\nd=0",
"# Due to \\n\\r line breaks we have 2 extra bytes per line read,\n# 6 + 2 newlines == 10 junk bytes\na=$((a*2+b+c+d+10))\n",
"# extract all params from QUERY_STRING\n# shellcheck disable=SC2046,SC2116,SC2086\neval $(echo ${QUERY_STRING//&/;})\n",
"# calculate the expected content length using\n# HTTP_CONTENT_LENGTH or CONTENT_LENGTH",
"if [ -z \"${HTTP_CONTENT_LENGTH}\" ]; then",
" HTTP_CONTENT_LENGTH=${CONTENT_LENGTH}\nfi\nSIZE=$((HTTP_CONTENT_LENGTH-a))\n",
"",
"# write out the data\nfilename=$(mktemp -p /usr/local/tmp)\nif ! /usr/bin/head -q -c ${SIZE} >\"${filename}\"; then",
" echo \"ERROR (head)\"",
"fi",
"echo \"<html>\"\necho \" <head>\"\necho \" <script>\"\necho \" <!--- Hide script from browsers that don't understand JavaScript\"\necho \" var url = '${url}?sid=${sid}';\"\necho \" var dlgPopup = parent.top.dlgPopup;\"\necho \" if (dlgPopup === undefined) {\"\necho \" dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\necho \" }\"\necho \" if (dlgPopup !== undefined) {\"\necho \" dlgPopup.hide();\"\necho \" dlgPopup.setWidth(450);\"\nif [[ -n \"${downloadOnly}\" ]]; then\n echo \" dlgPopup.downloadOnly=${downloadOnly};\"\nfi\necho \" dlgPopup.LoadFromFile(url, 'action=${action}&filename=${filename}');\"\necho \" }\"\necho \" // End hiding -->\"\necho \" </script>\"\necho \" </head>\"\necho \"</html>\"",
"exit 0"
] |
[
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [944, 37], "buggy_code_start_loc": [262, 2], "filenames": ["buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload.patch", "buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload/occu/WebUI/www/config/fileupload.ccc"], "fixing_code_end_loc": [992, 85], "fixing_code_start_loc": [262, 2], "message": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:raspberrymatic:raspberrymatic:*:*:*:*:*:*:*:*", "matchCriteriaId": "A097A067-7101-442C-B36A-1C351163BE0B", "versionEndExcluding": "3.63.8.20220330", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.25.20180428", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available."}, {"lang": "es", "value": "RaspberryMatic es un sistema operativo libre y de c\u00f3digo abierto para ejecutar una casa inteligente sin nube usando la l\u00ednea de hardware homematicIP / HomeMatic de dispositivos IoT. Se presenta una vulnerabilidad de ejecuci\u00f3n de c\u00f3digo remota (RCE) en la funci\u00f3n de carga de archivos de la interfaz WebUI de RaspberryMatic. Una falta de comprobaci\u00f3n/saneo de la entrada en el mecanismo de carga de archivos permite a atacantes remotos y no autenticados con acceso a la red a la interfaz WebUI lograr la ejecuci\u00f3n arbitraria de comandos del sistema operativo por medio de metacaracteres de shell en la cadena de consulta HTTP. Los comandos inyectados son ejecutados como root, conllevando as\u00ed a un compromiso total del sistema subyacente y todos sus componentes. Las versiones posteriores a la \"2.31.25.20180428\" y anteriores a \"3.63.8.20220330\" est\u00e1n afectadas. Es recomendado a usuarios actualizar a versi\u00f3n \"3.63.8.20220330\" o m\u00e1s reciente. Actualmente no se conocen medidas para mitigar el impacto de seguridad y es recomendado a usuarios actualizar a la \u00faltima versi\u00f3n disponible"}], "evaluatorComment": null, "id": "CVE-2022-24796", "lastModified": "2022-04-08T17:01:32.593", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 10.0, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 10.0, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 6.0, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-31T23:15:08.187", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/security/advisories/GHSA-g7vv-7rmf-mff7"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-78"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, "type": "CWE-78"}
| 90
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"#!/bin/sh",
"# shellcheck shell=dash disable=SC3036,SC3010,SC2034,SC3060,SC2116,SC3045 source=/dev/null",
"\necho -ne \"Content-Type: text/html; charset=iso-8859-1\\r\\n\\r\\n\"",
"\n# allow only POST requests\nif [[ \"${REQUEST_METHOD}\" != \"POST\" ]]; then\n echo \"ERROR: no POST request\"\n exit 1\nfi",
"\n# fake read boundary+disposition, etc.\nread -r boundary\nread -r disposition\nread -r ctype\nread -r junk",
"# get length\na=${#boundary}\nb=${#disposition}\nc=${#ctype}\nd=0",
"# Due to \\n\\r line breaks we have 2 extra bytes per line read,\n# 6 + 2 newlines == 10 junk bytes\na=$((a*2+b+c+d+10))\n",
"",
"# calculate the expected content length using\n# HTTP_CONTENT_LENGTH or CONTENT_LENGTH",
"if [[ -z \"${HTTP_CONTENT_LENGTH}\" ]]; then",
" HTTP_CONTENT_LENGTH=${CONTENT_LENGTH}\nfi\nSIZE=$((HTTP_CONTENT_LENGTH-a))\n",
"# continue only if SIZE > 0\nif [[ \"${SIZE}\" -le 0 ]]; then\n echo \"ERROR: POST size <= 0\"\n exit 1\nfi",
"# extract known params from QUERY_STRING only\nwhile IFS= read -r -d '&' KEYVAL && [[ -n \"$KEYVAL\" ]]; do\n case ${KEYVAL%%=*} in\n url) url=${KEYVAL#*=} ;;\n sid) sid=${KEYVAL#*=} ;;\n action) action=${KEYVAL#*=} ;;\n downloadOnly) downloadOnly=${KEYVAL#*=} ;;\n esac\ndone <<END\n$(echo \"${QUERY_STRING}&\")\nEND",
"# check for url and action parameter\nif [[ -z \"${url}\" ]] || [[ -z \"${action}\" ]]; then\n echo \"ERROR: missing required URL parameters\"\n exit 1\nfi",
"# check for a valid ADMIN session id\nif [[ \"${#sid}\" -eq 12 ]]; then\n # parse the current version\n [[ -r /VERSION ]] && . /VERSION",
" # use CCU.getVersion which is allowed only for Admins\n RES=$(/usr/bin/curl http://127.0.0.1/api/homematic.cgi \\\n -H 'Content-Type: application/json' \\\n -d \"{\\\"method\\\":\\\"CCU.getVersion\\\",\\\"params\\\":{\\\"_session_id_\\\": \\\"${sid//@}\\\"}}\")",
" # check the curl result contains the current\n # version number or not\n if ! echo \"${RES}\" | grep -q \"${VERSION}\"; then\n echo \"ERROR: no valid admin session id\"\n exit 1\n fi\nelse\n echo \"ERROR: invalid session id\"\n exit 1\nfi\n",
"# write out the data\nfilename=$(mktemp -p /usr/local/tmp)\nif ! /usr/bin/head -q -c ${SIZE} >\"${filename}\"; then",
" echo \"ERROR: head failure\"\n exit 1",
"fi",
"echo \"<html>\"\necho \" <head>\"\necho \" <script>\"\necho \" <!--- Hide script from browsers that don't understand JavaScript\"\necho \" var url = '${url}?sid=${sid}';\"\necho \" var dlgPopup = parent.top.dlgPopup;\"\necho \" if (dlgPopup === undefined) {\"\necho \" dlgPopup = window.open('', 'ccu-main-window').dlgPopup;\"\necho \" }\"\necho \" if (dlgPopup !== undefined) {\"\necho \" dlgPopup.hide();\"\necho \" dlgPopup.setWidth(450);\"\nif [[ -n \"${downloadOnly}\" ]]; then\n echo \" dlgPopup.downloadOnly=${downloadOnly};\"\nfi\necho \" dlgPopup.LoadFromFile(url, 'action=${action}&filename=${filename}');\"\necho \" }\"\necho \" // End hiding -->\"\necho \" </script>\"\necho \" </head>\"\necho \"</html>\"",
"exit 0"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [944, 37], "buggy_code_start_loc": [262, 2], "filenames": ["buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload.patch", "buildroot-external/patches/occu/0031-WebUI-Fix-FileUpload/occu/WebUI/www/config/fileupload.ccc"], "fixing_code_end_loc": [992, 85], "fixing_code_start_loc": [262, 2], "message": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:raspberrymatic:raspberrymatic:*:*:*:*:*:*:*:*", "matchCriteriaId": "A097A067-7101-442C-B36A-1C351163BE0B", "versionEndExcluding": "3.63.8.20220330", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "2.31.25.20180428", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "RaspberryMatic is a free and open-source operating system for running a cloud-free smart-home using the homematicIP / HomeMatic hardware line of IoT devices. A Remote Code Execution (RCE) vulnerability in the file upload facility of the WebUI interface of RaspberryMatic exists. Missing input validation/sanitization in the file upload mechanism allows remote, unauthenticated attackers with network access to the WebUI interface to achieve arbitrary operating system command execution via shell metacharacters in the HTTP query string. Injected commands are executed as root, thus leading to a full compromise of the underlying system and all its components. Versions after `2.31.25.20180428` and prior to `3.63.8.20220330` are affected. Users are advised to update to version `3.63.8.20220330` or newer. There are currently no known workarounds to mitigate the security impact and users are advised to update to the latest version available."}, {"lang": "es", "value": "RaspberryMatic es un sistema operativo libre y de c\u00f3digo abierto para ejecutar una casa inteligente sin nube usando la l\u00ednea de hardware homematicIP / HomeMatic de dispositivos IoT. Se presenta una vulnerabilidad de ejecuci\u00f3n de c\u00f3digo remota (RCE) en la funci\u00f3n de carga de archivos de la interfaz WebUI de RaspberryMatic. Una falta de comprobaci\u00f3n/saneo de la entrada en el mecanismo de carga de archivos permite a atacantes remotos y no autenticados con acceso a la red a la interfaz WebUI lograr la ejecuci\u00f3n arbitraria de comandos del sistema operativo por medio de metacaracteres de shell en la cadena de consulta HTTP. Los comandos inyectados son ejecutados como root, conllevando as\u00ed a un compromiso total del sistema subyacente y todos sus componentes. Las versiones posteriores a la \"2.31.25.20180428\" y anteriores a \"3.63.8.20220330\" est\u00e1n afectadas. Es recomendado a usuarios actualizar a versi\u00f3n \"3.63.8.20220330\" o m\u00e1s reciente. Actualmente no se conocen medidas para mitigar el impacto de seguridad y es recomendado a usuarios actualizar a la \u00faltima versi\u00f3n disponible"}], "evaluatorComment": null, "id": "CVE-2022-24796", "lastModified": "2022-04-08T17:01:32.593", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 10.0, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 10.0, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 6.0, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-03-31T23:15:08.187", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/jens-maus/RaspberryMatic/security/advisories/GHSA-g7vv-7rmf-mff7"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-78"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/jens-maus/RaspberryMatic/commit/34854659a63e9fb3ad529bb413e96978c6450a53"}, "type": "CWE-78"}
| 90
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# -*- coding: utf-8 -*-\n'''\nSupport for the Git SCM\n'''\nfrom __future__ import absolute_import",
"# Import python libs\nimport os",
"",
"import subprocess",
"# Import salt libs\nfrom salt import utils\nfrom salt.exceptions import SaltInvocationError, CommandExecutionError\nfrom salt.ext.six.moves.urllib.parse import urlparse as _urlparse # pylint: disable=no-name-in-module,import-error\nfrom salt.ext.six.moves.urllib.parse import urlunparse as _urlunparse # pylint: disable=no-name-in-module,import-error",
"\ndef __virtual__():\n '''\n Only load if git exists on the system\n '''\n return True if utils.which('git') else False",
"\ndef _git_run(cmd, cwd=None, runas=None, identity=None, **kwargs):\n '''\n simple, throw an exception with the error message on an error return code.",
" this function may be moved to the command module, spliced with\n 'cmd.run_all', and used as an alternative to 'cmd.run_all'. Some\n commands don't return proper retcodes, so this can't replace 'cmd.run_all'.\n '''\n env = {}",
" if identity:\n stderrs = []",
" # if the statefile provides multiple identities, they need to be tried\n # (but also allow a string instead of a list)\n if not isinstance(identity, list):\n # force it into a list\n identity = [identity]",
" # try each of the identities, independently\n for id_file in identity:\n env = {\n 'GIT_IDENTITY': id_file\n }",
" # copy wrapper to area accessible by ``runas`` user\n # currently no suppport in windows for wrapping git ssh\n if not utils.is_windows():\n ssh_id_wrapper = os.path.join(utils.templates.TEMPLATE_DIRNAME,\n 'git/ssh-id-wrapper')\n tmp_file = utils.mkstemp()\n utils.files.copyfile(ssh_id_wrapper, tmp_file)\n os.chmod(tmp_file, 0o500)\n os.chown(tmp_file, __salt__['file.user_to_uid'](runas), -1)\n env['GIT_SSH'] = tmp_file",
" try:\n result = __salt__['cmd.run_all'](cmd,\n cwd=cwd,\n runas=runas,",
"",
" env=env,\n python_shell=False,\n **kwargs)\n finally:\n if 'GIT_SSH' in env:\n os.remove(env['GIT_SSH'])",
" # if the command was successful, no need to try additional IDs\n if result['retcode'] == 0:\n return result['stdout']\n else:",
" stderrs.append(result['stderr'])",
"\n # we've tried all IDs and still haven't passed, so error out\n raise CommandExecutionError(\"\\n\\n\".join(stderrs))",
" else:\n result = __salt__['cmd.run_all'](cmd,\n cwd=cwd,\n runas=runas,",
"",
" env=env,\n python_shell=False,\n **kwargs)\n retcode = result['retcode']",
" if retcode == 0:\n return result['stdout']\n else:",
"",
" raise CommandExecutionError(",
" 'Command {0!r} failed. Stderr: {1!r}'.format(cmd,\n result['stderr']))",
"",
"def _git_getdir(cwd, user=None):\n '''\n Returns the absolute path to the top-level of a given repo because some Git\n commands are sensitive to where they're run from (archive for one)\n '''\n cmd_bare = 'git rev-parse --is-bare-repository'\n is_bare = __salt__['cmd.run_stdout'](cmd_bare, cwd, runas=user) == 'true'",
" if is_bare:\n return cwd",
" cmd_toplvl = 'git rev-parse --show-toplevel'\n return __salt__['cmd.run'](cmd_toplvl, cwd)",
"\ndef _check_git():\n '''\n Check if git is available\n '''\n utils.check_or_die('git')",
"\ndef _add_http_basic_auth(repository, https_user=None, https_pass=None):\n if https_user is None and https_pass is None:\n return repository\n else:\n urltuple = _urlparse(repository)\n if urltuple.scheme == 'https':\n if https_pass:\n auth_string = \"{0}:{1}\".format(https_user, https_pass)\n else:\n auth_string = https_user\n netloc = \"{0}@{1}\".format(auth_string, urltuple.netloc)\n urltuple = urltuple._replace(netloc=netloc)\n return _urlunparse(urltuple)\n else:\n raise ValueError('Basic Auth only supported for HTTPS scheme')",
"\ndef current_branch(cwd, user=None):\n '''\n Returns the current branch name, if on a branch.",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.current_branch /path/to/repo\n '''\n cmd = r'git rev-parse --abbrev-ref HEAD'",
" return __salt__['cmd.run_stdout'](cmd, cwd=cwd, runas=user)",
"\ndef revision(cwd, rev='HEAD', short=False, user=None):\n '''\n Returns the long hash of a given identifier (hash, branch, tag, HEAD, etc)",
" cwd\n The path to the Git repository",
" rev: HEAD\n The revision",
" short: False\n Return an abbreviated SHA1 git hash",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.revision /path/to/repo mybranch\n '''\n _check_git()",
" cmd = 'git rev-parse {0}{1}'.format('--short ' if short else '', rev)\n return _git_run(cmd, cwd, runas=user)",
"\ndef clone(cwd, repository, opts=None, user=None, identity=None,\n https_user=None, https_pass=None):\n '''\n Clone a new repository",
" cwd\n The path to the Git repository",
" repository\n The git URI of the repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" https_user : None\n HTTP Basic Auth username for HTTPS (only) clones",
" .. versionadded:: 20515.5.0",
" https_pass : None\n HTTP Basic Auth password for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.clone /path/to/repo git://github.com/saltstack/salt.git",
" salt '*' git.clone /path/to/repo.git\\\\\n git://github.com/saltstack/salt.git '--bare --origin github'",
" '''\n _check_git()",
" repository = _add_http_basic_auth(repository, https_user, https_pass)",
" if not opts:\n opts = ''\n if utils.is_windows():\n cmd = 'git clone {0} {1} {2}'.format(repository, cwd, opts)\n else:\n cmd = 'git clone {0} {1!r} {2}'.format(repository, cwd, opts)",
" return _git_run(cmd, runas=user, identity=identity)",
"\ndef describe(cwd, rev='HEAD', user=None):\n '''\n Returns the git describe string (or the SHA hash if there are no tags) for\n the given revision",
" cwd\n The path to the Git repository",
" rev: HEAD\n The revision to describe",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Examples:",
" .. code-block:: bash",
" salt '*' git.describe /path/to/repo",
" salt '*' git.describe /path/to/repo develop\n '''\n cmd = 'git describe {0}'.format(rev)\n return __salt__['cmd.run_stdout'](cmd,\n cwd=cwd,\n runas=user,\n python_shell=False)",
"\ndef archive(cwd, output, rev='HEAD', fmt=None, prefix=None, user=None):\n '''\n Export a tarball from the repository",
" cwd\n The path to the Git repository",
" output\n The path to the archive tarball",
" rev: HEAD\n The revision to create an archive from",
" fmt: None\n Format of the resulting archive, zip and tar are commonly used",
" prefix : None\n Prepend <prefix>/ to every filename in the archive",
" user : None\n Run git as a user other than what the minion runs as",
" If ``prefix`` is not specified it defaults to the basename of the repo\n directory.",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.archive /path/to/repo /path/to/archive.tar.gz\n '''\n _check_git()",
" basename = '{0}/'.format(os.path.basename(_git_getdir(cwd, user=user)))",
" cmd = 'git archive{prefix}{fmt} -o {output} {rev}'.format(\n rev=rev,\n output=output,\n fmt=' --format={0}'.format(fmt) if fmt else '',\n prefix=' --prefix=\"{0}\"'.format(prefix if prefix else basename)\n )",
" return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef fetch(cwd, opts=None, user=None, identity=None):\n '''\n Perform a fetch on the given repository",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.fetch /path/to/repo '--all'",
" salt '*' git.fetch cwd=/path/to/repo opts='--all' user=johnny\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git fetch {0}'.format(opts)",
" return _git_run(cmd, cwd=cwd, runas=user, identity=identity)",
"\ndef pull(cwd, opts=None, user=None, identity=None):\n '''\n Perform a pull on the given repository",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.pull /path/to/repo opts='--rebase origin master'\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git pull {0}'.format(opts),\n cwd=cwd,\n runas=user,\n identity=identity)",
"\ndef rebase(cwd, rev='master', opts=None, user=None):\n '''\n Rebase the current branch",
" cwd\n The path to the Git repository",
" rev : master\n The revision to rebase onto the current branch",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.rebase /path/to/repo master\n salt '*' git.rebase /path/to/repo 'origin master'",
" That is the same as:",
" .. code-block:: bash",
" git rebase master\n git rebase origin master\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git rebase {0} {1}'.format(opts, rev),\n cwd=cwd,\n runas=user)",
"\ndef checkout(cwd, rev, force=False, opts=None, user=None):\n '''\n Checkout a given revision",
" cwd\n The path to the Git repository",
" rev\n The remote branch or revision to checkout",
" force : False\n Force a checkout even if there might be overwritten changes",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Examples:",
" .. code-block:: bash",
" salt '*' git.checkout /path/to/repo somebranch user=jeff",
" salt '*' git.checkout /path/to/repo opts='testbranch -- conf/file1 file2'",
" salt '*' git.checkout /path/to/repo rev=origin/mybranch opts=--track\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git checkout {0} {1} {2}'.format(' -f' if force else '', rev, opts)\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef merge(cwd, branch='@{upstream}', opts=None, user=None):\n '''\n Merge a given branch",
" cwd\n The path to the Git repository",
" branch : @{upstream}\n The remote branch or revision to merge into the current branch",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.fetch /path/to/repo\n salt '*' git.merge /path/to/repo @{upstream}\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git merge {0} {1}'.format(branch,\n opts)",
" return _git_run(cmd, cwd, runas=user)",
"\ndef init(cwd, opts=None, user=None):\n '''\n Initialize a new git repository",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.init /path/to/repo.git opts='--bare'\n '''\n _check_git()\n if not opts:\n opts = ''\n cmd = 'git init {0} {1}'.format(cwd, opts)\n return _git_run(cmd, runas=user)",
"\ndef submodule(cwd, init=True, opts=None, user=None, identity=None):\n '''\n Initialize git submodules",
" cwd\n The path to the Git repository",
" init : True\n Ensure that new submodules are initialized",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.submodule /path/to/repo.git/sub/repo\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git submodule update {0} {1}'.format('--init' if init else '', opts)\n return _git_run(cmd, cwd=cwd, runas=user, identity=identity)",
"\ndef status(cwd, user=None):\n '''\n Return the status of the repository. The returned format uses the status\n codes of git's 'porcelain' output mode",
" cwd\n The path to the Git repository",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.status /path/to/git/repo\n '''\n cmd = 'git status -z --porcelain'\n stdout = _git_run(cmd, cwd=cwd, runas=user)\n state_by_file = []\n for line in stdout.split(\"\\0\"):\n state = line[:2]\n filename = line[3:]\n if filename != '' and state != '':\n state_by_file.append((state, filename))\n return state_by_file",
"\ndef add(cwd, file_name, user=None, opts=None):\n '''\n add a file to git",
" cwd\n The path to the Git repository",
" file_name\n Path to the file in the cwd",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.add /path/to/git/repo /path/to/file",
" '''",
" if not opts:\n opts = ''\n cmd = 'git add {0} {1}'.format(file_name, opts)\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef rm(cwd, file_name, user=None, opts=None):\n '''\n Remove a file from git",
" cwd\n The path to the Git repository",
" file_name\n Path to the file in the cwd",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.rm /path/to/git/repo /path/to/file\n '''",
" if not opts:\n opts = ''\n cmd = 'git rm {0} {1}'.format(file_name, opts)\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef commit(cwd, message, user=None, opts=None):\n '''\n create a commit",
" cwd\n The path to the Git repository",
" message\n The commit message",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.commit /path/to/git/repo 'The commit message'\n '''",
" cmd = subprocess.list2cmdline(['git', 'commit', '-m', message])\n # add opts separately; they don't need to be quoted\n if opts:\n cmd = cmd + ' ' + opts\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef push(cwd, remote_name, branch='master', user=None, opts=None,\n identity=None):\n '''\n Push to remote",
" cwd\n The path to the Git repository",
" remote_name\n Name of the remote to push to",
" branch : master\n Name of the branch to push",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
"\n CLI Example:",
" .. code-block:: bash",
" salt '*' git.push /path/to/git/repo remote-name\n '''",
" if not opts:\n opts = ''\n cmd = 'git push {0} {1} {2}'.format(remote_name, branch, opts)\n return _git_run(cmd, cwd=cwd, runas=user, identity=identity)",
"\ndef remotes(cwd, user=None):\n '''\n Get remotes like git remote -v",
" cwd\n The path to the Git repository",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.remotes /path/to/repo\n '''\n cmd = 'git remote'\n ret = _git_run(cmd, cwd=cwd, runas=user)\n res = dict()\n for remote_name in ret.splitlines():\n remote = remote_name.strip()\n res[remote] = remote_get(cwd, remote, user=user)\n return res",
"\ndef remote_get(cwd, remote='origin', user=None):\n '''\n get the fetch and push URL for a specified remote name",
" remote : origin\n the remote name used to define the fetch and push URL",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.remote_get /path/to/repo\n salt '*' git.remote_get /path/to/repo upstream\n '''\n try:\n cmd = 'git remote show -n {0}'.format(remote)\n ret = _git_run(cmd, cwd=cwd, runas=user)\n lines = ret.splitlines()\n remote_fetch_url = lines[1].replace('Fetch URL: ', '').strip()\n remote_push_url = lines[2].replace('Push URL: ', '').strip()\n if remote_fetch_url != remote and remote_push_url != remote:\n res = (remote_fetch_url, remote_push_url)\n return res\n else:\n return None\n except CommandExecutionError:\n return None",
"\ndef remote_set(cwd, name='origin', url=None, user=None, https_user=None,\n https_pass=None):\n '''\n sets a remote with name and URL like git remote add <remote_name> <remote_url>",
" remote_name : origin\n defines the remote name",
" remote_url : None\n defines the remote URL; should not be None!",
" user : None\n Run git as a user other than what the minion runs as",
" https_user : None\n HTTP Basic Auth username for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" https_pass : None\n HTTP Basic Auth password for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.remote_set /path/to/repo remote_url=git@github.com:saltstack/salt.git\n salt '*' git.remote_set /path/to/repo origin git@github.com:saltstack/salt.git\n '''\n if remote_get(cwd, name):\n cmd = 'git remote rm {0}'.format(name)\n _git_run(cmd, cwd=cwd, runas=user)\n url = _add_http_basic_auth(url, https_user, https_pass)\n cmd = 'git remote add {0} {1}'.format(name, url)\n _git_run(cmd, cwd=cwd, runas=user)\n return remote_get(cwd=cwd, remote=name, user=None)",
"\ndef branch(cwd, rev, opts=None, user=None):\n '''\n Interacts with branches.",
" cwd\n The path to the Git repository",
" rev\n The branch/revision to be used in the command.",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.branch mybranch --set-upstream-to=origin/mybranch\n '''\n cmd = 'git branch {0} {1}'.format(rev, opts)\n _git_run(cmd, cwd=cwd, user=user)\n return current_branch(cwd, user=user)",
"\ndef reset(cwd, opts=None, user=None):\n '''\n Reset the repository checkout",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.reset /path/to/repo master\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git reset {0}'.format(opts), cwd=cwd, runas=user)",
"\ndef stash(cwd, opts=None, user=None):\n '''\n Stash changes in the repository checkout",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.stash /path/to/repo master\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git stash {0}'.format(opts), cwd=cwd, runas=user)",
"\ndef config_set(cwd=None, setting_name=None, setting_value=None, user=None, is_global=False):\n '''\n Set a key in the git configuration file (.git/config) of the repository or\n globally.",
" cwd : None\n Options path to the Git repository",
" .. versionchanged:: 2014.7.0\n Made ``cwd`` optional",
" setting_name : None\n The name of the configuration key to set. Required.",
" setting_value : None\n The (new) value to set. Required.",
" user : None\n Run git as a user other than what the minion runs as",
" is_global : False\n Set to True to use the '--global' flag with 'git config'",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.config_set /path/to/repo user.email me@example.com\n '''\n if setting_name is None or setting_value is None:\n raise TypeError('Missing required parameter setting_name for git.config_set')\n if cwd is None and not is_global:\n raise SaltInvocationError('Either `is_global` must be set to True or '\n 'you must provide `cwd`')",
" if is_global:\n cmd = 'git config --global {0} \"{1}\"'.format(setting_name, setting_value)\n else:\n cmd = 'git config {0} \"{1}\"'.format(setting_name, setting_value)",
" _check_git()",
" return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef config_get(cwd=None, setting_name=None, user=None):\n '''\n Get a key or keys from the git configuration file (.git/config).",
" cwd : None\n Optional path to a Git repository",
" .. versionchanged:: 2014.7.0\n Made ``cwd`` optional",
" setting_name : None\n The name of the configuration key to get. Required.",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.config_get setting_name=user.email\n salt '*' git.config_get /path/to/repo user.name arthur\n '''\n if setting_name is None:\n raise TypeError('Missing required parameter setting_name for git.config_get')\n _check_git()",
" return _git_run('git config {0}'.format(setting_name), cwd=cwd, runas=user)",
"\ndef ls_remote(cwd, repository=\"origin\", branch=\"master\", user=None,\n identity=None, https_user=None, https_pass=None):\n '''\n Returns the upstream hash for any given URL and branch.",
" cwd\n The path to the Git repository",
" repository: origin\n The name of the repository to get the revision from. Can be the name of\n a remote, an URL, etc.",
" branch: master\n The name of the branch to get the revision from.",
" user : none\n run git as a user other than what the minion runs as",
" identity : none\n a path to a private key to use over ssh",
" https_user : None\n HTTP Basic Auth username for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" https_pass : None\n HTTP Basic Auth password for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.ls_remote /pat/to/repo origin master",
" '''\n _check_git()\n repository = _add_http_basic_auth(repository, https_user, https_pass)\n cmd = ' '.join([\"git\", \"ls-remote\", \"-h\", str(repository), str(branch), \"| cut -f 1\"])\n return _git_run(cmd, cwd=cwd, runas=user, identity=identity)"
] |
[
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [96, 39], "buggy_code_start_loc": [8, 39], "filenames": ["salt/modules/git.py", "tests/unit/modules/git_test.py"], "fixing_code_end_loc": [107, 58], "fixing_code_start_loc": [9, 40], "message": "salt before 2015.5.5 leaks git usernames and passwords to the log.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:saltstack:salt_2015:*:*:*:*:*:*:*:*", "matchCriteriaId": "A241B444-0215-4D01-ABCB-25C8D2CF9804", "versionEndExcluding": null, "versionEndIncluding": "5.4", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "salt before 2015.5.5 leaks git usernames and passwords to the log."}, {"lang": "es", "value": "salt en versiones anteriores a la 2015.5.5 fuga nombres de usuario y contrase\u00f1as de git al log."}], "evaluatorComment": null, "id": "CVE-2015-6918", "lastModified": "2017-11-05T21:18:20.237", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 4.0, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-10-10T16:29:00.417", "references": [{"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory", "VDB Entry"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1257154"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}, "type": "CWE-200"}
| 91
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# -*- coding: utf-8 -*-\n'''\nSupport for the Git SCM\n'''\nfrom __future__ import absolute_import",
"# Import python libs\nimport os",
"import re",
"import subprocess",
"# Import salt libs\nfrom salt import utils\nfrom salt.exceptions import SaltInvocationError, CommandExecutionError\nfrom salt.ext.six.moves.urllib.parse import urlparse as _urlparse # pylint: disable=no-name-in-module,import-error\nfrom salt.ext.six.moves.urllib.parse import urlunparse as _urlunparse # pylint: disable=no-name-in-module,import-error",
"\ndef __virtual__():\n '''\n Only load if git exists on the system\n '''\n return True if utils.which('git') else False",
"\ndef _git_run(cmd, cwd=None, runas=None, identity=None, **kwargs):\n '''\n simple, throw an exception with the error message on an error return code.",
" this function may be moved to the command module, spliced with\n 'cmd.run_all', and used as an alternative to 'cmd.run_all'. Some\n commands don't return proper retcodes, so this can't replace 'cmd.run_all'.\n '''\n env = {}",
" if identity:\n stderrs = []",
" # if the statefile provides multiple identities, they need to be tried\n # (but also allow a string instead of a list)\n if not isinstance(identity, list):\n # force it into a list\n identity = [identity]",
" # try each of the identities, independently\n for id_file in identity:\n env = {\n 'GIT_IDENTITY': id_file\n }",
" # copy wrapper to area accessible by ``runas`` user\n # currently no suppport in windows for wrapping git ssh\n if not utils.is_windows():\n ssh_id_wrapper = os.path.join(utils.templates.TEMPLATE_DIRNAME,\n 'git/ssh-id-wrapper')\n tmp_file = utils.mkstemp()\n utils.files.copyfile(ssh_id_wrapper, tmp_file)\n os.chmod(tmp_file, 0o500)\n os.chown(tmp_file, __salt__['file.user_to_uid'](runas), -1)\n env['GIT_SSH'] = tmp_file",
" try:\n result = __salt__['cmd.run_all'](cmd,\n cwd=cwd,\n runas=runas,",
" output_loglevel='quiet',",
" env=env,\n python_shell=False,\n **kwargs)\n finally:\n if 'GIT_SSH' in env:\n os.remove(env['GIT_SSH'])",
" # if the command was successful, no need to try additional IDs\n if result['retcode'] == 0:\n return result['stdout']\n else:",
" stderr = _remove_sensitive_data(result['stderr'])\n stderrs.append(stderr)",
"\n # we've tried all IDs and still haven't passed, so error out\n raise CommandExecutionError(\"\\n\\n\".join(stderrs))",
" else:\n result = __salt__['cmd.run_all'](cmd,\n cwd=cwd,\n runas=runas,",
" output_loglevel='quiet',",
" env=env,\n python_shell=False,\n **kwargs)\n retcode = result['retcode']",
" if retcode == 0:\n return result['stdout']\n else:",
" stderr = _remove_sensitive_data(result['stderr'])",
" raise CommandExecutionError(",
" 'Command {0!r} failed. Stderr: {1!r}'.format(cmd, stderr))",
"\ndef _remove_sensitive_data(sensitive_output):\n '''\n Remove HTTP user and password.\n '''\n return re.sub('(https?)://.*@', r'\\1://<redacted>@', sensitive_output)",
"",
"def _git_getdir(cwd, user=None):\n '''\n Returns the absolute path to the top-level of a given repo because some Git\n commands are sensitive to where they're run from (archive for one)\n '''\n cmd_bare = 'git rev-parse --is-bare-repository'\n is_bare = __salt__['cmd.run_stdout'](cmd_bare, cwd, runas=user) == 'true'",
" if is_bare:\n return cwd",
" cmd_toplvl = 'git rev-parse --show-toplevel'\n return __salt__['cmd.run'](cmd_toplvl, cwd)",
"\ndef _check_git():\n '''\n Check if git is available\n '''\n utils.check_or_die('git')",
"\ndef _add_http_basic_auth(repository, https_user=None, https_pass=None):\n if https_user is None and https_pass is None:\n return repository\n else:\n urltuple = _urlparse(repository)\n if urltuple.scheme == 'https':\n if https_pass:\n auth_string = \"{0}:{1}\".format(https_user, https_pass)\n else:\n auth_string = https_user\n netloc = \"{0}@{1}\".format(auth_string, urltuple.netloc)\n urltuple = urltuple._replace(netloc=netloc)\n return _urlunparse(urltuple)\n else:\n raise ValueError('Basic Auth only supported for HTTPS scheme')",
"\ndef current_branch(cwd, user=None):\n '''\n Returns the current branch name, if on a branch.",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.current_branch /path/to/repo\n '''\n cmd = r'git rev-parse --abbrev-ref HEAD'",
" return __salt__['cmd.run_stdout'](cmd, cwd=cwd, runas=user)",
"\ndef revision(cwd, rev='HEAD', short=False, user=None):\n '''\n Returns the long hash of a given identifier (hash, branch, tag, HEAD, etc)",
" cwd\n The path to the Git repository",
" rev: HEAD\n The revision",
" short: False\n Return an abbreviated SHA1 git hash",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.revision /path/to/repo mybranch\n '''\n _check_git()",
" cmd = 'git rev-parse {0}{1}'.format('--short ' if short else '', rev)\n return _git_run(cmd, cwd, runas=user)",
"\ndef clone(cwd, repository, opts=None, user=None, identity=None,\n https_user=None, https_pass=None):\n '''\n Clone a new repository",
" cwd\n The path to the Git repository",
" repository\n The git URI of the repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" https_user : None\n HTTP Basic Auth username for HTTPS (only) clones",
" .. versionadded:: 20515.5.0",
" https_pass : None\n HTTP Basic Auth password for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.clone /path/to/repo git://github.com/saltstack/salt.git",
" salt '*' git.clone /path/to/repo.git\\\\\n git://github.com/saltstack/salt.git '--bare --origin github'",
" '''\n _check_git()",
" repository = _add_http_basic_auth(repository, https_user, https_pass)",
" if not opts:\n opts = ''\n if utils.is_windows():\n cmd = 'git clone {0} {1} {2}'.format(repository, cwd, opts)\n else:\n cmd = 'git clone {0} {1!r} {2}'.format(repository, cwd, opts)",
" return _git_run(cmd, runas=user, identity=identity)",
"\ndef describe(cwd, rev='HEAD', user=None):\n '''\n Returns the git describe string (or the SHA hash if there are no tags) for\n the given revision",
" cwd\n The path to the Git repository",
" rev: HEAD\n The revision to describe",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Examples:",
" .. code-block:: bash",
" salt '*' git.describe /path/to/repo",
" salt '*' git.describe /path/to/repo develop\n '''\n cmd = 'git describe {0}'.format(rev)\n return __salt__['cmd.run_stdout'](cmd,\n cwd=cwd,\n runas=user,\n python_shell=False)",
"\ndef archive(cwd, output, rev='HEAD', fmt=None, prefix=None, user=None):\n '''\n Export a tarball from the repository",
" cwd\n The path to the Git repository",
" output\n The path to the archive tarball",
" rev: HEAD\n The revision to create an archive from",
" fmt: None\n Format of the resulting archive, zip and tar are commonly used",
" prefix : None\n Prepend <prefix>/ to every filename in the archive",
" user : None\n Run git as a user other than what the minion runs as",
" If ``prefix`` is not specified it defaults to the basename of the repo\n directory.",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.archive /path/to/repo /path/to/archive.tar.gz\n '''\n _check_git()",
" basename = '{0}/'.format(os.path.basename(_git_getdir(cwd, user=user)))",
" cmd = 'git archive{prefix}{fmt} -o {output} {rev}'.format(\n rev=rev,\n output=output,\n fmt=' --format={0}'.format(fmt) if fmt else '',\n prefix=' --prefix=\"{0}\"'.format(prefix if prefix else basename)\n )",
" return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef fetch(cwd, opts=None, user=None, identity=None):\n '''\n Perform a fetch on the given repository",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.fetch /path/to/repo '--all'",
" salt '*' git.fetch cwd=/path/to/repo opts='--all' user=johnny\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git fetch {0}'.format(opts)",
" return _git_run(cmd, cwd=cwd, runas=user, identity=identity)",
"\ndef pull(cwd, opts=None, user=None, identity=None):\n '''\n Perform a pull on the given repository",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.pull /path/to/repo opts='--rebase origin master'\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git pull {0}'.format(opts),\n cwd=cwd,\n runas=user,\n identity=identity)",
"\ndef rebase(cwd, rev='master', opts=None, user=None):\n '''\n Rebase the current branch",
" cwd\n The path to the Git repository",
" rev : master\n The revision to rebase onto the current branch",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.rebase /path/to/repo master\n salt '*' git.rebase /path/to/repo 'origin master'",
" That is the same as:",
" .. code-block:: bash",
" git rebase master\n git rebase origin master\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git rebase {0} {1}'.format(opts, rev),\n cwd=cwd,\n runas=user)",
"\ndef checkout(cwd, rev, force=False, opts=None, user=None):\n '''\n Checkout a given revision",
" cwd\n The path to the Git repository",
" rev\n The remote branch or revision to checkout",
" force : False\n Force a checkout even if there might be overwritten changes",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Examples:",
" .. code-block:: bash",
" salt '*' git.checkout /path/to/repo somebranch user=jeff",
" salt '*' git.checkout /path/to/repo opts='testbranch -- conf/file1 file2'",
" salt '*' git.checkout /path/to/repo rev=origin/mybranch opts=--track\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git checkout {0} {1} {2}'.format(' -f' if force else '', rev, opts)\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef merge(cwd, branch='@{upstream}', opts=None, user=None):\n '''\n Merge a given branch",
" cwd\n The path to the Git repository",
" branch : @{upstream}\n The remote branch or revision to merge into the current branch",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.fetch /path/to/repo\n salt '*' git.merge /path/to/repo @{upstream}\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git merge {0} {1}'.format(branch,\n opts)",
" return _git_run(cmd, cwd, runas=user)",
"\ndef init(cwd, opts=None, user=None):\n '''\n Initialize a new git repository",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.init /path/to/repo.git opts='--bare'\n '''\n _check_git()\n if not opts:\n opts = ''\n cmd = 'git init {0} {1}'.format(cwd, opts)\n return _git_run(cmd, runas=user)",
"\ndef submodule(cwd, init=True, opts=None, user=None, identity=None):\n '''\n Initialize git submodules",
" cwd\n The path to the Git repository",
" init : True\n Ensure that new submodules are initialized",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.submodule /path/to/repo.git/sub/repo\n '''\n _check_git()",
" if not opts:\n opts = ''\n cmd = 'git submodule update {0} {1}'.format('--init' if init else '', opts)\n return _git_run(cmd, cwd=cwd, runas=user, identity=identity)",
"\ndef status(cwd, user=None):\n '''\n Return the status of the repository. The returned format uses the status\n codes of git's 'porcelain' output mode",
" cwd\n The path to the Git repository",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.status /path/to/git/repo\n '''\n cmd = 'git status -z --porcelain'\n stdout = _git_run(cmd, cwd=cwd, runas=user)\n state_by_file = []\n for line in stdout.split(\"\\0\"):\n state = line[:2]\n filename = line[3:]\n if filename != '' and state != '':\n state_by_file.append((state, filename))\n return state_by_file",
"\ndef add(cwd, file_name, user=None, opts=None):\n '''\n add a file to git",
" cwd\n The path to the Git repository",
" file_name\n Path to the file in the cwd",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.add /path/to/git/repo /path/to/file",
" '''",
" if not opts:\n opts = ''\n cmd = 'git add {0} {1}'.format(file_name, opts)\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef rm(cwd, file_name, user=None, opts=None):\n '''\n Remove a file from git",
" cwd\n The path to the Git repository",
" file_name\n Path to the file in the cwd",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.rm /path/to/git/repo /path/to/file\n '''",
" if not opts:\n opts = ''\n cmd = 'git rm {0} {1}'.format(file_name, opts)\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef commit(cwd, message, user=None, opts=None):\n '''\n create a commit",
" cwd\n The path to the Git repository",
" message\n The commit message",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.commit /path/to/git/repo 'The commit message'\n '''",
" cmd = subprocess.list2cmdline(['git', 'commit', '-m', message])\n # add opts separately; they don't need to be quoted\n if opts:\n cmd = cmd + ' ' + opts\n return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef push(cwd, remote_name, branch='master', user=None, opts=None,\n identity=None):\n '''\n Push to remote",
" cwd\n The path to the Git repository",
" remote_name\n Name of the remote to push to",
" branch : master\n Name of the branch to push",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" identity : None\n A path to a private key to use over SSH",
"\n CLI Example:",
" .. code-block:: bash",
" salt '*' git.push /path/to/git/repo remote-name\n '''",
" if not opts:\n opts = ''\n cmd = 'git push {0} {1} {2}'.format(remote_name, branch, opts)\n return _git_run(cmd, cwd=cwd, runas=user, identity=identity)",
"\ndef remotes(cwd, user=None):\n '''\n Get remotes like git remote -v",
" cwd\n The path to the Git repository",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.remotes /path/to/repo\n '''\n cmd = 'git remote'\n ret = _git_run(cmd, cwd=cwd, runas=user)\n res = dict()\n for remote_name in ret.splitlines():\n remote = remote_name.strip()\n res[remote] = remote_get(cwd, remote, user=user)\n return res",
"\ndef remote_get(cwd, remote='origin', user=None):\n '''\n get the fetch and push URL for a specified remote name",
" remote : origin\n the remote name used to define the fetch and push URL",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.remote_get /path/to/repo\n salt '*' git.remote_get /path/to/repo upstream\n '''\n try:\n cmd = 'git remote show -n {0}'.format(remote)\n ret = _git_run(cmd, cwd=cwd, runas=user)\n lines = ret.splitlines()\n remote_fetch_url = lines[1].replace('Fetch URL: ', '').strip()\n remote_push_url = lines[2].replace('Push URL: ', '').strip()\n if remote_fetch_url != remote and remote_push_url != remote:\n res = (remote_fetch_url, remote_push_url)\n return res\n else:\n return None\n except CommandExecutionError:\n return None",
"\ndef remote_set(cwd, name='origin', url=None, user=None, https_user=None,\n https_pass=None):\n '''\n sets a remote with name and URL like git remote add <remote_name> <remote_url>",
" remote_name : origin\n defines the remote name",
" remote_url : None\n defines the remote URL; should not be None!",
" user : None\n Run git as a user other than what the minion runs as",
" https_user : None\n HTTP Basic Auth username for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" https_pass : None\n HTTP Basic Auth password for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.remote_set /path/to/repo remote_url=git@github.com:saltstack/salt.git\n salt '*' git.remote_set /path/to/repo origin git@github.com:saltstack/salt.git\n '''\n if remote_get(cwd, name):\n cmd = 'git remote rm {0}'.format(name)\n _git_run(cmd, cwd=cwd, runas=user)\n url = _add_http_basic_auth(url, https_user, https_pass)\n cmd = 'git remote add {0} {1}'.format(name, url)\n _git_run(cmd, cwd=cwd, runas=user)\n return remote_get(cwd=cwd, remote=name, user=None)",
"\ndef branch(cwd, rev, opts=None, user=None):\n '''\n Interacts with branches.",
" cwd\n The path to the Git repository",
" rev\n The branch/revision to be used in the command.",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.branch mybranch --set-upstream-to=origin/mybranch\n '''\n cmd = 'git branch {0} {1}'.format(rev, opts)\n _git_run(cmd, cwd=cwd, user=user)\n return current_branch(cwd, user=user)",
"\ndef reset(cwd, opts=None, user=None):\n '''\n Reset the repository checkout",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.reset /path/to/repo master\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git reset {0}'.format(opts), cwd=cwd, runas=user)",
"\ndef stash(cwd, opts=None, user=None):\n '''\n Stash changes in the repository checkout",
" cwd\n The path to the Git repository",
" opts : None\n Any additional options to add to the command line",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.stash /path/to/repo master\n '''\n _check_git()",
" if not opts:\n opts = ''\n return _git_run('git stash {0}'.format(opts), cwd=cwd, runas=user)",
"\ndef config_set(cwd=None, setting_name=None, setting_value=None, user=None, is_global=False):\n '''\n Set a key in the git configuration file (.git/config) of the repository or\n globally.",
" cwd : None\n Options path to the Git repository",
" .. versionchanged:: 2014.7.0\n Made ``cwd`` optional",
" setting_name : None\n The name of the configuration key to set. Required.",
" setting_value : None\n The (new) value to set. Required.",
" user : None\n Run git as a user other than what the minion runs as",
" is_global : False\n Set to True to use the '--global' flag with 'git config'",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.config_set /path/to/repo user.email me@example.com\n '''\n if setting_name is None or setting_value is None:\n raise TypeError('Missing required parameter setting_name for git.config_set')\n if cwd is None and not is_global:\n raise SaltInvocationError('Either `is_global` must be set to True or '\n 'you must provide `cwd`')",
" if is_global:\n cmd = 'git config --global {0} \"{1}\"'.format(setting_name, setting_value)\n else:\n cmd = 'git config {0} \"{1}\"'.format(setting_name, setting_value)",
" _check_git()",
" return _git_run(cmd, cwd=cwd, runas=user)",
"\ndef config_get(cwd=None, setting_name=None, user=None):\n '''\n Get a key or keys from the git configuration file (.git/config).",
" cwd : None\n Optional path to a Git repository",
" .. versionchanged:: 2014.7.0\n Made ``cwd`` optional",
" setting_name : None\n The name of the configuration key to get. Required.",
" user : None\n Run git as a user other than what the minion runs as",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.config_get setting_name=user.email\n salt '*' git.config_get /path/to/repo user.name arthur\n '''\n if setting_name is None:\n raise TypeError('Missing required parameter setting_name for git.config_get')\n _check_git()",
" return _git_run('git config {0}'.format(setting_name), cwd=cwd, runas=user)",
"\ndef ls_remote(cwd, repository=\"origin\", branch=\"master\", user=None,\n identity=None, https_user=None, https_pass=None):\n '''\n Returns the upstream hash for any given URL and branch.",
" cwd\n The path to the Git repository",
" repository: origin\n The name of the repository to get the revision from. Can be the name of\n a remote, an URL, etc.",
" branch: master\n The name of the branch to get the revision from.",
" user : none\n run git as a user other than what the minion runs as",
" identity : none\n a path to a private key to use over ssh",
" https_user : None\n HTTP Basic Auth username for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" https_pass : None\n HTTP Basic Auth password for HTTPS (only) clones",
" .. versionadded:: 2015.5.0",
" CLI Example:",
" .. code-block:: bash",
" salt '*' git.ls_remote /pat/to/repo origin master",
" '''\n _check_git()\n repository = _add_http_basic_auth(repository, https_user, https_pass)\n cmd = ' '.join([\"git\", \"ls-remote\", \"-h\", str(repository), str(branch), \"| cut -f 1\"])\n return _git_run(cmd, cwd=cwd, runas=user, identity=identity)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [96, 39], "buggy_code_start_loc": [8, 39], "filenames": ["salt/modules/git.py", "tests/unit/modules/git_test.py"], "fixing_code_end_loc": [107, 58], "fixing_code_start_loc": [9, 40], "message": "salt before 2015.5.5 leaks git usernames and passwords to the log.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:saltstack:salt_2015:*:*:*:*:*:*:*:*", "matchCriteriaId": "A241B444-0215-4D01-ABCB-25C8D2CF9804", "versionEndExcluding": null, "versionEndIncluding": "5.4", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "salt before 2015.5.5 leaks git usernames and passwords to the log."}, {"lang": "es", "value": "salt en versiones anteriores a la 2015.5.5 fuga nombres de usuario y contrase\u00f1as de git al log."}], "evaluatorComment": null, "id": "CVE-2015-6918", "lastModified": "2017-11-05T21:18:20.237", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 4.0, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-10-10T16:29:00.417", "references": [{"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory", "VDB Entry"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1257154"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}, "type": "CWE-200"}
| 91
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Tarjei Husøy <git@thusoy.com>`\n'''",
"# Import Salt Testing Libs\nfrom salttesting import TestCase\nfrom salttesting.helpers import ensure_in_syspath",
"ensure_in_syspath('../../')",
"# Import Salt Libs\nfrom salt.modules import git",
"\nclass GitTestCase(TestCase):\n '''\n TestCase for salt.modules.git module\n '''",
" def test_http_basic_authentication(self):\n '''\n Test that HTTP Basic auth works as intended.\n '''\n # ((user, pass), expected) tuples\n test_inputs = [\n ((None, None), 'https://example.com'),\n (('user', None), 'https://user@example.com'),\n (('user', 'pass'), 'https://user:pass@example.com'),\n ]\n for (user, password), expected in test_inputs:\n kwargs = {\n 'https_user': user,\n 'https_pass': password,\n 'repository': 'https://example.com',\n }\n result = git._add_http_basic_auth(**kwargs)\n self.assertEqual(result, expected)\n",
"",
"\nif __name__ == '__main__':\n from integration import run_tests\n run_tests(GitTestCase, needs_daemon=False)"
] |
[
1,
1,
1,
1,
1,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [96, 39], "buggy_code_start_loc": [8, 39], "filenames": ["salt/modules/git.py", "tests/unit/modules/git_test.py"], "fixing_code_end_loc": [107, 58], "fixing_code_start_loc": [9, 40], "message": "salt before 2015.5.5 leaks git usernames and passwords to the log.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:saltstack:salt_2015:*:*:*:*:*:*:*:*", "matchCriteriaId": "A241B444-0215-4D01-ABCB-25C8D2CF9804", "versionEndExcluding": null, "versionEndIncluding": "5.4", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "salt before 2015.5.5 leaks git usernames and passwords to the log."}, {"lang": "es", "value": "salt en versiones anteriores a la 2015.5.5 fuga nombres de usuario y contrase\u00f1as de git al log."}], "evaluatorComment": null, "id": "CVE-2015-6918", "lastModified": "2017-11-05T21:18:20.237", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 4.0, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-10-10T16:29:00.417", "references": [{"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory", "VDB Entry"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1257154"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}, "type": "CWE-200"}
| 91
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# -*- coding: utf-8 -*-\n'''\n :codeauthor: :email:`Tarjei Husøy <git@thusoy.com>`\n'''",
"# Import Salt Testing Libs\nfrom salttesting import TestCase\nfrom salttesting.helpers import ensure_in_syspath",
"ensure_in_syspath('../../')",
"# Import Salt Libs\nfrom salt.modules import git",
"\nclass GitTestCase(TestCase):\n '''\n TestCase for salt.modules.git module\n '''",
" def test_http_basic_authentication(self):\n '''\n Test that HTTP Basic auth works as intended.\n '''\n # ((user, pass), expected) tuples\n test_inputs = [\n ((None, None), 'https://example.com'),\n (('user', None), 'https://user@example.com'),\n (('user', 'pass'), 'https://user:pass@example.com'),\n ]\n for (user, password), expected in test_inputs:\n kwargs = {\n 'https_user': user,\n 'https_pass': password,\n 'repository': 'https://example.com',\n }\n result = git._add_http_basic_auth(**kwargs)\n self.assertEqual(result, expected)\n",
" def test_https_user_and_pw_is_confidential(self):\n sensitive_outputs = (\n 'https://deadbeaf@example.com',\n 'https://user:pw@example.com',\n )\n sanitized = 'https://<redacted>@example.com'\n for sensitive_output in sensitive_outputs:\n result = git._remove_sensitive_data(sensitive_output)\n self.assertEqual(result, sanitized)",
" def test_git_ssh_user_is_not_treated_as_sensitive(self):\n not_sensitive_outputs = (\n 'ssh://user@example.com',\n )\n for not_sensitive_output in not_sensitive_outputs:\n result = git._remove_sensitive_data(not_sensitive_output)\n self.assertEqual(result, not_sensitive_output)\n",
"\nif __name__ == '__main__':\n from integration import run_tests\n run_tests(GitTestCase, needs_daemon=False)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [96, 39], "buggy_code_start_loc": [8, 39], "filenames": ["salt/modules/git.py", "tests/unit/modules/git_test.py"], "fixing_code_end_loc": [107, 58], "fixing_code_start_loc": [9, 40], "message": "salt before 2015.5.5 leaks git usernames and passwords to the log.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:saltstack:salt_2015:*:*:*:*:*:*:*:*", "matchCriteriaId": "A241B444-0215-4D01-ABCB-25C8D2CF9804", "versionEndExcluding": null, "versionEndIncluding": "5.4", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "salt before 2015.5.5 leaks git usernames and passwords to the log."}, {"lang": "es", "value": "salt en versiones anteriores a la 2015.5.5 fuga nombres de usuario y contrase\u00f1as de git al log."}], "evaluatorComment": null, "id": "CVE-2015-6918", "lastModified": "2017-11-05T21:18:20.237", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "LOW", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 3.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:S/C:P/I:N/A:N", "version": "2.0"}, "exploitabilityScore": 6.8, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 4.0, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2017-10-10T16:29:00.417", "references": [{"source": "cve@mitre.org", "tags": ["Issue Tracking", "Patch", "Third Party Advisory", "VDB Entry"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=1257154"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-200"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/saltstack/salt/commit/28aa9b105804ff433d8f663b2f9b804f2b75495a"}, "type": "CWE-200"}
| 91
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/**\n * jQuery.browser.mobile (http://detectmobilebrowser.com/)\n *\n * jQuery.browser.mobile will be true if the browser is a mobile device\n *\n **/\n(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);",
"/*! jQuery JSON plugin 2.4.0 | code.google.com/p/jquery-json */\n(function(jQuery){'use strict';var escape=/[\"\\\\\\x00-\\x1f\\x7f-\\x9f]/g,meta={'\\b':'\\\\b','\\t':'\\\\t','\\n':'\\\\n','\\f':'\\\\f','\\r':'\\\\r','\"':'\\\\\"','\\\\':'\\\\\\\\'},hasOwn=Object.prototype.hasOwnProperty;jQuery.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';}\nvar pairs,k,name,val,type=jQuery.type(o);if(type==='undefined'){return undefined;}\nif(type==='number'||type==='boolean'){return String(o);}\nif(type==='string'){return jQuery.quoteString(o);}\nif(typeof o.toJSON==='function'){return jQuery.toJSON(o.toJSON());}\nif(type==='date'){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month='0'+month;}\nif(day<10){day='0'+day;}\nif(hours<10){hours='0'+hours;}\nif(minutes<10){minutes='0'+minutes;}\nif(seconds<10){seconds='0'+seconds;}\nif(milli<100){milli='0'+milli;}\nif(milli<10){milli='0'+milli;}\nreturn'\"'+year+'-'+month+'-'+day+'T'+\nhours+':'+minutes+':'+seconds+'.'+milli+'Z\"';}\npairs=[];if(jQuery.isArray(o)){for(k=0;k<o.length;k++){pairs.push(jQuery.toJSON(o[k])||'null');}\nreturn'['+pairs.join(',')+']';}\nif(typeof o==='object'){for(k in o){if(hasOwn.call(o,k)){type=typeof k;if(type==='number'){name='\"'+k+'\"';}else if(type==='string'){name=jQuery.quoteString(k);}else{continue;}\ntype=typeof o[k];if(type!=='function'&&type!=='undefined'){val=jQuery.toJSON(o[k]);pairs.push(name+':'+val);}}}\nreturn'{'+pairs.join(',')+'}';}};jQuery.evalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){return eval('('+str+')');};jQuery.secureEvalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\\\[\"\\\\\\/bfnrtu]/g,'@').replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,']').replace(/(?:^|:|,)(?:\\s*\\[)+/g,'');if(/^[\\],:{}\\s]*jQuery/.test(filtered)){return eval('('+str+')');}\nthrow new SyntaxError('Error parsing JSON, source is not valid.');};jQuery.quoteString=function(str){if(str.match(escape)){return'\"'+str.replace(escape,function(a){var c=meta[a];if(typeof c==='string'){return c;}\nc=a.charCodeAt();return'\\\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'\"';}\nreturn'\"'+str+'\"';};}(jQuery));",
"\n$.fn.scrollTo = function( target, options, callback ){\n if(typeof options == 'function' && arguments.length == 2){ callback = options; options = target; }\n var settings = $.extend({\n scrollTarget : target,\n offsetTop : 50,\n duration : 10,\n easing : 'swing'\n }, options);\n return this.each(function(){\n var scrollPane = $(this);\n var scrollTarget = (typeof settings.scrollTarget == \"number\") ? settings.scrollTarget : $(settings.scrollTarget);\n var scrollY = (typeof scrollTarget == \"number\") ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop);\n scrollPane.animate({scrollTop : scrollY }, parseInt(settings.duration), settings.easing, function(){\n if (typeof callback == 'function') { callback.call(this); }\n });\n });\n}",
"/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan <stevenlevithan.com>\n * MIT license\n *\n * Includes enhancements by Scott Trenda <scott.trenda.net>\n * and Kris Kowal <cixar.com/~kris.kowal/>\n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */",
"",
"\nvar dateFormat = function () {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[LloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function (val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) val = \"0\" + val;\n return val;\n };",
" // Regexes and supporting functions are cached through closure\n return function (date, mask, utc) {\n var dF = dateFormat;",
" // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if (arguments.length == 1 && Object.prototype.toString.call(date) == \"[object String]\" && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }",
" // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date(date) : new Date;\n if (isNaN(date)) throw SyntaxError(\"invalid date\");",
" mask = String(dF.masks[mask] || mask || dF.masks[\"default\"]);",
" // Allow setting the utc argument via the mask\n if (mask.slice(0, 4) == \"UTC:\") {\n mask = mask.slice(4);\n utc = true;\n }",
" var _ = utc ? \"getUTC\" : \"get\",\n d = date[_ + \"Date\"](),\n D = date[_ + \"Day\"](),\n m = date[_ + \"Month\"](),\n y = date[_ + \"FullYear\"](),\n H = date[_ + \"Hours\"](),\n M = date[_ + \"Minutes\"](),\n s = date[_ + \"Seconds\"](),\n L = date[_ + \"Milliseconds\"](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad(d),\n ddd: dF.i18n.dayNames[D],\n dddd: dF.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dF.i18n.monthNames[m],\n mmmm: dF.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(L > 99 ? Math.round(L / 10) : L),\n t: H < 12 ? \"a\" : \"p\",\n tt: H < 12 ? \"am\" : \"pm\",\n T: H < 12 ? \"A\" : \"P\",\n TT: H < 12 ? \"AM\" : \"PM\",\n Z: utc ? \"UTC\" : (String(date).match(timezone) || [\"\"]).pop().replace(timezoneClip, \"\"),\n o: (o > 0 ? \"-\" : \"+\") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: [\"th\", \"st\", \"nd\", \"rd\"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]\n };",
" return mask.replace(token, function ($0) {\n return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);\n });\n };\n}();",
"// Some common format strings\ndateFormat.masks = {\n \"default\": \"ddd mmm dd yyyy HH:MM:ss\",\n shortDate: \"m/d/yy\",\n mediumDate: \"mmm d, yyyy\",\n longDate: \"mmmm d, yyyy\",\n fullDate: \"dddd, mmmm d, yyyy\",\n shortTime: \"h:MM TT\",\n mediumTime: \"h:MM:ss TT\",\n longTime: \"h:MM:ss TT Z\",\n isoDate: \"yyyy-mm-dd\",\n isoTime: \"HH:MM:ss\",\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n};",
"// Internationalization strings\ndateFormat.i18n = {\n dayNames: [\n \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\",\n \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"\n ],\n monthNames: [\n \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\",\n \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"\n ]\n};",
"// For convenience...\nDate.prototype.format = function (mask, utc) {\n return dateFormat(this, mask, utc);\n};",
"\n/*\n * http://code.google.com/p/flexible-js-formatting/\n * \n * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */",
"Date.parseFunctions = {count:0};\nDate.parseRegexes = [];\nDate.formatFunctions = {count:0};",
"Date.prototype.dateFormat = function(format, ignore_offset) {\n if (Date.formatFunctions[format] == null) {\n Date.createNewFormat(format);\n }\n var func = Date.formatFunctions[format];\n if (ignore_offset || ! this.offset) {\n return this[func]();\n } else {\n return (new Date(this.valueOf() - this.offset))[func]();\n }\n};",
"Date.createNewFormat = function(format) {\n var funcName = \"format\" + Date.formatFunctions.count++;\n Date.formatFunctions[format] = funcName;\n var code = \"Date.prototype.\" + funcName + \" = function(){return \";\n var special = false;\n var ch = '';\n for (var i = 0; i < format.length; ++i) {\n ch = format.charAt(i);\n // escape character start\n if (!special && ch == \"\\\\\") {\n special = true;\n }\n // escaped string\n else if (!special && ch == '\"') {\n var end = format.indexOf('\"', i+1);\n if (end==-1)\n {\n end = format.length;\n }\n code += \"'\" + String.escape(format.substring(i+1, end)) + \"' + \";\n i = end;\n }\n // escaped character\n else if (special) {\n special = false;\n code += \"'\" + String.escape(ch) + \"' + \";\n }\n else {\n code += Date.getFormatCode(ch);\n }\n }\n eval(code.substring(0, code.length - 3) + \";}\");\n};",
"Date.getFormatCode = function(character) {\n switch (character) {\n case \"d\":\n return \"String.leftPad(this.getDate(), 2, '0') + \";\n case \"D\":\n return \"Date.dayNames[this.getDay()].substring(0, 3) + \";\n case \"j\":\n return \"this.getDate() + \";\n case \"l\":\n return \"Date.dayNames[this.getDay()] + \";\n case \"S\":\n return \"this.getSuffix() + \";\n case \"w\":\n return \"this.getDay() + \";\n case \"z\":\n return \"this.getDayOfYear() + \";\n case \"W\":\n return \"this.getWeekOfYear() + \";\n case \"F\":\n return \"Date.monthNames[this.getMonth()] + \";\n case \"m\":\n return \"String.leftPad(this.getMonth() + 1, 2, '0') + \";\n case \"M\":\n return \"Date.monthNames[this.getMonth()].substring(0, 3) + \";\n case \"n\":\n return \"(this.getMonth() + 1) + \";\n case \"t\":\n return \"this.getDaysInMonth() + \";\n case \"L\":\n return \"(this.isLeapYear() ? 1 : 0) + \";\n case \"Y\":\n return \"this.getFullYear() + \";\n case \"y\":\n return \"('' + this.getFullYear()).substring(2, 4) + \";\n case \"a\":\n return \"(this.getHours() < 12 ? 'am' : 'pm') + \";\n case \"A\":\n return \"(this.getHours() < 12 ? 'AM' : 'PM') + \";\n case \"g\":\n return \"((this.getHours() %12) ? this.getHours() % 12 : 12) + \";\n case \"G\":\n return \"this.getHours() + \";\n case \"h\":\n return \"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + \";\n case \"H\":\n return \"String.leftPad(this.getHours(), 2, '0') + \";\n case \"i\":\n return \"String.leftPad(this.getMinutes(), 2, '0') + \";\n case \"s\":\n return \"String.leftPad(this.getSeconds(), 2, '0') + \";\n case \"X\":\n return \"String.leftPad(this.getMilliseconds(), 3, '0') + \";\n case \"O\":\n return \"this.getGMTOffset() + \";\n case \"T\":\n return \"this.getTimezone() + \";\n case \"Z\":\n return \"(this.getTimezoneOffset() * -60) + \";\n case \"q\": // quarter num, Q for name?\n return \"this.getQuarter() + \";\n default:\n return \"'\" + String.escape(character) + \"' + \";\n }\n};",
"Date.parseDate = function(input, format) {\n if (Date.parseFunctions[format] == null) {\n Date.createParser(format);\n }\n var func = Date.parseFunctions[format];\n return Date[func](input);\n};",
"Date.createParser = function(format) {\n var funcName = \"parse\" + Date.parseFunctions.count++;\n var regexNum = Date.parseRegexes.length;\n var currentGroup = 1;\n Date.parseFunctions[format] = funcName;",
" var code = \"Date.\" + funcName + \" = function(input){\\n\"\n + \"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, ms = -1, z = 0;\\n\"\n + \"var d = new Date();\\n\"\n + \"y = d.getFullYear();\\n\"\n + \"m = d.getMonth();\\n\"\n + \"d = d.getDate();\\n\"\n + \"var results = input.match(Date.parseRegexes[\" + regexNum + \"]);\\n\"\n + \"if (results && results.length > 0) {\" ;\n var regex = \"\";",
" var special = false;\n var ch = '';\n for (var i = 0; i < format.length; ++i) {\n ch = format.charAt(i);\n if (!special && ch == \"\\\\\") {\n special = true;\n }\n else if (special) {\n special = false;\n regex += String.escape(ch);\n }\n else {\n obj = Date.formatCodeToRegex(ch, currentGroup);\n currentGroup += obj.g;\n regex += obj.s;\n if (obj.g && obj.c) {\n code += obj.c;\n }\n }\n }",
" code += \"if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0)\\n\"\n + \"{return new Date(y, m, d, h, i, s, ms).applyOffset(z);}\\n\"\n + \"if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\\n\"\n + \"{return new Date(y, m, d, h, i, s).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\\n\"\n + \"{return new Date(y, m, d, h, i).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\\n\"\n + \"{return new Date(y, m, d, h).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0 && d > 0)\\n\"\n + \"{return new Date(y, m, d).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0)\\n\"\n + \"{return new Date(y, m).applyOffset(z);}\\n\"\n + \"else if (y > 0)\\n\"\n + \"{return new Date(y).applyOffset(z);}\\n\"\n + \"}return null;}\";",
" Date.parseRegexes[regexNum] = new RegExp(\"^\" + regex + \"$\");\n eval(code);\n};",
"Date.formatCodeToRegex = function(character, currentGroup) {\n switch (character) {\n case \"D\":\n return {g:0,\n c:null,\n s:\"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\"};\n case \"j\":\n case \"d\":\n return {g:1,\n c:\"d = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"l\":\n return {g:0,\n c:null,\n s:\"(?:\" + Date.dayNames.join(\"|\") + \")\"};\n case \"S\":\n return {g:0,\n c:null,\n s:\"(?:st|nd|rd|th)\"};\n case \"w\":\n return {g:0,\n c:null,\n s:\"\\\\d\"};\n case \"z\":\n return {g:0,\n c:null,\n s:\"(?:\\\\d{1,3})\"};\n case \"W\":\n return {g:0,\n c:null,\n s:\"(?:\\\\d{2})\"};\n case \"F\":\n return {g:1,\n c:\"m = parseInt(Date.monthNumbers[results[\" + currentGroup + \"].substring(0, 3)], 10);\\n\",\n s:\"(\" + Date.monthNames.join(\"|\") + \")\"};\n case \"M\":\n return {g:1,\n c:\"m = parseInt(Date.monthNumbers[results[\" + currentGroup + \"]], 10);\\n\",\n s:\"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\"};\n case \"n\":\n case \"m\":\n return {g:1,\n c:\"m = parseInt(results[\" + currentGroup + \"], 10) - 1;\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"t\":\n return {g:0,\n c:null,\n s:\"\\\\d{1,2}\"};\n case \"L\":\n return {g:0,\n c:null,\n s:\"(?:1|0)\"};\n case \"Y\":\n return {g:1,\n c:\"y = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{4})\"};\n case \"y\":\n return {g:1,\n c:\"var ty = parseInt(results[\" + currentGroup + \"], 10);\\n\"\n + \"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"a\":\n return {g:1,\n c:\"if (results[\" + currentGroup + \"] == 'am') {\\n\"\n + \"if (h == 12) { h = 0; }\\n\"\n + \"} else { if (h < 12) { h += 12; }}\",\n s:\"(am|pm)\"};\n case \"A\":\n return {g:1,\n c:\"if (results[\" + currentGroup + \"] == 'AM') {\\n\"\n + \"if (h == 12) { h = 0; }\\n\"\n + \"} else { if (h < 12) { h += 12; }}\",\n s:\"(AM|PM)\"};\n case \"g\":\n case \"G\":\n case \"h\":\n case \"H\":\n return {g:1,\n c:\"h = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"i\":\n return {g:1,\n c:\"i = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{2})\"};\n case \"s\":\n return {g:1,\n c:\"s = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{2})\"};\n case \"X\":\n return {g:1,\n c:\"ms = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{3})\"};\n case \"O\":\n case \"P\":\n return {g:1,\n c:\"z = Date.parseOffset(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(Z|[+-]\\\\d{2}:?\\\\d{2})\"}; // \"Z\", \"+05:00\", \"+0500\" all acceptable.\n case \"T\":\n return {g:0,\n c:null,\n s:\"[A-Z]{3}\"};\n case \"Z\":\n return {g:1,\n c:\"s = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"([+-]\\\\d{1,5})\"};\n default:\n return {g:0,\n c:null,\n s:String.escape(character)};\n }\n};",
"Date.parseOffset = function(str) {\n if (str == \"Z\") { return 0 ; } // UTC, no offset.\n var seconds ;\n seconds = parseInt(str[0] + str[1] + str[2]) * 3600 ; // e.g., \"+05\" or \"-08\"\n if (str[3] == \":\") { // \"+HH:MM\" is preferred iso8601 format (\"O\")\n seconds += parseInt(str[4] + str[5]) * 60;\n } else { // \"+HHMM\" is frequently used, though. (\"P\")\n seconds += parseInt(str[3] + str[4]) * 60;\n }\n return seconds ;\n};",
"Date.today = function() {\n var now = new Date();\n now.setHours(0);\n now.setMinutes(0);\n now.setSeconds(0);\n \n return now;\n}",
"// convert the parsed date into UTC, but store the offset so we can optionally use it in dateFormat()\nDate.prototype.applyOffset = function(offset_seconds) {\n this.offset = offset_seconds * 1000 ;\n this.setTime(this.valueOf() + this.offset);\n return this ;\n};",
"Date.prototype.getTimezone = function() {\n return this.toString().replace(\n /^.*? ([A-Z]{3}) [0-9]{4}.*$/, \"$1\").replace(\n /^.*?\\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\\)$/, \"$1$2$3\").replace(\n /^.*?[0-9]{4} \\(([A-Z]{3})\\)/, \"$1\");\n};",
"Date.prototype.getGMTOffset = function() {\n return (this.getTimezoneOffset() > 0 ? \"-\" : \"+\")\n + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, \"0\")\n + String.leftPad(this.getTimezoneOffset() % 60, 2, \"0\");\n};",
"Date.prototype.getDayOfYear = function() {\n var num = 0;\n Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;\n for (var i = 0; i < this.getMonth(); ++i) {\n num += Date.daysInMonth[i];\n }\n return num + this.getDate() - 1;\n};",
"Date.prototype.getWeekOfYear = function() {\n // Skip to Thursday of this week\n var now = this.getDayOfYear() + (4 - this.getDay());\n // Find the first Thursday of the year\n var jan1 = new Date(this.getFullYear(), 0, 1);\n var then = (7 - jan1.getDay() + 4);\n document.write(then);\n return String.leftPad(((now - then) / 7) + 1, 2, \"0\");\n};",
"Date.prototype.isLeapYear = function() {\n var year = this.getFullYear();\n return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));\n};",
"Date.prototype.getFirstDayOfMonth = function() {\n var day = (this.getDay() - (this.getDate() - 1)) % 7;\n return (day < 0) ? (day + 7) : day;\n};",
"Date.prototype.getLastDayOfMonth = function() {\n var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;\n return (day < 0) ? (day + 7) : day;\n};",
"Date.prototype.getDaysInMonth = function() {\n Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;\n return Date.daysInMonth[this.getMonth()];\n};\nDate.prototype.getQuarter = function() {\n return Date.quarterFromMonthNum[this.getMonth()];\n};",
"Date.prototype.getSuffix = function() {\n switch (this.getDate()) {\n case 1:\n case 21:\n case 31:\n return \"st\";\n case 2:\n case 22:\n return \"nd\";\n case 3:\n case 23:\n return \"rd\";\n default:\n return \"th\";\n }\n};",
"String.escape = function(string) {\n return string.replace(/('|\\\\)/g, \"\\\\$1\");\n};",
"String.leftPad = function (val, size, ch) {\n var result = new String(val);\n if (ch == null) {\n ch = \" \";\n }\n while (result.length < size) {\n result = ch + result;\n }\n return result;\n};",
"Date.quarterFromMonthNum = [1,1,1,2,2,2,3,3,3,4,4,4];\nDate.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];\nDate.monthNames =\n [\"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"];\nDate.dayNames =\n [\"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\"];\nDate.y2kYear = 50;\nDate.monthNumbers = {\n Jan:0,\n Feb:1,\n Mar:2,\n Apr:3,\n May:4,\n Jun:5,\n Jul:6,\n Aug:7,\n Sep:8,\n Oct:9,\n Nov:10,\n Dec:11};\nDate.patterns = {\n ISO8601LongPattern: \"Y\\\\-m\\\\-d\\\\TH\\\\:i\\\\:sO\",\n ISO8601ShortPattern: \"Y\\\\-m\\\\-d\",\n ShortDatePattern: \"n/j/Y\",\n LongDatePattern: \"l, F d, Y\",\n FullDateTimePattern: \"l, F d, Y g:i:s A\",\n MonthDayPattern: \"F d\",\n ShortTimePattern: \"g:i A\",\n LongTimePattern: \"g:i:s A\",\n SortableDateTimePattern: \"Y-m-d\\\\TH:i:s\",\n UniversalSortableDateTimePattern: \"Y-m-d H:i:sO\",\n YearMonthPattern: \"F, Y\"};",
"\n/**\n *\n * @author: Malishev Dmitry <dima.malishev@gmail.com>\n */\nvar _DEBUG = true;\nvar _DEBUG_LEVEL = 'ALL';\n// possible levels: ALL, IMPORTANT\nvar Error = {FATAL: 1, WARNING: 0, NORMAL: -1};",
"\n/**\n * Init debug, grabs console object if accessible, or makes dummy debugger\n */\nvar fb = _DEBUG && 'undefined' != typeof(console) ? console : {\n log : function(){},\n debug : function(){},\n info : function(){},\n warn : function(){},\n error : function(){},\n assert : function(){},\n dir : function(){},\n dirxml : function(){},\n trace : function(){},\n group : function(){},\n groupEnd : function(){},\n time : function(){},\n timeEnd : function(){},\n profile : function(){},\n profileEnd : function(){},\n count : function(){},\n msg : function(){}\n};",
"var checked = false;\nvar frmname = '';\nvar lastScrollTop = 0;",
"\n//\nvar App = {\n // Main namespases for page specific functions\n // Core namespaces\n Ajax: { \n Busy: {} \n },\n Core: {},\n // CONSTANT VALUES\n Constants: {\n UNLIM_VALUE: 'unlimited', // overritten in i18n.js.php\n UNLIM_TRANSLATED_VALUE: 'unlimited' // overritten in i18n.js.php\n }, \n // Actions. More widly used funcs\n Actions: {\n DB: {},\n WEB: {},\n PACKAGE: {},\n MAIL_ACC:{},\n MAIL: {}\n },\n // Utilities\n Helpers: {},\n HTML: {\n Build: {}\n },\n Filters: {},\n Env: {\n lang: GLOBAL.lang,\n },\n i18n: {},\n Listeners: {\n DB: {},\n WEB: {},\n PACKAGE: {},\n MAIL_ACC:{}\n },\n View:{\n HTML: {\n Build: {}\n },\n // pages related views\n },\n Cache: {\n clear: function() {} // TODO: stub method, will be used later\n },\n Ref: {},\n Tmp: {},\n Thread: {\n run: function(delay, ref) {\n setTimeout(function() {\n ref();\n }, delay*10);\n }\n },\n Settings: { \n GLOBAL: {}, \n General: {}\n },\n Templates: {\n Templator: null,\n Tpl: {},\n _indexes: {}\n }\n};",
"// Internals\nArray.prototype.set = function(key, value){\n var index = this[0][key];\n this[1][index] = value;\n}\nArray.prototype.get = function(key){\n var index = this[0][key];\n return this[1][index];\n}\nArray.prototype.finalize = function(){\n this.shift();\n this[0] = this[0].join('');\n return this[0];\n}\nArray.prototype.done = function(){\n return this.join('');\n}",
"String.prototype.wrapperize = function(key, ns){\n var tpl = App.Templates.get(key, ns);\n tpl.set(':content', this);",
" return tpl.finalize();\n}",
"",
"App.Ajax.request = function(method, data, callback, onError){\n // this will prevent multiple ajaxes on user clicks\n /*if (App.Helpers.isAjaxBusy(method, data)) {\n fb.warn('ajax request ['+method+'] is busy');\n return;\n }*/\n //App.Helpers.setAjaxBusy(method, data);\n data = data || {};",
" var prgs = $('.progress-container');",
" switch (method) {\n case 'cd':\n prgs.find('title').text('Opening dir');\n prgs.show();\n break;\n case 'delete_files':\n prgs.find('title').text('Deleting');\n prgs.show();\n break;\n case 'unpack_item':\n prgs.find('title').text('Unpacking');\n prgs.show();\n break;\n case 'create_file':\n prgs.find('title').text('Creating file');\n prgs.show();\n break;\n case 'create_dir':\n prgs.find('title').text('Creating directory');\n prgs.show();\n break;\n case 'rename_file':\n prgs.find('title').text('Renaming file');\n prgs.show();\n break;\n case 'copy_file':\n case 'copy_directory':\n prgs.find('title').text('Copying files');\n prgs.show();\n break;\n default:\n break;\n }",
" jQuery.ajax({\n url: GLOBAL.ajax_url,\n global: false,\n type: data.request_method || \"GET\",\n data: jQuery.extend(data, {'action': method}),\n dataType: \"text boost\",\n converters: {\n \"text boost\": function(value) {\n value = value.trim();\n return $.parseJSON(value);\n }},\n async: true,\n cache: false,\n error: function(jqXHR, textStatus, errorThrown)\n {\n prgs.hide();\n onError && onError();\n if ('undefined' != typeof onError) {\n fb.error(textStatus);\n }\n },\n complete: function()\n {\n //App.Helpers.setAjaxFree(method, data);\n prgs.hide();\n },\n success: function(reply)\n {\n prgs.hide();\n //App.Helpers.setAjaxFree(method, data);\n try {\n callback && callback(reply);\n }\n catch(e) {\n fb.error('GENERAL ERROR with ajax method: ' + data.request_method + ' ' + e);\n //App.Helpers.generalError();\n }\n }\n });\n}",
"jQuery.extend({\n keys: function(obj){\n if (!obj) {\n return [];\n }\n var a = [];\n jQuery.each(obj, function(k){ a.push(k) });\n return a;\n }\n})",
"\nApp.Core.create_hidden_form = function(action){\n var form = jQuery('<form>', {\n id : 'hidden-form',\n method : 'post',\n action : action\n });\n jQuery('body').append(form);",
" return form;\n};",
"App.Core.extend_from_json = function(elm, data, prefix){\n elm = jQuery(elm);\n var data = App.Core.flatten_json(data, prefix);\n var keys = jQuery.keys(data);\n for(var i=0, cnt=keys.length; i<cnt; i++)\n {\n elm.append(jQuery('<input>', {\n name : keys[i],\n value: data[keys[i]],\n type : 'hidden'\n }));\n }",
" return elm;\n}",
"App.Core.flatten_json = function(data, prefix){\n var keys = jQuery.keys(data);\n var result = {};",
" prefix || (prefix = '');",
" if(keys.length)\n {\n for(var i=0, cnt=keys.length; i<cnt; i++)\n {\n var value = data[keys[i]];\n switch(typeof(value))\n {\n case 'function': break;\n case 'object' : result = jQuery.extend(result, App.Core.flatten_json(value, prefix + '[' + keys[i] + ']')); break;\n default : result[prefix + '[' + keys[i] + ']'] = value;\n }\n }\n return result;\n }\n else\n {\n return false;\n }\n}",
"//\n// Cookies adapter\n// Allow to work old pages realisations of cookie requests\n//\nfunction createCookie(name, value, expire_days) {\n jQuery.cookie(name, value, { expires: expire_days});\n}",
"function readCookie(name) {\n jQuery.cookie(name);\n}",
"function eraseCookie(name) {\n jQuery.removeCookie(name);\n}",
"\n/**\n * Timer for profiling\n */\nvar timer = {};\ntimer.start = function()\n{\n timer.start_time = new Date();\n}",
"timer.stop = function( msg )\n{\n timer.stop_time = new Date();\n timer.print( msg );\n}",
"timer.print = function( msg )\n{\n var passed = timer.stop_time - timer.start_time;\n fb.info( msg || '' + passed / 1000 );\n}",
"\nString.prototype.trim = function()\n{\n var str = this;\n str = str.replace(/^\\s+/, '');\n for (var i = str.length - 1; i >= 0; i--) {\n if (/\\S/.test(str.charAt(i))) {\n str = str.substring(0, i + 1);\n break;\n }\n }\n return str;\n}",
"hover_menu = function() {\n var sep_1 = $('div.l-content > div.l-separator:nth-of-type(2)');\n var sep_2 = $('div.l-content > div.l-separator:nth-of-type(4)');\n var nav_main = $('.l-stat');\n var nav_a = $('.l-stat .l-stat__col a');\n var nav_context = $('.l-sort');",
" var st = $(window).scrollTop();",
" if (st <= 112) {\n sep_1.css({'margin-top': 180 - st + 'px'});\n sep_2.css({'margin-top': 225 - st + 'px'});\n nav_a.css({'height': 111 - st + 'px'});\n nav_a.css({'min-height': 111 - st + 'px'});\n nav_context.css({'margin-top': 181 - st + 'px'});\n sep_2.css({'box-shadow':'none'});\n sep_2.css({'height': '1px'});\n }",
" if(st > 112){\n sep_1.css({'margin-top': '100px'});\n sep_2.css({'margin-top': '130px'});\n sep_2.css({'height': '15px'});\n nav_a.css({'height': '0'});\n nav_a.css({'min-height': '0'});\n nav_context.css({'margin-top': '101px'});\n nav_a.find('ul').css({'visibility': 'hidden'});\n nav_main.css({'padding-top': '27px'});\n sep_2.css({'box-shadow':'0 5px 6px 0 rgba(200, 200, 200, 0.35)'});\n }",
" if(st == 0){\n nav_a.css({'min-height': '70px'});\n nav_a.css({'height': '70px'});\n }",
" if(st < 109 ){\n nav_a.find('ul').css({'visibility': 'visible'});\n nav_main.css({'padding-top': 36 + 'px'});\n }",
" if (st <= 112 && st > 110 ) {\n nav_main.css({'padding-top': 36 - st + 109 + 'px'});\n }",
" lastScrollTop = st;\n}",
"\nfunction checkedAll(frmname) {\n if($('input#toggle-all').prop('checked')){\n $('.l-unit:not(.header)').addClass(\"selected\");\n $('.ch-toggle').prop(\"checked\", true);\n $('.toggle-all').addClass('clicked-on');\n } else {\n $('.l-unit:not(.header)').removeClass(\"selected\");\n $('.ch-toggle').prop(\"checked\", false);\n $('.toggle-all').removeClass('clicked-on');\n }\n}",
"function doSearch(url) {\n var url = url || '/search/';\n var loc = url + '?q=' + $('.search-input').val() + '&token=' + $('input[name=\"token\"]').val();\n location.href = loc;\n return false;\n}",
"\nfunction elementHideShow(elementToHideOrShow,trigger){\n var el = document.getElementById(elementToHideOrShow);\n el.style.display = el.style.display === 'none' ? 'block' : 'none';\n \n if (typeof trigger !== 'undefined') {\n trigger.querySelector('.section-hide-button').classList.toggle('fa-minus-square');\n trigger.querySelector('.section-hide-button').classList.toggle('fa-plus-square');\n }\n}"
] |
[
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/**\n * jQuery.browser.mobile (http://detectmobilebrowser.com/)\n *\n * jQuery.browser.mobile will be true if the browser is a mobile device\n *\n **/\n(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);",
"/*! jQuery JSON plugin 2.4.0 | code.google.com/p/jquery-json */\n(function(jQuery){'use strict';var escape=/[\"\\\\\\x00-\\x1f\\x7f-\\x9f]/g,meta={'\\b':'\\\\b','\\t':'\\\\t','\\n':'\\\\n','\\f':'\\\\f','\\r':'\\\\r','\"':'\\\\\"','\\\\':'\\\\\\\\'},hasOwn=Object.prototype.hasOwnProperty;jQuery.toJSON=typeof JSON==='object'&&JSON.stringify?JSON.stringify:function(o){if(o===null){return'null';}\nvar pairs,k,name,val,type=jQuery.type(o);if(type==='undefined'){return undefined;}\nif(type==='number'||type==='boolean'){return String(o);}\nif(type==='string'){return jQuery.quoteString(o);}\nif(typeof o.toJSON==='function'){return jQuery.toJSON(o.toJSON());}\nif(type==='date'){var month=o.getUTCMonth()+1,day=o.getUTCDate(),year=o.getUTCFullYear(),hours=o.getUTCHours(),minutes=o.getUTCMinutes(),seconds=o.getUTCSeconds(),milli=o.getUTCMilliseconds();if(month<10){month='0'+month;}\nif(day<10){day='0'+day;}\nif(hours<10){hours='0'+hours;}\nif(minutes<10){minutes='0'+minutes;}\nif(seconds<10){seconds='0'+seconds;}\nif(milli<100){milli='0'+milli;}\nif(milli<10){milli='0'+milli;}\nreturn'\"'+year+'-'+month+'-'+day+'T'+\nhours+':'+minutes+':'+seconds+'.'+milli+'Z\"';}\npairs=[];if(jQuery.isArray(o)){for(k=0;k<o.length;k++){pairs.push(jQuery.toJSON(o[k])||'null');}\nreturn'['+pairs.join(',')+']';}\nif(typeof o==='object'){for(k in o){if(hasOwn.call(o,k)){type=typeof k;if(type==='number'){name='\"'+k+'\"';}else if(type==='string'){name=jQuery.quoteString(k);}else{continue;}\ntype=typeof o[k];if(type!=='function'&&type!=='undefined'){val=jQuery.toJSON(o[k]);pairs.push(name+':'+val);}}}\nreturn'{'+pairs.join(',')+'}';}};jQuery.evalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){return eval('('+str+')');};jQuery.secureEvalJSON=typeof JSON==='object'&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\\\[\"\\\\\\/bfnrtu]/g,'@').replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,']').replace(/(?:^|:|,)(?:\\s*\\[)+/g,'');if(/^[\\],:{}\\s]*jQuery/.test(filtered)){return eval('('+str+')');}\nthrow new SyntaxError('Error parsing JSON, source is not valid.');};jQuery.quoteString=function(str){if(str.match(escape)){return'\"'+str.replace(escape,function(a){var c=meta[a];if(typeof c==='string'){return c;}\nc=a.charCodeAt();return'\\\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'\"';}\nreturn'\"'+str+'\"';};}(jQuery));",
"\n$.fn.scrollTo = function( target, options, callback ){\n if(typeof options == 'function' && arguments.length == 2){ callback = options; options = target; }\n var settings = $.extend({\n scrollTarget : target,\n offsetTop : 50,\n duration : 10,\n easing : 'swing'\n }, options);\n return this.each(function(){\n var scrollPane = $(this);\n var scrollTarget = (typeof settings.scrollTarget == \"number\") ? settings.scrollTarget : $(settings.scrollTarget);\n var scrollY = (typeof scrollTarget == \"number\") ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop);\n scrollPane.animate({scrollTop : scrollY }, parseInt(settings.duration), settings.easing, function(){\n if (typeof callback == 'function') { callback.call(this); }\n });\n });\n}",
"/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan <stevenlevithan.com>\n * MIT license\n *\n * Includes enhancements by Scott Trenda <scott.trenda.net>\n * and Kris Kowal <cixar.com/~kris.kowal/>\n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */",
"",
"\nvar dateFormat = function () {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[LloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function (val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) val = \"0\" + val;\n return val;\n };",
" // Regexes and supporting functions are cached through closure\n return function (date, mask, utc) {\n var dF = dateFormat;",
" // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if (arguments.length == 1 && Object.prototype.toString.call(date) == \"[object String]\" && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }",
" // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date(date) : new Date;\n if (isNaN(date)) throw SyntaxError(\"invalid date\");",
" mask = String(dF.masks[mask] || mask || dF.masks[\"default\"]);",
" // Allow setting the utc argument via the mask\n if (mask.slice(0, 4) == \"UTC:\") {\n mask = mask.slice(4);\n utc = true;\n }",
" var _ = utc ? \"getUTC\" : \"get\",\n d = date[_ + \"Date\"](),\n D = date[_ + \"Day\"](),\n m = date[_ + \"Month\"](),\n y = date[_ + \"FullYear\"](),\n H = date[_ + \"Hours\"](),\n M = date[_ + \"Minutes\"](),\n s = date[_ + \"Seconds\"](),\n L = date[_ + \"Milliseconds\"](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad(d),\n ddd: dF.i18n.dayNames[D],\n dddd: dF.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dF.i18n.monthNames[m],\n mmmm: dF.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(L > 99 ? Math.round(L / 10) : L),\n t: H < 12 ? \"a\" : \"p\",\n tt: H < 12 ? \"am\" : \"pm\",\n T: H < 12 ? \"A\" : \"P\",\n TT: H < 12 ? \"AM\" : \"PM\",\n Z: utc ? \"UTC\" : (String(date).match(timezone) || [\"\"]).pop().replace(timezoneClip, \"\"),\n o: (o > 0 ? \"-\" : \"+\") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: [\"th\", \"st\", \"nd\", \"rd\"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10]\n };",
" return mask.replace(token, function ($0) {\n return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);\n });\n };\n}();",
"// Some common format strings\ndateFormat.masks = {\n \"default\": \"ddd mmm dd yyyy HH:MM:ss\",\n shortDate: \"m/d/yy\",\n mediumDate: \"mmm d, yyyy\",\n longDate: \"mmmm d, yyyy\",\n fullDate: \"dddd, mmmm d, yyyy\",\n shortTime: \"h:MM TT\",\n mediumTime: \"h:MM:ss TT\",\n longTime: \"h:MM:ss TT Z\",\n isoDate: \"yyyy-mm-dd\",\n isoTime: \"HH:MM:ss\",\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n};",
"// Internationalization strings\ndateFormat.i18n = {\n dayNames: [\n \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\",\n \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"\n ],\n monthNames: [\n \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\",\n \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"\n ]\n};",
"// For convenience...\nDate.prototype.format = function (mask, utc) {\n return dateFormat(this, mask, utc);\n};",
"\n/*\n * http://code.google.com/p/flexible-js-formatting/\n * \n * Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */",
"Date.parseFunctions = {count:0};\nDate.parseRegexes = [];\nDate.formatFunctions = {count:0};",
"Date.prototype.dateFormat = function(format, ignore_offset) {\n if (Date.formatFunctions[format] == null) {\n Date.createNewFormat(format);\n }\n var func = Date.formatFunctions[format];\n if (ignore_offset || ! this.offset) {\n return this[func]();\n } else {\n return (new Date(this.valueOf() - this.offset))[func]();\n }\n};",
"Date.createNewFormat = function(format) {\n var funcName = \"format\" + Date.formatFunctions.count++;\n Date.formatFunctions[format] = funcName;\n var code = \"Date.prototype.\" + funcName + \" = function(){return \";\n var special = false;\n var ch = '';\n for (var i = 0; i < format.length; ++i) {\n ch = format.charAt(i);\n // escape character start\n if (!special && ch == \"\\\\\") {\n special = true;\n }\n // escaped string\n else if (!special && ch == '\"') {\n var end = format.indexOf('\"', i+1);\n if (end==-1)\n {\n end = format.length;\n }\n code += \"'\" + String.escape(format.substring(i+1, end)) + \"' + \";\n i = end;\n }\n // escaped character\n else if (special) {\n special = false;\n code += \"'\" + String.escape(ch) + \"' + \";\n }\n else {\n code += Date.getFormatCode(ch);\n }\n }\n eval(code.substring(0, code.length - 3) + \";}\");\n};",
"Date.getFormatCode = function(character) {\n switch (character) {\n case \"d\":\n return \"String.leftPad(this.getDate(), 2, '0') + \";\n case \"D\":\n return \"Date.dayNames[this.getDay()].substring(0, 3) + \";\n case \"j\":\n return \"this.getDate() + \";\n case \"l\":\n return \"Date.dayNames[this.getDay()] + \";\n case \"S\":\n return \"this.getSuffix() + \";\n case \"w\":\n return \"this.getDay() + \";\n case \"z\":\n return \"this.getDayOfYear() + \";\n case \"W\":\n return \"this.getWeekOfYear() + \";\n case \"F\":\n return \"Date.monthNames[this.getMonth()] + \";\n case \"m\":\n return \"String.leftPad(this.getMonth() + 1, 2, '0') + \";\n case \"M\":\n return \"Date.monthNames[this.getMonth()].substring(0, 3) + \";\n case \"n\":\n return \"(this.getMonth() + 1) + \";\n case \"t\":\n return \"this.getDaysInMonth() + \";\n case \"L\":\n return \"(this.isLeapYear() ? 1 : 0) + \";\n case \"Y\":\n return \"this.getFullYear() + \";\n case \"y\":\n return \"('' + this.getFullYear()).substring(2, 4) + \";\n case \"a\":\n return \"(this.getHours() < 12 ? 'am' : 'pm') + \";\n case \"A\":\n return \"(this.getHours() < 12 ? 'AM' : 'PM') + \";\n case \"g\":\n return \"((this.getHours() %12) ? this.getHours() % 12 : 12) + \";\n case \"G\":\n return \"this.getHours() + \";\n case \"h\":\n return \"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + \";\n case \"H\":\n return \"String.leftPad(this.getHours(), 2, '0') + \";\n case \"i\":\n return \"String.leftPad(this.getMinutes(), 2, '0') + \";\n case \"s\":\n return \"String.leftPad(this.getSeconds(), 2, '0') + \";\n case \"X\":\n return \"String.leftPad(this.getMilliseconds(), 3, '0') + \";\n case \"O\":\n return \"this.getGMTOffset() + \";\n case \"T\":\n return \"this.getTimezone() + \";\n case \"Z\":\n return \"(this.getTimezoneOffset() * -60) + \";\n case \"q\": // quarter num, Q for name?\n return \"this.getQuarter() + \";\n default:\n return \"'\" + String.escape(character) + \"' + \";\n }\n};",
"Date.parseDate = function(input, format) {\n if (Date.parseFunctions[format] == null) {\n Date.createParser(format);\n }\n var func = Date.parseFunctions[format];\n return Date[func](input);\n};",
"Date.createParser = function(format) {\n var funcName = \"parse\" + Date.parseFunctions.count++;\n var regexNum = Date.parseRegexes.length;\n var currentGroup = 1;\n Date.parseFunctions[format] = funcName;",
" var code = \"Date.\" + funcName + \" = function(input){\\n\"\n + \"var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, ms = -1, z = 0;\\n\"\n + \"var d = new Date();\\n\"\n + \"y = d.getFullYear();\\n\"\n + \"m = d.getMonth();\\n\"\n + \"d = d.getDate();\\n\"\n + \"var results = input.match(Date.parseRegexes[\" + regexNum + \"]);\\n\"\n + \"if (results && results.length > 0) {\" ;\n var regex = \"\";",
" var special = false;\n var ch = '';\n for (var i = 0; i < format.length; ++i) {\n ch = format.charAt(i);\n if (!special && ch == \"\\\\\") {\n special = true;\n }\n else if (special) {\n special = false;\n regex += String.escape(ch);\n }\n else {\n obj = Date.formatCodeToRegex(ch, currentGroup);\n currentGroup += obj.g;\n regex += obj.s;\n if (obj.g && obj.c) {\n code += obj.c;\n }\n }\n }",
" code += \"if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0)\\n\"\n + \"{return new Date(y, m, d, h, i, s, ms).applyOffset(z);}\\n\"\n + \"if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\\n\"\n + \"{return new Date(y, m, d, h, i, s).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\\n\"\n + \"{return new Date(y, m, d, h, i).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\\n\"\n + \"{return new Date(y, m, d, h).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0 && d > 0)\\n\"\n + \"{return new Date(y, m, d).applyOffset(z);}\\n\"\n + \"else if (y > 0 && m >= 0)\\n\"\n + \"{return new Date(y, m).applyOffset(z);}\\n\"\n + \"else if (y > 0)\\n\"\n + \"{return new Date(y).applyOffset(z);}\\n\"\n + \"}return null;}\";",
" Date.parseRegexes[regexNum] = new RegExp(\"^\" + regex + \"$\");\n eval(code);\n};",
"Date.formatCodeToRegex = function(character, currentGroup) {\n switch (character) {\n case \"D\":\n return {g:0,\n c:null,\n s:\"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\"};\n case \"j\":\n case \"d\":\n return {g:1,\n c:\"d = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"l\":\n return {g:0,\n c:null,\n s:\"(?:\" + Date.dayNames.join(\"|\") + \")\"};\n case \"S\":\n return {g:0,\n c:null,\n s:\"(?:st|nd|rd|th)\"};\n case \"w\":\n return {g:0,\n c:null,\n s:\"\\\\d\"};\n case \"z\":\n return {g:0,\n c:null,\n s:\"(?:\\\\d{1,3})\"};\n case \"W\":\n return {g:0,\n c:null,\n s:\"(?:\\\\d{2})\"};\n case \"F\":\n return {g:1,\n c:\"m = parseInt(Date.monthNumbers[results[\" + currentGroup + \"].substring(0, 3)], 10);\\n\",\n s:\"(\" + Date.monthNames.join(\"|\") + \")\"};\n case \"M\":\n return {g:1,\n c:\"m = parseInt(Date.monthNumbers[results[\" + currentGroup + \"]], 10);\\n\",\n s:\"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\"};\n case \"n\":\n case \"m\":\n return {g:1,\n c:\"m = parseInt(results[\" + currentGroup + \"], 10) - 1;\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"t\":\n return {g:0,\n c:null,\n s:\"\\\\d{1,2}\"};\n case \"L\":\n return {g:0,\n c:null,\n s:\"(?:1|0)\"};\n case \"Y\":\n return {g:1,\n c:\"y = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{4})\"};\n case \"y\":\n return {g:1,\n c:\"var ty = parseInt(results[\" + currentGroup + \"], 10);\\n\"\n + \"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"a\":\n return {g:1,\n c:\"if (results[\" + currentGroup + \"] == 'am') {\\n\"\n + \"if (h == 12) { h = 0; }\\n\"\n + \"} else { if (h < 12) { h += 12; }}\",\n s:\"(am|pm)\"};\n case \"A\":\n return {g:1,\n c:\"if (results[\" + currentGroup + \"] == 'AM') {\\n\"\n + \"if (h == 12) { h = 0; }\\n\"\n + \"} else { if (h < 12) { h += 12; }}\",\n s:\"(AM|PM)\"};\n case \"g\":\n case \"G\":\n case \"h\":\n case \"H\":\n return {g:1,\n c:\"h = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{1,2})\"};\n case \"i\":\n return {g:1,\n c:\"i = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{2})\"};\n case \"s\":\n return {g:1,\n c:\"s = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{2})\"};\n case \"X\":\n return {g:1,\n c:\"ms = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(\\\\d{3})\"};\n case \"O\":\n case \"P\":\n return {g:1,\n c:\"z = Date.parseOffset(results[\" + currentGroup + \"], 10);\\n\",\n s:\"(Z|[+-]\\\\d{2}:?\\\\d{2})\"}; // \"Z\", \"+05:00\", \"+0500\" all acceptable.\n case \"T\":\n return {g:0,\n c:null,\n s:\"[A-Z]{3}\"};\n case \"Z\":\n return {g:1,\n c:\"s = parseInt(results[\" + currentGroup + \"], 10);\\n\",\n s:\"([+-]\\\\d{1,5})\"};\n default:\n return {g:0,\n c:null,\n s:String.escape(character)};\n }\n};",
"Date.parseOffset = function(str) {\n if (str == \"Z\") { return 0 ; } // UTC, no offset.\n var seconds ;\n seconds = parseInt(str[0] + str[1] + str[2]) * 3600 ; // e.g., \"+05\" or \"-08\"\n if (str[3] == \":\") { // \"+HH:MM\" is preferred iso8601 format (\"O\")\n seconds += parseInt(str[4] + str[5]) * 60;\n } else { // \"+HHMM\" is frequently used, though. (\"P\")\n seconds += parseInt(str[3] + str[4]) * 60;\n }\n return seconds ;\n};",
"Date.today = function() {\n var now = new Date();\n now.setHours(0);\n now.setMinutes(0);\n now.setSeconds(0);\n \n return now;\n}",
"// convert the parsed date into UTC, but store the offset so we can optionally use it in dateFormat()\nDate.prototype.applyOffset = function(offset_seconds) {\n this.offset = offset_seconds * 1000 ;\n this.setTime(this.valueOf() + this.offset);\n return this ;\n};",
"Date.prototype.getTimezone = function() {\n return this.toString().replace(\n /^.*? ([A-Z]{3}) [0-9]{4}.*$/, \"$1\").replace(\n /^.*?\\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\\)$/, \"$1$2$3\").replace(\n /^.*?[0-9]{4} \\(([A-Z]{3})\\)/, \"$1\");\n};",
"Date.prototype.getGMTOffset = function() {\n return (this.getTimezoneOffset() > 0 ? \"-\" : \"+\")\n + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, \"0\")\n + String.leftPad(this.getTimezoneOffset() % 60, 2, \"0\");\n};",
"Date.prototype.getDayOfYear = function() {\n var num = 0;\n Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;\n for (var i = 0; i < this.getMonth(); ++i) {\n num += Date.daysInMonth[i];\n }\n return num + this.getDate() - 1;\n};",
"Date.prototype.getWeekOfYear = function() {\n // Skip to Thursday of this week\n var now = this.getDayOfYear() + (4 - this.getDay());\n // Find the first Thursday of the year\n var jan1 = new Date(this.getFullYear(), 0, 1);\n var then = (7 - jan1.getDay() + 4);\n document.write(then);\n return String.leftPad(((now - then) / 7) + 1, 2, \"0\");\n};",
"Date.prototype.isLeapYear = function() {\n var year = this.getFullYear();\n return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));\n};",
"Date.prototype.getFirstDayOfMonth = function() {\n var day = (this.getDay() - (this.getDate() - 1)) % 7;\n return (day < 0) ? (day + 7) : day;\n};",
"Date.prototype.getLastDayOfMonth = function() {\n var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;\n return (day < 0) ? (day + 7) : day;\n};",
"Date.prototype.getDaysInMonth = function() {\n Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;\n return Date.daysInMonth[this.getMonth()];\n};\nDate.prototype.getQuarter = function() {\n return Date.quarterFromMonthNum[this.getMonth()];\n};",
"Date.prototype.getSuffix = function() {\n switch (this.getDate()) {\n case 1:\n case 21:\n case 31:\n return \"st\";\n case 2:\n case 22:\n return \"nd\";\n case 3:\n case 23:\n return \"rd\";\n default:\n return \"th\";\n }\n};",
"String.escape = function(string) {\n return string.replace(/('|\\\\)/g, \"\\\\$1\");\n};",
"String.leftPad = function (val, size, ch) {\n var result = new String(val);\n if (ch == null) {\n ch = \" \";\n }\n while (result.length < size) {\n result = ch + result;\n }\n return result;\n};",
"Date.quarterFromMonthNum = [1,1,1,2,2,2,3,3,3,4,4,4];\nDate.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31];\nDate.monthNames =\n [\"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"];\nDate.dayNames =\n [\"Sunday\",\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\"];\nDate.y2kYear = 50;\nDate.monthNumbers = {\n Jan:0,\n Feb:1,\n Mar:2,\n Apr:3,\n May:4,\n Jun:5,\n Jul:6,\n Aug:7,\n Sep:8,\n Oct:9,\n Nov:10,\n Dec:11};\nDate.patterns = {\n ISO8601LongPattern: \"Y\\\\-m\\\\-d\\\\TH\\\\:i\\\\:sO\",\n ISO8601ShortPattern: \"Y\\\\-m\\\\-d\",\n ShortDatePattern: \"n/j/Y\",\n LongDatePattern: \"l, F d, Y\",\n FullDateTimePattern: \"l, F d, Y g:i:s A\",\n MonthDayPattern: \"F d\",\n ShortTimePattern: \"g:i A\",\n LongTimePattern: \"g:i:s A\",\n SortableDateTimePattern: \"Y-m-d\\\\TH:i:s\",\n UniversalSortableDateTimePattern: \"Y-m-d H:i:sO\",\n YearMonthPattern: \"F, Y\"};",
"\n/**\n *\n * @author: Malishev Dmitry <dima.malishev@gmail.com>\n */\nvar _DEBUG = true;\nvar _DEBUG_LEVEL = 'ALL';\n// possible levels: ALL, IMPORTANT\nvar Error = {FATAL: 1, WARNING: 0, NORMAL: -1};",
"\n/**\n * Init debug, grabs console object if accessible, or makes dummy debugger\n */\nvar fb = _DEBUG && 'undefined' != typeof(console) ? console : {\n log : function(){},\n debug : function(){},\n info : function(){},\n warn : function(){},\n error : function(){},\n assert : function(){},\n dir : function(){},\n dirxml : function(){},\n trace : function(){},\n group : function(){},\n groupEnd : function(){},\n time : function(){},\n timeEnd : function(){},\n profile : function(){},\n profileEnd : function(){},\n count : function(){},\n msg : function(){}\n};",
"var checked = false;\nvar frmname = '';\nvar lastScrollTop = 0;",
"\n//\nvar App = {\n // Main namespases for page specific functions\n // Core namespaces\n Ajax: { \n Busy: {} \n },\n Core: {},\n // CONSTANT VALUES\n Constants: {\n UNLIM_VALUE: 'unlimited', // overritten in i18n.js.php\n UNLIM_TRANSLATED_VALUE: 'unlimited' // overritten in i18n.js.php\n }, \n // Actions. More widly used funcs\n Actions: {\n DB: {},\n WEB: {},\n PACKAGE: {},\n MAIL_ACC:{},\n MAIL: {}\n },\n // Utilities\n Helpers: {},\n HTML: {\n Build: {}\n },\n Filters: {},\n Env: {\n lang: GLOBAL.lang,\n },\n i18n: {},\n Listeners: {\n DB: {},\n WEB: {},\n PACKAGE: {},\n MAIL_ACC:{}\n },\n View:{\n HTML: {\n Build: {}\n },\n // pages related views\n },\n Cache: {\n clear: function() {} // TODO: stub method, will be used later\n },\n Ref: {},\n Tmp: {},\n Thread: {\n run: function(delay, ref) {\n setTimeout(function() {\n ref();\n }, delay*10);\n }\n },\n Settings: { \n GLOBAL: {}, \n General: {}\n },\n Templates: {\n Templator: null,\n Tpl: {},\n _indexes: {}\n }\n};",
"// Internals\nArray.prototype.set = function(key, value){\n var index = this[0][key];\n this[1][index] = value;\n}\nArray.prototype.get = function(key){\n var index = this[0][key];\n return this[1][index];\n}\nArray.prototype.finalize = function(){\n this.shift();\n this[0] = this[0].join('');\n return this[0];\n}\nArray.prototype.done = function(){\n return this.join('');\n}",
"String.prototype.wrapperize = function(key, ns){\n var tpl = App.Templates.get(key, ns);\n tpl.set(':content', this);",
" return tpl.finalize();\n}",
"",
"App.Ajax.request = function(method, data, callback, onError){\n // this will prevent multiple ajaxes on user clicks\n /*if (App.Helpers.isAjaxBusy(method, data)) {\n fb.warn('ajax request ['+method+'] is busy');\n return;\n }*/\n //App.Helpers.setAjaxBusy(method, data);\n data = data || {};",
" var prgs = $('.progress-container');",
" switch (method) {\n case 'cd':\n prgs.find('title').text('Opening dir');\n prgs.show();\n break;\n case 'delete_files':\n prgs.find('title').text('Deleting');\n prgs.show();\n break;\n case 'unpack_item':\n prgs.find('title').text('Unpacking');\n prgs.show();\n break;\n case 'create_file':\n prgs.find('title').text('Creating file');\n prgs.show();\n break;\n case 'create_dir':\n prgs.find('title').text('Creating directory');\n prgs.show();\n break;\n case 'rename_file':\n prgs.find('title').text('Renaming file');\n prgs.show();\n break;\n case 'copy_file':\n case 'copy_directory':\n prgs.find('title').text('Copying files');\n prgs.show();\n break;\n default:\n break;\n }",
" jQuery.ajax({\n url: GLOBAL.ajax_url,\n global: false,\n type: data.request_method || \"GET\",\n data: jQuery.extend(data, {'action': method}),\n dataType: \"text boost\",\n converters: {\n \"text boost\": function(value) {\n value = value.trim();\n return $.parseJSON(value);\n }},\n async: true,\n cache: false,\n error: function(jqXHR, textStatus, errorThrown)\n {\n prgs.hide();\n onError && onError();\n if ('undefined' != typeof onError) {\n fb.error(textStatus);\n }\n },\n complete: function()\n {\n //App.Helpers.setAjaxFree(method, data);\n prgs.hide();\n },\n success: function(reply)\n {\n prgs.hide();\n //App.Helpers.setAjaxFree(method, data);\n try {\n callback && callback(reply);\n }\n catch(e) {\n fb.error('GENERAL ERROR with ajax method: ' + data.request_method + ' ' + e);\n //App.Helpers.generalError();\n }\n }\n });\n}",
"jQuery.extend({\n keys: function(obj){\n if (!obj) {\n return [];\n }\n var a = [];\n jQuery.each(obj, function(k){ a.push(k) });\n return a;\n }\n})",
"\nApp.Core.create_hidden_form = function(action){\n var form = jQuery('<form>', {\n id : 'hidden-form',\n method : 'post',\n action : action\n });\n jQuery('body').append(form);",
" return form;\n};",
"App.Core.extend_from_json = function(elm, data, prefix){\n elm = jQuery(elm);\n var data = App.Core.flatten_json(data, prefix);\n var keys = jQuery.keys(data);\n for(var i=0, cnt=keys.length; i<cnt; i++)\n {\n elm.append(jQuery('<input>', {\n name : keys[i],\n value: data[keys[i]],\n type : 'hidden'\n }));\n }",
" return elm;\n}",
"App.Core.flatten_json = function(data, prefix){\n var keys = jQuery.keys(data);\n var result = {};",
" prefix || (prefix = '');",
" if(keys.length)\n {\n for(var i=0, cnt=keys.length; i<cnt; i++)\n {\n var value = data[keys[i]];\n switch(typeof(value))\n {\n case 'function': break;\n case 'object' : result = jQuery.extend(result, App.Core.flatten_json(value, prefix + '[' + keys[i] + ']')); break;\n default : result[prefix + '[' + keys[i] + ']'] = value;\n }\n }\n return result;\n }\n else\n {\n return false;\n }\n}",
"//\n// Cookies adapter\n// Allow to work old pages realisations of cookie requests\n//\nfunction createCookie(name, value, expire_days) {\n jQuery.cookie(name, value, { expires: expire_days});\n}",
"function readCookie(name) {\n jQuery.cookie(name);\n}",
"function eraseCookie(name) {\n jQuery.removeCookie(name);\n}",
"\n/**\n * Timer for profiling\n */\nvar timer = {};\ntimer.start = function()\n{\n timer.start_time = new Date();\n}",
"timer.stop = function( msg )\n{\n timer.stop_time = new Date();\n timer.print( msg );\n}",
"timer.print = function( msg )\n{\n var passed = timer.stop_time - timer.start_time;\n fb.info( msg || '' + passed / 1000 );\n}",
"\nString.prototype.trim = function()\n{\n var str = this;\n str = str.replace(/^\\s+/, '');\n for (var i = str.length - 1; i >= 0; i--) {\n if (/\\S/.test(str.charAt(i))) {\n str = str.substring(0, i + 1);\n break;\n }\n }\n return str;\n}",
"hover_menu = function() {\n var sep_1 = $('div.l-content > div.l-separator:nth-of-type(2)');\n var sep_2 = $('div.l-content > div.l-separator:nth-of-type(4)');\n var nav_main = $('.l-stat');\n var nav_a = $('.l-stat .l-stat__col a');\n var nav_context = $('.l-sort');",
" var st = $(window).scrollTop();",
" if (st <= 112) {\n sep_1.css({'margin-top': 180 - st + 'px'});\n sep_2.css({'margin-top': 225 - st + 'px'});\n nav_a.css({'height': 111 - st + 'px'});\n nav_a.css({'min-height': 111 - st + 'px'});\n nav_context.css({'margin-top': 181 - st + 'px'});\n sep_2.css({'box-shadow':'none'});\n sep_2.css({'height': '1px'});\n }",
" if(st > 112){\n sep_1.css({'margin-top': '100px'});\n sep_2.css({'margin-top': '130px'});\n sep_2.css({'height': '15px'});\n nav_a.css({'height': '0'});\n nav_a.css({'min-height': '0'});\n nav_context.css({'margin-top': '101px'});\n nav_a.find('ul').css({'visibility': 'hidden'});\n nav_main.css({'padding-top': '27px'});\n sep_2.css({'box-shadow':'0 5px 6px 0 rgba(200, 200, 200, 0.35)'});\n }",
" if(st == 0){\n nav_a.css({'min-height': '70px'});\n nav_a.css({'height': '70px'});\n }",
" if(st < 109 ){\n nav_a.find('ul').css({'visibility': 'visible'});\n nav_main.css({'padding-top': 36 + 'px'});\n }",
" if (st <= 112 && st > 110 ) {\n nav_main.css({'padding-top': 36 - st + 109 + 'px'});\n }",
" lastScrollTop = st;\n}",
"\nfunction checkedAll(frmname) {\n if($('input#toggle-all').prop('checked')){\n $('.l-unit:not(.header)').addClass(\"selected\");\n $('.ch-toggle').prop(\"checked\", true);\n $('.toggle-all').addClass('clicked-on');\n } else {\n $('.l-unit:not(.header)').removeClass(\"selected\");\n $('.ch-toggle').prop(\"checked\", false);\n $('.toggle-all').removeClass('clicked-on');\n }\n}",
"function doSearch(url) {\n var url = url || '/search/';\n var loc = url + '?q=' + $('.search-input').val() + '&token=' + $('input[name=\"token\"]').val();\n location.href = loc;\n return false;\n}",
"\nfunction elementHideShow(elementToHideOrShow,trigger){\n var el = document.getElementById(elementToHideOrShow);\n el.style.display = el.style.display === 'none' ? 'block' : 'none';\n \n if (typeof trigger !== 'undefined') {\n trigger.querySelector('.section-hide-button').classList.toggle('fa-minus-square');\n trigger.querySelector('.section-hide-button').classList.toggle('fa-plus-square');\n }\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database username dynamically, showing its prefix\nApp.Actions.DB.update_db_username_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);\n}",
"//\n//\n// Updates database name dynamically, showing its prefix\nApp.Actions.DB.update_db_databasename_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);\n}",
"//\n// listener that triggers database user hint updating\nApp.Listeners.DB.keypress_db_username = function() {\n var ref = $('input[name=\"v_dbuser\"]');\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_username_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_username_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// listener that triggers database name hint updating\nApp.Listeners.DB.keypress_db_databasename = function() {\n var ref = $('input[name=\"v_database\"]');\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_databasename_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_dbn_tmt);\n window.frp_dbn_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_databasename_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Actions.DB.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.DB.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Listeners.DB.keypress_v_password();",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_db_username();\nApp.Listeners.DB.keypress_db_databasename();",
"randomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n App.Actions.DB.update_v_password();\n } \n}"
] |
[
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database username dynamically, showing its prefix\nApp.Actions.DB.update_db_username_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);\n}",
"//\n//\n// Updates database name dynamically, showing its prefix\nApp.Actions.DB.update_db_databasename_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);\n}",
"//\n// listener that triggers database user hint updating\nApp.Listeners.DB.keypress_db_username = function() {\n var ref = $('input[name=\"v_dbuser\"]');\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_username_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_username_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// listener that triggers database name hint updating\nApp.Listeners.DB.keypress_db_databasename = function() {\n var ref = $('input[name=\"v_database\"]');\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_databasename_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_dbn_tmt);\n window.frp_dbn_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_databasename_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Actions.DB.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.DB.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Listeners.DB.keypress_v_password();",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_db_username();\nApp.Listeners.DB.keypress_db_databasename();",
"randomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n App.Actions.DB.update_v_password();\n } \n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database dns record dynamically, showing its full domain path\nApp.Actions.DB.update_dns_record_hint = function(elm, hint) {\n // clean hint\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" }",
" // set domain name without rec in case of @ entries\n if (hint == '@') {\n hint = '';\n }",
" // dont show pregix if domain name = rec value\n if (hint == GLOBAL.DNS_REC_PREFIX + '.') {\n hint = '';\n }",
" // add dot at the end if needed\n if (hint != '' && hint.slice(-1) != '.') {\n hint += '.';\n }",
" $(elm).parent().find('.hint').text(hint + GLOBAL.DNS_REC_PREFIX);\n}",
"//\n// listener that triggers dns record name hint updating\nApp.Listeners.DB.keypress_dns_rec_entry = function() {\n var ref = $('input[name=\"v_rec\"]');\n var current_rec = ref.val();\n if (current_rec.trim() != '') {\n App.Actions.DB.update_dns_record_hint(ref, current_rec);\n }",
" ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_dns_record_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_dns_rec_entry();"
] |
[
1,
0,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database dns record dynamically, showing its full domain path\nApp.Actions.DB.update_dns_record_hint = function(elm, hint) {\n // clean hint\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" }",
" // set domain name without rec in case of @ entries\n if (hint == '@') {\n hint = '';\n }",
" // dont show pregix if domain name = rec value\n if (hint == GLOBAL.DNS_REC_PREFIX + '.') {\n hint = '';\n }",
" // add dot at the end if needed\n if (hint != '' && hint.slice(-1) != '.') {\n hint += '.';\n }",
" $(elm).parent().find('.hint').text(hint + GLOBAL.DNS_REC_PREFIX);\n}",
"//\n// listener that triggers dns record name hint updating\nApp.Listeners.DB.keypress_dns_rec_entry = function() {\n var ref = $('input[name=\"v_rec\"]');\n var current_rec = ref.val();\n if (current_rec.trim() != '') {\n App.Actions.DB.update_dns_record_hint(ref, current_rec);\n }",
" ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_dns_record_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_dns_rec_entry();"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"App.Actions.MAIL_ACC.enable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', true);\n $(elm).data('prev_value', $(elm).val()); // save prev value in order to restore if needed\n $(elm).val(App.Constants.UNLIM_TRANSLATED_VALUE);\n $(elm).attr('disabled', true);\n $(source_elm).css('opacity', '1');\n}",
"App.Actions.MAIL_ACC.disable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', false);\n if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {\n var prev_value = $(elm).data('prev_value').trim();\n $(elm).val(prev_value);\n if (App.Helpers.isUnlimitedValue(prev_value)) {\n $(elm).val('0');\n }\n }\n else {\n if (App.Helpers.isUnlimitedValue($(elm).val())) {\n $(elm).val('0');\n }\n }\n $(elm).attr('disabled', false);\n $(source_elm).css('opacity', '0.5');\n}",
"App.Actions.MAIL_ACC.toggle_unlimited_feature = function(evt) {\n var elm = $(evt.target);\n var ref = elm.prev('.vst-input');\n if (!$(ref).data('checked')) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n}",
"App.Listeners.MAIL_ACC.checkbox_unlimited_feature = function() {\n $('.unlim-trigger').on('click', App.Actions.MAIL_ACC.toggle_unlimited_feature);\n}",
"App.Listeners.MAIL_ACC.init = function() {\n $('.unlim-trigger').each(function(i, elm) {\n var ref = $(elm).prev('.vst-input');\n if (App.Helpers.isUnlimitedValue($(ref).val())) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n $(ref).data('prev_value', $(ref).val());\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n });\n}",
"App.Helpers.isUnlimitedValue = function(value) {\n var value = value.trim();\n if (value == App.Constants.UNLIM_VALUE || value == App.Constants.UNLIM_TRANSLATED_VALUE) {\n return true;\n }",
" return false;\n}",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.MAIL_ACC.init();\nApp.Listeners.MAIL_ACC.checkbox_unlimited_feature();\n$('#v_blackhole').on('click', function(evt){\n if($('#v_blackhole').is(':checked')){\n $('#v_fwd').prop('disabled', true);\n $('#v_fwd_for').prop('checked', true);\n $('#id_fwd_for').hide();\n }else{\n $('#v_fwd').prop('disabled', false);\n $('#id_fwd_for').show(); \n }\n});\n$('form[name=\"v_quota\"]').on('submit', function(evt) {\n $('input:disabled').each(function(i, elm) {\n $(elm).attr('disabled', false);\n if (App.Helpers.isUnlimitedValue($(elm).val())) {\n $(elm).val(App.Constants.UNLIM_VALUE);\n }\n });\n});",
"App.Actions.MAIL_ACC.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.MAIL_ACC.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.MAIL_ACC.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Listeners.MAIL_ACC.keypress_v_password();",
"\nrandomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text(randomstring);\n else\n $('#v_password').text(Array(randomstring.length+1).join('*'));\n \n App.Actions.MAIL_ACC.update_v_password();\n generate_mail_credentials();\n } \n}",
"generate_mail_credentials = function() {\n var div = $('.mail-infoblock').clone();\n div.find('#mail_configuration').remove();\n var pass=div.find('#v_password').text();",
" if (pass==\"\") div.find('#v_password').html(' ');",
" var output = div.text();\n output=output.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, \"|\");\n output=output.replace(/ /g, \"\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/^\\|+/g, \"\");\n output=output.replace(/\\|$/, \"\");\n output=output.replace(/ $/, \"\");\n output=output.replace(/:\\|/g, \": \");\n output=output.replace(/\\|/g, \"\\n\");\n //console.log(output);\n $('#v_credentials').val(output);\n}",
"$(document).ready(function() {\n $('#v_account').text($('input[name=v_account]').val());\n $('#v_password').text($('input[name=v_password]').val());\n generate_mail_credentials();",
" $('input[name=v_account]').change(function(){\n $('#v_account').text($(this).val());\n generate_mail_credentials();\n });",
" $('input[name=v_password]').change(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($(this).val());\n else\n $('#v_password').text(Array($(this).val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('.toggle-psw-visibility-icon').click(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($('input[name=v_password]').val());\n else\n $('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('#mail_configuration').change(function(evt){\n var opt = $(evt.target).find('option:selected');",
" switch(opt.attr('v_type')){\n case 'hostname':",
" $('#td_imap_hostname').html(opt.attr('domain'));\n $('#td_smtp_hostname').html(opt.attr('domain'));",
" break;\n case 'starttls':",
" $('#td_imap_port').html('143');\n $('#td_imap_encryption').html('STARTTLS');\n $('#td_smtp_port').html('587');\n $('#td_smtp_encryption').html('STARTTLS');",
" break;\n case 'ssl':",
" $('#td_imap_port').html('993');\n $('#td_imap_encryption').html('SSL / TLS');\n $('#td_smtp_port').html('465');\n $('#td_smtp_encryption').html('SSL / TLS');",
" break;\n case 'no_encryption':",
" $('#td_imap_hostname').html(opt.attr('domain'));\n $('#td_smtp_hostname').html(opt.attr('domain'));",
" $('#td_imap_port').html('143');\n $('#td_imap_encryption').html(opt.attr('no_encryption'));\n $('#td_smtp_port').html('25');\n $('#td_smtp_encryption').html(opt.attr('no_encryption'));",
" break;\n }\n generate_mail_credentials();\n });\n});"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"App.Actions.MAIL_ACC.enable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', true);\n $(elm).data('prev_value', $(elm).val()); // save prev value in order to restore if needed\n $(elm).val(App.Constants.UNLIM_TRANSLATED_VALUE);\n $(elm).attr('disabled', true);\n $(source_elm).css('opacity', '1');\n}",
"App.Actions.MAIL_ACC.disable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', false);\n if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {\n var prev_value = $(elm).data('prev_value').trim();\n $(elm).val(prev_value);\n if (App.Helpers.isUnlimitedValue(prev_value)) {\n $(elm).val('0');\n }\n }\n else {\n if (App.Helpers.isUnlimitedValue($(elm).val())) {\n $(elm).val('0');\n }\n }\n $(elm).attr('disabled', false);\n $(source_elm).css('opacity', '0.5');\n}",
"App.Actions.MAIL_ACC.toggle_unlimited_feature = function(evt) {\n var elm = $(evt.target);\n var ref = elm.prev('.vst-input');\n if (!$(ref).data('checked')) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n}",
"App.Listeners.MAIL_ACC.checkbox_unlimited_feature = function() {\n $('.unlim-trigger').on('click', App.Actions.MAIL_ACC.toggle_unlimited_feature);\n}",
"App.Listeners.MAIL_ACC.init = function() {\n $('.unlim-trigger').each(function(i, elm) {\n var ref = $(elm).prev('.vst-input');\n if (App.Helpers.isUnlimitedValue($(ref).val())) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n $(ref).data('prev_value', $(ref).val());\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n });\n}",
"App.Helpers.isUnlimitedValue = function(value) {\n var value = value.trim();\n if (value == App.Constants.UNLIM_VALUE || value == App.Constants.UNLIM_TRANSLATED_VALUE) {\n return true;\n }",
" return false;\n}",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.MAIL_ACC.init();\nApp.Listeners.MAIL_ACC.checkbox_unlimited_feature();\n$('#v_blackhole').on('click', function(evt){\n if($('#v_blackhole').is(':checked')){\n $('#v_fwd').prop('disabled', true);\n $('#v_fwd_for').prop('checked', true);\n $('#id_fwd_for').hide();\n }else{\n $('#v_fwd').prop('disabled', false);\n $('#id_fwd_for').show(); \n }\n});\n$('form[name=\"v_quota\"]').on('submit', function(evt) {\n $('input:disabled').each(function(i, elm) {\n $(elm).attr('disabled', false);\n if (App.Helpers.isUnlimitedValue($(elm).val())) {\n $(elm).val(App.Constants.UNLIM_VALUE);\n }\n });\n});",
"App.Actions.MAIL_ACC.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.MAIL_ACC.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.MAIL_ACC.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Listeners.MAIL_ACC.keypress_v_password();",
"\nrandomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text(randomstring);\n else\n $('#v_password').text(Array(randomstring.length+1).join('*'));\n \n App.Actions.MAIL_ACC.update_v_password();\n generate_mail_credentials();\n } \n}",
"generate_mail_credentials = function() {\n var div = $('.mail-infoblock').clone();\n div.find('#mail_configuration').remove();\n var pass=div.find('#v_password').text();",
" if (pass==\"\") div.find('#v_password').text(' ');",
" var output = div.text();\n output=output.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, \"|\");\n output=output.replace(/ /g, \"\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/^\\|+/g, \"\");\n output=output.replace(/\\|$/, \"\");\n output=output.replace(/ $/, \"\");\n output=output.replace(/:\\|/g, \": \");\n output=output.replace(/\\|/g, \"\\n\");\n //console.log(output);\n $('#v_credentials').val(output);\n}",
"$(document).ready(function() {\n $('#v_account').text($('input[name=v_account]').val());\n $('#v_password').text($('input[name=v_password]').val());\n generate_mail_credentials();",
" $('input[name=v_account]').change(function(){\n $('#v_account').text($(this).val());\n generate_mail_credentials();\n });",
" $('input[name=v_password]').change(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($(this).val());\n else\n $('#v_password').text(Array($(this).val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('.toggle-psw-visibility-icon').click(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($('input[name=v_password]').val());\n else\n $('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('#mail_configuration').change(function(evt){\n var opt = $(evt.target).find('option:selected');",
" switch(opt.attr('v_type')){\n case 'hostname':",
" $('#td_imap_hostname').text(opt.attr('domain'));\n $('#td_smtp_hostname').text(opt.attr('domain'));",
" break;\n case 'starttls':",
" $('#td_imap_port').text('143');\n $('#td_imap_encryption').text('STARTTLS');\n $('#td_smtp_port').text('587');\n $('#td_smtp_encryption').text('STARTTLS');",
" break;\n case 'ssl':",
" $('#td_imap_port').text('993');\n $('#td_imap_encryption').text('SSL / TLS');\n $('#td_smtp_port').text('465');\n $('#td_smtp_encryption').text('SSL / TLS');",
" break;\n case 'no_encryption':",
" $('#td_imap_hostname').text(opt.attr('domain'));\n $('#td_smtp_hostname').text(opt.attr('domain'));",
" $('#td_imap_port').text('143');\n $('#td_imap_encryption').text(opt.attr('no_encryption'));\n $('#td_smtp_port').text('25');\n $('#td_smtp_encryption').text(opt.attr('no_encryption'));",
" break;\n }\n generate_mail_credentials();\n });\n});"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"App.Actions.WEB.update_custom_doc_root = function(elm, hint) {\n var prepath = $('input[name=\"v-custom-doc-root_prepath\"]').val();\n var domain = $('select[name=\"v-custom-doc-domain\"]').val();\n var folder = $('input[name=\"v-custom-doc-folder\"]').val();\n console.log(domain, folder);",
" $('.custom_docroot_hint').html(prepath+domain+'/public_html/'+folder);",
"}\nApp.Listeners.DB.keypress_custom_folder = function() {\n var ref = $('input[name=\"v-custom-doc-folder\"]');\n var current_rec = ref.val();\n App.Actions.WEB.update_custom_doc_root(ref, current_rec);\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_custom_doc_root(elm, $(elm).val());\n });\n });\n}",
"App.Listeners.DB.change_custom_doc = function() {\n var ref = $('select[name=\"v-custom-doc-domain\"]');\n var current_rec = ref.val();\n ref.bind('change select', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_custom_doc_root(elm, $(elm).val());\n var domain = $('.ftp-path-prefix').text(GLOBAL.FTP_USER_PREPATH + '/' + $(evt.target));",
" });\n });\n}",
"// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_custom_folder();\nApp.Listeners.DB.change_custom_doc();",
"App.Actions.WEB.update_ftp_username_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" }\n \n hint = hint.replace(/[^\\w\\d]/gi, '');",
" $(elm).parent().find('.v-ftp-user').val(hint);\n $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint);\n}",
"App.Listeners.WEB.keypress_ftp_username = function() {\n var ftp_user_inputs = $('.v-ftp-user');\n $.each(ftp_user_inputs, function(i, ref) {\n var ref = $(ref);\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.WEB.update_ftp_username_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val());\n }, 100);\n });\n });\n}",
"App.Listeners.WEB.keypress_domain_name = function() {\n $('#v_domain').bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n //var elm = $(evt.target);\n //App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val());\n var domain = $('.ftp-path-prefix').text(GLOBAL.FTP_USER_PREPATH + '/' + $('#v_domain').val());\n $('#v-custom-doc-domain-main').text($('#v_domain').val());\n $('#v-custom-doc-domain-main').val($('#v_domain').val());\n App.Actions.WEB.update_custom_doc_root(13, 12);\n \n }, 100);\n });\n}",
"//\n//",
"App.Actions.WEB.update_ftp_path_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.v-ftp-path-hint').html('');",
" }",
" if (hint[0] != '/') {\n hint = '/' + hint;\n }\n hint = hint.replace(/\\/(\\/+)/g, '/');",
" $(elm).parent().find('.v-ftp-path-hint').text(hint);\n}",
"App.Listeners.WEB.keypress_ftp_path = function() {\n var ftp_path_inputs = $('.v-ftp-path');\n $.each(ftp_path_inputs, function(i, ref) {\n var ref = $(ref);\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.WEB.update_ftp_path_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_ftp_path_hint(elm, $(elm).val());\n }, 100);\n });\n });\n}",
"//\n//\nApp.Actions.WEB.add_ftp_user_form = function() {\n var ref = $('#templates').find('.ftptable-nrm').clone(true);\n var index = $('.data-col2 .ftptable').length + 1;\n \n ref.find('input').each(function(i, elm) {\n var attr_value = $(elm).prop('name').replace('%INDEX%', index);\n $(elm).prop('name', attr_value);\n });\n \n ref.find('.ftp-user-number').text(index);\n \n $('#ftp_users').append(ref);\n \n var index = 1;\n $('.data-col2 .ftp-user-number:visible').each(function(i, o) {\n $(o).text(index);\n index += 1;\n });\n}",
"App.Actions.WEB.remove_ftp_user = function(elm) {\n var ref = $(elm).parents('.ftptable');\n ref.remove();",
" var index = 1;\n $('.data-col2 .ftp-user-number:visible').each(function(i, o) {\n $(o).text(index);\n index += 1;\n });",
" if ($('.ftptable-nrm:visible').length == 0) {\n $('.v-add-new-user').hide();\n $('input[name=\"v_ftp\"]').attr('checked', false);\n }\n}",
"\nApp.Actions.WEB.toggle_additional_ftp_accounts = function(elm) {\n if ($(elm).prop('checked')) {\n $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').show();\n $('.ftptable-nrm').each(function(i, elm) {\n var login = $(elm).find('.v-ftp-user');\n if (login.val().trim() != '') {\n $(elm).find('.v-ftp-user-deleted').val(0);\n }\n });\n }\n else {\n $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').hide();\n $('.ftptable-nrm').each(function(i, elm) {\n var login = $(elm).find('.v-ftp-user');\n if (login.val().trim() != '') {\n $(elm).find('.v-ftp-user-deleted').val(1);\n }\n });\n }\n \n if ($('.ftptable-nrm:visible').length == 0) {\n var ref = $('#templates').find('.ftptable').clone(true);\n var index = $('.data-col2 .ftptable').length + 1;\n \n ref.find('input').each(function(i, elm) {\n var attr_value = $(elm).prop('name').replace('%INDEX%', index);\n $(elm).prop('name', attr_value);\n });\n \n ref.find('.ftp-user-number').text(index);\n \n $('.v-add-new-user').parent('tr').prev().find('td').html(ref);\n }\n}",
"App.Actions.WEB.toggle_letsencrypt = function(elm) {\n if ($(elm).prop('checked')) {\n $('#ssltable textarea[name=v_ssl_crt],#ssltable textarea[name=v_ssl_key], #ssltable textarea[name=v_ssl_ca]').attr('disabled', 'disabled');\n $('#generate-csr').hide();\n\t$('.lets-encrypt-note').show();\n }\n else {\n $('#ssltable textarea[name=v_ssl_crt],#ssltable textarea[name=v_ssl_key], #ssltable textarea[name=v_ssl_ca]').removeAttr('disabled');\n $('#generate-csr').show();\n\t$('.lets-encrypt-note').hide();\n }\n}",
"//\n// Page entry point\nApp.Listeners.WEB.keypress_ftp_username();\nApp.Listeners.WEB.keypress_ftp_path();\nApp.Listeners.WEB.keypress_domain_name();",
"\n$(function() {\n $('#v_domain').change(function() {\n var prefix = 'www.';\n if (((document.getElementById('v_domain').value).split(\".\")).length > 2) {\n document.getElementById('v_aliases').value = \"\";\n } else {\n document.getElementById('v_aliases').value = prefix + document.getElementById('v_domain').value;\n }\n });\n App.Actions.WEB.toggle_letsencrypt($('input[name=v_letsencrypt]'))",
" $('select[name=\"v_stats\"]').change(function(evt){\n var select = $(evt.target);\n \n if(select.val() == 'none'){\n $('.stats-auth').hide();\n } else {\n $('.stats-auth').show();\n }\n });\n});",
"",
"function WEBrandom() {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = 16;\n var webrandom = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n webrandom += chars.substr(rnum, 1);\n }\n document.v_add_web.v_stats_password.value = webrandom;\n}",
"function FTPrandom(elm) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = 16;\n var ftprandomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n ftprandomstring += chars.substr(rnum, 1);\n }\n $(elm).parents('.ftptable').find('.v-ftp-user-psw').val(ftprandomstring);\n}",
"$('#vstobjects').on('submit', function(evt) {\n $('input[disabled]').each(function(i, elm) {\n $(elm).removeAttr('disabled');\n });\n});"
] |
[
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"App.Actions.WEB.update_custom_doc_root = function(elm, hint) {\n var prepath = $('input[name=\"v-custom-doc-root_prepath\"]').val();\n var domain = $('select[name=\"v-custom-doc-domain\"]').val();\n var folder = $('input[name=\"v-custom-doc-folder\"]').val();\n console.log(domain, folder);",
" $('.custom_docroot_hint').text(prepath+domain+'/public_html/'+folder);",
"}\nApp.Listeners.DB.keypress_custom_folder = function() {\n var ref = $('input[name=\"v-custom-doc-folder\"]');\n var current_rec = ref.val();\n App.Actions.WEB.update_custom_doc_root(ref, current_rec);\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_custom_doc_root(elm, $(elm).val());\n });\n });\n}",
"App.Listeners.DB.change_custom_doc = function() {\n var ref = $('select[name=\"v-custom-doc-domain\"]');\n var current_rec = ref.val();\n ref.bind('change select', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_custom_doc_root(elm, $(elm).val());\n var domain = $('.ftp-path-prefix').text(GLOBAL.FTP_USER_PREPATH + '/' + $(evt.target));",
" });\n });\n}",
"// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_custom_folder();\nApp.Listeners.DB.change_custom_doc();",
"App.Actions.WEB.update_ftp_username_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" }\n \n hint = hint.replace(/[^\\w\\d]/gi, '');",
" $(elm).parent().find('.v-ftp-user').val(hint);\n $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint);\n}",
"App.Listeners.WEB.keypress_ftp_username = function() {\n var ftp_user_inputs = $('.v-ftp-user');\n $.each(ftp_user_inputs, function(i, ref) {\n var ref = $(ref);\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.WEB.update_ftp_username_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val());\n }, 100);\n });\n });\n}",
"App.Listeners.WEB.keypress_domain_name = function() {\n $('#v_domain').bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n //var elm = $(evt.target);\n //App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val());\n var domain = $('.ftp-path-prefix').text(GLOBAL.FTP_USER_PREPATH + '/' + $('#v_domain').val());\n $('#v-custom-doc-domain-main').text($('#v_domain').val());\n $('#v-custom-doc-domain-main').val($('#v_domain').val());\n App.Actions.WEB.update_custom_doc_root(13, 12);\n \n }, 100);\n });\n}",
"//\n//",
"App.Actions.WEB.update_ftp_path_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.v-ftp-path-hint').text('');",
" }",
" if (hint[0] != '/') {\n hint = '/' + hint;\n }\n hint = hint.replace(/\\/(\\/+)/g, '/');",
" $(elm).parent().find('.v-ftp-path-hint').text(hint);\n}",
"App.Listeners.WEB.keypress_ftp_path = function() {\n var ftp_path_inputs = $('.v-ftp-path');\n $.each(ftp_path_inputs, function(i, ref) {\n var ref = $(ref);\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.WEB.update_ftp_path_hint(ref, current_val);\n }\n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.WEB.update_ftp_path_hint(elm, $(elm).val());\n }, 100);\n });\n });\n}",
"//\n//\nApp.Actions.WEB.add_ftp_user_form = function() {\n var ref = $('#templates').find('.ftptable-nrm').clone(true);\n var index = $('.data-col2 .ftptable').length + 1;\n \n ref.find('input').each(function(i, elm) {\n var attr_value = $(elm).prop('name').replace('%INDEX%', index);\n $(elm).prop('name', attr_value);\n });\n \n ref.find('.ftp-user-number').text(index);\n \n $('#ftp_users').append(ref);\n \n var index = 1;\n $('.data-col2 .ftp-user-number:visible').each(function(i, o) {\n $(o).text(index);\n index += 1;\n });\n}",
"App.Actions.WEB.remove_ftp_user = function(elm) {\n var ref = $(elm).parents('.ftptable');\n ref.remove();",
" var index = 1;\n $('.data-col2 .ftp-user-number:visible').each(function(i, o) {\n $(o).text(index);\n index += 1;\n });",
" if ($('.ftptable-nrm:visible').length == 0) {\n $('.v-add-new-user').hide();\n $('input[name=\"v_ftp\"]').attr('checked', false);\n }\n}",
"\nApp.Actions.WEB.toggle_additional_ftp_accounts = function(elm) {\n if ($(elm).prop('checked')) {\n $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').show();\n $('.ftptable-nrm').each(function(i, elm) {\n var login = $(elm).find('.v-ftp-user');\n if (login.val().trim() != '') {\n $(elm).find('.v-ftp-user-deleted').val(0);\n }\n });\n }\n else {\n $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').hide();\n $('.ftptable-nrm').each(function(i, elm) {\n var login = $(elm).find('.v-ftp-user');\n if (login.val().trim() != '') {\n $(elm).find('.v-ftp-user-deleted').val(1);\n }\n });\n }\n \n if ($('.ftptable-nrm:visible').length == 0) {\n var ref = $('#templates').find('.ftptable').clone(true);\n var index = $('.data-col2 .ftptable').length + 1;\n \n ref.find('input').each(function(i, elm) {\n var attr_value = $(elm).prop('name').replace('%INDEX%', index);\n $(elm).prop('name', attr_value);\n });\n \n ref.find('.ftp-user-number').text(index);\n \n $('.v-add-new-user').parent('tr').prev().find('td').html(ref);\n }\n}",
"App.Actions.WEB.toggle_letsencrypt = function(elm) {\n if ($(elm).prop('checked')) {\n $('#ssltable textarea[name=v_ssl_crt],#ssltable textarea[name=v_ssl_key], #ssltable textarea[name=v_ssl_ca]').attr('disabled', 'disabled');\n $('#generate-csr').hide();\n\t$('.lets-encrypt-note').show();\n }\n else {\n $('#ssltable textarea[name=v_ssl_crt],#ssltable textarea[name=v_ssl_key], #ssltable textarea[name=v_ssl_ca]').removeAttr('disabled');\n $('#generate-csr').show();\n\t$('.lets-encrypt-note').hide();\n }\n}",
"//\n// Page entry point\nApp.Listeners.WEB.keypress_ftp_username();\nApp.Listeners.WEB.keypress_ftp_path();\nApp.Listeners.WEB.keypress_domain_name();",
"\n$(function() {\n $('#v_domain').change(function() {\n var prefix = 'www.';\n if (((document.getElementById('v_domain').value).split(\".\")).length > 2) {\n document.getElementById('v_aliases').value = \"\";\n } else {\n document.getElementById('v_aliases').value = prefix + document.getElementById('v_domain').value;\n }\n });\n App.Actions.WEB.toggle_letsencrypt($('input[name=v_letsencrypt]'))",
" $('select[name=\"v_stats\"]').change(function(evt){\n var select = $(evt.target);\n \n if(select.val() == 'none'){\n $('.stats-auth').hide();\n } else {\n $('.stats-auth').show();\n }\n });\n});",
"",
"function WEBrandom() {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = 16;\n var webrandom = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n webrandom += chars.substr(rnum, 1);\n }\n document.v_add_web.v_stats_password.value = webrandom;\n}",
"function FTPrandom(elm) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = 16;\n var ftprandomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n ftprandomstring += chars.substr(rnum, 1);\n }\n $(elm).parents('.ftptable').find('.v-ftp-user-psw').val(ftprandomstring);\n}",
"$('#vstobjects').on('submit', function(evt) {\n $('input[disabled]').each(function(i, elm) {\n $(elm).removeAttr('disabled');\n });\n});"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database username dynamically, showing its prefix\nApp.Actions.DB.update_db_username_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);\n}",
"//\n//\n// Updates database name dynamically, showing its prefix\nApp.Actions.DB.update_db_databasename_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);\n}",
"//\n// listener that triggers database user hint updating\nApp.Listeners.DB.keypress_db_username = function() {\n var ref = $('input[name=\"v_dbuser\"]');\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_username_hint(ref, current_val);\n } \n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_username_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// listener that triggers database name hint updating\nApp.Listeners.DB.keypress_db_databasename = function() {\n var ref = $('input[name=\"v_database\"]');\n var current_val = ref.val();\n if (current_val.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) {\n current_val = current_val.slice(GLOBAL.DB_DBNAME_PREFIX.length, current_val.length);\n ref.val(current_val);\n }\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_username_hint(ref, current_val);\n } \n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_dbn_tmt);\n window.frp_dbn_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_databasename_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Actions.DB.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.DB.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Listeners.DB.keypress_v_password();",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_db_username();\nApp.Listeners.DB.keypress_db_databasename();",
"\nrandomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n App.Actions.DB.update_v_password();\n } \n}"
] |
[
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database username dynamically, showing its prefix\nApp.Actions.DB.update_db_username_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);\n}",
"//\n//\n// Updates database name dynamically, showing its prefix\nApp.Actions.DB.update_db_databasename_hint = function(elm, hint) {\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" } \n $(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint);\n}",
"//\n// listener that triggers database user hint updating\nApp.Listeners.DB.keypress_db_username = function() {\n var ref = $('input[name=\"v_dbuser\"]');\n var current_val = ref.val();\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_username_hint(ref, current_val);\n } \n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_username_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// listener that triggers database name hint updating\nApp.Listeners.DB.keypress_db_databasename = function() {\n var ref = $('input[name=\"v_database\"]');\n var current_val = ref.val();\n if (current_val.indexOf(GLOBAL.DB_DBNAME_PREFIX) == 0) {\n current_val = current_val.slice(GLOBAL.DB_DBNAME_PREFIX.length, current_val.length);\n ref.val(current_val);\n }\n if (current_val.trim() != '') {\n App.Actions.DB.update_db_username_hint(ref, current_val);\n } \n \n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_dbn_tmt);\n window.frp_dbn_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_db_databasename_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Actions.DB.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.DB.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"App.Listeners.DB.keypress_v_password();",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_db_username();\nApp.Listeners.DB.keypress_db_databasename();",
"\nrandomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n App.Actions.DB.update_v_password();\n } \n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database dns record dynamically, showing its full domain path\nApp.Actions.DB.update_dns_record_hint = function(elm, hint) {\n // clean hint\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').html('');",
" }",
" // set domain name without rec in case of @ entries\n if (hint == '@') {\n hint = '';\n }",
" // dont show pregix if domain name = rec value\n if (hint == GLOBAL.DNS_REC_PREFIX + '.') {\n hint = '';\n }",
" // add dot at the end if needed\n if (hint != '' && hint.slice(-1) != '.') {\n hint += '.';\n }",
" $(elm).parent().find('.hint').text(hint + GLOBAL.DNS_REC_PREFIX);\n}",
"//\n// listener that triggers dns record name hint updating\nApp.Listeners.DB.keypress_dns_rec_entry = function() {\n var ref = $('input[name=\"v_rec\"]');\n var current_rec = ref.val();\n if (current_rec.trim() != '') {\n App.Actions.DB.update_dns_record_hint(ref, current_rec);\n }",
" ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_dns_record_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_dns_rec_entry();"
] |
[
1,
0,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"//\n//\n// Updates database dns record dynamically, showing its full domain path\nApp.Actions.DB.update_dns_record_hint = function(elm, hint) {\n // clean hint\n if (hint.trim() == '') {",
" $(elm).parent().find('.hint').text('');",
" }",
" // set domain name without rec in case of @ entries\n if (hint == '@') {\n hint = '';\n }",
" // dont show pregix if domain name = rec value\n if (hint == GLOBAL.DNS_REC_PREFIX + '.') {\n hint = '';\n }",
" // add dot at the end if needed\n if (hint != '' && hint.slice(-1) != '.') {\n hint += '.';\n }",
" $(elm).parent().find('.hint').text(hint + GLOBAL.DNS_REC_PREFIX);\n}",
"//\n// listener that triggers dns record name hint updating\nApp.Listeners.DB.keypress_dns_rec_entry = function() {\n var ref = $('input[name=\"v_rec\"]');\n var current_rec = ref.val();\n if (current_rec.trim() != '') {\n App.Actions.DB.update_dns_record_hint(ref, current_rec);\n }",
" ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.DB.update_dns_record_hint(elm, $(elm).val());\n }, 100);\n });\n}",
"//\n// Page entry point\n// Trigger listeners\nApp.Listeners.DB.keypress_dns_rec_entry();"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"App.Actions.MAIL_ACC.enable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', true);\n $(elm).data('prev_value', $(elm).val()); // save prev value in order to restore if needed\n $(elm).val(App.Constants.UNLIM_TRANSLATED_VALUE);\n $(elm).attr('disabled', true);\n $(source_elm).css('opacity', '1');\n}",
"App.Actions.MAIL_ACC.disable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', false);\n if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {\n var prev_value = $(elm).data('prev_value').trim();\n $(elm).val(prev_value);\n if (App.Helpers.isUnlimitedValue(prev_value)) {\n $(elm).val('0');\n }\n }\n else {\n if (App.Helpers.isUnlimitedValue($(elm).val())) {\n $(elm).val('0');\n }\n }\n $(elm).attr('disabled', false);\n $(source_elm).css('opacity', '0.5');\n}",
"// \nApp.Actions.MAIL_ACC.toggle_unlimited_feature = function(evt) {\n var elm = $(evt.target);\n var ref = elm.prev('.vst-input');\n if (!$(ref).data('checked')) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n}",
"App.Listeners.MAIL_ACC.checkbox_unlimited_feature = function() {\n $('.unlim-trigger').on('click', App.Actions.MAIL_ACC.toggle_unlimited_feature);\n}",
"App.Listeners.MAIL_ACC.init = function() {\n $('.unlim-trigger').each(function(i, elm) {\n var ref = $(elm).prev('.vst-input');\n if (App.Helpers.isUnlimitedValue($(ref).val())) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n $(ref).data('prev_value', $(ref).val());\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n });\n}",
"App.Actions.MAIL_ACC.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.MAIL_ACC.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.MAIL_ACC.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"$('#v_blackhole').on('click', function(evt){\n if($('#v_blackhole').is(':checked')){\n $('#v_fwd').prop('disabled', true);\n $('#v_fwd_for').prop('checked', true);\n $('#id_fwd_for').hide();\n }else{\n $('#v_fwd').prop('disabled', false);\n $('#id_fwd_for').show(); \n }\n });",
"App.Listeners.MAIL_ACC.keypress_v_password();",
"\nrandomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text(randomstring);\n else\n $('#v_password').text(Array(randomstring.length+1).join('*'));\n \n App.Actions.MAIL_ACC.update_v_password();\n generate_mail_credentials();\n } \n}\ngenerate_mail_credentials = function() {\n var div = $('.mail-infoblock').clone();\n div.find('#mail_configuration').remove();\n var pass=div.find('#v_password').text();",
" if (pass==\"\") div.find('#v_password').html(' ');",
" var output = div.text();\n output=output.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, \"|\");\n output=output.replace(/ /g, \"\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/^\\|+/g, \"\");\n output=output.replace(/\\|$/, \"\");\n output=output.replace(/ $/, \"\");\n output=output.replace(/:\\|/g, \": \");\n output=output.replace(/\\|/g, \"\\n\");\n //console.log(output);\n $('#v_credentials').val(output);\n}",
"$(document).ready(function() {\n $('#v_account').text($('input[name=v_account]').val());\n $('#v_password').text($('input[name=v_password]').val());\n generate_mail_credentials();",
" $('input[name=v_account]').change(function(){\n $('#v_account').text($(this).val());\n generate_mail_credentials();\n });\n \n $('input[name=v_password]').change(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($(this).val());\n else\n $('#v_password').text(Array($(this).val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('.toggle-psw-visibility-icon').click(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($('input[name=v_password]').val());\n else\n $('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('#mail_configuration').change(function(evt){\n var opt = $(evt.target).find('option:selected');",
" switch(opt.attr('v_type')){\n case 'hostname':",
" $('#td_imap_hostname').html(opt.attr('domain'));\n $('#td_smtp_hostname').html(opt.attr('domain'));",
" break;\n case 'starttls':",
" $('#td_imap_port').html('143');\n $('#td_imap_encryption').html('STARTTLS');\n $('#td_smtp_port').html('587');\n $('#td_smtp_encryption').html('STARTTLS');",
" break;\n case 'ssl':",
" $('#td_imap_port').html('993');\n $('#td_imap_encryption').html('SSL / TLS');\n $('#td_smtp_port').html('465');\n $('#td_smtp_encryption').html('SSL / TLS');",
" break;\n case 'no_encryption':",
" $('#td_imap_hostname').html(opt.attr('domain'));\n $('#td_smtp_hostname').html(opt.attr('domain'));",
"",
" $('#td_imap_port').html('143');\n $('#td_imap_encryption').html(opt.attr('no_encryption'));\n $('#td_smtp_port').html('25');\n $('#td_smtp_encryption').html(opt.attr('no_encryption'));",
" break;\n }\n generate_mail_credentials();\n });\n});"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"App.Actions.MAIL_ACC.enable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', true);\n $(elm).data('prev_value', $(elm).val()); // save prev value in order to restore if needed\n $(elm).val(App.Constants.UNLIM_TRANSLATED_VALUE);\n $(elm).attr('disabled', true);\n $(source_elm).css('opacity', '1');\n}",
"App.Actions.MAIL_ACC.disable_unlimited = function(elm, source_elm) {\n $(elm).data('checked', false);\n if ($(elm).data('prev_value') && $(elm).data('prev_value').trim() != '') {\n var prev_value = $(elm).data('prev_value').trim();\n $(elm).val(prev_value);\n if (App.Helpers.isUnlimitedValue(prev_value)) {\n $(elm).val('0');\n }\n }\n else {\n if (App.Helpers.isUnlimitedValue($(elm).val())) {\n $(elm).val('0');\n }\n }\n $(elm).attr('disabled', false);\n $(source_elm).css('opacity', '0.5');\n}",
"// \nApp.Actions.MAIL_ACC.toggle_unlimited_feature = function(evt) {\n var elm = $(evt.target);\n var ref = elm.prev('.vst-input');\n if (!$(ref).data('checked')) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n}",
"App.Listeners.MAIL_ACC.checkbox_unlimited_feature = function() {\n $('.unlim-trigger').on('click', App.Actions.MAIL_ACC.toggle_unlimited_feature);\n}",
"App.Listeners.MAIL_ACC.init = function() {\n $('.unlim-trigger').each(function(i, elm) {\n var ref = $(elm).prev('.vst-input');\n if (App.Helpers.isUnlimitedValue($(ref).val())) {\n App.Actions.MAIL_ACC.enable_unlimited(ref, elm);\n }\n else {\n $(ref).data('prev_value', $(ref).val());\n App.Actions.MAIL_ACC.disable_unlimited(ref, elm);\n }\n });\n}",
"App.Actions.MAIL_ACC.update_v_password = function (){\n var password = $('input[name=\"v_password\"]').val();\n var min_small = new RegExp(/^(?=.*[a-z]).+$/);\n var min_cap = new RegExp(/^(?=.*[A-Z]).+$/);\n var min_num = new RegExp(/^(?=.*\\d).+$/); \n var min_length = 8;\n var score = 0;\n \n if(password.length >= min_length) { score = score + 1; }\n if(min_small.test(password)) { score = score + 1;}\n if(min_cap.test(password)) { score = score + 1;}\n if(min_num.test(password)) { score = score+ 1; }\n $('#meter').val(score); \n}",
"App.Listeners.MAIL_ACC.keypress_v_password = function() {\n var ref = $('input[name=\"v_password\"]');\n ref.bind('keypress input', function(evt) {\n clearTimeout(window.frp_usr_tmt);\n window.frp_usr_tmt = setTimeout(function() {\n var elm = $(evt.target);\n App.Actions.MAIL_ACC.update_v_password(elm, $(elm).val());\n }, 100);\n });\n}",
"$('#v_blackhole').on('click', function(evt){\n if($('#v_blackhole').is(':checked')){\n $('#v_fwd').prop('disabled', true);\n $('#v_fwd_for').prop('checked', true);\n $('#id_fwd_for').hide();\n }else{\n $('#v_fwd').prop('disabled', false);\n $('#id_fwd_for').show(); \n }\n });",
"App.Listeners.MAIL_ACC.keypress_v_password();",
"\nrandomString = function(min_length = 16) {\n var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';\n var string_length = min_length;\n var randomstring = '';\n for (var i = 0; i < string_length; i++) {\n var rnum = Math.floor(Math.random() * chars.length);\n randomstring += chars.substr(rnum, 1);\n }\n var regex = new RegExp(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\\d)[a-zA-Z\\d]{8,}$/);\n if(!regex.test(randomstring)){\n randomString();\n }else{\n $('input[name=v_password]').val(randomstring);\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text(randomstring);\n else\n $('#v_password').text(Array(randomstring.length+1).join('*'));\n \n App.Actions.MAIL_ACC.update_v_password();\n generate_mail_credentials();\n } \n}\ngenerate_mail_credentials = function() {\n var div = $('.mail-infoblock').clone();\n div.find('#mail_configuration').remove();\n var pass=div.find('#v_password').text();",
" if (pass==\"\") div.find('#v_password').text(' ');",
" var output = div.text();\n output=output.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, \"|\");\n output=output.replace(/ /g, \"\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/\\|\\|/g, \"|\");\n output=output.replace(/^\\|+/g, \"\");\n output=output.replace(/\\|$/, \"\");\n output=output.replace(/ $/, \"\");\n output=output.replace(/:\\|/g, \": \");\n output=output.replace(/\\|/g, \"\\n\");\n //console.log(output);\n $('#v_credentials').val(output);\n}",
"$(document).ready(function() {\n $('#v_account').text($('input[name=v_account]').val());\n $('#v_password').text($('input[name=v_password]').val());\n generate_mail_credentials();",
" $('input[name=v_account]').change(function(){\n $('#v_account').text($(this).val());\n generate_mail_credentials();\n });\n \n $('input[name=v_password]').change(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($(this).val());\n else\n $('#v_password').text(Array($(this).val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('.toggle-psw-visibility-icon').click(function(){\n if($('input[name=v_password]').attr('type') == 'text')\n $('#v_password').text($('input[name=v_password]').val());\n else\n $('#v_password').text(Array($('input[name=v_password]').val().length+1).join('*'));\n generate_mail_credentials();\n });",
" $('#mail_configuration').change(function(evt){\n var opt = $(evt.target).find('option:selected');",
" switch(opt.attr('v_type')){\n case 'hostname':",
" $('#td_imap_hostname').text(opt.attr('domain'));\n $('#td_smtp_hostname').text(opt.attr('domain'));",
" break;\n case 'starttls':",
" $('#td_imap_port').text('143');\n $('#td_imap_encryption').text('STARTTLS');\n $('#td_smtp_port').text('587');\n $('#td_smtp_encryption').text('STARTTLS');",
" break;\n case 'ssl':",
" $('#td_imap_port').text('993');\n $('#td_imap_encryption').text('SSL / TLS');\n $('#td_smtp_port').text('465');\n $('#td_smtp_encryption').text('SSL / TLS');",
" break;\n case 'no_encryption':",
" $('#td_imap_hostname').text(opt.attr('domain'));\n $('#td_smtp_hostname').text(opt.attr('domain'));",
"",
" $('#td_imap_port').text('143');\n $('#td_imap_encryption').text(opt.attr('no_encryption'));\n $('#td_smtp_port').text('25');\n $('#td_smtp_encryption').text(opt.attr('no_encryption'));",
" break;\n }\n generate_mail_credentials();\n });\n});"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<!-- Begin toolbar -->\n<div class=\"l-center edit\">\n\t<div class=\"l-sort clearfix\">\n\t\t<div class=\"l-unit-toolbar__buttonstrip\">\n\t\t\t<a class=\"ui-button cancel\" dir=\"ltr\" id=\"btn-back\" href=\"/list/db/\"><i class=\"fas fa-arrow-left status-icon blue\"></i><?=_('Back');?></a>\n\t\t</div>\n\t\t<div class=\"l-unit-toolbar__buttonstrip float-right\">\n\t\t\t<a href=\"#\" class=\"ui-button\" data-action=\"submit\" data-id=\"vstobjects\"><i class=\"fas fa-save status-icon purple\"></i><?=_('Save');?></a>\n\t\t</div>\n\t</div>\n</div>\n<!-- End toolbar -->",
"<div class=\"l-separator\"></div>",
"<div class=\"l-center animated fadeIn\">",
"\t<form id=\"vstobjects\" name=\"v_add_db\" method=\"post\">\n\t\t<input type=\"hidden\" name=\"token\" value=\"<?=$_SESSION['token']?>\" />\n\t\t<input type=\"hidden\" name=\"ok\" value=\"Add\" />",
"\t\t<table class=\"data mode-add\">\n\t\t\t<tr class=\"data-add\">\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col1\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col2\" width=\"600px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t<span class=\"page-title\"><?=_('Adding database');?></span>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<?php show_error_panel($_SESSION);?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php if (($user == 'admin') && (($_GET['accept'] !== \"true\"))) {?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t\t<span class=\"alert alert-danger alert-with-icon\">\n\t\t\t\t\t\t\t\t\t\t<i class=\"fas fa-exclamation\"></i>\n\t\t\t\t\t\t\t\t\t\t<?=_('Avoid adding web domains on admin account');?>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t<?php if (($user == 'admin') && (empty($_GET['accept']))) {?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t\t<span><a href=\"/add/user/\" class=\"vst-advanced admin-warning-button\"><?=_('Add User');?></a></span>\n\t\t\t\t\t\t\t\t\t<span><a href=\"/add/db/?accept=true\" class=\"vst-advanced button danger admin-warning-button\"><?=_('Continue');?></a> </span>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t<?php if (($user == 'admin') && (($_GET['accept'] === \"true\")) || ($user !== \"admin\")) {?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"hint\">",
"\t\t\t\t\t\t\t\t\t<?=sprintf(_('Prefix %s will be automatically added to database name and database user'),'<b>'.$user.'_</b>'); ?>",
"\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text step-top input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Database');?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_database\" value=\"<?=htmlentities(trim($v_database, \"'\"))?>\">\n\t\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Type');?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<select class=\"vst-list\" name=\"v_type\">\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\tforeach ($db_types as $key => $value) {\n\t\t\t\t\t\t\t\t\t\t\t\techo \"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<option value=\\\"\".htmlentities($value).\"\\\"\";\n\t\t\t\t\t\t\t\t\t\t\t\tif ((!empty($v_type)) && ( $value == $v_type )) echo ' selected';\n\t\t\t\t\t\t\t\t\t\t\t\techo \">\".htmlentities($value).\"</option>\";\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\tprint _('Username');\n\t\t\t\t\t\t\t\t\t\techo \" <em><small>(\".sprintf(_('maximum characters length, including prefix'), 32).\")</small></em>\";\n\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_dbuser\" value=\"<?=htmlentities(trim($v_dbuser, \"'\"))?>\">\n\t\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Password');?> <a href=\"javascript:randomString();\" title=\"<?=_('generate');?>\"><i class=\"fas fa-sync status-icon green icon-large\"></i></a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input password\" name=\"v_password\"><br />\n\t\t\t\t\t\t\t\t\t<meter max=\"4\" id=\"meter\"></meter>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text\">\n\t\t\t\t\t\t\t\t\t<?=_('Your password must have at least');?>:\n\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t<li><?=_('8 characters long');?></li>\n\t\t\t\t\t\t\t\t\t\t<li><?=_('1 uppercase & 1 lowercase character');?></li>\n\t\t\t\t\t\t\t\t\t\t<li><?=_('1 number');?></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Send login credentials to email address') ?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"vst-input\" name=\"v_db_email\" value=\"<?=htmlentities(trim($v_db_email, \"'\"))?>\">\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top vst-text\" style=\"/*padding: 32px 0 20px 0;*/\">\n\t\t\t\t\t\t\t\t\t<a href=\"javascript:elementHideShow('advanced-opts');\" class=\"vst-advanced\"><?=_('Advanced options');?></a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t\t<table id=\"advanced-opts\" style=\"display: none;\">\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?=_('Host');?>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t<select class=\"vst-list\" name=\"v_host\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tforeach ($db_hosts as $value) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<option value=\\\"\".htmlentities($value).\"\\\"\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ((!empty($v_host)) && ( $value == $v_host )) echo ' selected';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \">\".htmlentities($value).\"</option>\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?=_('Charset');?>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t<select class=\"vst-list\" name=\"v_charset\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=big5 <?php if ((!empty($v_charset)) && ( $v_charset == 'big5')) echo 'selected';?>>big5</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=dec8 <?php if ((!empty($v_charset)) && ( $v_charset == 'dec8')) echo 'selected';?>>dec8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp850 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp850')) echo 'selected';?>>cp850</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=hp8 <?php if ((!empty($v_charset)) && ( $v_charset == 'hp8')) echo 'selected';?>>hp8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=koi8r <?php if ((!empty($v_charset)) && ( $v_charset == 'koi8r')) echo 'selected';?>>koi8r</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin1 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin1')) echo 'selected';?>>latin1</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin2 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin2')) echo 'selected';?>>latin2</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=swe7 <?php if ((!empty($v_charset)) && ( $v_charset == 'swe7')) echo 'selected';?>>swe7</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=ascii <?php if ((!empty($v_charset)) && ( $v_charset == 'ascii')) echo 'selected';?>>ascii</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=ujis <?php if ((!empty($v_charset)) && ( $v_charset == 'ujis')) echo 'selected';?>>ujis</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=sjis <?php if ((!empty($v_charset)) && ( $v_charset == 'sjis')) echo 'selected';?>>sjis</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=hebrew <?php if ((!empty($v_charset)) && ( $v_charset == 'hebrew')) echo 'selected';?>>hebrew</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=tis620 <?php if ((!empty($v_charset)) && ( $v_charset == 'tis620')) echo 'selected';?>>tis620</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=euckr <?php if ((!empty($v_charset)) && ( $v_charset == 'euckr')) echo 'selected';?>>euckr</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=koi8u <?php if ((!empty($v_charset)) && ( $v_charset == 'koi8u')) echo 'selected';?>>koi8u</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=gb2312 <?php if ((!empty($v_charset)) && ( $v_charset == 'gb2312')) echo 'selected';?>>gb2312</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=greek <?php if ((!empty($v_charset)) && ( $v_charset == 'greek')) echo 'selected';?>>greek</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1250 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1250')) echo 'selected';?>>cp1250</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=gbk <?php if ((!empty($v_charset)) && ( $v_charset == 'gbk')) echo 'selected';?>>gbk</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin5 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin5')) echo 'selected';?>>latin5</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=armscii8 <?php if ((!empty($v_charset)) && ( $v_charset == 'armscii8')) echo 'selected';?>>armscii8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=utf8 <?php if ((!empty($v_charset)) && ( $v_charset == 'utf8')) echo 'selected';?> <?php if (empty($v_charset)) echo 'selected';?>>utf8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=utf8mb4 <?php if ((!empty($v_charset)) && ( $v_charset == 'utf8mb4')) echo 'selected';?>>utf8mb4</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=ucs2 <?php if ((!empty($v_charset)) && ( $v_charset == 'ucs2')) echo 'selected';?>>ucs2</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp866 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp866')) echo 'selected';?>>cp866</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=keybcs2 <?php if ((!empty($v_charset)) && ( $v_charset == 'keybcs2')) echo 'selected';?>>keybcs2</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=macce <?php if ((!empty($v_charset)) && ( $v_charset == 'macce')) echo 'selected';?>>macce</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=macroman <?php if ((!empty($v_charset)) && ( $v_charset == 'macroman')) echo 'selected';?>>macroman</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp852 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp852')) echo 'selected';?>>cp852</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin7 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin7')) echo 'selected';?>>latin7</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1251 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1251')) echo 'selected';?>>cp1251</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1256 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1256')) echo 'selected';?>>cp1256</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1257 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1257')) echo 'selected';?>>cp1257</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=binary <?php if ((!empty($v_charset)) && ( $v_charset == 'binary')) echo 'selected';?>>binary</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=geostd8 <?php if ((!empty($v_charset)) && ( $v_charset == 'geostd8')) echo 'selected';?>>geostd8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp932 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp932')) echo 'selected';?>>cp932</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=eucjpms <?php if ((!empty($v_charset)) && ( $v_charset == 'eucjpms')) echo 'selected';?>>eucjpms</option>\n\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<table class=\"data-col2\">\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t<?php } ?>\n\t\t</table>\n\t</form>\n</div>",
"<script>",
"GLOBAL.DB_USER_PREFIX = \"<?=$user_plain;?>\";\nGLOBAL.DB_DBNAME_PREFIX = \"<?=$user_plain;?>\";",
"</script>"
] |
[
1,
1,
1,
1,
1,
0,
1,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<!-- Begin toolbar -->\n<div class=\"l-center edit\">\n\t<div class=\"l-sort clearfix\">\n\t\t<div class=\"l-unit-toolbar__buttonstrip\">\n\t\t\t<a class=\"ui-button cancel\" dir=\"ltr\" id=\"btn-back\" href=\"/list/db/\"><i class=\"fas fa-arrow-left status-icon blue\"></i><?=_('Back');?></a>\n\t\t</div>\n\t\t<div class=\"l-unit-toolbar__buttonstrip float-right\">\n\t\t\t<a href=\"#\" class=\"ui-button\" data-action=\"submit\" data-id=\"vstobjects\"><i class=\"fas fa-save status-icon purple\"></i><?=_('Save');?></a>\n\t\t</div>\n\t</div>\n</div>\n<!-- End toolbar -->",
"<div class=\"l-separator\"></div>",
"<div class=\"l-center animated fadeIn\">",
"\t<form id=\"vstobjects\" name=\"v_add_db\" method=\"post\">\n\t\t<input type=\"hidden\" name=\"token\" value=\"<?=$_SESSION['token']?>\" />\n\t\t<input type=\"hidden\" name=\"ok\" value=\"Add\" />",
"\t\t<table class=\"data mode-add\">\n\t\t\t<tr class=\"data-add\">\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col1\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col2\" width=\"600px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t<span class=\"page-title\"><?=_('Adding database');?></span>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<?php show_error_panel($_SESSION);?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php if (($user == 'admin') && (($_GET['accept'] !== \"true\"))) {?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t\t<span class=\"alert alert-danger alert-with-icon\">\n\t\t\t\t\t\t\t\t\t\t<i class=\"fas fa-exclamation\"></i>\n\t\t\t\t\t\t\t\t\t\t<?=_('Avoid adding web domains on admin account');?>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t<?php if (($user == 'admin') && (empty($_GET['accept']))) {?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t\t<span><a href=\"/add/user/\" class=\"vst-advanced admin-warning-button\"><?=_('Add User');?></a></span>\n\t\t\t\t\t\t\t\t\t<span><a href=\"/add/db/?accept=true\" class=\"vst-advanced button danger admin-warning-button\"><?=_('Continue');?></a> </span>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<?php } ?>\n\t\t\t\t\t\t<?php if (($user == 'admin') && (($_GET['accept'] === \"true\")) || ($user !== \"admin\")) {?>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"hint\">",
"\t\t\t\t\t\t\t\t\t<?=sprintf(_('Prefix %s will be automatically added to database name and database user'),'<b>'.$user_plain.'_</b>'); ?>",
"\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text step-top input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Database');?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_database\" value=\"<?=htmlentities(trim($v_database, \"'\"))?>\">\n\t\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Type');?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<select class=\"vst-list\" name=\"v_type\">\n\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\tforeach ($db_types as $key => $value) {\n\t\t\t\t\t\t\t\t\t\t\t\techo \"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<option value=\\\"\".htmlentities($value).\"\\\"\";\n\t\t\t\t\t\t\t\t\t\t\t\tif ((!empty($v_type)) && ( $value == $v_type )) echo ' selected';\n\t\t\t\t\t\t\t\t\t\t\t\techo \">\".htmlentities($value).\"</option>\";\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\tprint _('Username');\n\t\t\t\t\t\t\t\t\t\techo \" <em><small>(\".sprintf(_('maximum characters length, including prefix'), 32).\")</small></em>\";\n\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_dbuser\" value=\"<?=htmlentities(trim($v_dbuser, \"'\"))?>\">\n\t\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Password');?> <a href=\"javascript:randomString();\" title=\"<?=_('generate');?>\"><i class=\"fas fa-sync status-icon green icon-large\"></i></a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input password\" name=\"v_password\"><br />\n\t\t\t\t\t\t\t\t\t<meter max=\"4\" id=\"meter\"></meter>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text\">\n\t\t\t\t\t\t\t\t\t<?=_('Your password must have at least');?>:\n\t\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t\t<li><?=_('8 characters long');?></li>\n\t\t\t\t\t\t\t\t\t\t<li><?=_('1 uppercase & 1 lowercase character');?></li>\n\t\t\t\t\t\t\t\t\t\t<li><?=_('1 number');?></li>\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t<?=_('Send login credentials to email address') ?>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"vst-input\" name=\"v_db_email\" value=\"<?=htmlentities(trim($v_db_email, \"'\"))?>\">\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top vst-text\" style=\"/*padding: 32px 0 20px 0;*/\">\n\t\t\t\t\t\t\t\t\t<a href=\"javascript:elementHideShow('advanced-opts');\" class=\"vst-advanced\"><?=_('Advanced options');?></a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t\t<table id=\"advanced-opts\" style=\"display: none;\">\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?=_('Host');?>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t<select class=\"vst-list\" name=\"v_host\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tforeach ($db_hosts as $value) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t<option value=\\\"\".htmlentities($value).\"\\\"\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif ((!empty($v_host)) && ( $value == $v_host )) echo ' selected';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\techo \">\".htmlentities($value).\"</option>\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t\t\t\t\t<?=_('Charset');?>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t\t<select class=\"vst-list\" name=\"v_charset\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=big5 <?php if ((!empty($v_charset)) && ( $v_charset == 'big5')) echo 'selected';?>>big5</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=dec8 <?php if ((!empty($v_charset)) && ( $v_charset == 'dec8')) echo 'selected';?>>dec8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp850 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp850')) echo 'selected';?>>cp850</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=hp8 <?php if ((!empty($v_charset)) && ( $v_charset == 'hp8')) echo 'selected';?>>hp8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=koi8r <?php if ((!empty($v_charset)) && ( $v_charset == 'koi8r')) echo 'selected';?>>koi8r</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin1 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin1')) echo 'selected';?>>latin1</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin2 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin2')) echo 'selected';?>>latin2</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=swe7 <?php if ((!empty($v_charset)) && ( $v_charset == 'swe7')) echo 'selected';?>>swe7</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=ascii <?php if ((!empty($v_charset)) && ( $v_charset == 'ascii')) echo 'selected';?>>ascii</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=ujis <?php if ((!empty($v_charset)) && ( $v_charset == 'ujis')) echo 'selected';?>>ujis</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=sjis <?php if ((!empty($v_charset)) && ( $v_charset == 'sjis')) echo 'selected';?>>sjis</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=hebrew <?php if ((!empty($v_charset)) && ( $v_charset == 'hebrew')) echo 'selected';?>>hebrew</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=tis620 <?php if ((!empty($v_charset)) && ( $v_charset == 'tis620')) echo 'selected';?>>tis620</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=euckr <?php if ((!empty($v_charset)) && ( $v_charset == 'euckr')) echo 'selected';?>>euckr</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=koi8u <?php if ((!empty($v_charset)) && ( $v_charset == 'koi8u')) echo 'selected';?>>koi8u</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=gb2312 <?php if ((!empty($v_charset)) && ( $v_charset == 'gb2312')) echo 'selected';?>>gb2312</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=greek <?php if ((!empty($v_charset)) && ( $v_charset == 'greek')) echo 'selected';?>>greek</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1250 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1250')) echo 'selected';?>>cp1250</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=gbk <?php if ((!empty($v_charset)) && ( $v_charset == 'gbk')) echo 'selected';?>>gbk</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin5 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin5')) echo 'selected';?>>latin5</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=armscii8 <?php if ((!empty($v_charset)) && ( $v_charset == 'armscii8')) echo 'selected';?>>armscii8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=utf8 <?php if ((!empty($v_charset)) && ( $v_charset == 'utf8')) echo 'selected';?> <?php if (empty($v_charset)) echo 'selected';?>>utf8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=utf8mb4 <?php if ((!empty($v_charset)) && ( $v_charset == 'utf8mb4')) echo 'selected';?>>utf8mb4</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=ucs2 <?php if ((!empty($v_charset)) && ( $v_charset == 'ucs2')) echo 'selected';?>>ucs2</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp866 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp866')) echo 'selected';?>>cp866</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=keybcs2 <?php if ((!empty($v_charset)) && ( $v_charset == 'keybcs2')) echo 'selected';?>>keybcs2</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=macce <?php if ((!empty($v_charset)) && ( $v_charset == 'macce')) echo 'selected';?>>macce</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=macroman <?php if ((!empty($v_charset)) && ( $v_charset == 'macroman')) echo 'selected';?>>macroman</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp852 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp852')) echo 'selected';?>>cp852</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=latin7 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin7')) echo 'selected';?>>latin7</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1251 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1251')) echo 'selected';?>>cp1251</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1256 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1256')) echo 'selected';?>>cp1256</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp1257 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1257')) echo 'selected';?>>cp1257</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=binary <?php if ((!empty($v_charset)) && ( $v_charset == 'binary')) echo 'selected';?>>binary</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=geostd8 <?php if ((!empty($v_charset)) && ( $v_charset == 'geostd8')) echo 'selected';?>>geostd8</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=cp932 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp932')) echo 'selected';?>>cp932</option>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<option value=eucjpms <?php if ((!empty($v_charset)) && ( $v_charset == 'eucjpms')) echo 'selected';?>>eucjpms</option>\n\t\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<table class=\"data-col2\">\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t<?php } ?>\n\t\t</table>\n\t</form>\n</div>",
"<script>",
"GLOBAL.DB_USER_PREFIX = \"<?=$user_plain;?>_\";\nGLOBAL.DB_DBNAME_PREFIX = \"<?=$user_plain;?>_\";",
"</script>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<!-- Begin toolbar -->\n<div class=\"l-center edit\">\n\t<div class=\"l-sort clearfix\">\n\t\t<div class=\"l-unit-toolbar__buttonstrip\">\n\t\t\t<a class=\"ui-button cancel\" dir=\"ltr\" id=\"btn-back\" href=\"/list/db/\"><i class=\"fas fa-arrow-left status-icon blue\"></i><?=_('Back');?></a>\n\t\t</div>\n\t\t<div class=\"l-unit-toolbar__buttonstrip float-right\">\n\t\t\t<a href=\"#\" class=\"ui-button\" data-action=\"submit\" data-id=\"vstobjects\"><i class=\"fas fa-save status-icon purple\"></i><?=_('Save');?></a>\n\t\t</div>\n\t</div>\n</div>\n<!-- End toolbar -->",
"<div class=\"l-separator\"></div>",
"<div class=\"l-center animated fadeIn\">",
"\t<form id=\"vstobjects\" name=\"v_edit_db\" method=\"post\" class=\"<?=$v_status?>\">\n\t\t<input type=\"hidden\" name=\"token\" value=\"<?=$_SESSION['token']?>\" />\n\t\t<input type=\"hidden\" name=\"save\" value=\"save\" />",
"\t\t<table class='data'>\n\t\t\t<tr class=\"data-add\">\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col1\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col2\" width=\"600px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t<span class=\"page-title\"><?=_('Editing Database');?></span>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<?php show_error_panel($_SESSION);?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text step-top\">\n\t\t\t\t\t\t\t\t<?=_('Database');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_database\" value=\"<?=htmlentities(trim($v_database, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\tprint _('Username');\n\t\t\t\t\t\t\t\t\techo \" <em><small>(\".sprintf(_('maximum characters length, including prefix'), 32).\")</small></em>\";\n\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_dbuser\" value=\"<?=htmlentities(trim($v_dbuser, \"'\"))?>\">\n\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Password');?> <a href=\"javascript:randomString();\" title=\"<?=_('generate');?>\"><i class=\"fas fa-sync status-icon green icon-large\"></i></a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input password\" name=\"v_password\" value=\"<?=htmlentities(trim($v_password, \"'\"))?>\"><br />\n\t\t\t\t\t\t\t\t<meter max=\"4\" id=\"meter\"></meter>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text\">\n\t\t\t\t\t\t\t\t<?=_('Your password must have at least');?>:\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<li><?=_('8 characters long');?></li>\n\t\t\t\t\t\t\t\t\t<li><?=_('1 uppercase & 1 lowercase character');?></li>\n\t\t\t\t\t\t\t\t\t<li><?=_('1 number');?></li>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Type');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_type\" value=\"<?=htmlentities(trim($v_type, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Host');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_host\" value=\"<?=htmlentities(trim($v_host, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Charset');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_charset\" value=\"<?=htmlentities(trim($v_charset, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t<table class=\"data-col2\"></table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>\n</div>\n<?php if ($v_type == 'pgsql'){ $user=strtolower($user); } ?>\n<script>",
" GLOBAL.DB_USER_PREFIX = \"<?=$user_plain;?>\";\n GLOBAL.DB_DBNAME_PREFIX = \"<?=$user_plain;?>\";",
"</script>"
] |
[
1,
1,
1,
1,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<!-- Begin toolbar -->\n<div class=\"l-center edit\">\n\t<div class=\"l-sort clearfix\">\n\t\t<div class=\"l-unit-toolbar__buttonstrip\">\n\t\t\t<a class=\"ui-button cancel\" dir=\"ltr\" id=\"btn-back\" href=\"/list/db/\"><i class=\"fas fa-arrow-left status-icon blue\"></i><?=_('Back');?></a>\n\t\t</div>\n\t\t<div class=\"l-unit-toolbar__buttonstrip float-right\">\n\t\t\t<a href=\"#\" class=\"ui-button\" data-action=\"submit\" data-id=\"vstobjects\"><i class=\"fas fa-save status-icon purple\"></i><?=_('Save');?></a>\n\t\t</div>\n\t</div>\n</div>\n<!-- End toolbar -->",
"<div class=\"l-separator\"></div>",
"<div class=\"l-center animated fadeIn\">",
"\t<form id=\"vstobjects\" name=\"v_edit_db\" method=\"post\" class=\"<?=$v_status?>\">\n\t\t<input type=\"hidden\" name=\"token\" value=\"<?=$_SESSION['token']?>\" />\n\t\t<input type=\"hidden\" name=\"save\" value=\"save\" />",
"\t\t<table class='data'>\n\t\t\t<tr class=\"data-add\">\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col1\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td class=\"data-dotted\">\n\t\t\t\t\t<table class=\"data-col2\" width=\"600px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"step-top\">\n\t\t\t\t\t\t\t\t<span class=\"page-title\"><?=_('Editing Database');?></span>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<?php show_error_panel($_SESSION);?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text step-top\">\n\t\t\t\t\t\t\t\t<?=_('Database');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_database\" value=\"<?=htmlentities(trim($v_database, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?php\n\t\t\t\t\t\t\t\t\tprint _('Username');\n\t\t\t\t\t\t\t\t\techo \" <em><small>(\".sprintf(_('maximum characters length, including prefix'), 32).\")</small></em>\";\n\t\t\t\t\t\t\t\t?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_dbuser\" value=\"<?=htmlentities(trim($v_dbuser, \"'\"))?>\">\n\t\t\t\t\t\t\t\t<small class=\"hint\"></small>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Password');?> <a href=\"javascript:randomString();\" title=\"<?=_('generate');?>\"><i class=\"fas fa-sync status-icon green icon-large\"></i></a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input password\" name=\"v_password\" value=\"<?=htmlentities(trim($v_password, \"'\"))?>\"><br />\n\t\t\t\t\t\t\t\t<meter max=\"4\" id=\"meter\"></meter>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text\">\n\t\t\t\t\t\t\t\t<?=_('Your password must have at least');?>:\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<li><?=_('8 characters long');?></li>\n\t\t\t\t\t\t\t\t\t<li><?=_('1 uppercase & 1 lowercase character');?></li>\n\t\t\t\t\t\t\t\t\t<li><?=_('1 number');?></li>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Type');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_type\" value=\"<?=htmlentities(trim($v_type, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Host');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_host\" value=\"<?=htmlentities(trim($v_host, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class=\"vst-text input-label\">\n\t\t\t\t\t\t\t\t<?=_('Charset');?>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input type=\"text\" size=\"20\" class=\"vst-input\" name=\"v_charset\" value=\"<?=htmlentities(trim($v_charset, \"'\"))?>\" disabled>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t<table class=\"data-col2\"></table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>\n</div>\n<?php if ($v_type == 'pgsql'){ $user=strtolower($user); } ?>\n<script>",
" GLOBAL.DB_USER_PREFIX = \"<?=$user_plain;?>_\";\n GLOBAL.DB_DBNAME_PREFIX = \"<?=$user_plain;?>_\";",
"</script>"
] |
[
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [66, 17, 8, 214, 92, 17, 8, 192, 232, 131], "buggy_code_start_loc": [65, 6, 7, 144, 6, 6, 7, 122, 64, 129], "filenames": ["web/js/app.js", "web/js/pages/add_db.js", "web/js/pages/add_dns_rec.js", "web/js/pages/add_mail_acc.js", "web/js/pages/add_web.js", "web/js/pages/edit_db.js", "web/js/pages/edit_dns_rec.js", "web/js/pages/edit_mail_acc.js", "web/templates/pages/add_db.html", "web/templates/pages/edit_db.html"], "fixing_code_end_loc": [64, 17, 8, 214, 92, 17, 8, 192, 232, 131], "fixing_code_start_loc": [64, 6, 7, 144, 6, 6, 7, 122, 64, 129], "message": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:hestiacp:control_panel:*:*:*:*:*:*:*:*", "matchCriteriaId": "E3BC0A83-CD46-44C4-9B34-73FD22FC12A9", "versionEndExcluding": "1.5.10", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Reflected in GitHub repository hestiacp/hestiacp prior to 1.5.10."}, {"lang": "es", "value": "Una vulnerabilidad de tipo Cross-site Scripting (XSS) - Reflejado en el repositorio de GitHub hestiacp/hestiacp versiones anteriores a 1.5.10"}], "evaluatorComment": null, "id": "CVE-2022-0838", "lastModified": "2022-03-10T15:07:30.923", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "NONE", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:N/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.6, "baseSeverity": "MEDIUM", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 0.7, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-03-04T08:15:07.407", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/bd2fb1f1-cc8b-4ef7-8e2b-4ca686d8d614"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Secondary"}]}, "github_commit_url": "https://github.com/hestiacp/hestiacp/commit/640f822d306ffb3eddf8ce2f46de75d7344283c1"}, "type": "CWE-79"}
| 92
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# Changelog",
"All notable changes to this project will be documented in this file.",
"The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).",
"## \\[2.0.0] - Unreleased\n### Added\n- Handle attributes comming from nuclio detectors (<https://github.com/openvinotoolkit/cvat/pull/3917>)\n- Add additional environment variables for Nuclio configuration (<https://github.com/openvinotoolkit/cvat/pull/3894>)\n- Add KITTI segmentation and detection format (<https://github.com/openvinotoolkit/cvat/pull/3757>)\n- Add LFW format (<https://github.com/openvinotoolkit/cvat/pull/3770>)\n- Add Cityscapes format (<https://github.com/openvinotoolkit/cvat/pull/3758>)\n- Add Open Images V6 format (<https://github.com/openvinotoolkit/cvat/pull/3679>)\n- Rotated bounding boxes (<https://github.com/openvinotoolkit/cvat/pull/3832>)\n- Player option: Smooth image when zoom-in, enabled by default (<https://github.com/openvinotoolkit/cvat/pull/3933>)\n- Google Cloud Storage support in UI (<https://github.com/openvinotoolkit/cvat/pull/3919>)\n- Add project tasks paginations (<https://github.com/openvinotoolkit/cvat/pull/3910>)\n- Add remove issue button (<https://github.com/openvinotoolkit/cvat/pull/3952>)\n- Data sorting option (<https://github.com/openvinotoolkit/cvat/pull/3937>)\n- Options to change font size & position of text labels on the canvas (<https://github.com/openvinotoolkit/cvat/pull/3972>)\n- Add \"tag\" return type for automatic annotation in Nuclio (<https://github.com/openvinotoolkit/cvat/pull/3896>)\n- Helm chart: Make user-data-permission-fix optional (<https://github.com/openvinotoolkit/cvat/pull/3994>)\n- Advanced identity access management system, using open policy agent (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Organizations to create \"shared space\" for different groups of users (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Dataset importing to a project (<https://github.com/openvinotoolkit/cvat/pull/3790>)\n- User is able to customize information that text labels show (<https://github.com/openvinotoolkit/cvat/pull/4029>)\n- Support for uploading manifest with any name (<https://github.com/openvinotoolkit/cvat/pull/4041>)\n- Added information about OpenVINO toolkit to login page (<https://github.com/openvinotoolkit/cvat/pull/4077>)\n- Support for working with ellipses (<https://github.com/openvinotoolkit/cvat/pull/4062>)\n- Add several flags to task creation CLI (<https://github.com/openvinotoolkit/cvat/pull/4119>)\n- Add YOLOv5 serverless function for automatic annotation (<https://github.com/openvinotoolkit/cvat/pull/4178>)\n- Add possibility to change git repository and git export format from already created task (<https://github.com/openvinotoolkit/cvat/pull/3886>)\n- Basic page with jobs list, basic filtration to this list (<https://github.com/openvinotoolkit/cvat/pull/4258>)\n- Added OpenCV.js TrackerMIL as tracking tool (<https://github.com/openvinotoolkit/cvat/pull/4200>)\n- Ability to continue working from the latest frame where an annotator was before (<https://github.com/openvinotoolkit/cvat/pull/4297>)\n- `GET /api/jobs/<id>/commits` was implemented (<https://github.com/openvinotoolkit/cvat/pull/4368>)\n- Advanced filtration and sorting for a list of jobs (<https://github.com/openvinotoolkit/cvat/pull/4319>)",
"### Changed\n- Users don't have access to a task object anymore if they are assigneed only on some jobs of the task (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Different resources (tasks, projects) are not visible anymore for all CVAT instance users by default (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- API versioning scheme: using accept header versioning instead of namespace versioning (<https://github.com/openvinotoolkit/cvat/pull/4239>)\n- Replaced 'django_sendfile' with 'django_sendfile2' (<https://github.com/openvinotoolkit/cvat/pull/4267>)\n- Use drf-spectacular instead of drf-yasg for swagger documentation (<https://github.com/openvinotoolkit/cvat/pull/4210>)",
"### Deprecated\n- Job field \"status\" is not used in UI anymore, but it has not been removed from the database yet (<https://github.com/openvinotoolkit/cvat/pull/3788>)",
"### Removed\n- Review rating, reviewer field from the job instance (use assignee field together with stage field instead) (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Training django app (<https://github.com/openvinotoolkit/cvat/pull/4330>)\n- v1 api version support (<https://github.com/openvinotoolkit/cvat/pull/4332>)",
"### Fixed\n- Fixed Interaction handler keyboard handlers (<https://github.com/openvinotoolkit/cvat/pull/3881>)\n- Points of invisible shapes are visible in autobordering (<https://github.com/openvinotoolkit/cvat/pull/3931>)\n- Order of the label attributes in the object item details(<https://github.com/openvinotoolkit/cvat/pull/3945>)\n- Order of labels in tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/3987>)\n- Fixed task creating with large files via webpage (<https://github.com/openvinotoolkit/cvat/pull/3692>)\n- Added information to export CVAT_HOST when performing local installation for accessing over network (<https://github.com/openvinotoolkit/cvat/pull/4014>)\n- Fixed possible color collisions in the generated colormap (<https://github.com/openvinotoolkit/cvat/pull/4007>)\n- Original pdf file is deleted when using share (<https://github.com/openvinotoolkit/cvat/pull/3967>)\n- Order in an annotation file(<https://github.com/openvinotoolkit/cvat/pull/4087>)\n- Fixed task data upload progressbar (<https://github.com/openvinotoolkit/cvat/pull/4134>)\n- Email in org invitations is case sensitive (<https://github.com/openvinotoolkit/cvat/pull/4153>)\n- Caching for tasks and jobs can lead to an exception if its assignee user is removed (<https://github.com/openvinotoolkit/cvat/pull/4165>)\n- Added intelligent function when paste labels to another task (<https://github.com/openvinotoolkit/cvat/pull/4161>)\n- Uncaught TypeError: this.el.node.getScreenCTM() is null in Firefox (<https://github.com/openvinotoolkit/cvat/pull/4175>)\n- Bug: canvas is busy when start playing, start resizing a shape and do not release the mouse cursor (<https://github.com/openvinotoolkit/cvat/pull/4151>)\n- Bug: could not receive frame N. TypeError: Cannot read properties of undefined (reding \"filename\") (<https://github.com/openvinotoolkit/cvat/pull/4187>)\n- Cannot choose a dataset format for a linked repository if a task type is annotation (<https://github.com/openvinotoolkit/cvat/pull/4203>)\n- Fixed tus upload error over https (<https://github.com/openvinotoolkit/cvat/pull/4154>)\n- Issues disappear when rescale a browser (<https://github.com/openvinotoolkit/cvat/pull/4189>)\n- Auth token key is not returned when registering without email verification (<https://github.com/openvinotoolkit/cvat/pull/4092>)\n- Error in create project from backup for standard 3D annotation (<https://github.com/openvinotoolkit/cvat/pull/4160>)\n- Annotations search does not work correctly in some corner cases (when use complex properties with width, height) (<https://github.com/openvinotoolkit/cvat/pull/4198>)\n- Kibana requests are not proxied due to django-revproxy incompatibility with Django >3.2.x (<https://github.com/openvinotoolkit/cvat/issues/4085>)\n- Content type for getting frame with tasks/{id}/data/ endpoint (<https://github.com/openvinotoolkit/cvat/pull/4333>)",
"### Security\n- Updated ELK to 6.8.23 which uses log4j 2.17.1 (<https://github.com/openvinotoolkit/cvat/pull/4206>)",
"",
"\n## \\[1.7.0] - 2021-11-15",
"### Added",
"- cvat-ui: support cloud storages (<https://github.com/openvinotoolkit/cvat/pull/3372>)\n- interactor: add HRNet interactive segmentation serverless function (<https://github.com/openvinotoolkit/cvat/pull/3740>)\n- Added GPU implementation for SiamMask, reworked tracking approach (<https://github.com/openvinotoolkit/cvat/pull/3571>)\n- Progress bar for manifest creating (<https://github.com/openvinotoolkit/cvat/pull/3712>)\n- IAM: Open Policy Agent integration (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Add a tutorial on attaching cloud storage AWS-S3 (<https://github.com/openvinotoolkit/cvat/pull/3745>)\n and Azure Blob Container (<https://github.com/openvinotoolkit/cvat/pull/3778>)\n- The feature to remove annotations in a specified range of frames (<https://github.com/openvinotoolkit/cvat/pull/3617>)\n- Project backup/restore (<https://github.com/openvinotoolkit/cvat/pull/3852>)",
"### Changed",
"- UI tracking has been reworked (<https://github.com/openvinotoolkit/cvat/pull/3571>)\n- Updated Django till 3.2.7 (automatic AppConfig discovery)\n- Manifest generation: Reduce creating time (<https://github.com/openvinotoolkit/cvat/pull/3712>)\n- Migration from NPM 6 to NPM 7 (<https://github.com/openvinotoolkit/cvat/pull/3773>)\n- Update Datumaro dependency to 0.2.0 (<https://github.com/openvinotoolkit/cvat/pull/3813>)",
"### Fixed",
"- Fixed JSON transform issues in network requests (<https://github.com/openvinotoolkit/cvat/pull/3706>)\n- Display a more user-friendly exception message (<https://github.com/openvinotoolkit/cvat/pull/3721>)\n- Exception `DataCloneError: The object could not be cloned` (<https://github.com/openvinotoolkit/cvat/pull/3733>)\n- Fixed extension comparison in task frames CLI (<https://github.com/openvinotoolkit/cvat/pull/3674>)\n- Incorrect work when copy job list with \"Copy\" button (<https://github.com/openvinotoolkit/cvat/pull/3749>)\n- Iterating over manifest (<https://github.com/openvinotoolkit/cvat/pull/3792>)\n- Manifest removing (<https://github.com/openvinotoolkit/cvat/pull/3791>)\n- Fixed project updated date (<https://github.com/openvinotoolkit/cvat/pull/3814>)\n- Fixed dextr deployment (<https://github.com/openvinotoolkit/cvat/pull/3820>)\n- Migration of `dataset_repo` application (<https://github.com/openvinotoolkit/cvat/pull/3827>)\n- Helm settings for external psql database were unused by backend (<https://github.com/openvinotoolkit/cvat/pull/3779>)\n- Updated WSL setup for development (<https://github.com/openvinotoolkit/cvat/pull/3828>)\n- Helm chart config (<https://github.com/openvinotoolkit/cvat/pull/3784>)",
"### Security",
"- Fix security issues on the documentation website unsafe use of target blank\n and potential clickjacking on legacy browsers (<https://github.com/openvinotoolkit/cvat/pull/3789>)",
"## \\[1.6.0] - 2021-09-17",
"### Added",
"- Added ability to import data from share with cli without copying the data (<https://github.com/openvinotoolkit/cvat/issues/2862>)\n- Notification if the browser does not support nesassary API\n- Added ability to export project as a dataset (<https://github.com/openvinotoolkit/cvat/pull/3365>)\n and project with 3D tasks (<https://github.com/openvinotoolkit/cvat/pull/3502>)\n- Additional inline tips in interactors with demo gifs (<https://github.com/openvinotoolkit/cvat/pull/3473>)\n- Added intelligent scissors blocking feature (<https://github.com/openvinotoolkit/cvat/pull/3510>)\n- Support cloud storage status (<https://github.com/openvinotoolkit/cvat/pull/3386>)\n- Support cloud storage preview (<https://github.com/openvinotoolkit/cvat/pull/3386>)\n- cvat-core: support cloud storages (<https://github.com/openvinotoolkit/cvat/pull/3313>)",
"### Changed",
"- Non-blocking UI when using interactors (<https://github.com/openvinotoolkit/cvat/pull/3473>)\n- \"Selected opacity\" slider now defines opacity level for shapes being drawnSelected opacity (<https://github.com/openvinotoolkit/cvat/pull/3473>)\n- Cloud storage creating and updating (<https://github.com/openvinotoolkit/cvat/pull/3386>)\n- Way of working with cloud storage content (<https://github.com/openvinotoolkit/cvat/pull/3386>)",
"### Removed",
"- Support TEMP_KEY_SECRET_KEY_TOKEN_SET for AWS S3 cloud storage (<https://github.com/openvinotoolkit/cvat/pull/3386>)",
"### Fixed",
"- Fixed multiple tasks moving (<https://github.com/openvinotoolkit/cvat/pull/3517>)\n- Fixed task creating CLI parameter (<https://github.com/openvinotoolkit/cvat/pull/3519>)\n- Fixed import for MOTS format (<https://github.com/openvinotoolkit/cvat/pull/3612>)",
"## \\[1.5.0] - 2021-08-02",
"### Added",
"- Support of context images for 2D image tasks (<https://github.com/openvinotoolkit/cvat/pull/3122>)\n- Support of cloud storage without copying data into CVAT: server part (<https://github.com/openvinotoolkit/cvat/pull/2620>)\n- Filter `is_active` for user list (<https://github.com/openvinotoolkit/cvat/pull/3235>)\n- Ability to export/import tasks (<https://github.com/openvinotoolkit/cvat/pull/3056>)\n- Add a tutorial for semi-automatic/automatic annotation (<https://github.com/openvinotoolkit/cvat/pull/3124>)\n- Explicit \"Done\" button when drawing any polyshapes (<https://github.com/openvinotoolkit/cvat/pull/3417>)\n- Histogram equalization with OpenCV javascript (<https://github.com/openvinotoolkit/cvat/pull/3447>)\n- Client-side polyshapes approximation when using semi-automatic interactors & scissors (<https://github.com/openvinotoolkit/cvat/pull/3450>)\n- Support of Google Cloud Storage for cloud storage (<https://github.com/openvinotoolkit/cvat/pull/3561>)",
"### Changed",
"- Updated manifest format, added meta with related images (<https://github.com/openvinotoolkit/cvat/pull/3122>)\n- Update of COCO format documentation (<https://github.com/openvinotoolkit/cvat/pull/3197>)\n- Updated Webpack Dev Server config to add proxy (<https://github.com/openvinotoolkit/cvat/pull/3368>)\n- Update to Django 3.1.12 (<https://github.com/openvinotoolkit/cvat/pull/3378>)\n- Updated visibility for removable points in AI tools (<https://github.com/openvinotoolkit/cvat/pull/3417>)\n- Updated UI handling for IOG serverless function (<https://github.com/openvinotoolkit/cvat/pull/3417>)\n- Changed Nginx proxy to Traefik in `docker-compose.yml` (<https://github.com/openvinotoolkit/cvat/pull/3409>)\n- Simplify the process of deploying CVAT with HTTPS (<https://github.com/openvinotoolkit/cvat/pull/3409>)",
"### Fixed",
"- Project page requests took a long time and did many DB queries (<https://github.com/openvinotoolkit/cvat/pull/3223>)\n- Fixed Python 3.6 support (<https://github.com/openvinotoolkit/cvat/pull/3258>)\n- Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>)\n- Issue \"is not a constructor\" when create object, save, undo, save, redo save (<https://github.com/openvinotoolkit/cvat/pull/3292>)\n- Fix CLI create an infinite loop if git repository responds with failure (<https://github.com/openvinotoolkit/cvat/pull/3267>)\n- Bug with sidebar & fullscreen (<https://github.com/openvinotoolkit/cvat/pull/3289>)\n- 504 Gateway Time-out on `data/meta` requests (<https://github.com/openvinotoolkit/cvat/pull/3269>)\n- TypeError: Cannot read property 'clientX' of undefined when draw cuboids with hotkeys (<https://github.com/openvinotoolkit/cvat/pull/3308>)\n- Duplication of the cuboids when redraw them (<https://github.com/openvinotoolkit/cvat/pull/3308>)\n- Some code issues in Deep Extreme Cut handler code (<https://github.com/openvinotoolkit/cvat/pull/3325>)\n- UI fails when inactive user is assigned to a task/job (<https://github.com/openvinotoolkit/cvat/pull/3343>)\n- Calculate precise progress of decoding a video file (<https://github.com/openvinotoolkit/cvat/pull/3381>)\n- Falsely successful `cvat_ui` image build in case of OOM error that leads to the default nginx welcome page\n (<https://github.com/openvinotoolkit/cvat/pull/3379>)\n- Fixed issue when save filtered object in AAM (<https://github.com/openvinotoolkit/cvat/pull/3401>)\n- Context image disappears after undo/redo (<https://github.com/openvinotoolkit/cvat/pull/3416>)\n- Using combined data sources (directory and image) when create a task (<https://github.com/openvinotoolkit/cvat/pull/3424>)\n- Creating task with labels in project (<https://github.com/openvinotoolkit/cvat/pull/3454>)\n- Move task and autoannotation modals were invisible from project page (<https://github.com/openvinotoolkit/cvat/pull/3475>)",
"## \\[1.4.0] - 2021-05-18",
"### Added",
"- Documentation on mask annotation (<https://github.com/openvinotoolkit/cvat/pull/3044>)\n- Hotkeys to switch a label of existing object or to change default label (for objects created with N) (<https://github.com/openvinotoolkit/cvat/pull/3070>)\n- A script to convert some kinds of DICOM files to regular images (<https://github.com/openvinotoolkit/cvat/pull/3095>)\n- Helm chart prototype (<https://github.com/openvinotoolkit/cvat/pull/3102>)\n- Initial implementation of moving tasks between projects (<https://github.com/openvinotoolkit/cvat/pull/3164>)",
"### Changed",
"- Place of migration logger initialization (<https://github.com/openvinotoolkit/cvat/pull/3170>)",
"### Removed",
"- Kubernetes templates from (<https://github.com/openvinotoolkit/cvat/pull/1962>) due to helm charts (<https://github.com/openvinotoolkit/cvat/pull/3171>)",
"### Fixed",
"- Export of instance masks with holes (<https://github.com/openvinotoolkit/cvat/pull/3044>)\n- Changing a label on canvas does not work when 'Show object details' enabled (<https://github.com/openvinotoolkit/cvat/pull/3084>)\n- Make sure frame unzip web worker correctly terminates after unzipping all images in a requested chunk (<https://github.com/openvinotoolkit/cvat/pull/3096>)\n- Reset password link was unavailable before login (<https://github.com/openvinotoolkit/cvat/pull/3140>)\n- Manifest: migration (<https://github.com/openvinotoolkit/cvat/pull/3146>)\n- Fixed cropping polygon in some corner cases (<https://github.com/openvinotoolkit/cvat/pull/3184>)",
"## \\[1.3.0] - 3/31/2021",
"### Added",
"- CLI: Add support for saving annotations in a git repository when creating a task.\n- CVAT-3D: support lidar data on the server side (<https://github.com/openvinotoolkit/cvat/pull/2534>)\n- GPU support for Mask-RCNN and improvement in its deployment time (<https://github.com/openvinotoolkit/cvat/pull/2714>)\n- CVAT-3D: Load all frames corresponding to the job instance\n (<https://github.com/openvinotoolkit/cvat/pull/2645>)\n- Intelligent scissors with OpenCV javascript (<https://github.com/openvinotoolkit/cvat/pull/2689>)\n- CVAT-3D: Visualize 3D point cloud spaces in 3D View, Top View Side View and Front View (<https://github.com/openvinotoolkit/cvat/pull/2768>)\n- [Inside Outside Guidance](https://github.com/shiyinzhang/Inside-Outside-Guidance) serverless\n function for interactive segmentation\n- Pre-built [cvat_server](https://hub.docker.com/r/openvino/cvat_server) and\n [cvat_ui](https://hub.docker.com/r/openvino/cvat_ui) images were published on DockerHub (<https://github.com/openvinotoolkit/cvat/pull/2766>)\n- Project task subsets (<https://github.com/openvinotoolkit/cvat/pull/2774>)\n- Kubernetes templates and guide for their deployment (<https://github.com/openvinotoolkit/cvat/pull/1962>)\n- [WiderFace](http://shuoyang1213.me/WIDERFACE/) format support (<https://github.com/openvinotoolkit/cvat/pull/2864>)\n- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)\n- [Backup/Restore guide](cvat/apps/documentation/backup_guide.md) (<https://github.com/openvinotoolkit/cvat/pull/2964>)\n- Label deletion from tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/2881>)\n- CVAT-3D: Implemented initial cuboid placement in 3D View and select cuboid in Top, Side and Front views\n (<https://github.com/openvinotoolkit/cvat/pull/2891>)\n- [Market-1501](https://www.aitribune.com/dataset/2018051063) format support (<https://github.com/openvinotoolkit/cvat/pull/2869>)\n- Ability of upload manifest for dataset with images (<https://github.com/openvinotoolkit/cvat/pull/2763>)\n- Annotations filters UI using react-awesome-query-builder (<https://github.com/openvinotoolkit/cvat/issues/1418>)\n- Storing settings in local storage to keep them between browser sessions (<https://github.com/openvinotoolkit/cvat/pull/3017>)\n- [ICDAR](https://rrc.cvc.uab.es/?ch=2) format support (<https://github.com/openvinotoolkit/cvat/pull/2866>)\n- Added switcher to maintain polygon crop behavior (<https://github.com/openvinotoolkit/cvat/pull/3021>\n- Filters and sorting options for job list, added tooltip for tasks filters (<https://github.com/openvinotoolkit/cvat/pull/3030>)",
"### Changed",
"- CLI - task list now returns a list of current tasks. (<https://github.com/openvinotoolkit/cvat/pull/2863>)\n- Updated HTTPS install README section (cleanup and described more robust deploy)\n- Logstash is improved for using with configurable elasticsearch outputs (<https://github.com/openvinotoolkit/cvat/pull/2531>)\n- Bumped nuclio version to 1.5.16 (<https://github.com/openvinotoolkit/cvat/pull/2578>)\n- All methods for interactive segmentation accept negative points as well\n- Persistent queue added to logstash (<https://github.com/openvinotoolkit/cvat/pull/2744>)\n- Improved maintenance of popups visibility (<https://github.com/openvinotoolkit/cvat/pull/2809>)\n- Image visualizations settings on canvas for faster access (<https://github.com/openvinotoolkit/cvat/pull/2872>)\n- Better scale management of left panel when screen is too small (<https://github.com/openvinotoolkit/cvat/pull/2880>)\n- Improved error messages for annotation import (<https://github.com/openvinotoolkit/cvat/pull/2935>)\n- Using manifest support instead video meta information and dummy chunks (<https://github.com/openvinotoolkit/cvat/pull/2763>)",
"### Fixed",
"- More robust execution of nuclio GPU functions by limiting the GPU memory consumption per worker (<https://github.com/openvinotoolkit/cvat/pull/2714>)\n- Kibana startup initialization (<https://github.com/openvinotoolkit/cvat/pull/2659>)\n- The cursor jumps to the end of the line when renaming a task (<https://github.com/openvinotoolkit/cvat/pull/2669>)\n- SSLCertVerificationError when remote source is used (<https://github.com/openvinotoolkit/cvat/pull/2683>)\n- Fixed filters select overflow (<https://github.com/openvinotoolkit/cvat/pull/2614>)\n- Fixed tasks in project auto annotation (<https://github.com/openvinotoolkit/cvat/pull/2725>)\n- Cuboids are missed in annotations statistics (<https://github.com/openvinotoolkit/cvat/pull/2704>)\n- The list of files attached to the task is not displayed (<https://github.com/openvinotoolkit/cvat/pull/2706>)\n- A couple of css-related issues (top bar disappear, wrong arrow position on collapse elements) (<https://github.com/openvinotoolkit/cvat/pull/2736>)\n- Issue with point region doesn't work in Firefox (<https://github.com/openvinotoolkit/cvat/pull/2727>)\n- Fixed cuboid perspective change (<https://github.com/openvinotoolkit/cvat/pull/2733>)\n- Annotation page popups (ai tools, drawing) reset state after detecting, tracking, drawing (<https://github.com/openvinotoolkit/cvat/pull/2780>)\n- Polygon editing using trailing point (<https://github.com/openvinotoolkit/cvat/pull/2808>)\n- Updated the path to python for DL models inside automatic annotation documentation (<https://github.com/openvinotoolkit/cvat/pull/2847>)\n- Fixed of receiving function variable (<https://github.com/openvinotoolkit/cvat/pull/2860>)\n- Shortcuts with CAPSLOCK enabled and with non-US languages activated (<https://github.com/openvinotoolkit/cvat/pull/2872>)\n- Prevented creating several issues for the same object (<https://github.com/openvinotoolkit/cvat/pull/2868>)\n- Fixed label editor name field validator (<https://github.com/openvinotoolkit/cvat/pull/2879>)\n- An error about track shapes outside of the task frames during export (<https://github.com/openvinotoolkit/cvat/pull/2890>)\n- Fixed project search field updating (<https://github.com/openvinotoolkit/cvat/pull/2901>)\n- Fixed export error when invalid polygons are present in overlapping frames (<https://github.com/openvinotoolkit/cvat/pull/2852>)\n- Fixed image quality option for tasks created from images (<https://github.com/openvinotoolkit/cvat/pull/2963>)\n- Incorrect text on the warning when specifying an incorrect link to the issue tracker (<https://github.com/openvinotoolkit/cvat/pull/2971>)\n- Updating label attributes when label contains number attributes (<https://github.com/openvinotoolkit/cvat/pull/2969>)\n- Crop a polygon if its points are outside the bounds of the image (<https://github.com/openvinotoolkit/cvat/pull/3025>)",
"## \\[1.2.0] - 2021-01-08",
"### Fixed",
"- Memory consumption for the task creation process (<https://github.com/openvinotoolkit/cvat/pull/2582>)\n- Frame preloading (<https://github.com/openvinotoolkit/cvat/pull/2608>)\n- Project cannot be removed from the project page (<https://github.com/openvinotoolkit/cvat/pull/2626>)",
"## \\[1.2.0-beta] - 2020-12-15",
"### Added",
"- GPU support and improved documentation for auto annotation (<https://github.com/openvinotoolkit/cvat/pull/2546>)\n- Manual review pipeline: issues/comments/workspace (<https://github.com/openvinotoolkit/cvat/pull/2357>)\n- Basic projects implementation (<https://github.com/openvinotoolkit/cvat/pull/2255>)\n- Documentation on how to mount cloud starage(AWS S3 bucket, Azure container, Google Drive) as FUSE (<https://github.com/openvinotoolkit/cvat/pull/2377>)\n- Ability to work with share files without copying inside (<https://github.com/openvinotoolkit/cvat/pull/2377>)\n- Tooltips in label selectors (<https://github.com/openvinotoolkit/cvat/pull/2509>)\n- Page redirect after login using `next` query parameter (<https://github.com/openvinotoolkit/cvat/pull/2527>)\n- [ImageNet](http://www.image-net.org) format support (<https://github.com/openvinotoolkit/cvat/pull/2376>)\n- [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/) format support (<https://github.com/openvinotoolkit/cvat/pull/2559>)",
"### Changed",
"- PATCH requests from cvat-core submit only changed fields (<https://github.com/openvinotoolkit/cvat/pull/2445>)\n- deploy.sh in serverless folder is separated into deploy_cpu.sh and deploy_gpu.sh (<https://github.com/openvinotoolkit/cvat/pull/2546>)\n- Bumped nuclio version to 1.5.8\n- Migrated to Antd 4.9 (<https://github.com/openvinotoolkit/cvat/pull/2536>)",
"### Fixed",
"- Fixed FastRCNN inference bug for images with 4 channels i.e. png (<https://github.com/openvinotoolkit/cvat/pull/2546>)\n- Django templates for email and user guide (<https://github.com/openvinotoolkit/cvat/pull/2412>)\n- Saving relative paths in dummy chunks instead of absolute (<https://github.com/openvinotoolkit/cvat/pull/2424>)\n- Objects with a specific label cannot be displayed if at least one tag with the label exist (<https://github.com/openvinotoolkit/cvat/pull/2435>)\n- Wrong attribute can be removed in labels editor (<https://github.com/openvinotoolkit/cvat/pull/2436>)\n- UI fails with the error \"Cannot read property 'label' of undefined\" (<https://github.com/openvinotoolkit/cvat/pull/2442>)\n- Exception: \"Value must be a user instance\" (<https://github.com/openvinotoolkit/cvat/pull/2441>)\n- Reset zoom option doesn't work in tag annotation mode (<https://github.com/openvinotoolkit/cvat/pull/2443>)\n- Canvas is busy error (<https://github.com/openvinotoolkit/cvat/pull/2437>)\n- Projects view layout fix (<https://github.com/openvinotoolkit/cvat/pull/2503>)\n- Fixed the tasks view (infinite loading) when it is impossible to get a preview of the task (<https://github.com/openvinotoolkit/cvat/pull/2504>)\n- Empty frames navigation (<https://github.com/openvinotoolkit/cvat/pull/2505>)\n- TypeError: Cannot read property 'toString' of undefined (<https://github.com/openvinotoolkit/cvat/pull/2517>)\n- Extra shapes are drawn after Esc, or G pressed while drawing a region in grouping (<https://github.com/openvinotoolkit/cvat/pull/2507>)\n- Reset state (reviews, issues) after logout or changing a job (<https://github.com/openvinotoolkit/cvat/pull/2525>)\n- TypeError: Cannot read property 'id' of undefined when updating a task (<https://github.com/openvinotoolkit/cvat/pull/2544>)",
"## \\[1.2.0-alpha] - 2020-11-09",
"### Added",
"- Ability to login into CVAT-UI with token from api/v1/auth/login (<https://github.com/openvinotoolkit/cvat/pull/2234>)\n- Added layout grids toggling ('ctrl + alt + Enter')\n- Added password reset functionality (<https://github.com/opencv/cvat/pull/2058>)\n- Ability to work with data on the fly (<https://github.com/opencv/cvat/pull/2007>)\n- Annotation in process outline color wheel (<https://github.com/opencv/cvat/pull/2084>)\n- On the fly annotation using DL detectors (<https://github.com/opencv/cvat/pull/2102>)\n- Displaying automatic annotation progress on a task view (<https://github.com/opencv/cvat/pull/2148>)\n- Automatic tracking of bounding boxes using serverless functions (<https://github.com/opencv/cvat/pull/2136>)\n- \\[Datumaro] CLI command for dataset equality comparison (<https://github.com/opencv/cvat/pull/1989>)\n- \\[Datumaro] Merging of datasets with different labels (<https://github.com/opencv/cvat/pull/2098>)\n- Add FBRS interactive segmentation serverless function (<https://github.com/openvinotoolkit/cvat/pull/2094>)\n- Ability to change default behaviour of previous/next buttons of a player.\n It supports regular navigation, searching a frame according to annotations\n filters and searching the nearest frame without any annotations (<https://github.com/openvinotoolkit/cvat/pull/2221>)\n- MacOS users notes in CONTRIBUTING.md\n- Ability to prepare meta information manually (<https://github.com/openvinotoolkit/cvat/pull/2217>)\n- Ability to upload prepared meta information along with a video when creating a task (<https://github.com/openvinotoolkit/cvat/pull/2217>)\n- Optional chaining plugin for cvat-canvas and cvat-ui (<https://github.com/openvinotoolkit/cvat/pull/2249>)\n- MOTS png mask format support (<https://github.com/openvinotoolkit/cvat/pull/2198>)\n- Ability to correct upload video with a rotation record in the metadata (<https://github.com/openvinotoolkit/cvat/pull/2218>)\n- User search field for assignee fields (<https://github.com/openvinotoolkit/cvat/pull/2370>)\n- Support of mxf videos (<https://github.com/openvinotoolkit/cvat/pull/2514>)",
"### Changed",
"- UI models (like DEXTR) were redesigned to be more interactive (<https://github.com/opencv/cvat/pull/2054>)\n- Used Ubuntu:20.04 as a base image for CVAT Dockerfile (<https://github.com/opencv/cvat/pull/2101>)\n- Right colors of label tags in label mapping when a user runs automatic detection (<https://github.com/openvinotoolkit/cvat/pull/2162>)\n- Nuclio became an optional component of CVAT (<https://github.com/openvinotoolkit/cvat/pull/2192>)\n- A key to remove a point from a polyshape (Ctrl => Alt) (<https://github.com/openvinotoolkit/cvat/pull/2204>)\n- Updated `docker-compose` file version from `2.3` to `3.3`(<https://github.com/openvinotoolkit/cvat/pull/2235>)\n- Added auto inference of url schema from host in CLI, if provided (<https://github.com/openvinotoolkit/cvat/pull/2240>)\n- Track frames in skips between annotation is presented in MOT and MOTS formats are marked `outside` (<https://github.com/openvinotoolkit/cvat/pull/2198>)\n- UI packages installation with `npm ci` instead of `npm install` (<https://github.com/openvinotoolkit/cvat/pull/2350>)",
"### Removed",
"- Removed Z-Order flag from task creation process",
"### Fixed",
"- Fixed multiple errors which arises when polygon is of length 5 or less (<https://github.com/opencv/cvat/pull/2100>)\n- Fixed task creation from PDF (<https://github.com/opencv/cvat/pull/2141>)\n- Fixed CVAT format import for frame stepped tasks (<https://github.com/openvinotoolkit/cvat/pull/2151>)\n- Fixed the reading problem with large PDFs (<https://github.com/openvinotoolkit/cvat/pull/2154>)\n- Fixed unnecessary pyhash dependency (<https://github.com/openvinotoolkit/cvat/pull/2170>)\n- Fixed Data is not getting cleared, even after deleting the Task from Django Admin App(<https://github.com/openvinotoolkit/cvat/issues/1925>)\n- Fixed blinking message: \"Some tasks have not been showed because they do not have any data\" (<https://github.com/openvinotoolkit/cvat/pull/2200>)\n- Fixed case when a task with 0 jobs is shown as \"Completed\" in UI (<https://github.com/openvinotoolkit/cvat/pull/2200>)\n- Fixed use case when UI throws exception: Cannot read property 'objectType' of undefined #2053 (<https://github.com/openvinotoolkit/cvat/pull/2203>)\n- Fixed use case when logs could be saved twice or more times #2202 (<https://github.com/openvinotoolkit/cvat/pull/2203>)\n- Fixed issues from #2112 (<https://github.com/openvinotoolkit/cvat/pull/2217>)\n- Git application name (renamed to dataset_repo) (<https://github.com/openvinotoolkit/cvat/pull/2243>)\n- A problem in exporting of tracks, where tracks could be truncated (<https://github.com/openvinotoolkit/cvat/issues/2129>)\n- Fixed CVAT startup process if the user has `umask 077` in .bashrc file (<https://github.com/openvinotoolkit/cvat/pull/2293>)\n- Exception: Cannot read property \"each\" of undefined after drawing a single point (<https://github.com/openvinotoolkit/cvat/pull/2307>)\n- Cannot read property 'label' of undefined (Fixed?) (<https://github.com/openvinotoolkit/cvat/pull/2311>)\n- Excluded track frames marked `outside` in `CVAT for Images` export (<https://github.com/openvinotoolkit/cvat/pull/2345>)\n- 'List of tasks' Kibana visualization (<https://github.com/openvinotoolkit/cvat/pull/2361>)\n- An error on exporting not `jpg` or `png` images in TF Detection API format (<https://github.com/openvinotoolkit/datumaro/issues/35>)",
"## \\[1.1.0] - 2020-08-31",
"### Added",
"- Siammask tracker as DL serverless function (<https://github.com/opencv/cvat/pull/1988>)\n- \\[Datumaro] Added model info and source info commands (<https://github.com/opencv/cvat/pull/1973>)\n- \\[Datumaro] Dataset statistics (<https://github.com/opencv/cvat/pull/1668>)\n- Ability to change label color in tasks and predefined labels (<https://github.com/opencv/cvat/pull/2014>)\n- \\[Datumaro] Multi-dataset merge (<https://github.com/opencv/cvat/pull/1695>)\n- Ability to configure email verification for new users (<https://github.com/opencv/cvat/pull/1929>)\n- Link to django admin page from UI (<https://github.com/opencv/cvat/pull/2068>)\n- Notification message when users use wrong browser (<https://github.com/opencv/cvat/pull/2070>)",
"### Changed",
"- Shape coordinates are rounded to 2 digits in dumped annotations (<https://github.com/opencv/cvat/pull/1970>)\n- COCO format does not produce polygon points for bbox annotations (<https://github.com/opencv/cvat/pull/1953>)",
"### Fixed",
"- Issue loading openvino models for semi-automatic and automatic annotation (<https://github.com/opencv/cvat/pull/1996>)\n- Basic functions of CVAT works without activated nuclio dashboard\n- Fixed a case in which exported masks could have wrong color order (<https://github.com/opencv/cvat/issues/2032>)\n- Fixed error with creating task with labels with the same name (<https://github.com/opencv/cvat/pull/2031>)\n- Django RQ dashboard view (<https://github.com/opencv/cvat/pull/2069>)\n- Object's details menu settings (<https://github.com/opencv/cvat/pull/2084>)",
"## \\[1.1.0-beta] - 2020-08-03",
"### Added",
"- DL models as serverless functions (<https://github.com/opencv/cvat/pull/1767>)\n- Source type support for tags, shapes and tracks (<https://github.com/opencv/cvat/pull/1192>)\n- Source type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)\n- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)\n- Support creating multiple jobs for each task through python cli (<https://github.com/opencv/cvat/pull/1950>)\n- python cli over https (<https://github.com/opencv/cvat/pull/1942>)\n- Error message when plugins weren't able to initialize instead of infinite loading (<https://github.com/opencv/cvat/pull/1966>)\n- Ability to change user password (<https://github.com/opencv/cvat/pull/1954>)",
"### Changed",
"- Smaller object details (<https://github.com/opencv/cvat/pull/1877>)\n- `COCO` format does not convert bboxes to polygons on export (<https://github.com/opencv/cvat/pull/1953>)\n- It is impossible to submit a DL model in OpenVINO format using UI.\n Now you can deploy new models on the server using serverless functions\n (<https://github.com/opencv/cvat/pull/1767>)\n- Files and folders under share path are now alphabetically sorted",
"### Removed",
"- Removed OpenVINO and CUDA components because they are not necessary anymore (<https://github.com/opencv/cvat/pull/1767>)\n- Removed the old UI code (<https://github.com/opencv/cvat/pull/1964>)",
"### Fixed",
"- Some objects aren't shown on canvas sometimes. For example after propagation on of objects is invisible (<https://github.com/opencv/cvat/pull/1834>)\n- CVAT doesn't offer to restore state after an error (<https://github.com/opencv/cvat/pull/1874>)\n- Cannot read property 'shapeType' of undefined because of zOrder related issues (<https://github.com/opencv/cvat/pull/1874>)\n- Cannot read property 'pinned' of undefined because of zOrder related issues (<https://github.com/opencv/cvat/pull/1874>)\n- Do not iterate over hidden objects in aam (which are invisible because of zOrder) (<https://github.com/opencv/cvat/pull/1874>)\n- Cursor position is reset after changing a text field (<https://github.com/opencv/cvat/pull/1874>)\n- Hidden points and cuboids can be selected to be grouped (<https://github.com/opencv/cvat/pull/1874>)\n- `outside` annotations should not be in exported images (<https://github.com/opencv/cvat/issues/1620>)\n- `CVAT for video format` import error with interpolation (<https://github.com/opencv/cvat/issues/1893>)\n- `Image compression` definition mismatch (<https://github.com/opencv/cvat/issues/1900>)\n- Points are duplicated during polygon interpolation sometimes (<https://github.com/opencv/cvat/pull/1892>)\n- When redraw a shape with activated autobordering, previous points are visible (<https://github.com/opencv/cvat/pull/1892>)\n- No mapping between side object element and context menu in some attributes (<https://github.com/opencv/cvat/pull/1923>)\n- Interpolated shapes exported as `keyframe = True` (<https://github.com/opencv/cvat/pull/1937>)\n- Stylelint filetype scans (<https://github.com/opencv/cvat/pull/1952>)\n- Fixed toolip closing issue (<https://github.com/opencv/cvat/pull/1955>)\n- Clearing frame cache when close a task (<https://github.com/opencv/cvat/pull/1966>)\n- Increase rate of throttling policy for unauthenticated users (<https://github.com/opencv/cvat/pull/1969>)",
"## \\[1.1.0-alpha] - 2020-06-30",
"### Added",
"- Throttling policy for unauthenticated users (<https://github.com/opencv/cvat/pull/1531>)\n- Added default label color table for mask export (<https://github.com/opencv/cvat/pull/1549>)\n- Added environment variables for Redis and Postgres hosts for Kubernetes deployment support (<https://github.com/opencv/cvat/pull/1641>)\n- Added visual identification for unavailable formats (<https://github.com/opencv/cvat/pull/1567>)\n- Shortcut to change color of an activated shape in new UI (Enter) (<https://github.com/opencv/cvat/pull/1683>)\n- Shortcut to switch split mode (<https://github.com/opencv/cvat/pull/1683>)\n- Built-in search for labels when create an object or change a label (<https://github.com/opencv/cvat/pull/1683>)\n- Better validation of labels and attributes in raw viewer (<https://github.com/opencv/cvat/pull/1727>)\n- ClamAV antivirus integration (<https://github.com/opencv/cvat/pull/1712>)\n- Added canvas background color selector (<https://github.com/opencv/cvat/pull/1705>)\n- SCSS files linting with Stylelint tool (<https://github.com/opencv/cvat/pull/1766>)\n- Supported import and export or single boxes in MOT format (<https://github.com/opencv/cvat/pull/1764>)\n- \\[Datumaro] Added `stats` command, which shows some dataset statistics\n like image mean and std (<https://github.com/opencv/cvat/pull/1734>)\n- Add option to upload annotations upon task creation on CLI\n- Polygon and polylines interpolation (<https://github.com/opencv/cvat/pull/1571>)\n- Ability to redraw shape from scratch (Shift + N) for an activated shape (<https://github.com/opencv/cvat/pull/1571>)\n- Highlights for the first point of a polygon/polyline and direction (<https://github.com/opencv/cvat/pull/1571>)\n- Ability to change orientation for poylgons/polylines in context menu (<https://github.com/opencv/cvat/pull/1571>)\n- Ability to set the first point for polygons in points context menu (<https://github.com/opencv/cvat/pull/1571>)\n- Added new tag annotation workspace (<https://github.com/opencv/cvat/pull/1570>)\n- Appearance block in attribute annotation mode (<https://github.com/opencv/cvat/pull/1820>)\n- Keyframe navigations and some switchers in attribute annotation mode (<https://github.com/opencv/cvat/pull/1820>)\n- \\[Datumaro] Added `convert` command to convert datasets directly (<https://github.com/opencv/cvat/pull/1837>)\n- \\[Datumaro] Added an option to specify image extension when exporting datasets (<https://github.com/opencv/cvat/pull/1799>)\n- \\[Datumaro] Added image copying when exporting datasets, if possible (<https://github.com/opencv/cvat/pull/1799>)",
"### Changed",
"- Removed information about e-mail from the basic user information (<https://github.com/opencv/cvat/pull/1627>)\n- Update https install manual. Makes it easier and more robust.\n Includes automatic renewing of lets encrypt certificates.\n- Settings page move to the modal. (<https://github.com/opencv/cvat/pull/1705>)\n- Implemented import and export of annotations with relative image paths (<https://github.com/opencv/cvat/pull/1463>)\n- Using only single click to start editing or remove a point (<https://github.com/opencv/cvat/pull/1571>)\n- Added support for attributes in VOC XML format (<https://github.com/opencv/cvat/pull/1792>)\n- Added annotation attributes in COCO format (<https://github.com/opencv/cvat/pull/1782>)\n- Colorized object items in the side panel (<https://github.com/opencv/cvat/pull/1753>)\n- \\[Datumaro] Annotation-less files are not generated anymore in COCO format, unless tasks explicitly requested (<https://github.com/opencv/cvat/pull/1799>)",
"### Fixed",
"- Problem with exported frame stepped image task (<https://github.com/opencv/cvat/issues/1613>)\n- Fixed dataset filter item representation for imageless dataset items (<https://github.com/opencv/cvat/pull/1593>)\n- Fixed interpreter crash when trying to import `tensorflow` with no AVX instructions available (<https://github.com/opencv/cvat/pull/1567>)\n- Kibana wrong working time calculation with new annotation UI use (<https://github.com/opencv/cvat/pull/1654>)\n- Wrong rexex for account name validation (<https://github.com/opencv/cvat/pull/1667>)\n- Wrong description on register view for the username field (<https://github.com/opencv/cvat/pull/1667>)\n- Wrong resolution for resizing a shape (<https://github.com/opencv/cvat/pull/1667>)\n- React warning because of not unique keys in labels viewer (<https://github.com/opencv/cvat/pull/1727>)\n- Fixed issue tracker (<https://github.com/opencv/cvat/pull/1705>)\n- Fixed canvas fit after sidebar open/close event (<https://github.com/opencv/cvat/pull/1705>)\n- A couple of exceptions in AAM related with early object activation (<https://github.com/opencv/cvat/pull/1755>)\n- Propagation from the latest frame (<https://github.com/opencv/cvat/pull/1800>)\n- Number attribute value validation (didn't work well with floats) (<https://github.com/opencv/cvat/pull/1800>)\n- Logout doesn't work (<https://github.com/opencv/cvat/pull/1812>)\n- Annotations aren't updated after reopening a task (<https://github.com/opencv/cvat/pull/1753>)\n- Labels aren't updated after reopening a task (<https://github.com/opencv/cvat/pull/1753>)\n- Canvas isn't fitted after collapsing side panel in attribute annotation mode (<https://github.com/opencv/cvat/pull/1753>)\n- Error when interpolating polygons (<https://github.com/opencv/cvat/pull/1878>)",
"### Security",
"- SQL injection in Django `CVE-2020-9402` (<https://github.com/opencv/cvat/pull/1657>)",
"## \\[1.0.0] - 2020-05-29",
"### Added",
"- cvat-ui: cookie policy drawer for login page (<https://github.com/opencv/cvat/pull/1511>)\n- `datumaro_project` export format (<https://github.com/opencv/cvat/pull/1352>)\n- Ability to configure user agreements for the user registration form (<https://github.com/opencv/cvat/pull/1464>)\n- Cuboid interpolation and cuboid drawing from rectangles (<https://github.com/opencv/cvat/pull/1560>)\n- Ability to configure custom pageViewHit, which can be useful for web analytics integration (<https://github.com/opencv/cvat/pull/1566>)\n- Ability to configure access to the analytics page based on roles (<https://github.com/opencv/cvat/pull/1592>)",
"### Changed",
"- Downloaded file name in annotations export became more informative (<https://github.com/opencv/cvat/pull/1352>)\n- Added auto trimming for trailing whitespaces style enforcement (<https://github.com/opencv/cvat/pull/1352>)\n- REST API: updated `GET /task/<id>/annotations`: parameters are `format`, `filename`\n (now optional), `action` (optional) (<https://github.com/opencv/cvat/pull/1352>)\n- REST API: removed `dataset/formats`, changed format of `annotation/formats` (<https://github.com/opencv/cvat/pull/1352>)\n- Exported annotations are stored for N hours instead of indefinitely (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: CVAT format now accepts ZIP and XML (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: COCO format now accepts ZIP and JSON (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: most of formats renamed, no extension in title (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: definitions are changed, are not stored in DB anymore (<https://github.com/opencv/cvat/pull/1352>)\n- cvat-core: session.annotations.put() now returns ids of added objects (<https://github.com/opencv/cvat/pull/1493>)\n- Images without annotations now also included in dataset/annotations export (<https://github.com/opencv/cvat/issues/525>)",
"### Removed",
"- `annotation` application is replaced with `dataset_manager` (<https://github.com/opencv/cvat/pull/1352>)\n- `_DATUMARO_INIT_LOGLEVEL` env. variable is removed in favor of regular `--loglevel` cli parameter (<https://github.com/opencv/cvat/pull/1583>)",
"### Fixed",
"- Categories for empty projects with no sources are taken from own dataset (<https://github.com/opencv/cvat/pull/1352>)\n- Added directory removal on error during `extract` command (<https://github.com/opencv/cvat/pull/1352>)\n- Added debug error message on incorrect XPath (<https://github.com/opencv/cvat/pull/1352>)\n- Exporting frame stepped task\n (<https://github.com/opencv/cvat/issues/1294>, <https://github.com/opencv/cvat/issues/1334>)\n- Fixed broken command line interface for `cvat` export format in Datumaro (<https://github.com/opencv/cvat/issues/1494>)\n- Updated Rest API document, Swagger document serving instruction issue (<https://github.com/opencv/cvat/issues/1495>)\n- Fixed cuboid occluded view (<https://github.com/opencv/cvat/pull/1500>)\n- Non-informative lock icon (<https://github.com/opencv/cvat/pull/1434>)\n- Sidebar in AAM has no hide/show button (<https://github.com/opencv/cvat/pull/1420>)\n- Task/Job buttons has no \"Open in new tab\" option (<https://github.com/opencv/cvat/pull/1419>)\n- Delete point context menu option has no shortcut hint (<https://github.com/opencv/cvat/pull/1416>)\n- Fixed issue with unnecessary tag activation in cvat-canvas (<https://github.com/opencv/cvat/issues/1540>)\n- Fixed an issue with large number of instances in instance mask (<https://github.com/opencv/cvat/issues/1539>)\n- Fixed full COCO dataset import error with conflicting labels in keypoints and detection (<https://github.com/opencv/cvat/pull/1548>)\n- Fixed COCO keypoints skeleton parsing and saving (<https://github.com/opencv/cvat/issues/1539>)\n- `tf.placeholder() is not compatible with eager execution` exception for auto_segmentation (<https://github.com/opencv/cvat/pull/1562>)\n- Canvas cannot be moved with move functionality on left mouse key (<https://github.com/opencv/cvat/pull/1573>)\n- Deep extreme cut request is sent when draw any shape with Make AI polygon option enabled (<https://github.com/opencv/cvat/pull/1573>)\n- Fixed an error when exporting a task with cuboids to any format except CVAT (<https://github.com/opencv/cvat/pull/1577>)\n- Synchronization with remote git repo (<https://github.com/opencv/cvat/pull/1582>)\n- A problem with mask to polygons conversion when polygons are too small (<https://github.com/opencv/cvat/pull/1581>)\n- Unable to upload video with uneven size (<https://github.com/opencv/cvat/pull/1594>)\n- Fixed an issue with `z_order` having no effect on segmentations (<https://github.com/opencv/cvat/pull/1589>)",
"### Security",
"- Permission group whitelist check for analytics view (<https://github.com/opencv/cvat/pull/1608>)",
"## \\[1.0.0-beta.2] - 2020-04-30",
"### Added",
"- Re-Identification algorithm to merging bounding boxes automatically to the new UI (<https://github.com/opencv/cvat/pull/1406>)\n- Methods `import` and `export` to import/export raw annotations for Job and Task in `cvat-core` (<https://github.com/opencv/cvat/pull/1406>)\n- Versioning of client packages (`cvat-core`, `cvat-canvas`, `cvat-ui`). Initial versions are set to 1.0.0 (<https://github.com/opencv/cvat/pull/1448>)\n- Cuboids feature was migrated from old UI to new one. (<https://github.com/opencv/cvat/pull/1451>)",
"### Removed",
"- Annotation conversion utils, currently supported natively via Datumaro framework\n (<https://github.com/opencv/cvat/pull/1477>)",
"### Fixed",
"- Auto annotation, TF annotation and Auto segmentation apps (<https://github.com/opencv/cvat/pull/1409>)\n- Import works with truncated images now: \"OSError:broken data stream\" on corrupt images\n (<https://github.com/opencv/cvat/pull/1430>)\n- Hide functionality (H) doesn't work (<https://github.com/opencv/cvat/pull/1445>)\n- The highlighted attribute doesn't correspond to the chosen attribute in AAM (<https://github.com/opencv/cvat/pull/1445>)\n- Inconvinient image shaking while drawing a polygon (hold Alt key during drawing/editing/grouping to drag an image) (<https://github.com/opencv/cvat/pull/1445>)\n- Filter property \"shape\" doesn't work and extra operator in description (<https://github.com/opencv/cvat/pull/1445>)\n- Block of text information doesn't disappear after deactivating for locked shapes (<https://github.com/opencv/cvat/pull/1445>)\n- Annotation uploading fails in annotation view (<https://github.com/opencv/cvat/pull/1445>)\n- UI freezes after canceling pasting with escape (<https://github.com/opencv/cvat/pull/1445>)\n- Duplicating keypoints in COCO export (<https://github.com/opencv/cvat/pull/1435>)\n- CVAT new UI: add arrows on a mouse cursor (<https://github.com/opencv/cvat/pull/1391>)\n- Delete point bug (in new UI) (<https://github.com/opencv/cvat/pull/1440>)\n- Fix apache startup after PC restart (<https://github.com/opencv/cvat/pull/1467>)\n- Open task button doesn't work (<https://github.com/opencv/cvat/pull/1474>)",
"## \\[1.0.0-beta.1] - 2020-04-15",
"### Added",
"- Special behaviour for attribute value `__undefined__` (invisibility, no shortcuts to be set in AAM)\n- Dialog window with some helpful information about using filters\n- Ability to display a bitmap in the new UI\n- Button to reset colors settings (brightness, saturation, contrast) in the new UI\n- Option to display shape text always\n- Dedicated message with clarifications when share is unmounted (<https://github.com/opencv/cvat/pull/1373>)\n- Ability to create one tracked point (<https://github.com/opencv/cvat/pull/1383>)\n- Ability to draw/edit polygons and polylines with automatic bordering feature\n (<https://github.com/opencv/cvat/pull/1394>)\n- Tutorial: instructions for CVAT over HTTPS\n- Deep extreme cut (semi-automatic segmentation) to the new UI (<https://github.com/opencv/cvat/pull/1398>)",
"### Changed",
"- Increase preview size of a task till 256, 256 on the server\n- Public ssh-keys are displayed in a dedicated window instead of console when create a task with a repository\n- React UI is the primary UI",
"### Fixed",
"- Cleaned up memory in Auto Annotation to enable long running tasks on videos\n- New shape is added when press `esc` when drawing instead of cancellation\n- Dextr segmentation doesn't work.\n- `FileNotFoundError` during dump after moving format files\n- CVAT doesn't append outside shapes when merge polyshapes in old UI\n- Layout sometimes shows double scroll bars on create task, dashboard and settings pages\n- UI fails after trying to change frame during resizing, dragging, editing\n- Hidden points (or outsided) are visible after changing a frame\n- Merge is allowed for points, but clicks on points conflict with frame dragging logic\n- Removed objects are visible for search\n- Add missed task_id and job_id fields into exception logs for the new UI (<https://github.com/opencv/cvat/pull/1372>)\n- UI fails when annotations saving occurs during drag/resize/edit (<https://github.com/opencv/cvat/pull/1383>)\n- Multiple savings when hold Ctrl+S (a lot of the same copies of events were sent with the same working time)\n (<https://github.com/opencv/cvat/pull/1383>)\n- UI doesn't have any reaction when git repos synchronization failed (<https://github.com/opencv/cvat/pull/1383>)\n- Bug when annotations cannot be saved after (delete - save - undo - save) (<https://github.com/opencv/cvat/pull/1383>)\n- VOC format exports Upper case labels correctly in lower case (<https://github.com/opencv/cvat/pull/1379>)\n- Fixed polygon exporting bug in COCO dataset (<https://github.com/opencv/cvat/issues/1387>)\n- Task creation from remote files (<https://github.com/opencv/cvat/pull/1392>)\n- Job cannot be opened in some cases when the previous job was failed during opening\n (<https://github.com/opencv/cvat/issues/1403>)\n- Deactivated shape is still highlighted on the canvas (<https://github.com/opencv/cvat/issues/1403>)\n- AttributeError: 'tuple' object has no attribute 'read' in ReID algorithm (<https://github.com/opencv/cvat/issues/1403>)\n- Wrong semi-automatic segmentation near edges of an image (<https://github.com/opencv/cvat/issues/1403>)\n- Git repos paths (<https://github.com/opencv/cvat/pull/1400>)\n- Uploading annotations for tasks with multiple jobs (<https://github.com/opencv/cvat/pull/1396>)",
"## \\[1.0.0-alpha] - 2020-03-31",
"### Added",
"- Data streaming using chunks (<https://github.com/opencv/cvat/pull/1007>)\n- New UI: showing file names in UI (<https://github.com/opencv/cvat/pull/1311>)\n- New UI: delete a point from context menu (<https://github.com/opencv/cvat/pull/1292>)",
"### Fixed",
"- Git app cannot clone a repository (<https://github.com/opencv/cvat/pull/1330>)\n- New UI: preview position in task details (<https://github.com/opencv/cvat/pull/1312>)\n- AWS deployment (<https://github.com/opencv/cvat/pull/1316>)",
"## \\[0.6.1] - 2020-03-21",
"### Changed",
"- VOC task export now does not use official label map by default, but takes one\n from the source task to avoid primary-class and class part name\n clashing ([#1275](https://github.com/opencv/cvat/issues/1275))",
"### Fixed",
"- File names in LabelMe format export are no longer truncated ([#1259](https://github.com/opencv/cvat/issues/1259))\n- `occluded` and `z_order` annotation attributes are now correctly passed to Datumaro ([#1271](https://github.com/opencv/cvat/pull/1271))\n- Annotation-less tasks now can be exported as empty datasets in COCO ([#1277](https://github.com/opencv/cvat/issues/1277))\n- Frame name matching for video annotations import -\n allowed `frame_XXXXXX[.ext]` format ([#1274](https://github.com/opencv/cvat/pull/1274))",
"### Security",
"- Bump acorn from 6.3.0 to 6.4.1 in /cvat-ui ([#1270](https://github.com/opencv/cvat/pull/1270))",
"## \\[0.6.0] - 2020-03-15",
"### Added",
"- Server only support for projects. Extend REST API v1 (/api/v1/projects\\*)\n- Ability to get basic information about users without admin permissions ([#750](https://github.com/opencv/cvat/issues/750))\n- Changed REST API: removed PUT and added DELETE methods for /api/v1/users/ID\n- Mask-RCNN Auto Annotation Script in OpenVINO format\n- Yolo Auto Annotation Script\n- Auto segmentation using Mask_RCNN component (Keras+Tensorflow Mask R-CNN Segmentation)\n- REST API to export an annotation task (images + annotations)\n [Datumaro](https://github.com/opencv/cvat/tree/develop/datumaro) -\n a framework to build, analyze, debug and visualize datasets\n- Text Detection Auto Annotation Script in OpenVINO format for version 4\n- Added in OpenVINO Semantic Segmentation for roads\n- Ability to visualize labels when using Auto Annotation runner\n- MOT CSV format support ([#830](https://github.com/opencv/cvat/pull/830))\n- LabelMe format support ([#844](https://github.com/opencv/cvat/pull/844))\n- Segmentation MASK format import (as polygons) ([#1163](https://github.com/opencv/cvat/pull/1163))\n- Git repositories can be specified with IPv4 address ([#827](https://github.com/opencv/cvat/pull/827))",
"### Changed",
"- page_size parameter for all REST API methods\n- React & Redux & Antd based dashboard\n- Yolov3 interpretation script fix and changes to mapping.json\n- YOLO format support ([#1151](https://github.com/opencv/cvat/pull/1151))\n- Added support for OpenVINO 2020",
"### Fixed",
"- Exception in Git plugin [#826](https://github.com/opencv/cvat/issues/826)\n- Label ids in TFrecord format now start from 1 [#866](https://github.com/opencv/cvat/issues/866)\n- Mask problem in COCO JSON style [#718](https://github.com/opencv/cvat/issues/718)\n- Datasets (or tasks) can be joined and split to subsets with Datumaro [#791](https://github.com/opencv/cvat/issues/791)\n- Output labels for VOC format can be specified with Datumaro [#942](https://github.com/opencv/cvat/issues/942)\n- Annotations can be filtered before dumping with Datumaro [#994](https://github.com/opencv/cvat/issues/994)",
"## \\[0.5.2] - 2019-12-15",
"### Fixed",
"- Frozen version of scikit-image==0.15 in requirements.txt because next releases don't support Python 3.5",
"## \\[0.5.1] - 2019-10-17",
"### Added",
"- Integration with Zenodo.org (DOI)",
"## \\[0.5.0] - 2019-09-12",
"### Added",
"- A converter to YOLO format\n- Installation guide\n- Linear interpolation for a single point\n- Video frame filter\n- Running functional tests for REST API during a build\n- Admins are no longer limited to a subset of python commands in the auto annotation application\n- Remote data source (list of URLs to create an annotation task)\n- Auto annotation using Faster R-CNN with Inception v2 (utils/open_model_zoo)\n- Auto annotation using Pixel Link mobilenet v2 - text detection (utils/open_model_zoo)\n- Ability to create a custom extractors for unsupported media types\n- Added in PDF extractor\n- Added in a command line model manager tester\n- Ability to dump/load annotations in several formats from UI (CVAT, Pascal VOC, YOLO, MS COCO, png mask, TFRecord)\n- Auth for REST API (api/v1/auth/): login, logout, register, ...\n- Preview for the new CVAT UI (dashboard only) is available: <http://localhost:9080/>\n- Added command line tool for performing common task operations (/utils/cli/)",
"### Changed",
"- Outside and keyframe buttons in the side panel for all interpolation shapes (they were only for boxes before)\n- Improved error messages on the client side (#511)",
"### Removed",
"- \"Flip images\" has been removed. UI now contains rotation features.",
"### Fixed",
"- Incorrect width of shapes borders in some cases\n- Annotation parser for tracks with a start frame less than the first segment frame\n- Interpolation on the server near outside frames\n- Dump for case when task name has a slash\n- Auto annotation fail for multijob tasks\n- Installation of CVAT with OpenVINO on the Windows platform\n- Background color was always black in utils/mask/converter.py\n- Exception in attribute annotation mode when a label are switched to a value without any attributes\n- Handling of wrong labelamp json file in auto annotation (<https://github.com/opencv/cvat/issues/554>)\n- No default attributes in dumped annotation (<https://github.com/opencv/cvat/issues/601>)\n- Required field \"Frame Filter\" on admin page during a task modifying (#666)\n- Dump annotation errors for a task with several segments (#610, #500)\n- Invalid label parsing during a task creating (#628)\n- Button \"Open Task\" in the annotation view\n- Creating a video task with 0 overlap",
"### Security",
"- Upgraded Django, djangorestframework, and other packages",
"## \\[0.4.2] - 2019-06-03",
"### Fixed",
"- Fixed interaction with the server share in the auto annotation plugin",
"## \\[0.4.1] - 2019-05-14",
"### Fixed",
"- JavaScript syntax incompatibility with Google Chrome versions less than 72",
"## \\[0.4.0] - 2019-05-04",
"### Added",
"- OpenVINO auto annotation: it is possible to upload a custom model and annotate images automatically.\n- Ability to rotate images/video in the client part (Ctrl+R, Shift+Ctrl+R shortcuts) (#305)\n- The ReID application for automatic bounding box merging has been added (#299)\n- Keyboard shortcuts to switch next/previous default shape type (box, polygon etc) (Alt + <, Alt + >) (#316)\n- Converter for VOC now supports interpolation tracks\n- REST API (/api/v1/\\*, /api/docs)\n- Semi-automatic semantic segmentation with the [Deep Extreme Cut](http://www.vision.ee.ethz.ch/~cvlsegmentation/dextr/) work",
"### Changed",
"- Propagation setup has been moved from settings to bottom player panel\n- Additional events like \"Debug Info\" or \"Fit Image\" have been added for analitics\n- Optional using LFS for git annotation storages (#314)",
"### Deprecated",
"- \"Flip images\" flag in the create task dialog will be removed.\n Rotation functionality in client part have been added instead.",
"### Fixed",
"- Django 2.1.5 (security fix, [CVE-2019-3498](https://nvd.nist.gov/vuln/detail/CVE-2019-3498))\n- Several scenarious which cause code 400 after undo/redo/save have been fixed (#315)",
"## \\[0.3.0] - 2018-12-29",
"### Added",
"- Ability to copy Object URL and Frame URL via object context menu and player context menu respectively.\n- Ability to change opacity for selected shape with help \"Selected Fill Opacity\" slider.\n- Ability to remove polyshapes points by double click.\n- Ability to draw/change polyshapes (except for points) by slip method. Just press ENTER and moving a cursor.\n- Ability to switch lock/hide properties via label UI element (in right menu) for all objects with same label.\n- Shortcuts for outside/keyframe properties\n- Support of Intel OpenVINO for accelerated model inference\n- Tensorflow annotation now works without CUDA. It can use CPU only. OpenVINO and CUDA are supported optionally.\n- Incremental saving of annotations.\n- Tutorial for using polygons (screencast)\n- Silk profiler to improve development process\n- Admin panel can be used to edit labels and attributes for annotation tasks\n- Analytics component to manage a data annotation team, monitor exceptions, collect client and server logs\n- Changeable job and task statuses (annotation, validation, completed).\n A job status can be changed manually, a task status is computed automatically based on job statuses (#153)\n- Backlink to a task from its job annotation view (#156)\n- Buttons lock/hide for labels. They work for all objects with the same label on a current frame (#116)",
"### Changed",
"- Polyshape editing method has been improved. You can redraw part of shape instead of points cloning.\n- Unified shortcut (Esc) for close any mode instead of different shortcuts (Alt+N, Alt+G, Alt+M etc.).\n- Dump file contains information about data source (e.g. video name, archive name, ...)\n- Update requests library due to [CVE-2018-18074](https://nvd.nist.gov/vuln/detail/CVE-2018-18074)\n- Per task/job permissions to create/access/change/delete tasks and annotations\n- Documentation was improved\n- Timeout for creating tasks was increased (from 1h to 4h) (#136)\n- Drawing has become more convenience. Now it is possible to draw outside an image.\n Shapes will be automatically truncated after drawing process (#202)",
"### Fixed",
"- Performance bottleneck has been fixed during you create new objects (draw, copy, merge etc).\n- Label UI elements aren't updated after changelabel.\n- Attribute annotation mode can use invalid shape position after resize or move shapes.\n- Labels order is preserved now (#242)\n- Uploading large XML files (#123)\n- Django vulnerability (#121)\n- Grammatical cleanup of README.md (#107)\n- Dashboard loading has been accelerated (#156)\n- Text drawing outside of a frame in some cases (#202)",
"## \\[0.2.0] - 2018-09-28",
"### Added",
"- New annotation shapes: polygons, polylines, points\n- Undo/redo feature\n- Grid to estimate size of objects\n- Context menu for shapes\n- A converter to PASCAL VOC format\n- A converter to MS COCO format\n- A converter to mask format\n- License header for most of all files\n- .gitattribute to avoid problems with bash scripts inside a container\n- CHANGELOG.md itself\n- Drawing size of a bounding box during resize\n- Color by instance, group, label\n- Group objects\n- Object propagation on next frames\n- Full screen view",
"### Changed",
"- Documentation, screencasts, the primary screenshot\n- Content-type for save_job request is application/json",
"### Fixed",
"- Player navigation if the browser's window is scrolled\n- Filter doesn't support dash (-)\n- Several memory leaks\n- Inconsistent extensions between filenames in an annotation file and real filenames",
"## \\[0.1.2] - 2018-08-07",
"### Added",
"- 7z archive support when creating a task\n- .vscode/launch.json file for developing with VS code",
"### Fixed",
"- #14: docker-compose down command as written in the readme does not remove volumes\n- #15: all checkboxes in temporary attributes are checked when reopening job after saving the job\n- #18: extend CONTRIBUTING.md\n- #19: using the same attribute for label twice -> stuck",
"### Changed",
"- More strict verification for labels with attributes",
"## \\[0.1.1] - 2018-07-6",
"### Added",
"- Links on a screenshot, documentation, screencasts into README.md\n- CONTRIBUTORS.md",
"### Fixed",
"- GitHub documentation",
"## \\[0.1.0] - 2018-06-29",
"### Added",
"- Initial version",
"## Template",
"```\n## \\[Unreleased]\n### Added\n- TDB",
"### Changed\n- TDB",
"### Deprecated\n- TDB",
"### Removed\n- TDB",
"### Fixed\n- TDB",
"### Security\n- TDB\n```"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [83, 212, 54], "buggy_code_start_loc": [83, 8, 54], "filenames": ["CHANGELOG.md", "cvat/apps/engine/task.py", "cvat/requirements/base.txt"], "fixing_code_end_loc": [85, 256, 56], "fixing_code_start_loc": [84, 9, 55], "message": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cvat:cvat:*:*:*:*:*:*:*:*", "matchCriteriaId": "29D76D4E-B25E-4AE9-86EC-887059DBA160", "versionEndExcluding": "2.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "CVAT es una herramienta de anotaci\u00f3n de v\u00eddeo e imagen interactiva de c\u00f3digo abierto para la visi\u00f3n por ordenador. Las versiones anteriores a 2.0.0, est\u00e1n sujetas a una vulnerabilidad de tipo Server-side request forgery (SSRF). Ha sido a\u00f1adida la comprobaci\u00f3n de las urls usadas en la ruta de c\u00f3digo afectada en versi\u00f3n 2.0.0. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31188", "lastModified": "2022-12-08T22:35:16.617", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 8.6, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 4.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-08-01T20:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/169814/CVAT-2.0-Server-Side-Request-Forgery.html"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/security/advisories/GHSA-7vpj-j5xv-29pr"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, "type": "CWE-918"}
| 93
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# Changelog",
"All notable changes to this project will be documented in this file.",
"The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).",
"## \\[2.0.0] - Unreleased\n### Added\n- Handle attributes comming from nuclio detectors (<https://github.com/openvinotoolkit/cvat/pull/3917>)\n- Add additional environment variables for Nuclio configuration (<https://github.com/openvinotoolkit/cvat/pull/3894>)\n- Add KITTI segmentation and detection format (<https://github.com/openvinotoolkit/cvat/pull/3757>)\n- Add LFW format (<https://github.com/openvinotoolkit/cvat/pull/3770>)\n- Add Cityscapes format (<https://github.com/openvinotoolkit/cvat/pull/3758>)\n- Add Open Images V6 format (<https://github.com/openvinotoolkit/cvat/pull/3679>)\n- Rotated bounding boxes (<https://github.com/openvinotoolkit/cvat/pull/3832>)\n- Player option: Smooth image when zoom-in, enabled by default (<https://github.com/openvinotoolkit/cvat/pull/3933>)\n- Google Cloud Storage support in UI (<https://github.com/openvinotoolkit/cvat/pull/3919>)\n- Add project tasks paginations (<https://github.com/openvinotoolkit/cvat/pull/3910>)\n- Add remove issue button (<https://github.com/openvinotoolkit/cvat/pull/3952>)\n- Data sorting option (<https://github.com/openvinotoolkit/cvat/pull/3937>)\n- Options to change font size & position of text labels on the canvas (<https://github.com/openvinotoolkit/cvat/pull/3972>)\n- Add \"tag\" return type for automatic annotation in Nuclio (<https://github.com/openvinotoolkit/cvat/pull/3896>)\n- Helm chart: Make user-data-permission-fix optional (<https://github.com/openvinotoolkit/cvat/pull/3994>)\n- Advanced identity access management system, using open policy agent (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Organizations to create \"shared space\" for different groups of users (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Dataset importing to a project (<https://github.com/openvinotoolkit/cvat/pull/3790>)\n- User is able to customize information that text labels show (<https://github.com/openvinotoolkit/cvat/pull/4029>)\n- Support for uploading manifest with any name (<https://github.com/openvinotoolkit/cvat/pull/4041>)\n- Added information about OpenVINO toolkit to login page (<https://github.com/openvinotoolkit/cvat/pull/4077>)\n- Support for working with ellipses (<https://github.com/openvinotoolkit/cvat/pull/4062>)\n- Add several flags to task creation CLI (<https://github.com/openvinotoolkit/cvat/pull/4119>)\n- Add YOLOv5 serverless function for automatic annotation (<https://github.com/openvinotoolkit/cvat/pull/4178>)\n- Add possibility to change git repository and git export format from already created task (<https://github.com/openvinotoolkit/cvat/pull/3886>)\n- Basic page with jobs list, basic filtration to this list (<https://github.com/openvinotoolkit/cvat/pull/4258>)\n- Added OpenCV.js TrackerMIL as tracking tool (<https://github.com/openvinotoolkit/cvat/pull/4200>)\n- Ability to continue working from the latest frame where an annotator was before (<https://github.com/openvinotoolkit/cvat/pull/4297>)\n- `GET /api/jobs/<id>/commits` was implemented (<https://github.com/openvinotoolkit/cvat/pull/4368>)\n- Advanced filtration and sorting for a list of jobs (<https://github.com/openvinotoolkit/cvat/pull/4319>)",
"### Changed\n- Users don't have access to a task object anymore if they are assigneed only on some jobs of the task (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Different resources (tasks, projects) are not visible anymore for all CVAT instance users by default (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- API versioning scheme: using accept header versioning instead of namespace versioning (<https://github.com/openvinotoolkit/cvat/pull/4239>)\n- Replaced 'django_sendfile' with 'django_sendfile2' (<https://github.com/openvinotoolkit/cvat/pull/4267>)\n- Use drf-spectacular instead of drf-yasg for swagger documentation (<https://github.com/openvinotoolkit/cvat/pull/4210>)",
"### Deprecated\n- Job field \"status\" is not used in UI anymore, but it has not been removed from the database yet (<https://github.com/openvinotoolkit/cvat/pull/3788>)",
"### Removed\n- Review rating, reviewer field from the job instance (use assignee field together with stage field instead) (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Training django app (<https://github.com/openvinotoolkit/cvat/pull/4330>)\n- v1 api version support (<https://github.com/openvinotoolkit/cvat/pull/4332>)",
"### Fixed\n- Fixed Interaction handler keyboard handlers (<https://github.com/openvinotoolkit/cvat/pull/3881>)\n- Points of invisible shapes are visible in autobordering (<https://github.com/openvinotoolkit/cvat/pull/3931>)\n- Order of the label attributes in the object item details(<https://github.com/openvinotoolkit/cvat/pull/3945>)\n- Order of labels in tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/3987>)\n- Fixed task creating with large files via webpage (<https://github.com/openvinotoolkit/cvat/pull/3692>)\n- Added information to export CVAT_HOST when performing local installation for accessing over network (<https://github.com/openvinotoolkit/cvat/pull/4014>)\n- Fixed possible color collisions in the generated colormap (<https://github.com/openvinotoolkit/cvat/pull/4007>)\n- Original pdf file is deleted when using share (<https://github.com/openvinotoolkit/cvat/pull/3967>)\n- Order in an annotation file(<https://github.com/openvinotoolkit/cvat/pull/4087>)\n- Fixed task data upload progressbar (<https://github.com/openvinotoolkit/cvat/pull/4134>)\n- Email in org invitations is case sensitive (<https://github.com/openvinotoolkit/cvat/pull/4153>)\n- Caching for tasks and jobs can lead to an exception if its assignee user is removed (<https://github.com/openvinotoolkit/cvat/pull/4165>)\n- Added intelligent function when paste labels to another task (<https://github.com/openvinotoolkit/cvat/pull/4161>)\n- Uncaught TypeError: this.el.node.getScreenCTM() is null in Firefox (<https://github.com/openvinotoolkit/cvat/pull/4175>)\n- Bug: canvas is busy when start playing, start resizing a shape and do not release the mouse cursor (<https://github.com/openvinotoolkit/cvat/pull/4151>)\n- Bug: could not receive frame N. TypeError: Cannot read properties of undefined (reding \"filename\") (<https://github.com/openvinotoolkit/cvat/pull/4187>)\n- Cannot choose a dataset format for a linked repository if a task type is annotation (<https://github.com/openvinotoolkit/cvat/pull/4203>)\n- Fixed tus upload error over https (<https://github.com/openvinotoolkit/cvat/pull/4154>)\n- Issues disappear when rescale a browser (<https://github.com/openvinotoolkit/cvat/pull/4189>)\n- Auth token key is not returned when registering without email verification (<https://github.com/openvinotoolkit/cvat/pull/4092>)\n- Error in create project from backup for standard 3D annotation (<https://github.com/openvinotoolkit/cvat/pull/4160>)\n- Annotations search does not work correctly in some corner cases (when use complex properties with width, height) (<https://github.com/openvinotoolkit/cvat/pull/4198>)\n- Kibana requests are not proxied due to django-revproxy incompatibility with Django >3.2.x (<https://github.com/openvinotoolkit/cvat/issues/4085>)\n- Content type for getting frame with tasks/{id}/data/ endpoint (<https://github.com/openvinotoolkit/cvat/pull/4333>)",
"### Security\n- Updated ELK to 6.8.23 which uses log4j 2.17.1 (<https://github.com/openvinotoolkit/cvat/pull/4206>)",
"- Added validation for URLs which used as remote data source (<https://github.com/openvinotoolkit/cvat/pull/4387>)",
"\n## \\[1.7.0] - 2021-11-15",
"### Added",
"- cvat-ui: support cloud storages (<https://github.com/openvinotoolkit/cvat/pull/3372>)\n- interactor: add HRNet interactive segmentation serverless function (<https://github.com/openvinotoolkit/cvat/pull/3740>)\n- Added GPU implementation for SiamMask, reworked tracking approach (<https://github.com/openvinotoolkit/cvat/pull/3571>)\n- Progress bar for manifest creating (<https://github.com/openvinotoolkit/cvat/pull/3712>)\n- IAM: Open Policy Agent integration (<https://github.com/openvinotoolkit/cvat/pull/3788>)\n- Add a tutorial on attaching cloud storage AWS-S3 (<https://github.com/openvinotoolkit/cvat/pull/3745>)\n and Azure Blob Container (<https://github.com/openvinotoolkit/cvat/pull/3778>)\n- The feature to remove annotations in a specified range of frames (<https://github.com/openvinotoolkit/cvat/pull/3617>)\n- Project backup/restore (<https://github.com/openvinotoolkit/cvat/pull/3852>)",
"### Changed",
"- UI tracking has been reworked (<https://github.com/openvinotoolkit/cvat/pull/3571>)\n- Updated Django till 3.2.7 (automatic AppConfig discovery)\n- Manifest generation: Reduce creating time (<https://github.com/openvinotoolkit/cvat/pull/3712>)\n- Migration from NPM 6 to NPM 7 (<https://github.com/openvinotoolkit/cvat/pull/3773>)\n- Update Datumaro dependency to 0.2.0 (<https://github.com/openvinotoolkit/cvat/pull/3813>)",
"### Fixed",
"- Fixed JSON transform issues in network requests (<https://github.com/openvinotoolkit/cvat/pull/3706>)\n- Display a more user-friendly exception message (<https://github.com/openvinotoolkit/cvat/pull/3721>)\n- Exception `DataCloneError: The object could not be cloned` (<https://github.com/openvinotoolkit/cvat/pull/3733>)\n- Fixed extension comparison in task frames CLI (<https://github.com/openvinotoolkit/cvat/pull/3674>)\n- Incorrect work when copy job list with \"Copy\" button (<https://github.com/openvinotoolkit/cvat/pull/3749>)\n- Iterating over manifest (<https://github.com/openvinotoolkit/cvat/pull/3792>)\n- Manifest removing (<https://github.com/openvinotoolkit/cvat/pull/3791>)\n- Fixed project updated date (<https://github.com/openvinotoolkit/cvat/pull/3814>)\n- Fixed dextr deployment (<https://github.com/openvinotoolkit/cvat/pull/3820>)\n- Migration of `dataset_repo` application (<https://github.com/openvinotoolkit/cvat/pull/3827>)\n- Helm settings for external psql database were unused by backend (<https://github.com/openvinotoolkit/cvat/pull/3779>)\n- Updated WSL setup for development (<https://github.com/openvinotoolkit/cvat/pull/3828>)\n- Helm chart config (<https://github.com/openvinotoolkit/cvat/pull/3784>)",
"### Security",
"- Fix security issues on the documentation website unsafe use of target blank\n and potential clickjacking on legacy browsers (<https://github.com/openvinotoolkit/cvat/pull/3789>)",
"## \\[1.6.0] - 2021-09-17",
"### Added",
"- Added ability to import data from share with cli without copying the data (<https://github.com/openvinotoolkit/cvat/issues/2862>)\n- Notification if the browser does not support nesassary API\n- Added ability to export project as a dataset (<https://github.com/openvinotoolkit/cvat/pull/3365>)\n and project with 3D tasks (<https://github.com/openvinotoolkit/cvat/pull/3502>)\n- Additional inline tips in interactors with demo gifs (<https://github.com/openvinotoolkit/cvat/pull/3473>)\n- Added intelligent scissors blocking feature (<https://github.com/openvinotoolkit/cvat/pull/3510>)\n- Support cloud storage status (<https://github.com/openvinotoolkit/cvat/pull/3386>)\n- Support cloud storage preview (<https://github.com/openvinotoolkit/cvat/pull/3386>)\n- cvat-core: support cloud storages (<https://github.com/openvinotoolkit/cvat/pull/3313>)",
"### Changed",
"- Non-blocking UI when using interactors (<https://github.com/openvinotoolkit/cvat/pull/3473>)\n- \"Selected opacity\" slider now defines opacity level for shapes being drawnSelected opacity (<https://github.com/openvinotoolkit/cvat/pull/3473>)\n- Cloud storage creating and updating (<https://github.com/openvinotoolkit/cvat/pull/3386>)\n- Way of working with cloud storage content (<https://github.com/openvinotoolkit/cvat/pull/3386>)",
"### Removed",
"- Support TEMP_KEY_SECRET_KEY_TOKEN_SET for AWS S3 cloud storage (<https://github.com/openvinotoolkit/cvat/pull/3386>)",
"### Fixed",
"- Fixed multiple tasks moving (<https://github.com/openvinotoolkit/cvat/pull/3517>)\n- Fixed task creating CLI parameter (<https://github.com/openvinotoolkit/cvat/pull/3519>)\n- Fixed import for MOTS format (<https://github.com/openvinotoolkit/cvat/pull/3612>)",
"## \\[1.5.0] - 2021-08-02",
"### Added",
"- Support of context images for 2D image tasks (<https://github.com/openvinotoolkit/cvat/pull/3122>)\n- Support of cloud storage without copying data into CVAT: server part (<https://github.com/openvinotoolkit/cvat/pull/2620>)\n- Filter `is_active` for user list (<https://github.com/openvinotoolkit/cvat/pull/3235>)\n- Ability to export/import tasks (<https://github.com/openvinotoolkit/cvat/pull/3056>)\n- Add a tutorial for semi-automatic/automatic annotation (<https://github.com/openvinotoolkit/cvat/pull/3124>)\n- Explicit \"Done\" button when drawing any polyshapes (<https://github.com/openvinotoolkit/cvat/pull/3417>)\n- Histogram equalization with OpenCV javascript (<https://github.com/openvinotoolkit/cvat/pull/3447>)\n- Client-side polyshapes approximation when using semi-automatic interactors & scissors (<https://github.com/openvinotoolkit/cvat/pull/3450>)\n- Support of Google Cloud Storage for cloud storage (<https://github.com/openvinotoolkit/cvat/pull/3561>)",
"### Changed",
"- Updated manifest format, added meta with related images (<https://github.com/openvinotoolkit/cvat/pull/3122>)\n- Update of COCO format documentation (<https://github.com/openvinotoolkit/cvat/pull/3197>)\n- Updated Webpack Dev Server config to add proxy (<https://github.com/openvinotoolkit/cvat/pull/3368>)\n- Update to Django 3.1.12 (<https://github.com/openvinotoolkit/cvat/pull/3378>)\n- Updated visibility for removable points in AI tools (<https://github.com/openvinotoolkit/cvat/pull/3417>)\n- Updated UI handling for IOG serverless function (<https://github.com/openvinotoolkit/cvat/pull/3417>)\n- Changed Nginx proxy to Traefik in `docker-compose.yml` (<https://github.com/openvinotoolkit/cvat/pull/3409>)\n- Simplify the process of deploying CVAT with HTTPS (<https://github.com/openvinotoolkit/cvat/pull/3409>)",
"### Fixed",
"- Project page requests took a long time and did many DB queries (<https://github.com/openvinotoolkit/cvat/pull/3223>)\n- Fixed Python 3.6 support (<https://github.com/openvinotoolkit/cvat/pull/3258>)\n- Incorrect attribute import in tracks (<https://github.com/openvinotoolkit/cvat/pull/3229>)\n- Issue \"is not a constructor\" when create object, save, undo, save, redo save (<https://github.com/openvinotoolkit/cvat/pull/3292>)\n- Fix CLI create an infinite loop if git repository responds with failure (<https://github.com/openvinotoolkit/cvat/pull/3267>)\n- Bug with sidebar & fullscreen (<https://github.com/openvinotoolkit/cvat/pull/3289>)\n- 504 Gateway Time-out on `data/meta` requests (<https://github.com/openvinotoolkit/cvat/pull/3269>)\n- TypeError: Cannot read property 'clientX' of undefined when draw cuboids with hotkeys (<https://github.com/openvinotoolkit/cvat/pull/3308>)\n- Duplication of the cuboids when redraw them (<https://github.com/openvinotoolkit/cvat/pull/3308>)\n- Some code issues in Deep Extreme Cut handler code (<https://github.com/openvinotoolkit/cvat/pull/3325>)\n- UI fails when inactive user is assigned to a task/job (<https://github.com/openvinotoolkit/cvat/pull/3343>)\n- Calculate precise progress of decoding a video file (<https://github.com/openvinotoolkit/cvat/pull/3381>)\n- Falsely successful `cvat_ui` image build in case of OOM error that leads to the default nginx welcome page\n (<https://github.com/openvinotoolkit/cvat/pull/3379>)\n- Fixed issue when save filtered object in AAM (<https://github.com/openvinotoolkit/cvat/pull/3401>)\n- Context image disappears after undo/redo (<https://github.com/openvinotoolkit/cvat/pull/3416>)\n- Using combined data sources (directory and image) when create a task (<https://github.com/openvinotoolkit/cvat/pull/3424>)\n- Creating task with labels in project (<https://github.com/openvinotoolkit/cvat/pull/3454>)\n- Move task and autoannotation modals were invisible from project page (<https://github.com/openvinotoolkit/cvat/pull/3475>)",
"## \\[1.4.0] - 2021-05-18",
"### Added",
"- Documentation on mask annotation (<https://github.com/openvinotoolkit/cvat/pull/3044>)\n- Hotkeys to switch a label of existing object or to change default label (for objects created with N) (<https://github.com/openvinotoolkit/cvat/pull/3070>)\n- A script to convert some kinds of DICOM files to regular images (<https://github.com/openvinotoolkit/cvat/pull/3095>)\n- Helm chart prototype (<https://github.com/openvinotoolkit/cvat/pull/3102>)\n- Initial implementation of moving tasks between projects (<https://github.com/openvinotoolkit/cvat/pull/3164>)",
"### Changed",
"- Place of migration logger initialization (<https://github.com/openvinotoolkit/cvat/pull/3170>)",
"### Removed",
"- Kubernetes templates from (<https://github.com/openvinotoolkit/cvat/pull/1962>) due to helm charts (<https://github.com/openvinotoolkit/cvat/pull/3171>)",
"### Fixed",
"- Export of instance masks with holes (<https://github.com/openvinotoolkit/cvat/pull/3044>)\n- Changing a label on canvas does not work when 'Show object details' enabled (<https://github.com/openvinotoolkit/cvat/pull/3084>)\n- Make sure frame unzip web worker correctly terminates after unzipping all images in a requested chunk (<https://github.com/openvinotoolkit/cvat/pull/3096>)\n- Reset password link was unavailable before login (<https://github.com/openvinotoolkit/cvat/pull/3140>)\n- Manifest: migration (<https://github.com/openvinotoolkit/cvat/pull/3146>)\n- Fixed cropping polygon in some corner cases (<https://github.com/openvinotoolkit/cvat/pull/3184>)",
"## \\[1.3.0] - 3/31/2021",
"### Added",
"- CLI: Add support for saving annotations in a git repository when creating a task.\n- CVAT-3D: support lidar data on the server side (<https://github.com/openvinotoolkit/cvat/pull/2534>)\n- GPU support for Mask-RCNN and improvement in its deployment time (<https://github.com/openvinotoolkit/cvat/pull/2714>)\n- CVAT-3D: Load all frames corresponding to the job instance\n (<https://github.com/openvinotoolkit/cvat/pull/2645>)\n- Intelligent scissors with OpenCV javascript (<https://github.com/openvinotoolkit/cvat/pull/2689>)\n- CVAT-3D: Visualize 3D point cloud spaces in 3D View, Top View Side View and Front View (<https://github.com/openvinotoolkit/cvat/pull/2768>)\n- [Inside Outside Guidance](https://github.com/shiyinzhang/Inside-Outside-Guidance) serverless\n function for interactive segmentation\n- Pre-built [cvat_server](https://hub.docker.com/r/openvino/cvat_server) and\n [cvat_ui](https://hub.docker.com/r/openvino/cvat_ui) images were published on DockerHub (<https://github.com/openvinotoolkit/cvat/pull/2766>)\n- Project task subsets (<https://github.com/openvinotoolkit/cvat/pull/2774>)\n- Kubernetes templates and guide for their deployment (<https://github.com/openvinotoolkit/cvat/pull/1962>)\n- [WiderFace](http://shuoyang1213.me/WIDERFACE/) format support (<https://github.com/openvinotoolkit/cvat/pull/2864>)\n- [VGGFace2](https://github.com/ox-vgg/vgg_face2) format support (<https://github.com/openvinotoolkit/cvat/pull/2865>)\n- [Backup/Restore guide](cvat/apps/documentation/backup_guide.md) (<https://github.com/openvinotoolkit/cvat/pull/2964>)\n- Label deletion from tasks and projects (<https://github.com/openvinotoolkit/cvat/pull/2881>)\n- CVAT-3D: Implemented initial cuboid placement in 3D View and select cuboid in Top, Side and Front views\n (<https://github.com/openvinotoolkit/cvat/pull/2891>)\n- [Market-1501](https://www.aitribune.com/dataset/2018051063) format support (<https://github.com/openvinotoolkit/cvat/pull/2869>)\n- Ability of upload manifest for dataset with images (<https://github.com/openvinotoolkit/cvat/pull/2763>)\n- Annotations filters UI using react-awesome-query-builder (<https://github.com/openvinotoolkit/cvat/issues/1418>)\n- Storing settings in local storage to keep them between browser sessions (<https://github.com/openvinotoolkit/cvat/pull/3017>)\n- [ICDAR](https://rrc.cvc.uab.es/?ch=2) format support (<https://github.com/openvinotoolkit/cvat/pull/2866>)\n- Added switcher to maintain polygon crop behavior (<https://github.com/openvinotoolkit/cvat/pull/3021>\n- Filters and sorting options for job list, added tooltip for tasks filters (<https://github.com/openvinotoolkit/cvat/pull/3030>)",
"### Changed",
"- CLI - task list now returns a list of current tasks. (<https://github.com/openvinotoolkit/cvat/pull/2863>)\n- Updated HTTPS install README section (cleanup and described more robust deploy)\n- Logstash is improved for using with configurable elasticsearch outputs (<https://github.com/openvinotoolkit/cvat/pull/2531>)\n- Bumped nuclio version to 1.5.16 (<https://github.com/openvinotoolkit/cvat/pull/2578>)\n- All methods for interactive segmentation accept negative points as well\n- Persistent queue added to logstash (<https://github.com/openvinotoolkit/cvat/pull/2744>)\n- Improved maintenance of popups visibility (<https://github.com/openvinotoolkit/cvat/pull/2809>)\n- Image visualizations settings on canvas for faster access (<https://github.com/openvinotoolkit/cvat/pull/2872>)\n- Better scale management of left panel when screen is too small (<https://github.com/openvinotoolkit/cvat/pull/2880>)\n- Improved error messages for annotation import (<https://github.com/openvinotoolkit/cvat/pull/2935>)\n- Using manifest support instead video meta information and dummy chunks (<https://github.com/openvinotoolkit/cvat/pull/2763>)",
"### Fixed",
"- More robust execution of nuclio GPU functions by limiting the GPU memory consumption per worker (<https://github.com/openvinotoolkit/cvat/pull/2714>)\n- Kibana startup initialization (<https://github.com/openvinotoolkit/cvat/pull/2659>)\n- The cursor jumps to the end of the line when renaming a task (<https://github.com/openvinotoolkit/cvat/pull/2669>)\n- SSLCertVerificationError when remote source is used (<https://github.com/openvinotoolkit/cvat/pull/2683>)\n- Fixed filters select overflow (<https://github.com/openvinotoolkit/cvat/pull/2614>)\n- Fixed tasks in project auto annotation (<https://github.com/openvinotoolkit/cvat/pull/2725>)\n- Cuboids are missed in annotations statistics (<https://github.com/openvinotoolkit/cvat/pull/2704>)\n- The list of files attached to the task is not displayed (<https://github.com/openvinotoolkit/cvat/pull/2706>)\n- A couple of css-related issues (top bar disappear, wrong arrow position on collapse elements) (<https://github.com/openvinotoolkit/cvat/pull/2736>)\n- Issue with point region doesn't work in Firefox (<https://github.com/openvinotoolkit/cvat/pull/2727>)\n- Fixed cuboid perspective change (<https://github.com/openvinotoolkit/cvat/pull/2733>)\n- Annotation page popups (ai tools, drawing) reset state after detecting, tracking, drawing (<https://github.com/openvinotoolkit/cvat/pull/2780>)\n- Polygon editing using trailing point (<https://github.com/openvinotoolkit/cvat/pull/2808>)\n- Updated the path to python for DL models inside automatic annotation documentation (<https://github.com/openvinotoolkit/cvat/pull/2847>)\n- Fixed of receiving function variable (<https://github.com/openvinotoolkit/cvat/pull/2860>)\n- Shortcuts with CAPSLOCK enabled and with non-US languages activated (<https://github.com/openvinotoolkit/cvat/pull/2872>)\n- Prevented creating several issues for the same object (<https://github.com/openvinotoolkit/cvat/pull/2868>)\n- Fixed label editor name field validator (<https://github.com/openvinotoolkit/cvat/pull/2879>)\n- An error about track shapes outside of the task frames during export (<https://github.com/openvinotoolkit/cvat/pull/2890>)\n- Fixed project search field updating (<https://github.com/openvinotoolkit/cvat/pull/2901>)\n- Fixed export error when invalid polygons are present in overlapping frames (<https://github.com/openvinotoolkit/cvat/pull/2852>)\n- Fixed image quality option for tasks created from images (<https://github.com/openvinotoolkit/cvat/pull/2963>)\n- Incorrect text on the warning when specifying an incorrect link to the issue tracker (<https://github.com/openvinotoolkit/cvat/pull/2971>)\n- Updating label attributes when label contains number attributes (<https://github.com/openvinotoolkit/cvat/pull/2969>)\n- Crop a polygon if its points are outside the bounds of the image (<https://github.com/openvinotoolkit/cvat/pull/3025>)",
"## \\[1.2.0] - 2021-01-08",
"### Fixed",
"- Memory consumption for the task creation process (<https://github.com/openvinotoolkit/cvat/pull/2582>)\n- Frame preloading (<https://github.com/openvinotoolkit/cvat/pull/2608>)\n- Project cannot be removed from the project page (<https://github.com/openvinotoolkit/cvat/pull/2626>)",
"## \\[1.2.0-beta] - 2020-12-15",
"### Added",
"- GPU support and improved documentation for auto annotation (<https://github.com/openvinotoolkit/cvat/pull/2546>)\n- Manual review pipeline: issues/comments/workspace (<https://github.com/openvinotoolkit/cvat/pull/2357>)\n- Basic projects implementation (<https://github.com/openvinotoolkit/cvat/pull/2255>)\n- Documentation on how to mount cloud starage(AWS S3 bucket, Azure container, Google Drive) as FUSE (<https://github.com/openvinotoolkit/cvat/pull/2377>)\n- Ability to work with share files without copying inside (<https://github.com/openvinotoolkit/cvat/pull/2377>)\n- Tooltips in label selectors (<https://github.com/openvinotoolkit/cvat/pull/2509>)\n- Page redirect after login using `next` query parameter (<https://github.com/openvinotoolkit/cvat/pull/2527>)\n- [ImageNet](http://www.image-net.org) format support (<https://github.com/openvinotoolkit/cvat/pull/2376>)\n- [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/) format support (<https://github.com/openvinotoolkit/cvat/pull/2559>)",
"### Changed",
"- PATCH requests from cvat-core submit only changed fields (<https://github.com/openvinotoolkit/cvat/pull/2445>)\n- deploy.sh in serverless folder is separated into deploy_cpu.sh and deploy_gpu.sh (<https://github.com/openvinotoolkit/cvat/pull/2546>)\n- Bumped nuclio version to 1.5.8\n- Migrated to Antd 4.9 (<https://github.com/openvinotoolkit/cvat/pull/2536>)",
"### Fixed",
"- Fixed FastRCNN inference bug for images with 4 channels i.e. png (<https://github.com/openvinotoolkit/cvat/pull/2546>)\n- Django templates for email and user guide (<https://github.com/openvinotoolkit/cvat/pull/2412>)\n- Saving relative paths in dummy chunks instead of absolute (<https://github.com/openvinotoolkit/cvat/pull/2424>)\n- Objects with a specific label cannot be displayed if at least one tag with the label exist (<https://github.com/openvinotoolkit/cvat/pull/2435>)\n- Wrong attribute can be removed in labels editor (<https://github.com/openvinotoolkit/cvat/pull/2436>)\n- UI fails with the error \"Cannot read property 'label' of undefined\" (<https://github.com/openvinotoolkit/cvat/pull/2442>)\n- Exception: \"Value must be a user instance\" (<https://github.com/openvinotoolkit/cvat/pull/2441>)\n- Reset zoom option doesn't work in tag annotation mode (<https://github.com/openvinotoolkit/cvat/pull/2443>)\n- Canvas is busy error (<https://github.com/openvinotoolkit/cvat/pull/2437>)\n- Projects view layout fix (<https://github.com/openvinotoolkit/cvat/pull/2503>)\n- Fixed the tasks view (infinite loading) when it is impossible to get a preview of the task (<https://github.com/openvinotoolkit/cvat/pull/2504>)\n- Empty frames navigation (<https://github.com/openvinotoolkit/cvat/pull/2505>)\n- TypeError: Cannot read property 'toString' of undefined (<https://github.com/openvinotoolkit/cvat/pull/2517>)\n- Extra shapes are drawn after Esc, or G pressed while drawing a region in grouping (<https://github.com/openvinotoolkit/cvat/pull/2507>)\n- Reset state (reviews, issues) after logout or changing a job (<https://github.com/openvinotoolkit/cvat/pull/2525>)\n- TypeError: Cannot read property 'id' of undefined when updating a task (<https://github.com/openvinotoolkit/cvat/pull/2544>)",
"## \\[1.2.0-alpha] - 2020-11-09",
"### Added",
"- Ability to login into CVAT-UI with token from api/v1/auth/login (<https://github.com/openvinotoolkit/cvat/pull/2234>)\n- Added layout grids toggling ('ctrl + alt + Enter')\n- Added password reset functionality (<https://github.com/opencv/cvat/pull/2058>)\n- Ability to work with data on the fly (<https://github.com/opencv/cvat/pull/2007>)\n- Annotation in process outline color wheel (<https://github.com/opencv/cvat/pull/2084>)\n- On the fly annotation using DL detectors (<https://github.com/opencv/cvat/pull/2102>)\n- Displaying automatic annotation progress on a task view (<https://github.com/opencv/cvat/pull/2148>)\n- Automatic tracking of bounding boxes using serverless functions (<https://github.com/opencv/cvat/pull/2136>)\n- \\[Datumaro] CLI command for dataset equality comparison (<https://github.com/opencv/cvat/pull/1989>)\n- \\[Datumaro] Merging of datasets with different labels (<https://github.com/opencv/cvat/pull/2098>)\n- Add FBRS interactive segmentation serverless function (<https://github.com/openvinotoolkit/cvat/pull/2094>)\n- Ability to change default behaviour of previous/next buttons of a player.\n It supports regular navigation, searching a frame according to annotations\n filters and searching the nearest frame without any annotations (<https://github.com/openvinotoolkit/cvat/pull/2221>)\n- MacOS users notes in CONTRIBUTING.md\n- Ability to prepare meta information manually (<https://github.com/openvinotoolkit/cvat/pull/2217>)\n- Ability to upload prepared meta information along with a video when creating a task (<https://github.com/openvinotoolkit/cvat/pull/2217>)\n- Optional chaining plugin for cvat-canvas and cvat-ui (<https://github.com/openvinotoolkit/cvat/pull/2249>)\n- MOTS png mask format support (<https://github.com/openvinotoolkit/cvat/pull/2198>)\n- Ability to correct upload video with a rotation record in the metadata (<https://github.com/openvinotoolkit/cvat/pull/2218>)\n- User search field for assignee fields (<https://github.com/openvinotoolkit/cvat/pull/2370>)\n- Support of mxf videos (<https://github.com/openvinotoolkit/cvat/pull/2514>)",
"### Changed",
"- UI models (like DEXTR) were redesigned to be more interactive (<https://github.com/opencv/cvat/pull/2054>)\n- Used Ubuntu:20.04 as a base image for CVAT Dockerfile (<https://github.com/opencv/cvat/pull/2101>)\n- Right colors of label tags in label mapping when a user runs automatic detection (<https://github.com/openvinotoolkit/cvat/pull/2162>)\n- Nuclio became an optional component of CVAT (<https://github.com/openvinotoolkit/cvat/pull/2192>)\n- A key to remove a point from a polyshape (Ctrl => Alt) (<https://github.com/openvinotoolkit/cvat/pull/2204>)\n- Updated `docker-compose` file version from `2.3` to `3.3`(<https://github.com/openvinotoolkit/cvat/pull/2235>)\n- Added auto inference of url schema from host in CLI, if provided (<https://github.com/openvinotoolkit/cvat/pull/2240>)\n- Track frames in skips between annotation is presented in MOT and MOTS formats are marked `outside` (<https://github.com/openvinotoolkit/cvat/pull/2198>)\n- UI packages installation with `npm ci` instead of `npm install` (<https://github.com/openvinotoolkit/cvat/pull/2350>)",
"### Removed",
"- Removed Z-Order flag from task creation process",
"### Fixed",
"- Fixed multiple errors which arises when polygon is of length 5 or less (<https://github.com/opencv/cvat/pull/2100>)\n- Fixed task creation from PDF (<https://github.com/opencv/cvat/pull/2141>)\n- Fixed CVAT format import for frame stepped tasks (<https://github.com/openvinotoolkit/cvat/pull/2151>)\n- Fixed the reading problem with large PDFs (<https://github.com/openvinotoolkit/cvat/pull/2154>)\n- Fixed unnecessary pyhash dependency (<https://github.com/openvinotoolkit/cvat/pull/2170>)\n- Fixed Data is not getting cleared, even after deleting the Task from Django Admin App(<https://github.com/openvinotoolkit/cvat/issues/1925>)\n- Fixed blinking message: \"Some tasks have not been showed because they do not have any data\" (<https://github.com/openvinotoolkit/cvat/pull/2200>)\n- Fixed case when a task with 0 jobs is shown as \"Completed\" in UI (<https://github.com/openvinotoolkit/cvat/pull/2200>)\n- Fixed use case when UI throws exception: Cannot read property 'objectType' of undefined #2053 (<https://github.com/openvinotoolkit/cvat/pull/2203>)\n- Fixed use case when logs could be saved twice or more times #2202 (<https://github.com/openvinotoolkit/cvat/pull/2203>)\n- Fixed issues from #2112 (<https://github.com/openvinotoolkit/cvat/pull/2217>)\n- Git application name (renamed to dataset_repo) (<https://github.com/openvinotoolkit/cvat/pull/2243>)\n- A problem in exporting of tracks, where tracks could be truncated (<https://github.com/openvinotoolkit/cvat/issues/2129>)\n- Fixed CVAT startup process if the user has `umask 077` in .bashrc file (<https://github.com/openvinotoolkit/cvat/pull/2293>)\n- Exception: Cannot read property \"each\" of undefined after drawing a single point (<https://github.com/openvinotoolkit/cvat/pull/2307>)\n- Cannot read property 'label' of undefined (Fixed?) (<https://github.com/openvinotoolkit/cvat/pull/2311>)\n- Excluded track frames marked `outside` in `CVAT for Images` export (<https://github.com/openvinotoolkit/cvat/pull/2345>)\n- 'List of tasks' Kibana visualization (<https://github.com/openvinotoolkit/cvat/pull/2361>)\n- An error on exporting not `jpg` or `png` images in TF Detection API format (<https://github.com/openvinotoolkit/datumaro/issues/35>)",
"## \\[1.1.0] - 2020-08-31",
"### Added",
"- Siammask tracker as DL serverless function (<https://github.com/opencv/cvat/pull/1988>)\n- \\[Datumaro] Added model info and source info commands (<https://github.com/opencv/cvat/pull/1973>)\n- \\[Datumaro] Dataset statistics (<https://github.com/opencv/cvat/pull/1668>)\n- Ability to change label color in tasks and predefined labels (<https://github.com/opencv/cvat/pull/2014>)\n- \\[Datumaro] Multi-dataset merge (<https://github.com/opencv/cvat/pull/1695>)\n- Ability to configure email verification for new users (<https://github.com/opencv/cvat/pull/1929>)\n- Link to django admin page from UI (<https://github.com/opencv/cvat/pull/2068>)\n- Notification message when users use wrong browser (<https://github.com/opencv/cvat/pull/2070>)",
"### Changed",
"- Shape coordinates are rounded to 2 digits in dumped annotations (<https://github.com/opencv/cvat/pull/1970>)\n- COCO format does not produce polygon points for bbox annotations (<https://github.com/opencv/cvat/pull/1953>)",
"### Fixed",
"- Issue loading openvino models for semi-automatic and automatic annotation (<https://github.com/opencv/cvat/pull/1996>)\n- Basic functions of CVAT works without activated nuclio dashboard\n- Fixed a case in which exported masks could have wrong color order (<https://github.com/opencv/cvat/issues/2032>)\n- Fixed error with creating task with labels with the same name (<https://github.com/opencv/cvat/pull/2031>)\n- Django RQ dashboard view (<https://github.com/opencv/cvat/pull/2069>)\n- Object's details menu settings (<https://github.com/opencv/cvat/pull/2084>)",
"## \\[1.1.0-beta] - 2020-08-03",
"### Added",
"- DL models as serverless functions (<https://github.com/opencv/cvat/pull/1767>)\n- Source type support for tags, shapes and tracks (<https://github.com/opencv/cvat/pull/1192>)\n- Source type support for CVAT Dumper/Loader (<https://github.com/opencv/cvat/pull/1192>)\n- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)\n- Support creating multiple jobs for each task through python cli (<https://github.com/opencv/cvat/pull/1950>)\n- python cli over https (<https://github.com/opencv/cvat/pull/1942>)\n- Error message when plugins weren't able to initialize instead of infinite loading (<https://github.com/opencv/cvat/pull/1966>)\n- Ability to change user password (<https://github.com/opencv/cvat/pull/1954>)",
"### Changed",
"- Smaller object details (<https://github.com/opencv/cvat/pull/1877>)\n- `COCO` format does not convert bboxes to polygons on export (<https://github.com/opencv/cvat/pull/1953>)\n- It is impossible to submit a DL model in OpenVINO format using UI.\n Now you can deploy new models on the server using serverless functions\n (<https://github.com/opencv/cvat/pull/1767>)\n- Files and folders under share path are now alphabetically sorted",
"### Removed",
"- Removed OpenVINO and CUDA components because they are not necessary anymore (<https://github.com/opencv/cvat/pull/1767>)\n- Removed the old UI code (<https://github.com/opencv/cvat/pull/1964>)",
"### Fixed",
"- Some objects aren't shown on canvas sometimes. For example after propagation on of objects is invisible (<https://github.com/opencv/cvat/pull/1834>)\n- CVAT doesn't offer to restore state after an error (<https://github.com/opencv/cvat/pull/1874>)\n- Cannot read property 'shapeType' of undefined because of zOrder related issues (<https://github.com/opencv/cvat/pull/1874>)\n- Cannot read property 'pinned' of undefined because of zOrder related issues (<https://github.com/opencv/cvat/pull/1874>)\n- Do not iterate over hidden objects in aam (which are invisible because of zOrder) (<https://github.com/opencv/cvat/pull/1874>)\n- Cursor position is reset after changing a text field (<https://github.com/opencv/cvat/pull/1874>)\n- Hidden points and cuboids can be selected to be grouped (<https://github.com/opencv/cvat/pull/1874>)\n- `outside` annotations should not be in exported images (<https://github.com/opencv/cvat/issues/1620>)\n- `CVAT for video format` import error with interpolation (<https://github.com/opencv/cvat/issues/1893>)\n- `Image compression` definition mismatch (<https://github.com/opencv/cvat/issues/1900>)\n- Points are duplicated during polygon interpolation sometimes (<https://github.com/opencv/cvat/pull/1892>)\n- When redraw a shape with activated autobordering, previous points are visible (<https://github.com/opencv/cvat/pull/1892>)\n- No mapping between side object element and context menu in some attributes (<https://github.com/opencv/cvat/pull/1923>)\n- Interpolated shapes exported as `keyframe = True` (<https://github.com/opencv/cvat/pull/1937>)\n- Stylelint filetype scans (<https://github.com/opencv/cvat/pull/1952>)\n- Fixed toolip closing issue (<https://github.com/opencv/cvat/pull/1955>)\n- Clearing frame cache when close a task (<https://github.com/opencv/cvat/pull/1966>)\n- Increase rate of throttling policy for unauthenticated users (<https://github.com/opencv/cvat/pull/1969>)",
"## \\[1.1.0-alpha] - 2020-06-30",
"### Added",
"- Throttling policy for unauthenticated users (<https://github.com/opencv/cvat/pull/1531>)\n- Added default label color table for mask export (<https://github.com/opencv/cvat/pull/1549>)\n- Added environment variables for Redis and Postgres hosts for Kubernetes deployment support (<https://github.com/opencv/cvat/pull/1641>)\n- Added visual identification for unavailable formats (<https://github.com/opencv/cvat/pull/1567>)\n- Shortcut to change color of an activated shape in new UI (Enter) (<https://github.com/opencv/cvat/pull/1683>)\n- Shortcut to switch split mode (<https://github.com/opencv/cvat/pull/1683>)\n- Built-in search for labels when create an object or change a label (<https://github.com/opencv/cvat/pull/1683>)\n- Better validation of labels and attributes in raw viewer (<https://github.com/opencv/cvat/pull/1727>)\n- ClamAV antivirus integration (<https://github.com/opencv/cvat/pull/1712>)\n- Added canvas background color selector (<https://github.com/opencv/cvat/pull/1705>)\n- SCSS files linting with Stylelint tool (<https://github.com/opencv/cvat/pull/1766>)\n- Supported import and export or single boxes in MOT format (<https://github.com/opencv/cvat/pull/1764>)\n- \\[Datumaro] Added `stats` command, which shows some dataset statistics\n like image mean and std (<https://github.com/opencv/cvat/pull/1734>)\n- Add option to upload annotations upon task creation on CLI\n- Polygon and polylines interpolation (<https://github.com/opencv/cvat/pull/1571>)\n- Ability to redraw shape from scratch (Shift + N) for an activated shape (<https://github.com/opencv/cvat/pull/1571>)\n- Highlights for the first point of a polygon/polyline and direction (<https://github.com/opencv/cvat/pull/1571>)\n- Ability to change orientation for poylgons/polylines in context menu (<https://github.com/opencv/cvat/pull/1571>)\n- Ability to set the first point for polygons in points context menu (<https://github.com/opencv/cvat/pull/1571>)\n- Added new tag annotation workspace (<https://github.com/opencv/cvat/pull/1570>)\n- Appearance block in attribute annotation mode (<https://github.com/opencv/cvat/pull/1820>)\n- Keyframe navigations and some switchers in attribute annotation mode (<https://github.com/opencv/cvat/pull/1820>)\n- \\[Datumaro] Added `convert` command to convert datasets directly (<https://github.com/opencv/cvat/pull/1837>)\n- \\[Datumaro] Added an option to specify image extension when exporting datasets (<https://github.com/opencv/cvat/pull/1799>)\n- \\[Datumaro] Added image copying when exporting datasets, if possible (<https://github.com/opencv/cvat/pull/1799>)",
"### Changed",
"- Removed information about e-mail from the basic user information (<https://github.com/opencv/cvat/pull/1627>)\n- Update https install manual. Makes it easier and more robust.\n Includes automatic renewing of lets encrypt certificates.\n- Settings page move to the modal. (<https://github.com/opencv/cvat/pull/1705>)\n- Implemented import and export of annotations with relative image paths (<https://github.com/opencv/cvat/pull/1463>)\n- Using only single click to start editing or remove a point (<https://github.com/opencv/cvat/pull/1571>)\n- Added support for attributes in VOC XML format (<https://github.com/opencv/cvat/pull/1792>)\n- Added annotation attributes in COCO format (<https://github.com/opencv/cvat/pull/1782>)\n- Colorized object items in the side panel (<https://github.com/opencv/cvat/pull/1753>)\n- \\[Datumaro] Annotation-less files are not generated anymore in COCO format, unless tasks explicitly requested (<https://github.com/opencv/cvat/pull/1799>)",
"### Fixed",
"- Problem with exported frame stepped image task (<https://github.com/opencv/cvat/issues/1613>)\n- Fixed dataset filter item representation for imageless dataset items (<https://github.com/opencv/cvat/pull/1593>)\n- Fixed interpreter crash when trying to import `tensorflow` with no AVX instructions available (<https://github.com/opencv/cvat/pull/1567>)\n- Kibana wrong working time calculation with new annotation UI use (<https://github.com/opencv/cvat/pull/1654>)\n- Wrong rexex for account name validation (<https://github.com/opencv/cvat/pull/1667>)\n- Wrong description on register view for the username field (<https://github.com/opencv/cvat/pull/1667>)\n- Wrong resolution for resizing a shape (<https://github.com/opencv/cvat/pull/1667>)\n- React warning because of not unique keys in labels viewer (<https://github.com/opencv/cvat/pull/1727>)\n- Fixed issue tracker (<https://github.com/opencv/cvat/pull/1705>)\n- Fixed canvas fit after sidebar open/close event (<https://github.com/opencv/cvat/pull/1705>)\n- A couple of exceptions in AAM related with early object activation (<https://github.com/opencv/cvat/pull/1755>)\n- Propagation from the latest frame (<https://github.com/opencv/cvat/pull/1800>)\n- Number attribute value validation (didn't work well with floats) (<https://github.com/opencv/cvat/pull/1800>)\n- Logout doesn't work (<https://github.com/opencv/cvat/pull/1812>)\n- Annotations aren't updated after reopening a task (<https://github.com/opencv/cvat/pull/1753>)\n- Labels aren't updated after reopening a task (<https://github.com/opencv/cvat/pull/1753>)\n- Canvas isn't fitted after collapsing side panel in attribute annotation mode (<https://github.com/opencv/cvat/pull/1753>)\n- Error when interpolating polygons (<https://github.com/opencv/cvat/pull/1878>)",
"### Security",
"- SQL injection in Django `CVE-2020-9402` (<https://github.com/opencv/cvat/pull/1657>)",
"## \\[1.0.0] - 2020-05-29",
"### Added",
"- cvat-ui: cookie policy drawer for login page (<https://github.com/opencv/cvat/pull/1511>)\n- `datumaro_project` export format (<https://github.com/opencv/cvat/pull/1352>)\n- Ability to configure user agreements for the user registration form (<https://github.com/opencv/cvat/pull/1464>)\n- Cuboid interpolation and cuboid drawing from rectangles (<https://github.com/opencv/cvat/pull/1560>)\n- Ability to configure custom pageViewHit, which can be useful for web analytics integration (<https://github.com/opencv/cvat/pull/1566>)\n- Ability to configure access to the analytics page based on roles (<https://github.com/opencv/cvat/pull/1592>)",
"### Changed",
"- Downloaded file name in annotations export became more informative (<https://github.com/opencv/cvat/pull/1352>)\n- Added auto trimming for trailing whitespaces style enforcement (<https://github.com/opencv/cvat/pull/1352>)\n- REST API: updated `GET /task/<id>/annotations`: parameters are `format`, `filename`\n (now optional), `action` (optional) (<https://github.com/opencv/cvat/pull/1352>)\n- REST API: removed `dataset/formats`, changed format of `annotation/formats` (<https://github.com/opencv/cvat/pull/1352>)\n- Exported annotations are stored for N hours instead of indefinitely (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: CVAT format now accepts ZIP and XML (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: COCO format now accepts ZIP and JSON (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: most of formats renamed, no extension in title (<https://github.com/opencv/cvat/pull/1352>)\n- Formats: definitions are changed, are not stored in DB anymore (<https://github.com/opencv/cvat/pull/1352>)\n- cvat-core: session.annotations.put() now returns ids of added objects (<https://github.com/opencv/cvat/pull/1493>)\n- Images without annotations now also included in dataset/annotations export (<https://github.com/opencv/cvat/issues/525>)",
"### Removed",
"- `annotation` application is replaced with `dataset_manager` (<https://github.com/opencv/cvat/pull/1352>)\n- `_DATUMARO_INIT_LOGLEVEL` env. variable is removed in favor of regular `--loglevel` cli parameter (<https://github.com/opencv/cvat/pull/1583>)",
"### Fixed",
"- Categories for empty projects with no sources are taken from own dataset (<https://github.com/opencv/cvat/pull/1352>)\n- Added directory removal on error during `extract` command (<https://github.com/opencv/cvat/pull/1352>)\n- Added debug error message on incorrect XPath (<https://github.com/opencv/cvat/pull/1352>)\n- Exporting frame stepped task\n (<https://github.com/opencv/cvat/issues/1294>, <https://github.com/opencv/cvat/issues/1334>)\n- Fixed broken command line interface for `cvat` export format in Datumaro (<https://github.com/opencv/cvat/issues/1494>)\n- Updated Rest API document, Swagger document serving instruction issue (<https://github.com/opencv/cvat/issues/1495>)\n- Fixed cuboid occluded view (<https://github.com/opencv/cvat/pull/1500>)\n- Non-informative lock icon (<https://github.com/opencv/cvat/pull/1434>)\n- Sidebar in AAM has no hide/show button (<https://github.com/opencv/cvat/pull/1420>)\n- Task/Job buttons has no \"Open in new tab\" option (<https://github.com/opencv/cvat/pull/1419>)\n- Delete point context menu option has no shortcut hint (<https://github.com/opencv/cvat/pull/1416>)\n- Fixed issue with unnecessary tag activation in cvat-canvas (<https://github.com/opencv/cvat/issues/1540>)\n- Fixed an issue with large number of instances in instance mask (<https://github.com/opencv/cvat/issues/1539>)\n- Fixed full COCO dataset import error with conflicting labels in keypoints and detection (<https://github.com/opencv/cvat/pull/1548>)\n- Fixed COCO keypoints skeleton parsing and saving (<https://github.com/opencv/cvat/issues/1539>)\n- `tf.placeholder() is not compatible with eager execution` exception for auto_segmentation (<https://github.com/opencv/cvat/pull/1562>)\n- Canvas cannot be moved with move functionality on left mouse key (<https://github.com/opencv/cvat/pull/1573>)\n- Deep extreme cut request is sent when draw any shape with Make AI polygon option enabled (<https://github.com/opencv/cvat/pull/1573>)\n- Fixed an error when exporting a task with cuboids to any format except CVAT (<https://github.com/opencv/cvat/pull/1577>)\n- Synchronization with remote git repo (<https://github.com/opencv/cvat/pull/1582>)\n- A problem with mask to polygons conversion when polygons are too small (<https://github.com/opencv/cvat/pull/1581>)\n- Unable to upload video with uneven size (<https://github.com/opencv/cvat/pull/1594>)\n- Fixed an issue with `z_order` having no effect on segmentations (<https://github.com/opencv/cvat/pull/1589>)",
"### Security",
"- Permission group whitelist check for analytics view (<https://github.com/opencv/cvat/pull/1608>)",
"## \\[1.0.0-beta.2] - 2020-04-30",
"### Added",
"- Re-Identification algorithm to merging bounding boxes automatically to the new UI (<https://github.com/opencv/cvat/pull/1406>)\n- Methods `import` and `export` to import/export raw annotations for Job and Task in `cvat-core` (<https://github.com/opencv/cvat/pull/1406>)\n- Versioning of client packages (`cvat-core`, `cvat-canvas`, `cvat-ui`). Initial versions are set to 1.0.0 (<https://github.com/opencv/cvat/pull/1448>)\n- Cuboids feature was migrated from old UI to new one. (<https://github.com/opencv/cvat/pull/1451>)",
"### Removed",
"- Annotation conversion utils, currently supported natively via Datumaro framework\n (<https://github.com/opencv/cvat/pull/1477>)",
"### Fixed",
"- Auto annotation, TF annotation and Auto segmentation apps (<https://github.com/opencv/cvat/pull/1409>)\n- Import works with truncated images now: \"OSError:broken data stream\" on corrupt images\n (<https://github.com/opencv/cvat/pull/1430>)\n- Hide functionality (H) doesn't work (<https://github.com/opencv/cvat/pull/1445>)\n- The highlighted attribute doesn't correspond to the chosen attribute in AAM (<https://github.com/opencv/cvat/pull/1445>)\n- Inconvinient image shaking while drawing a polygon (hold Alt key during drawing/editing/grouping to drag an image) (<https://github.com/opencv/cvat/pull/1445>)\n- Filter property \"shape\" doesn't work and extra operator in description (<https://github.com/opencv/cvat/pull/1445>)\n- Block of text information doesn't disappear after deactivating for locked shapes (<https://github.com/opencv/cvat/pull/1445>)\n- Annotation uploading fails in annotation view (<https://github.com/opencv/cvat/pull/1445>)\n- UI freezes after canceling pasting with escape (<https://github.com/opencv/cvat/pull/1445>)\n- Duplicating keypoints in COCO export (<https://github.com/opencv/cvat/pull/1435>)\n- CVAT new UI: add arrows on a mouse cursor (<https://github.com/opencv/cvat/pull/1391>)\n- Delete point bug (in new UI) (<https://github.com/opencv/cvat/pull/1440>)\n- Fix apache startup after PC restart (<https://github.com/opencv/cvat/pull/1467>)\n- Open task button doesn't work (<https://github.com/opencv/cvat/pull/1474>)",
"## \\[1.0.0-beta.1] - 2020-04-15",
"### Added",
"- Special behaviour for attribute value `__undefined__` (invisibility, no shortcuts to be set in AAM)\n- Dialog window with some helpful information about using filters\n- Ability to display a bitmap in the new UI\n- Button to reset colors settings (brightness, saturation, contrast) in the new UI\n- Option to display shape text always\n- Dedicated message with clarifications when share is unmounted (<https://github.com/opencv/cvat/pull/1373>)\n- Ability to create one tracked point (<https://github.com/opencv/cvat/pull/1383>)\n- Ability to draw/edit polygons and polylines with automatic bordering feature\n (<https://github.com/opencv/cvat/pull/1394>)\n- Tutorial: instructions for CVAT over HTTPS\n- Deep extreme cut (semi-automatic segmentation) to the new UI (<https://github.com/opencv/cvat/pull/1398>)",
"### Changed",
"- Increase preview size of a task till 256, 256 on the server\n- Public ssh-keys are displayed in a dedicated window instead of console when create a task with a repository\n- React UI is the primary UI",
"### Fixed",
"- Cleaned up memory in Auto Annotation to enable long running tasks on videos\n- New shape is added when press `esc` when drawing instead of cancellation\n- Dextr segmentation doesn't work.\n- `FileNotFoundError` during dump after moving format files\n- CVAT doesn't append outside shapes when merge polyshapes in old UI\n- Layout sometimes shows double scroll bars on create task, dashboard and settings pages\n- UI fails after trying to change frame during resizing, dragging, editing\n- Hidden points (or outsided) are visible after changing a frame\n- Merge is allowed for points, but clicks on points conflict with frame dragging logic\n- Removed objects are visible for search\n- Add missed task_id and job_id fields into exception logs for the new UI (<https://github.com/opencv/cvat/pull/1372>)\n- UI fails when annotations saving occurs during drag/resize/edit (<https://github.com/opencv/cvat/pull/1383>)\n- Multiple savings when hold Ctrl+S (a lot of the same copies of events were sent with the same working time)\n (<https://github.com/opencv/cvat/pull/1383>)\n- UI doesn't have any reaction when git repos synchronization failed (<https://github.com/opencv/cvat/pull/1383>)\n- Bug when annotations cannot be saved after (delete - save - undo - save) (<https://github.com/opencv/cvat/pull/1383>)\n- VOC format exports Upper case labels correctly in lower case (<https://github.com/opencv/cvat/pull/1379>)\n- Fixed polygon exporting bug in COCO dataset (<https://github.com/opencv/cvat/issues/1387>)\n- Task creation from remote files (<https://github.com/opencv/cvat/pull/1392>)\n- Job cannot be opened in some cases when the previous job was failed during opening\n (<https://github.com/opencv/cvat/issues/1403>)\n- Deactivated shape is still highlighted on the canvas (<https://github.com/opencv/cvat/issues/1403>)\n- AttributeError: 'tuple' object has no attribute 'read' in ReID algorithm (<https://github.com/opencv/cvat/issues/1403>)\n- Wrong semi-automatic segmentation near edges of an image (<https://github.com/opencv/cvat/issues/1403>)\n- Git repos paths (<https://github.com/opencv/cvat/pull/1400>)\n- Uploading annotations for tasks with multiple jobs (<https://github.com/opencv/cvat/pull/1396>)",
"## \\[1.0.0-alpha] - 2020-03-31",
"### Added",
"- Data streaming using chunks (<https://github.com/opencv/cvat/pull/1007>)\n- New UI: showing file names in UI (<https://github.com/opencv/cvat/pull/1311>)\n- New UI: delete a point from context menu (<https://github.com/opencv/cvat/pull/1292>)",
"### Fixed",
"- Git app cannot clone a repository (<https://github.com/opencv/cvat/pull/1330>)\n- New UI: preview position in task details (<https://github.com/opencv/cvat/pull/1312>)\n- AWS deployment (<https://github.com/opencv/cvat/pull/1316>)",
"## \\[0.6.1] - 2020-03-21",
"### Changed",
"- VOC task export now does not use official label map by default, but takes one\n from the source task to avoid primary-class and class part name\n clashing ([#1275](https://github.com/opencv/cvat/issues/1275))",
"### Fixed",
"- File names in LabelMe format export are no longer truncated ([#1259](https://github.com/opencv/cvat/issues/1259))\n- `occluded` and `z_order` annotation attributes are now correctly passed to Datumaro ([#1271](https://github.com/opencv/cvat/pull/1271))\n- Annotation-less tasks now can be exported as empty datasets in COCO ([#1277](https://github.com/opencv/cvat/issues/1277))\n- Frame name matching for video annotations import -\n allowed `frame_XXXXXX[.ext]` format ([#1274](https://github.com/opencv/cvat/pull/1274))",
"### Security",
"- Bump acorn from 6.3.0 to 6.4.1 in /cvat-ui ([#1270](https://github.com/opencv/cvat/pull/1270))",
"## \\[0.6.0] - 2020-03-15",
"### Added",
"- Server only support for projects. Extend REST API v1 (/api/v1/projects\\*)\n- Ability to get basic information about users without admin permissions ([#750](https://github.com/opencv/cvat/issues/750))\n- Changed REST API: removed PUT and added DELETE methods for /api/v1/users/ID\n- Mask-RCNN Auto Annotation Script in OpenVINO format\n- Yolo Auto Annotation Script\n- Auto segmentation using Mask_RCNN component (Keras+Tensorflow Mask R-CNN Segmentation)\n- REST API to export an annotation task (images + annotations)\n [Datumaro](https://github.com/opencv/cvat/tree/develop/datumaro) -\n a framework to build, analyze, debug and visualize datasets\n- Text Detection Auto Annotation Script in OpenVINO format for version 4\n- Added in OpenVINO Semantic Segmentation for roads\n- Ability to visualize labels when using Auto Annotation runner\n- MOT CSV format support ([#830](https://github.com/opencv/cvat/pull/830))\n- LabelMe format support ([#844](https://github.com/opencv/cvat/pull/844))\n- Segmentation MASK format import (as polygons) ([#1163](https://github.com/opencv/cvat/pull/1163))\n- Git repositories can be specified with IPv4 address ([#827](https://github.com/opencv/cvat/pull/827))",
"### Changed",
"- page_size parameter for all REST API methods\n- React & Redux & Antd based dashboard\n- Yolov3 interpretation script fix and changes to mapping.json\n- YOLO format support ([#1151](https://github.com/opencv/cvat/pull/1151))\n- Added support for OpenVINO 2020",
"### Fixed",
"- Exception in Git plugin [#826](https://github.com/opencv/cvat/issues/826)\n- Label ids in TFrecord format now start from 1 [#866](https://github.com/opencv/cvat/issues/866)\n- Mask problem in COCO JSON style [#718](https://github.com/opencv/cvat/issues/718)\n- Datasets (or tasks) can be joined and split to subsets with Datumaro [#791](https://github.com/opencv/cvat/issues/791)\n- Output labels for VOC format can be specified with Datumaro [#942](https://github.com/opencv/cvat/issues/942)\n- Annotations can be filtered before dumping with Datumaro [#994](https://github.com/opencv/cvat/issues/994)",
"## \\[0.5.2] - 2019-12-15",
"### Fixed",
"- Frozen version of scikit-image==0.15 in requirements.txt because next releases don't support Python 3.5",
"## \\[0.5.1] - 2019-10-17",
"### Added",
"- Integration with Zenodo.org (DOI)",
"## \\[0.5.0] - 2019-09-12",
"### Added",
"- A converter to YOLO format\n- Installation guide\n- Linear interpolation for a single point\n- Video frame filter\n- Running functional tests for REST API during a build\n- Admins are no longer limited to a subset of python commands in the auto annotation application\n- Remote data source (list of URLs to create an annotation task)\n- Auto annotation using Faster R-CNN with Inception v2 (utils/open_model_zoo)\n- Auto annotation using Pixel Link mobilenet v2 - text detection (utils/open_model_zoo)\n- Ability to create a custom extractors for unsupported media types\n- Added in PDF extractor\n- Added in a command line model manager tester\n- Ability to dump/load annotations in several formats from UI (CVAT, Pascal VOC, YOLO, MS COCO, png mask, TFRecord)\n- Auth for REST API (api/v1/auth/): login, logout, register, ...\n- Preview for the new CVAT UI (dashboard only) is available: <http://localhost:9080/>\n- Added command line tool for performing common task operations (/utils/cli/)",
"### Changed",
"- Outside and keyframe buttons in the side panel for all interpolation shapes (they were only for boxes before)\n- Improved error messages on the client side (#511)",
"### Removed",
"- \"Flip images\" has been removed. UI now contains rotation features.",
"### Fixed",
"- Incorrect width of shapes borders in some cases\n- Annotation parser for tracks with a start frame less than the first segment frame\n- Interpolation on the server near outside frames\n- Dump for case when task name has a slash\n- Auto annotation fail for multijob tasks\n- Installation of CVAT with OpenVINO on the Windows platform\n- Background color was always black in utils/mask/converter.py\n- Exception in attribute annotation mode when a label are switched to a value without any attributes\n- Handling of wrong labelamp json file in auto annotation (<https://github.com/opencv/cvat/issues/554>)\n- No default attributes in dumped annotation (<https://github.com/opencv/cvat/issues/601>)\n- Required field \"Frame Filter\" on admin page during a task modifying (#666)\n- Dump annotation errors for a task with several segments (#610, #500)\n- Invalid label parsing during a task creating (#628)\n- Button \"Open Task\" in the annotation view\n- Creating a video task with 0 overlap",
"### Security",
"- Upgraded Django, djangorestframework, and other packages",
"## \\[0.4.2] - 2019-06-03",
"### Fixed",
"- Fixed interaction with the server share in the auto annotation plugin",
"## \\[0.4.1] - 2019-05-14",
"### Fixed",
"- JavaScript syntax incompatibility with Google Chrome versions less than 72",
"## \\[0.4.0] - 2019-05-04",
"### Added",
"- OpenVINO auto annotation: it is possible to upload a custom model and annotate images automatically.\n- Ability to rotate images/video in the client part (Ctrl+R, Shift+Ctrl+R shortcuts) (#305)\n- The ReID application for automatic bounding box merging has been added (#299)\n- Keyboard shortcuts to switch next/previous default shape type (box, polygon etc) (Alt + <, Alt + >) (#316)\n- Converter for VOC now supports interpolation tracks\n- REST API (/api/v1/\\*, /api/docs)\n- Semi-automatic semantic segmentation with the [Deep Extreme Cut](http://www.vision.ee.ethz.ch/~cvlsegmentation/dextr/) work",
"### Changed",
"- Propagation setup has been moved from settings to bottom player panel\n- Additional events like \"Debug Info\" or \"Fit Image\" have been added for analitics\n- Optional using LFS for git annotation storages (#314)",
"### Deprecated",
"- \"Flip images\" flag in the create task dialog will be removed.\n Rotation functionality in client part have been added instead.",
"### Fixed",
"- Django 2.1.5 (security fix, [CVE-2019-3498](https://nvd.nist.gov/vuln/detail/CVE-2019-3498))\n- Several scenarious which cause code 400 after undo/redo/save have been fixed (#315)",
"## \\[0.3.0] - 2018-12-29",
"### Added",
"- Ability to copy Object URL and Frame URL via object context menu and player context menu respectively.\n- Ability to change opacity for selected shape with help \"Selected Fill Opacity\" slider.\n- Ability to remove polyshapes points by double click.\n- Ability to draw/change polyshapes (except for points) by slip method. Just press ENTER and moving a cursor.\n- Ability to switch lock/hide properties via label UI element (in right menu) for all objects with same label.\n- Shortcuts for outside/keyframe properties\n- Support of Intel OpenVINO for accelerated model inference\n- Tensorflow annotation now works without CUDA. It can use CPU only. OpenVINO and CUDA are supported optionally.\n- Incremental saving of annotations.\n- Tutorial for using polygons (screencast)\n- Silk profiler to improve development process\n- Admin panel can be used to edit labels and attributes for annotation tasks\n- Analytics component to manage a data annotation team, monitor exceptions, collect client and server logs\n- Changeable job and task statuses (annotation, validation, completed).\n A job status can be changed manually, a task status is computed automatically based on job statuses (#153)\n- Backlink to a task from its job annotation view (#156)\n- Buttons lock/hide for labels. They work for all objects with the same label on a current frame (#116)",
"### Changed",
"- Polyshape editing method has been improved. You can redraw part of shape instead of points cloning.\n- Unified shortcut (Esc) for close any mode instead of different shortcuts (Alt+N, Alt+G, Alt+M etc.).\n- Dump file contains information about data source (e.g. video name, archive name, ...)\n- Update requests library due to [CVE-2018-18074](https://nvd.nist.gov/vuln/detail/CVE-2018-18074)\n- Per task/job permissions to create/access/change/delete tasks and annotations\n- Documentation was improved\n- Timeout for creating tasks was increased (from 1h to 4h) (#136)\n- Drawing has become more convenience. Now it is possible to draw outside an image.\n Shapes will be automatically truncated after drawing process (#202)",
"### Fixed",
"- Performance bottleneck has been fixed during you create new objects (draw, copy, merge etc).\n- Label UI elements aren't updated after changelabel.\n- Attribute annotation mode can use invalid shape position after resize or move shapes.\n- Labels order is preserved now (#242)\n- Uploading large XML files (#123)\n- Django vulnerability (#121)\n- Grammatical cleanup of README.md (#107)\n- Dashboard loading has been accelerated (#156)\n- Text drawing outside of a frame in some cases (#202)",
"## \\[0.2.0] - 2018-09-28",
"### Added",
"- New annotation shapes: polygons, polylines, points\n- Undo/redo feature\n- Grid to estimate size of objects\n- Context menu for shapes\n- A converter to PASCAL VOC format\n- A converter to MS COCO format\n- A converter to mask format\n- License header for most of all files\n- .gitattribute to avoid problems with bash scripts inside a container\n- CHANGELOG.md itself\n- Drawing size of a bounding box during resize\n- Color by instance, group, label\n- Group objects\n- Object propagation on next frames\n- Full screen view",
"### Changed",
"- Documentation, screencasts, the primary screenshot\n- Content-type for save_job request is application/json",
"### Fixed",
"- Player navigation if the browser's window is scrolled\n- Filter doesn't support dash (-)\n- Several memory leaks\n- Inconsistent extensions between filenames in an annotation file and real filenames",
"## \\[0.1.2] - 2018-08-07",
"### Added",
"- 7z archive support when creating a task\n- .vscode/launch.json file for developing with VS code",
"### Fixed",
"- #14: docker-compose down command as written in the readme does not remove volumes\n- #15: all checkboxes in temporary attributes are checked when reopening job after saving the job\n- #18: extend CONTRIBUTING.md\n- #19: using the same attribute for label twice -> stuck",
"### Changed",
"- More strict verification for labels with attributes",
"## \\[0.1.1] - 2018-07-6",
"### Added",
"- Links on a screenshot, documentation, screencasts into README.md\n- CONTRIBUTORS.md",
"### Fixed",
"- GitHub documentation",
"## \\[0.1.0] - 2018-06-29",
"### Added",
"- Initial version",
"## Template",
"```\n## \\[Unreleased]\n### Added\n- TDB",
"### Changed\n- TDB",
"### Deprecated\n- TDB",
"### Removed\n- TDB",
"### Fixed\n- TDB",
"### Security\n- TDB\n```"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [83, 212, 54], "buggy_code_start_loc": [83, 8, 54], "filenames": ["CHANGELOG.md", "cvat/apps/engine/task.py", "cvat/requirements/base.txt"], "fixing_code_end_loc": [85, 256, 56], "fixing_code_start_loc": [84, 9, 55], "message": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cvat:cvat:*:*:*:*:*:*:*:*", "matchCriteriaId": "29D76D4E-B25E-4AE9-86EC-887059DBA160", "versionEndExcluding": "2.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "CVAT es una herramienta de anotaci\u00f3n de v\u00eddeo e imagen interactiva de c\u00f3digo abierto para la visi\u00f3n por ordenador. Las versiones anteriores a 2.0.0, est\u00e1n sujetas a una vulnerabilidad de tipo Server-side request forgery (SSRF). Ha sido a\u00f1adida la comprobaci\u00f3n de las urls usadas en la ruta de c\u00f3digo afectada en versi\u00f3n 2.0.0. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31188", "lastModified": "2022-12-08T22:35:16.617", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 8.6, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 4.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-08-01T20:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/169814/CVAT-2.0-Server-Side-Request-Forgery.html"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/security/advisories/GHSA-7vpj-j5xv-29pr"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, "type": "CWE-918"}
| 93
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# Copyright (C) 2018-2022 Intel Corporation\n#\n# SPDX-License-Identifier: MIT",
"import itertools\nimport os\nimport sys",
"",
"import rq\nimport re\nimport shutil\nfrom distutils.dir_util import copy_tree\nfrom traceback import print_exception\nfrom urllib import parse as urlparse\nfrom urllib import request as urlrequest\nimport requests",
"",
"import django_rq",
"from django.conf import settings\nfrom django.db import transaction",
"from cvat.apps.engine import models\nfrom cvat.apps.engine.log import slogger\nfrom cvat.apps.engine.media_extractors import (MEDIA_TYPES, Mpeg4ChunkWriter, Mpeg4CompressedChunkWriter,\n ValidateDimension, ZipChunkWriter, ZipCompressedChunkWriter, get_mime, sort)\nfrom cvat.apps.engine.utils import av_scan_paths\nfrom utils.dataset_manifest import ImageManifestManager, VideoManifestManager, is_manifest\nfrom utils.dataset_manifest.core import VideoManifestValidator\nfrom utils.dataset_manifest.utils import detect_related_images\nfrom .cloud_provider import get_cloud_storage_instance, Credentials",
"############################# Low Level server API",
"def create(tid, data):\n \"\"\"Schedule the task\"\"\"\n q = django_rq.get_queue('default')\n q.enqueue_call(func=_create_thread, args=(tid, data),\n job_id=\"/api/tasks/{}\".format(tid))",
"@transaction.atomic\ndef rq_handler(job, exc_type, exc_value, traceback):\n split = job.id.split('/')\n tid = split[split.index('tasks') + 1]\n try:\n tid = int(tid)\n db_task = models.Task.objects.select_for_update().get(pk=tid)\n with open(db_task.get_log_path(), \"wt\") as log_file:\n print_exception(exc_type, exc_value, traceback, file=log_file)\n except (models.Task.DoesNotExist, ValueError):\n pass # skip exceptions in the code",
" return False",
"############################# Internal implementation for server API",
"def _copy_data_from_source(server_files, upload_dir, server_dir=None):\n job = rq.get_current_job()\n job.meta['status'] = 'Data are being copied from source..'\n job.save_meta()",
" for path in server_files:\n if server_dir is None:\n source_path = os.path.join(settings.SHARE_ROOT, os.path.normpath(path))\n else:\n source_path = os.path.join(server_dir, os.path.normpath(path))\n target_path = os.path.join(upload_dir, path)\n if os.path.isdir(source_path):\n copy_tree(source_path, target_path)\n else:\n target_dir = os.path.dirname(target_path)\n if not os.path.exists(target_dir):\n os.makedirs(target_dir)\n shutil.copyfile(source_path, target_path)",
"def _save_task_to_db(db_task):\n job = rq.get_current_job()\n job.meta['status'] = 'Task is being saved in database'\n job.save_meta()",
" segment_size = db_task.segment_size\n segment_step = segment_size\n if segment_size == 0 or segment_size > db_task.data.size:\n segment_size = db_task.data.size\n db_task.segment_size = segment_size",
" # Segment step must be more than segment_size + overlap in single-segment tasks\n # Otherwise a task contains an extra segment\n segment_step = sys.maxsize",
" default_overlap = 5 if db_task.mode == 'interpolation' else 0\n if db_task.overlap is None:\n db_task.overlap = default_overlap\n db_task.overlap = min(db_task.overlap, segment_size // 2)",
" segment_step -= db_task.overlap",
" for start_frame in range(0, db_task.data.size, segment_step):\n stop_frame = min(start_frame + segment_size - 1, db_task.data.size - 1)",
" slogger.glob.info(\"New segment for task #{}: start_frame = {}, \\\n stop_frame = {}\".format(db_task.id, start_frame, stop_frame))",
" db_segment = models.Segment()\n db_segment.task = db_task\n db_segment.start_frame = start_frame\n db_segment.stop_frame = stop_frame\n db_segment.save()",
" db_job = models.Job(segment=db_segment)\n db_job.save()",
"\n db_task.data.save()\n db_task.save()",
"def _count_files(data, manifest_files=None):\n share_root = settings.SHARE_ROOT\n server_files = []",
" for path in data[\"server_files\"]:\n path = os.path.normpath(path).lstrip('/')\n if '..' in path.split(os.path.sep):\n raise ValueError(\"Don't use '..' inside file paths\")\n full_path = os.path.abspath(os.path.join(share_root, path))\n if os.path.commonprefix([share_root, full_path]) != share_root:\n raise ValueError(\"Bad file path: \" + path)\n server_files.append(path)",
" sorted_server_files = sorted(server_files, reverse=True)\n # The idea of the code is trivial. After sort we will have files in the\n # following order: 'a/b/c/d/2.txt', 'a/b/c/d/1.txt', 'a/b/c/d', 'a/b/c'\n # Let's keep all items which aren't substrings of the previous item. In\n # the example above only 2.txt and 1.txt files will be in the final list.\n # Also need to correctly handle 'a/b/c0', 'a/b/c' case.\n without_extra_dirs = [v[1] for v in zip([\"\"] + sorted_server_files, sorted_server_files)\n if not os.path.dirname(v[0]).startswith(v[1])]",
" # we need to keep the original sequence of files\n data['server_files'] = [f for f in server_files if f in without_extra_dirs]",
" def count_files(file_mapping, counter):\n for rel_path, full_path in file_mapping.items():\n mime = get_mime(full_path)\n if mime in counter:\n counter[mime].append(rel_path)\n elif rel_path.endswith('.jsonl'):\n manifest_files.append(rel_path)\n else:\n slogger.glob.warn(\"Skip '{}' file (its mime type doesn't \"\n \"correspond to supported MIME file type)\".format(full_path))",
" counter = { media_type: [] for media_type in MEDIA_TYPES.keys() }",
" count_files(\n file_mapping={ f:f for f in data['remote_files'] or data['client_files']},\n counter=counter,\n )",
" count_files(\n file_mapping={ f:os.path.abspath(os.path.join(share_root, f)) for f in data['server_files']},\n counter=counter,\n )",
" return counter",
"def _validate_data(counter, manifest_files=None):\n unique_entries = 0\n multiple_entries = 0\n for media_type, media_config in MEDIA_TYPES.items():\n if counter[media_type]:\n if media_config['unique']:\n unique_entries += len(counter[media_type])\n else:\n multiple_entries += len(counter[media_type])",
" if manifest_files and media_type not in ('video', 'image'):\n raise Exception('File with meta information can only be uploaded with video/images ')",
" if unique_entries == 1 and multiple_entries > 0 or unique_entries > 1:\n unique_types = ', '.join([k for k, v in MEDIA_TYPES.items() if v['unique']])\n multiply_types = ', '.join([k for k, v in MEDIA_TYPES.items() if not v['unique']])\n count = ', '.join(['{} {}(s)'.format(len(v), k) for k, v in counter.items()])\n raise ValueError('Only one {} or many {} can be used simultaneously, \\\n but {} found.'.format(unique_types, multiply_types, count))",
" if unique_entries == 0 and multiple_entries == 0:\n raise ValueError('No media data found')",
" task_modes = [MEDIA_TYPES[media_type]['mode'] for media_type, media_files in counter.items() if media_files]",
" if not all(mode == task_modes[0] for mode in task_modes):\n raise Exception('Could not combine different task modes for data')",
" return counter, task_modes[0]",
"def _validate_manifest(manifests, root_dir):\n if manifests:\n if len(manifests) != 1:\n raise Exception('Only one manifest file can be attached with data')\n full_manifest_path = os.path.join(root_dir, manifests[0])\n if is_manifest(full_manifest_path):\n return manifests[0]\n raise Exception('Invalid manifest was uploaded')\n return None\n",
"",
"def _download_data(urls, upload_dir):\n job = rq.get_current_job()\n local_files = {}\n for url in urls:\n name = os.path.basename(urlrequest.url2pathname(urlparse.urlparse(url).path))\n if name in local_files:\n raise Exception(\"filename collision: {}\".format(name))",
"",
" slogger.glob.info(\"Downloading: {}\".format(url))\n job.meta['status'] = '{} is being downloaded..'.format(url)\n job.save_meta()",
" response = requests.get(url, stream=True)\n if response.status_code == 200:\n response.raw.decode_content = True\n with open(os.path.join(upload_dir, name), 'wb') as output_file:\n shutil.copyfileobj(response.raw, output_file)\n else:\n raise Exception(\"Failed to download \" + url)",
" local_files[name] = True",
" return list(local_files.keys())",
"def _get_manifest_frame_indexer(start_frame=0, frame_step=1):\n return lambda frame_id: start_frame + frame_id * frame_step",
"\n@transaction.atomic\ndef _create_thread(db_task, data, isBackupRestore=False, isDatasetImport=False):\n if isinstance(db_task, int):\n db_task = models.Task.objects.select_for_update().get(pk=db_task)",
" slogger.glob.info(\"create task #{}\".format(db_task.id))",
" db_data = db_task.data\n upload_dir = db_data.get_upload_dirname()",
" if data['remote_files'] and not isDatasetImport:\n data['remote_files'] = _download_data(data['remote_files'], upload_dir)",
" manifest_files = []\n media = _count_files(data, manifest_files)\n media, task_mode = _validate_data(media, manifest_files)",
" if data['server_files']:\n if db_data.storage == models.StorageChoice.LOCAL:\n _copy_data_from_source(data['server_files'], upload_dir, data.get('server_files_path'))\n elif db_data.storage == models.StorageChoice.SHARE:\n upload_dir = settings.SHARE_ROOT",
" manifest_root = None\n if db_data.storage in {models.StorageChoice.LOCAL, models.StorageChoice.SHARE}:\n manifest_root = upload_dir\n elif db_data.storage == models.StorageChoice.CLOUD_STORAGE:\n manifest_root = db_data.cloud_storage.get_storage_dirname()",
" manifest_file = _validate_manifest(manifest_files, manifest_root)\n if manifest_file and (not settings.USE_CACHE or db_data.storage_method != models.StorageMethodChoice.CACHE):\n raise Exception(\"File with meta information can be uploaded if 'Use cache' option is also selected\")",
" if data['server_files'] and db_data.storage == models.StorageChoice.CLOUD_STORAGE:\n if not manifest_file: raise Exception('A manifest file not found')\n db_cloud_storage = db_data.cloud_storage\n credentials = Credentials()\n credentials.convert_from_db({\n 'type': db_cloud_storage.credentials_type,\n 'value': db_cloud_storage.credentials,\n })",
" details = {\n 'resource': db_cloud_storage.resource,\n 'credentials': credentials,\n 'specific_attributes': db_cloud_storage.get_specific_attributes()\n }\n cloud_storage_instance = get_cloud_storage_instance(cloud_provider=db_cloud_storage.provider_type, **details)\n sorted_media = sort(media['image'], data['sorting_method'])\n first_sorted_media_image = sorted_media[0]\n cloud_storage_instance.download_file(first_sorted_media_image, os.path.join(upload_dir, first_sorted_media_image))",
" # prepare task manifest file from cloud storage manifest file\n # NOTE we should create manifest before defining chunk_size\n # FIXME in the future when will be implemented archive support\n manifest = ImageManifestManager(db_data.get_manifest_path())\n cloud_storage_manifest = ImageManifestManager(\n os.path.join(db_data.cloud_storage.get_storage_dirname(), manifest_file),\n db_data.cloud_storage.get_storage_dirname()\n )\n cloud_storage_manifest.set_index()\n sequence, content = cloud_storage_manifest.get_subset(sorted_media)\n sorted_content = (i[1] for i in sorted(zip(sequence, content)))\n manifest.create(sorted_content)",
" av_scan_paths(upload_dir)",
" job = rq.get_current_job()\n job.meta['status'] = 'Media files are being extracted...'\n job.save_meta()",
" db_images = []\n extractor = None\n manifest_index = _get_manifest_frame_indexer()",
" # If upload from server_files image and directories\n # need to update images list by all found images in directories\n if (data['server_files']) and len(media['directory']) and len(media['image']):\n media['image'].extend(\n [os.path.relpath(image, upload_dir) for image in\n MEDIA_TYPES['directory']['extractor'](\n source_path=[os.path.join(upload_dir, f) for f in media['directory']],\n ).absolute_source_paths\n ]\n )\n media['directory'] = []",
" for media_type, media_files in media.items():\n if media_files:\n if extractor is not None:\n raise Exception('Combined data types are not supported')\n if (isDatasetImport or isBackupRestore) and media_type == 'image' and db_data.storage == models.StorageChoice.SHARE:\n manifest_index = _get_manifest_frame_indexer(db_data.start_frame, db_data.get_frame_step())\n db_data.start_frame = 0\n data['stop_frame'] = None\n db_data.frame_filter = ''\n source_paths=[os.path.join(upload_dir, f) for f in media_files]\n if manifest_file and not isBackupRestore and data['sorting_method'] in {models.SortingMethod.RANDOM, models.SortingMethod.PREDEFINED}:\n raise Exception(\"It isn't supported to upload manifest file and use random sorting\")\n if isBackupRestore and db_data.storage_method == models.StorageMethodChoice.FILE_SYSTEM and \\\n data['sorting_method'] in {models.SortingMethod.RANDOM, models.SortingMethod.PREDEFINED}:\n raise Exception(\"It isn't supported to import the task that was created without cache but with random/predefined sorting\")",
" details = {\n 'source_path': source_paths,\n 'step': db_data.get_frame_step(),\n 'start': db_data.start_frame,\n 'stop': data['stop_frame'],\n }\n if media_type in {'archive', 'zip', 'pdf'} and db_data.storage == models.StorageChoice.SHARE:\n details['extract_dir'] = db_data.get_upload_dirname()\n upload_dir = db_data.get_upload_dirname()\n db_data.storage = models.StorageChoice.LOCAL\n if media_type != 'video':\n details['sorting_method'] = data['sorting_method']\n extractor = MEDIA_TYPES[media_type]['extractor'](**details)",
" validate_dimension = ValidateDimension()\n if isinstance(extractor, MEDIA_TYPES['zip']['extractor']):\n extractor.extract()",
" if db_data.storage == models.StorageChoice.LOCAL or \\\n (db_data.storage == models.StorageChoice.SHARE and \\\n isinstance(extractor, MEDIA_TYPES['zip']['extractor'])):\n validate_dimension.set_path(upload_dir)\n validate_dimension.validate()",
" if db_task.project is not None and db_task.project.tasks.count() > 1 and db_task.project.tasks.first().dimension != validate_dimension.dimension:\n raise Exception(f'Dimension ({validate_dimension.dimension}) of the task must be the same as other tasks in project ({db_task.project.tasks.first().dimension})')",
" if validate_dimension.dimension == models.DimensionType.DIM_3D:\n db_task.dimension = models.DimensionType.DIM_3D",
" keys_of_related_files = validate_dimension.related_files.keys()\n absolute_keys_of_related_files = [os.path.join(upload_dir, f) for f in keys_of_related_files]\n # When a task is created, the sorting method can be random and in this case, reinitialization will be with correct sorting\n # but when a task is restored from a backup, a random sorting is changed to predefined and we need to manually sort files\n # in the correct order.\n source_files = absolute_keys_of_related_files if not isBackupRestore else \\\n [item for item in extractor.absolute_source_paths if item in absolute_keys_of_related_files]\n extractor.reconcile(\n source_files=source_files,\n step=db_data.get_frame_step(),\n start=db_data.start_frame,\n stop=data['stop_frame'],\n dimension=models.DimensionType.DIM_3D,\n )",
" related_images = {}\n if isinstance(extractor, MEDIA_TYPES['image']['extractor']):\n extractor.filter(lambda x: not re.search(r'(^|{0})related_images{0}'.format(os.sep), x))\n related_images = detect_related_images(extractor.absolute_source_paths, upload_dir)",
" if isBackupRestore and not isinstance(extractor, MEDIA_TYPES['video']['extractor']) and db_data.storage_method == models.StorageMethodChoice.CACHE and \\\n db_data.sorting_method in {models.SortingMethod.RANDOM, models.SortingMethod.PREDEFINED} and validate_dimension.dimension != models.DimensionType.DIM_3D:\n # we should sort media_files according to the manifest content sequence\n # and we should do this in general after validation step for 3D data and after filtering from related_images\n manifest = ImageManifestManager(db_data.get_manifest_path())\n manifest.set_index()\n sorted_media_files = []",
" for idx in range(len(extractor.absolute_source_paths)):\n properties = manifest[idx]\n image_name = properties.get('name', None)\n image_extension = properties.get('extension', None)",
" full_image_path = os.path.join(upload_dir, f\"{image_name}{image_extension}\") if image_name and image_extension else None\n if full_image_path and full_image_path in extractor:\n sorted_media_files.append(full_image_path)\n media_files = sorted_media_files.copy()\n del sorted_media_files\n data['sorting_method'] = models.SortingMethod.PREDEFINED\n extractor.reconcile(\n source_files=media_files,\n step=db_data.get_frame_step(),\n start=db_data.start_frame,\n stop=data['stop_frame'],\n sorting_method=data['sorting_method'],\n )",
" db_task.mode = task_mode\n db_data.compressed_chunk_type = models.DataChoice.VIDEO if task_mode == 'interpolation' and not data['use_zip_chunks'] else models.DataChoice.IMAGESET\n db_data.original_chunk_type = models.DataChoice.VIDEO if task_mode == 'interpolation' else models.DataChoice.IMAGESET",
" def update_progress(progress):\n progress_animation = '|/-\\\\'\n if not hasattr(update_progress, 'call_counter'):\n update_progress.call_counter = 0",
" status_message = 'Images are being compressed'\n if not progress:\n status_message = '{} {}'.format(status_message, progress_animation[update_progress.call_counter])\n job.meta['status'] = status_message\n job.meta['task_progress'] = progress or 0.\n job.save_meta()\n update_progress.call_counter = (update_progress.call_counter + 1) % len(progress_animation)",
" compressed_chunk_writer_class = Mpeg4CompressedChunkWriter if db_data.compressed_chunk_type == models.DataChoice.VIDEO else ZipCompressedChunkWriter\n if db_data.original_chunk_type == models.DataChoice.VIDEO:\n original_chunk_writer_class = Mpeg4ChunkWriter\n # Let's use QP=17 (that is 67 for 0-100 range) for the original chunks, which should be visually lossless or nearly so.\n # A lower value will significantly increase the chunk size with a slight increase of quality.\n original_quality = 67\n else:\n original_chunk_writer_class = ZipChunkWriter\n original_quality = 100",
" kwargs = {}\n if validate_dimension.dimension == models.DimensionType.DIM_3D:\n kwargs[\"dimension\"] = validate_dimension.dimension\n compressed_chunk_writer = compressed_chunk_writer_class(db_data.image_quality, **kwargs)\n original_chunk_writer = original_chunk_writer_class(original_quality)",
" # calculate chunk size if it isn't specified\n if db_data.chunk_size is None:\n if isinstance(compressed_chunk_writer, ZipCompressedChunkWriter):\n if not (db_data.storage == models.StorageChoice.CLOUD_STORAGE):\n w, h = extractor.get_image_size(0)\n else:\n img_properties = manifest[0]\n w, h = img_properties['width'], img_properties['height']\n area = h * w\n db_data.chunk_size = max(2, min(72, 36 * 1920 * 1080 // area))\n else:\n db_data.chunk_size = 36",
" video_path = \"\"\n video_size = (0, 0)",
" def _update_status(msg):\n job.meta['status'] = msg\n job.save_meta()",
" if settings.USE_CACHE and db_data.storage_method == models.StorageMethodChoice.CACHE:\n for media_type, media_files in media.items():",
" if not media_files:\n continue",
" # replace manifest file (e.g was uploaded 'subdir/manifest.jsonl' or 'some_manifest.jsonl')\n if manifest_file and not os.path.exists(db_data.get_manifest_path()):\n shutil.copyfile(os.path.join(upload_dir, manifest_file),\n db_data.get_manifest_path())\n if upload_dir != settings.SHARE_ROOT:\n os.remove(os.path.join(upload_dir, manifest_file))",
" if task_mode == MEDIA_TYPES['video']['mode']:\n try:\n manifest_is_prepared = False\n if manifest_file:\n try:\n manifest = VideoManifestValidator(source_path=os.path.join(upload_dir, media_files[0]),\n manifest_path=db_data.get_manifest_path())\n manifest.init_index()\n manifest.validate_seek_key_frames()\n manifest.validate_frame_numbers()\n assert len(manifest) > 0, 'No key frames.'",
" all_frames = manifest.video_length\n video_size = manifest.video_resolution\n manifest_is_prepared = True\n except Exception as ex:\n manifest.remove()\n if isinstance(ex, AssertionError):\n base_msg = str(ex)\n else:\n base_msg = 'Invalid manifest file was upload.'\n slogger.glob.warning(str(ex))\n _update_status('{} Start prepare a valid manifest file.'.format(base_msg))",
" if not manifest_is_prepared:\n _update_status('Start prepare a manifest file')\n manifest = VideoManifestManager(db_data.get_manifest_path())\n manifest.link(\n media_file=media_files[0],\n upload_dir=upload_dir,\n chunk_size=db_data.chunk_size\n )\n manifest.create()\n _update_status('A manifest had been created')",
" all_frames = len(manifest.reader)\n video_size = manifest.reader.resolution\n manifest_is_prepared = True",
" db_data.size = len(range(db_data.start_frame, min(data['stop_frame'] + 1 \\\n if data['stop_frame'] else all_frames, all_frames), db_data.get_frame_step()))\n video_path = os.path.join(upload_dir, media_files[0])\n except Exception as ex:\n db_data.storage_method = models.StorageMethodChoice.FILE_SYSTEM\n manifest.remove()\n del manifest\n base_msg = str(ex) if isinstance(ex, AssertionError) \\\n else \"Uploaded video does not support a quick way of task creating.\"\n _update_status(\"{} The task will be created using the old method\".format(base_msg))\n else: # images, archive, pdf\n db_data.size = len(extractor)\n manifest = ImageManifestManager(db_data.get_manifest_path())\n if not manifest_file:\n manifest.link(\n sources=extractor.absolute_source_paths,\n meta={ k: {'related_images': related_images[k] } for k in related_images },\n data_dir=upload_dir,\n DIM_3D=(db_task.dimension == models.DimensionType.DIM_3D),\n )\n manifest.create()\n else:\n manifest.init_index()\n counter = itertools.count()\n for _, chunk_frames in itertools.groupby(extractor.frame_range, lambda x: next(counter) // db_data.chunk_size):\n chunk_paths = [(extractor.get_path(i), i) for i in chunk_frames]\n img_sizes = []",
" for chunk_path, frame_id in chunk_paths:\n properties = manifest[manifest_index(frame_id)]",
" # check mapping\n if not chunk_path.endswith(f\"{properties['name']}{properties['extension']}\"):\n raise Exception('Incorrect file mapping to manifest content')\n if db_task.dimension == models.DimensionType.DIM_2D:\n resolution = (properties['width'], properties['height'])\n else:\n resolution = extractor.get_image_size(frame_id)\n img_sizes.append(resolution)",
" db_images.extend([\n models.Image(data=db_data,\n path=os.path.relpath(path, upload_dir),\n frame=frame, width=w, height=h)\n for (path, frame), (w, h) in zip(chunk_paths, img_sizes)\n ])",
" if db_data.storage_method == models.StorageMethodChoice.FILE_SYSTEM or not settings.USE_CACHE:\n counter = itertools.count()\n generator = itertools.groupby(extractor, lambda x: next(counter) // db_data.chunk_size)\n for chunk_idx, chunk_data in generator:\n chunk_data = list(chunk_data)\n original_chunk_path = db_data.get_original_chunk_path(chunk_idx)\n original_chunk_writer.save_as_chunk(chunk_data, original_chunk_path)",
" compressed_chunk_path = db_data.get_compressed_chunk_path(chunk_idx)\n img_sizes = compressed_chunk_writer.save_as_chunk(chunk_data, compressed_chunk_path)",
" if db_task.mode == 'annotation':\n db_images.extend([\n models.Image(\n data=db_data,\n path=os.path.relpath(data[1], upload_dir),\n frame=data[2],\n width=size[0],\n height=size[1])",
" for data, size in zip(chunk_data, img_sizes)\n ])\n else:\n video_size = img_sizes[0]\n video_path = chunk_data[0][1]",
" db_data.size += len(chunk_data)\n progress = extractor.get_progress(chunk_data[-1][2])\n update_progress(progress)",
" if db_task.mode == 'annotation':\n models.Image.objects.bulk_create(db_images)\n created_images = models.Image.objects.filter(data_id=db_data.id)",
" db_related_files = [\n models.RelatedFile(data=image.data, primary_image=image, path=os.path.join(upload_dir, related_file_path))\n for image in created_images\n for related_file_path in related_images.get(image.path, [])\n ]\n models.RelatedFile.objects.bulk_create(db_related_files)\n db_images = []\n else:\n models.Video.objects.create(\n data=db_data,\n path=os.path.relpath(video_path, upload_dir),\n width=video_size[0], height=video_size[1])",
" if db_data.stop_frame == 0:\n db_data.stop_frame = db_data.start_frame + (db_data.size - 1) * db_data.get_frame_step()\n else:\n # validate stop_frame\n db_data.stop_frame = min(db_data.stop_frame, \\\n db_data.start_frame + (db_data.size - 1) * db_data.get_frame_step())",
" preview = extractor.get_preview()\n preview.save(db_data.get_preview_path())",
" slogger.glob.info(\"Found frames {} for Data #{}\".format(db_data.size, db_data.id))\n _save_task_to_db(db_task)"
] |
[
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [83, 212, 54], "buggy_code_start_loc": [83, 8, 54], "filenames": ["CHANGELOG.md", "cvat/apps/engine/task.py", "cvat/requirements/base.txt"], "fixing_code_end_loc": [85, 256, 56], "fixing_code_start_loc": [84, 9, 55], "message": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cvat:cvat:*:*:*:*:*:*:*:*", "matchCriteriaId": "29D76D4E-B25E-4AE9-86EC-887059DBA160", "versionEndExcluding": "2.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "CVAT es una herramienta de anotaci\u00f3n de v\u00eddeo e imagen interactiva de c\u00f3digo abierto para la visi\u00f3n por ordenador. Las versiones anteriores a 2.0.0, est\u00e1n sujetas a una vulnerabilidad de tipo Server-side request forgery (SSRF). Ha sido a\u00f1adida la comprobaci\u00f3n de las urls usadas en la ruta de c\u00f3digo afectada en versi\u00f3n 2.0.0. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31188", "lastModified": "2022-12-08T22:35:16.617", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 8.6, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 4.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-08-01T20:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/169814/CVAT-2.0-Server-Side-Request-Forgery.html"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/security/advisories/GHSA-7vpj-j5xv-29pr"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, "type": "CWE-918"}
| 93
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# Copyright (C) 2018-2022 Intel Corporation\n#\n# SPDX-License-Identifier: MIT",
"import itertools\nimport os\nimport sys",
"from rest_framework.serializers import ValidationError",
"import rq\nimport re\nimport shutil\nfrom distutils.dir_util import copy_tree\nfrom traceback import print_exception\nfrom urllib import parse as urlparse\nfrom urllib import request as urlrequest\nimport requests",
"import ipaddress\nimport dns.resolver",
"import django_rq",
"from django.conf import settings\nfrom django.db import transaction",
"from cvat.apps.engine import models\nfrom cvat.apps.engine.log import slogger\nfrom cvat.apps.engine.media_extractors import (MEDIA_TYPES, Mpeg4ChunkWriter, Mpeg4CompressedChunkWriter,\n ValidateDimension, ZipChunkWriter, ZipCompressedChunkWriter, get_mime, sort)\nfrom cvat.apps.engine.utils import av_scan_paths\nfrom utils.dataset_manifest import ImageManifestManager, VideoManifestManager, is_manifest\nfrom utils.dataset_manifest.core import VideoManifestValidator\nfrom utils.dataset_manifest.utils import detect_related_images\nfrom .cloud_provider import get_cloud_storage_instance, Credentials",
"############################# Low Level server API",
"def create(tid, data):\n \"\"\"Schedule the task\"\"\"\n q = django_rq.get_queue('default')\n q.enqueue_call(func=_create_thread, args=(tid, data),\n job_id=\"/api/tasks/{}\".format(tid))",
"@transaction.atomic\ndef rq_handler(job, exc_type, exc_value, traceback):\n split = job.id.split('/')\n tid = split[split.index('tasks') + 1]\n try:\n tid = int(tid)\n db_task = models.Task.objects.select_for_update().get(pk=tid)\n with open(db_task.get_log_path(), \"wt\") as log_file:\n print_exception(exc_type, exc_value, traceback, file=log_file)\n except (models.Task.DoesNotExist, ValueError):\n pass # skip exceptions in the code",
" return False",
"############################# Internal implementation for server API",
"def _copy_data_from_source(server_files, upload_dir, server_dir=None):\n job = rq.get_current_job()\n job.meta['status'] = 'Data are being copied from source..'\n job.save_meta()",
" for path in server_files:\n if server_dir is None:\n source_path = os.path.join(settings.SHARE_ROOT, os.path.normpath(path))\n else:\n source_path = os.path.join(server_dir, os.path.normpath(path))\n target_path = os.path.join(upload_dir, path)\n if os.path.isdir(source_path):\n copy_tree(source_path, target_path)\n else:\n target_dir = os.path.dirname(target_path)\n if not os.path.exists(target_dir):\n os.makedirs(target_dir)\n shutil.copyfile(source_path, target_path)",
"def _save_task_to_db(db_task):\n job = rq.get_current_job()\n job.meta['status'] = 'Task is being saved in database'\n job.save_meta()",
" segment_size = db_task.segment_size\n segment_step = segment_size\n if segment_size == 0 or segment_size > db_task.data.size:\n segment_size = db_task.data.size\n db_task.segment_size = segment_size",
" # Segment step must be more than segment_size + overlap in single-segment tasks\n # Otherwise a task contains an extra segment\n segment_step = sys.maxsize",
" default_overlap = 5 if db_task.mode == 'interpolation' else 0\n if db_task.overlap is None:\n db_task.overlap = default_overlap\n db_task.overlap = min(db_task.overlap, segment_size // 2)",
" segment_step -= db_task.overlap",
" for start_frame in range(0, db_task.data.size, segment_step):\n stop_frame = min(start_frame + segment_size - 1, db_task.data.size - 1)",
" slogger.glob.info(\"New segment for task #{}: start_frame = {}, \\\n stop_frame = {}\".format(db_task.id, start_frame, stop_frame))",
" db_segment = models.Segment()\n db_segment.task = db_task\n db_segment.start_frame = start_frame\n db_segment.stop_frame = stop_frame\n db_segment.save()",
" db_job = models.Job(segment=db_segment)\n db_job.save()",
"\n db_task.data.save()\n db_task.save()",
"def _count_files(data, manifest_files=None):\n share_root = settings.SHARE_ROOT\n server_files = []",
" for path in data[\"server_files\"]:\n path = os.path.normpath(path).lstrip('/')\n if '..' in path.split(os.path.sep):\n raise ValueError(\"Don't use '..' inside file paths\")\n full_path = os.path.abspath(os.path.join(share_root, path))\n if os.path.commonprefix([share_root, full_path]) != share_root:\n raise ValueError(\"Bad file path: \" + path)\n server_files.append(path)",
" sorted_server_files = sorted(server_files, reverse=True)\n # The idea of the code is trivial. After sort we will have files in the\n # following order: 'a/b/c/d/2.txt', 'a/b/c/d/1.txt', 'a/b/c/d', 'a/b/c'\n # Let's keep all items which aren't substrings of the previous item. In\n # the example above only 2.txt and 1.txt files will be in the final list.\n # Also need to correctly handle 'a/b/c0', 'a/b/c' case.\n without_extra_dirs = [v[1] for v in zip([\"\"] + sorted_server_files, sorted_server_files)\n if not os.path.dirname(v[0]).startswith(v[1])]",
" # we need to keep the original sequence of files\n data['server_files'] = [f for f in server_files if f in without_extra_dirs]",
" def count_files(file_mapping, counter):\n for rel_path, full_path in file_mapping.items():\n mime = get_mime(full_path)\n if mime in counter:\n counter[mime].append(rel_path)\n elif rel_path.endswith('.jsonl'):\n manifest_files.append(rel_path)\n else:\n slogger.glob.warn(\"Skip '{}' file (its mime type doesn't \"\n \"correspond to supported MIME file type)\".format(full_path))",
" counter = { media_type: [] for media_type in MEDIA_TYPES.keys() }",
" count_files(\n file_mapping={ f:f for f in data['remote_files'] or data['client_files']},\n counter=counter,\n )",
" count_files(\n file_mapping={ f:os.path.abspath(os.path.join(share_root, f)) for f in data['server_files']},\n counter=counter,\n )",
" return counter",
"def _validate_data(counter, manifest_files=None):\n unique_entries = 0\n multiple_entries = 0\n for media_type, media_config in MEDIA_TYPES.items():\n if counter[media_type]:\n if media_config['unique']:\n unique_entries += len(counter[media_type])\n else:\n multiple_entries += len(counter[media_type])",
" if manifest_files and media_type not in ('video', 'image'):\n raise Exception('File with meta information can only be uploaded with video/images ')",
" if unique_entries == 1 and multiple_entries > 0 or unique_entries > 1:\n unique_types = ', '.join([k for k, v in MEDIA_TYPES.items() if v['unique']])\n multiply_types = ', '.join([k for k, v in MEDIA_TYPES.items() if not v['unique']])\n count = ', '.join(['{} {}(s)'.format(len(v), k) for k, v in counter.items()])\n raise ValueError('Only one {} or many {} can be used simultaneously, \\\n but {} found.'.format(unique_types, multiply_types, count))",
" if unique_entries == 0 and multiple_entries == 0:\n raise ValueError('No media data found')",
" task_modes = [MEDIA_TYPES[media_type]['mode'] for media_type, media_files in counter.items() if media_files]",
" if not all(mode == task_modes[0] for mode in task_modes):\n raise Exception('Could not combine different task modes for data')",
" return counter, task_modes[0]",
"def _validate_manifest(manifests, root_dir):\n if manifests:\n if len(manifests) != 1:\n raise Exception('Only one manifest file can be attached with data')\n full_manifest_path = os.path.join(root_dir, manifests[0])\n if is_manifest(full_manifest_path):\n return manifests[0]\n raise Exception('Invalid manifest was uploaded')\n return None\n",
"def _validate_url(url):\n def _validate_ip_address(ip_address):\n if not ip_address.is_global:\n raise ValidationError('Non public IP address \\'{}\\' is provided!'.format(ip_address))",
" ALLOWED_SCHEMES = ['http', 'https']",
" parsed_url = urlparse.urlparse(url)",
" if parsed_url.scheme not in ALLOWED_SCHEMES:\n raise ValueError('Unsupported URL sheme: {}. Only http and https are supported'.format(parsed_url.scheme))",
" try:\n ip_address = ipaddress.ip_address(parsed_url.hostname)\n _validate_ip_address(ip_address)\n except ValueError as _:\n ip_v4_records = None\n ip_v6_records = None\n try:\n ip_v4_records = dns.resolver.query(parsed_url.hostname, 'A')\n for record in ip_v4_records:\n _validate_ip_address(ipaddress.ip_address(record.to_text()))\n except ValidationError:\n raise\n except Exception as e:\n slogger.glob.info('Cannot get A record for domain \\'{}\\': {}'.format(parsed_url.hostname, e))",
" try:\n ip_v6_records = dns.resolver.query(parsed_url.hostname, 'AAAA')\n for record in ip_v6_records:\n _validate_ip_address(ipaddress.ip_address(record.to_text()))\n except ValidationError:\n raise\n except Exception as e:\n slogger.glob.info('Cannot get AAAA record for domain \\'{}\\': {}'.format(parsed_url.hostname, e))",
" if not ip_v4_records and not ip_v6_records:\n raise ValidationError('Cannot resolve IP address for domain \\'{}\\''.format(parsed_url.hostname))\n",
"def _download_data(urls, upload_dir):\n job = rq.get_current_job()\n local_files = {}\n for url in urls:\n name = os.path.basename(urlrequest.url2pathname(urlparse.urlparse(url).path))\n if name in local_files:\n raise Exception(\"filename collision: {}\".format(name))",
" _validate_url(url)",
" slogger.glob.info(\"Downloading: {}\".format(url))\n job.meta['status'] = '{} is being downloaded..'.format(url)\n job.save_meta()",
" response = requests.get(url, stream=True)\n if response.status_code == 200:\n response.raw.decode_content = True\n with open(os.path.join(upload_dir, name), 'wb') as output_file:\n shutil.copyfileobj(response.raw, output_file)\n else:\n raise Exception(\"Failed to download \" + url)",
" local_files[name] = True",
" return list(local_files.keys())",
"def _get_manifest_frame_indexer(start_frame=0, frame_step=1):\n return lambda frame_id: start_frame + frame_id * frame_step",
"\n@transaction.atomic\ndef _create_thread(db_task, data, isBackupRestore=False, isDatasetImport=False):\n if isinstance(db_task, int):\n db_task = models.Task.objects.select_for_update().get(pk=db_task)",
" slogger.glob.info(\"create task #{}\".format(db_task.id))",
" db_data = db_task.data\n upload_dir = db_data.get_upload_dirname()",
" if data['remote_files'] and not isDatasetImport:\n data['remote_files'] = _download_data(data['remote_files'], upload_dir)",
" manifest_files = []\n media = _count_files(data, manifest_files)\n media, task_mode = _validate_data(media, manifest_files)",
" if data['server_files']:\n if db_data.storage == models.StorageChoice.LOCAL:\n _copy_data_from_source(data['server_files'], upload_dir, data.get('server_files_path'))\n elif db_data.storage == models.StorageChoice.SHARE:\n upload_dir = settings.SHARE_ROOT",
" manifest_root = None\n if db_data.storage in {models.StorageChoice.LOCAL, models.StorageChoice.SHARE}:\n manifest_root = upload_dir\n elif db_data.storage == models.StorageChoice.CLOUD_STORAGE:\n manifest_root = db_data.cloud_storage.get_storage_dirname()",
" manifest_file = _validate_manifest(manifest_files, manifest_root)\n if manifest_file and (not settings.USE_CACHE or db_data.storage_method != models.StorageMethodChoice.CACHE):\n raise Exception(\"File with meta information can be uploaded if 'Use cache' option is also selected\")",
" if data['server_files'] and db_data.storage == models.StorageChoice.CLOUD_STORAGE:\n if not manifest_file: raise Exception('A manifest file not found')\n db_cloud_storage = db_data.cloud_storage\n credentials = Credentials()\n credentials.convert_from_db({\n 'type': db_cloud_storage.credentials_type,\n 'value': db_cloud_storage.credentials,\n })",
" details = {\n 'resource': db_cloud_storage.resource,\n 'credentials': credentials,\n 'specific_attributes': db_cloud_storage.get_specific_attributes()\n }\n cloud_storage_instance = get_cloud_storage_instance(cloud_provider=db_cloud_storage.provider_type, **details)\n sorted_media = sort(media['image'], data['sorting_method'])\n first_sorted_media_image = sorted_media[0]\n cloud_storage_instance.download_file(first_sorted_media_image, os.path.join(upload_dir, first_sorted_media_image))",
" # prepare task manifest file from cloud storage manifest file\n # NOTE we should create manifest before defining chunk_size\n # FIXME in the future when will be implemented archive support\n manifest = ImageManifestManager(db_data.get_manifest_path())\n cloud_storage_manifest = ImageManifestManager(\n os.path.join(db_data.cloud_storage.get_storage_dirname(), manifest_file),\n db_data.cloud_storage.get_storage_dirname()\n )\n cloud_storage_manifest.set_index()\n sequence, content = cloud_storage_manifest.get_subset(sorted_media)\n sorted_content = (i[1] for i in sorted(zip(sequence, content)))\n manifest.create(sorted_content)",
" av_scan_paths(upload_dir)",
" job = rq.get_current_job()\n job.meta['status'] = 'Media files are being extracted...'\n job.save_meta()",
" db_images = []\n extractor = None\n manifest_index = _get_manifest_frame_indexer()",
" # If upload from server_files image and directories\n # need to update images list by all found images in directories\n if (data['server_files']) and len(media['directory']) and len(media['image']):\n media['image'].extend(\n [os.path.relpath(image, upload_dir) for image in\n MEDIA_TYPES['directory']['extractor'](\n source_path=[os.path.join(upload_dir, f) for f in media['directory']],\n ).absolute_source_paths\n ]\n )\n media['directory'] = []",
" for media_type, media_files in media.items():\n if media_files:\n if extractor is not None:\n raise Exception('Combined data types are not supported')\n if (isDatasetImport or isBackupRestore) and media_type == 'image' and db_data.storage == models.StorageChoice.SHARE:\n manifest_index = _get_manifest_frame_indexer(db_data.start_frame, db_data.get_frame_step())\n db_data.start_frame = 0\n data['stop_frame'] = None\n db_data.frame_filter = ''\n source_paths=[os.path.join(upload_dir, f) for f in media_files]\n if manifest_file and not isBackupRestore and data['sorting_method'] in {models.SortingMethod.RANDOM, models.SortingMethod.PREDEFINED}:\n raise Exception(\"It isn't supported to upload manifest file and use random sorting\")\n if isBackupRestore and db_data.storage_method == models.StorageMethodChoice.FILE_SYSTEM and \\\n data['sorting_method'] in {models.SortingMethod.RANDOM, models.SortingMethod.PREDEFINED}:\n raise Exception(\"It isn't supported to import the task that was created without cache but with random/predefined sorting\")",
" details = {\n 'source_path': source_paths,\n 'step': db_data.get_frame_step(),\n 'start': db_data.start_frame,\n 'stop': data['stop_frame'],\n }\n if media_type in {'archive', 'zip', 'pdf'} and db_data.storage == models.StorageChoice.SHARE:\n details['extract_dir'] = db_data.get_upload_dirname()\n upload_dir = db_data.get_upload_dirname()\n db_data.storage = models.StorageChoice.LOCAL\n if media_type != 'video':\n details['sorting_method'] = data['sorting_method']\n extractor = MEDIA_TYPES[media_type]['extractor'](**details)",
" validate_dimension = ValidateDimension()\n if isinstance(extractor, MEDIA_TYPES['zip']['extractor']):\n extractor.extract()",
" if db_data.storage == models.StorageChoice.LOCAL or \\\n (db_data.storage == models.StorageChoice.SHARE and \\\n isinstance(extractor, MEDIA_TYPES['zip']['extractor'])):\n validate_dimension.set_path(upload_dir)\n validate_dimension.validate()",
" if db_task.project is not None and db_task.project.tasks.count() > 1 and db_task.project.tasks.first().dimension != validate_dimension.dimension:\n raise Exception(f'Dimension ({validate_dimension.dimension}) of the task must be the same as other tasks in project ({db_task.project.tasks.first().dimension})')",
" if validate_dimension.dimension == models.DimensionType.DIM_3D:\n db_task.dimension = models.DimensionType.DIM_3D",
" keys_of_related_files = validate_dimension.related_files.keys()\n absolute_keys_of_related_files = [os.path.join(upload_dir, f) for f in keys_of_related_files]\n # When a task is created, the sorting method can be random and in this case, reinitialization will be with correct sorting\n # but when a task is restored from a backup, a random sorting is changed to predefined and we need to manually sort files\n # in the correct order.\n source_files = absolute_keys_of_related_files if not isBackupRestore else \\\n [item for item in extractor.absolute_source_paths if item in absolute_keys_of_related_files]\n extractor.reconcile(\n source_files=source_files,\n step=db_data.get_frame_step(),\n start=db_data.start_frame,\n stop=data['stop_frame'],\n dimension=models.DimensionType.DIM_3D,\n )",
" related_images = {}\n if isinstance(extractor, MEDIA_TYPES['image']['extractor']):\n extractor.filter(lambda x: not re.search(r'(^|{0})related_images{0}'.format(os.sep), x))\n related_images = detect_related_images(extractor.absolute_source_paths, upload_dir)",
" if isBackupRestore and not isinstance(extractor, MEDIA_TYPES['video']['extractor']) and db_data.storage_method == models.StorageMethodChoice.CACHE and \\\n db_data.sorting_method in {models.SortingMethod.RANDOM, models.SortingMethod.PREDEFINED} and validate_dimension.dimension != models.DimensionType.DIM_3D:\n # we should sort media_files according to the manifest content sequence\n # and we should do this in general after validation step for 3D data and after filtering from related_images\n manifest = ImageManifestManager(db_data.get_manifest_path())\n manifest.set_index()\n sorted_media_files = []",
" for idx in range(len(extractor.absolute_source_paths)):\n properties = manifest[idx]\n image_name = properties.get('name', None)\n image_extension = properties.get('extension', None)",
" full_image_path = os.path.join(upload_dir, f\"{image_name}{image_extension}\") if image_name and image_extension else None\n if full_image_path and full_image_path in extractor:\n sorted_media_files.append(full_image_path)\n media_files = sorted_media_files.copy()\n del sorted_media_files\n data['sorting_method'] = models.SortingMethod.PREDEFINED\n extractor.reconcile(\n source_files=media_files,\n step=db_data.get_frame_step(),\n start=db_data.start_frame,\n stop=data['stop_frame'],\n sorting_method=data['sorting_method'],\n )",
" db_task.mode = task_mode\n db_data.compressed_chunk_type = models.DataChoice.VIDEO if task_mode == 'interpolation' and not data['use_zip_chunks'] else models.DataChoice.IMAGESET\n db_data.original_chunk_type = models.DataChoice.VIDEO if task_mode == 'interpolation' else models.DataChoice.IMAGESET",
" def update_progress(progress):\n progress_animation = '|/-\\\\'\n if not hasattr(update_progress, 'call_counter'):\n update_progress.call_counter = 0",
" status_message = 'Images are being compressed'\n if not progress:\n status_message = '{} {}'.format(status_message, progress_animation[update_progress.call_counter])\n job.meta['status'] = status_message\n job.meta['task_progress'] = progress or 0.\n job.save_meta()\n update_progress.call_counter = (update_progress.call_counter + 1) % len(progress_animation)",
" compressed_chunk_writer_class = Mpeg4CompressedChunkWriter if db_data.compressed_chunk_type == models.DataChoice.VIDEO else ZipCompressedChunkWriter\n if db_data.original_chunk_type == models.DataChoice.VIDEO:\n original_chunk_writer_class = Mpeg4ChunkWriter\n # Let's use QP=17 (that is 67 for 0-100 range) for the original chunks, which should be visually lossless or nearly so.\n # A lower value will significantly increase the chunk size with a slight increase of quality.\n original_quality = 67\n else:\n original_chunk_writer_class = ZipChunkWriter\n original_quality = 100",
" kwargs = {}\n if validate_dimension.dimension == models.DimensionType.DIM_3D:\n kwargs[\"dimension\"] = validate_dimension.dimension\n compressed_chunk_writer = compressed_chunk_writer_class(db_data.image_quality, **kwargs)\n original_chunk_writer = original_chunk_writer_class(original_quality)",
" # calculate chunk size if it isn't specified\n if db_data.chunk_size is None:\n if isinstance(compressed_chunk_writer, ZipCompressedChunkWriter):\n if not (db_data.storage == models.StorageChoice.CLOUD_STORAGE):\n w, h = extractor.get_image_size(0)\n else:\n img_properties = manifest[0]\n w, h = img_properties['width'], img_properties['height']\n area = h * w\n db_data.chunk_size = max(2, min(72, 36 * 1920 * 1080 // area))\n else:\n db_data.chunk_size = 36",
" video_path = \"\"\n video_size = (0, 0)",
" def _update_status(msg):\n job.meta['status'] = msg\n job.save_meta()",
" if settings.USE_CACHE and db_data.storage_method == models.StorageMethodChoice.CACHE:\n for media_type, media_files in media.items():",
" if not media_files:\n continue",
" # replace manifest file (e.g was uploaded 'subdir/manifest.jsonl' or 'some_manifest.jsonl')\n if manifest_file and not os.path.exists(db_data.get_manifest_path()):\n shutil.copyfile(os.path.join(upload_dir, manifest_file),\n db_data.get_manifest_path())\n if upload_dir != settings.SHARE_ROOT:\n os.remove(os.path.join(upload_dir, manifest_file))",
" if task_mode == MEDIA_TYPES['video']['mode']:\n try:\n manifest_is_prepared = False\n if manifest_file:\n try:\n manifest = VideoManifestValidator(source_path=os.path.join(upload_dir, media_files[0]),\n manifest_path=db_data.get_manifest_path())\n manifest.init_index()\n manifest.validate_seek_key_frames()\n manifest.validate_frame_numbers()\n assert len(manifest) > 0, 'No key frames.'",
" all_frames = manifest.video_length\n video_size = manifest.video_resolution\n manifest_is_prepared = True\n except Exception as ex:\n manifest.remove()\n if isinstance(ex, AssertionError):\n base_msg = str(ex)\n else:\n base_msg = 'Invalid manifest file was upload.'\n slogger.glob.warning(str(ex))\n _update_status('{} Start prepare a valid manifest file.'.format(base_msg))",
" if not manifest_is_prepared:\n _update_status('Start prepare a manifest file')\n manifest = VideoManifestManager(db_data.get_manifest_path())\n manifest.link(\n media_file=media_files[0],\n upload_dir=upload_dir,\n chunk_size=db_data.chunk_size\n )\n manifest.create()\n _update_status('A manifest had been created')",
" all_frames = len(manifest.reader)\n video_size = manifest.reader.resolution\n manifest_is_prepared = True",
" db_data.size = len(range(db_data.start_frame, min(data['stop_frame'] + 1 \\\n if data['stop_frame'] else all_frames, all_frames), db_data.get_frame_step()))\n video_path = os.path.join(upload_dir, media_files[0])\n except Exception as ex:\n db_data.storage_method = models.StorageMethodChoice.FILE_SYSTEM\n manifest.remove()\n del manifest\n base_msg = str(ex) if isinstance(ex, AssertionError) \\\n else \"Uploaded video does not support a quick way of task creating.\"\n _update_status(\"{} The task will be created using the old method\".format(base_msg))\n else: # images, archive, pdf\n db_data.size = len(extractor)\n manifest = ImageManifestManager(db_data.get_manifest_path())\n if not manifest_file:\n manifest.link(\n sources=extractor.absolute_source_paths,\n meta={ k: {'related_images': related_images[k] } for k in related_images },\n data_dir=upload_dir,\n DIM_3D=(db_task.dimension == models.DimensionType.DIM_3D),\n )\n manifest.create()\n else:\n manifest.init_index()\n counter = itertools.count()\n for _, chunk_frames in itertools.groupby(extractor.frame_range, lambda x: next(counter) // db_data.chunk_size):\n chunk_paths = [(extractor.get_path(i), i) for i in chunk_frames]\n img_sizes = []",
" for chunk_path, frame_id in chunk_paths:\n properties = manifest[manifest_index(frame_id)]",
" # check mapping\n if not chunk_path.endswith(f\"{properties['name']}{properties['extension']}\"):\n raise Exception('Incorrect file mapping to manifest content')\n if db_task.dimension == models.DimensionType.DIM_2D:\n resolution = (properties['width'], properties['height'])\n else:\n resolution = extractor.get_image_size(frame_id)\n img_sizes.append(resolution)",
" db_images.extend([\n models.Image(data=db_data,\n path=os.path.relpath(path, upload_dir),\n frame=frame, width=w, height=h)\n for (path, frame), (w, h) in zip(chunk_paths, img_sizes)\n ])",
" if db_data.storage_method == models.StorageMethodChoice.FILE_SYSTEM or not settings.USE_CACHE:\n counter = itertools.count()\n generator = itertools.groupby(extractor, lambda x: next(counter) // db_data.chunk_size)\n for chunk_idx, chunk_data in generator:\n chunk_data = list(chunk_data)\n original_chunk_path = db_data.get_original_chunk_path(chunk_idx)\n original_chunk_writer.save_as_chunk(chunk_data, original_chunk_path)",
" compressed_chunk_path = db_data.get_compressed_chunk_path(chunk_idx)\n img_sizes = compressed_chunk_writer.save_as_chunk(chunk_data, compressed_chunk_path)",
" if db_task.mode == 'annotation':\n db_images.extend([\n models.Image(\n data=db_data,\n path=os.path.relpath(data[1], upload_dir),\n frame=data[2],\n width=size[0],\n height=size[1])",
" for data, size in zip(chunk_data, img_sizes)\n ])\n else:\n video_size = img_sizes[0]\n video_path = chunk_data[0][1]",
" db_data.size += len(chunk_data)\n progress = extractor.get_progress(chunk_data[-1][2])\n update_progress(progress)",
" if db_task.mode == 'annotation':\n models.Image.objects.bulk_create(db_images)\n created_images = models.Image.objects.filter(data_id=db_data.id)",
" db_related_files = [\n models.RelatedFile(data=image.data, primary_image=image, path=os.path.join(upload_dir, related_file_path))\n for image in created_images\n for related_file_path in related_images.get(image.path, [])\n ]\n models.RelatedFile.objects.bulk_create(db_related_files)\n db_images = []\n else:\n models.Video.objects.create(\n data=db_data,\n path=os.path.relpath(video_path, upload_dir),\n width=video_size[0], height=video_size[1])",
" if db_data.stop_frame == 0:\n db_data.stop_frame = db_data.start_frame + (db_data.size - 1) * db_data.get_frame_step()\n else:\n # validate stop_frame\n db_data.stop_frame = min(db_data.stop_frame, \\\n db_data.start_frame + (db_data.size - 1) * db_data.get_frame_step())",
" preview = extractor.get_preview()\n preview.save(db_data.get_preview_path())",
" slogger.glob.info(\"Found frames {} for Data #{}\".format(db_data.size, db_data.id))\n _save_task_to_db(db_task)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [83, 212, 54], "buggy_code_start_loc": [83, 8, 54], "filenames": ["CHANGELOG.md", "cvat/apps/engine/task.py", "cvat/requirements/base.txt"], "fixing_code_end_loc": [85, 256, 56], "fixing_code_start_loc": [84, 9, 55], "message": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cvat:cvat:*:*:*:*:*:*:*:*", "matchCriteriaId": "29D76D4E-B25E-4AE9-86EC-887059DBA160", "versionEndExcluding": "2.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "CVAT es una herramienta de anotaci\u00f3n de v\u00eddeo e imagen interactiva de c\u00f3digo abierto para la visi\u00f3n por ordenador. Las versiones anteriores a 2.0.0, est\u00e1n sujetas a una vulnerabilidad de tipo Server-side request forgery (SSRF). Ha sido a\u00f1adida la comprobaci\u00f3n de las urls usadas en la ruta de c\u00f3digo afectada en versi\u00f3n 2.0.0. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31188", "lastModified": "2022-12-08T22:35:16.617", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 8.6, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 4.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-08-01T20:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/169814/CVAT-2.0-Server-Side-Request-Forgery.html"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/security/advisories/GHSA-7vpj-j5xv-29pr"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, "type": "CWE-918"}
| 93
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"attrs==21.2.0\nclick==7.1.2\nDjango==3.2.12\ndjango-appconf==1.0.4\ndjango-auth-ldap==2.2.0\ndjango-compressor==2.4\ndjango-rq==2.3.2\nEasyProcess==0.3\nPillow==9.0.1\nnumpy==1.22.0\npython-ldap==3.4.0\npytz==2020.1\npyunpack==0.2.1\nrcssmin==1.0.6\nredis==3.5.3\nrjsmin==1.1.0\nrequests==2.26.0\nrq==1.5.1\nrq-scheduler==0.10.0\nsqlparse==0.4.2\ndjango-sendfile2==0.6.1\ndj-pagination==2.5.0\npython-logstash-async==2.2.0\nrules==2.2\nGitPython==3.1.27\ncoreapi==2.3.3\ndjango-filter==2.4.0\nMarkdown==3.2.2\ndjangorestframework==3.12.4\nPygments==2.7.4\ndrf-spectacular==0.21.2\nShapely==1.7.1\npdf2image==1.14.0\ndjango-rest-auth[with_social]==0.9.5\nopencv-python-headless==4.4.0.42\nh5py==2.10.0\ndjango-cors-headers==3.5.0\nfurl==2.1.0\nav==8.0.2 --no-binary=av\ntensorflow==2.8.0 # Optional requirement of Datumaro\n# The package is used by pyunpack as a command line tool to support multiple\n# archives. Don't use as a python module because it has GPL license.\npatool==1.12\ndiskcache==5.0.2\nopen3d==0.11.2\nboto3==1.17.61\nazure-storage-blob==12.8.1\ngoogle-cloud-storage==1.42.0\n# --no-binary=datumaro: workaround for pip to install\n# opencv-headless instead of regular opencv, to actually run setup script\ndatumaro==0.2.0 --no-binary=datumaro\nurllib3>=1.26.5 # not directly required, pinned by Snyk to avoid a vulnerability\nnatsort==8.0.0\nmistune>=2.0.1 # not directly required, pinned by Snyk to avoid a vulnerability",
""
] |
[
1,
0
] |
PreciseBugs
|
{"buggy_code_end_loc": [83, 212, 54], "buggy_code_start_loc": [83, 8, 54], "filenames": ["CHANGELOG.md", "cvat/apps/engine/task.py", "cvat/requirements/base.txt"], "fixing_code_end_loc": [85, 256, 56], "fixing_code_start_loc": [84, 9, 55], "message": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cvat:cvat:*:*:*:*:*:*:*:*", "matchCriteriaId": "29D76D4E-B25E-4AE9-86EC-887059DBA160", "versionEndExcluding": "2.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "CVAT es una herramienta de anotaci\u00f3n de v\u00eddeo e imagen interactiva de c\u00f3digo abierto para la visi\u00f3n por ordenador. Las versiones anteriores a 2.0.0, est\u00e1n sujetas a una vulnerabilidad de tipo Server-side request forgery (SSRF). Ha sido a\u00f1adida la comprobaci\u00f3n de las urls usadas en la ruta de c\u00f3digo afectada en versi\u00f3n 2.0.0. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31188", "lastModified": "2022-12-08T22:35:16.617", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 8.6, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 4.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-08-01T20:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/169814/CVAT-2.0-Server-Side-Request-Forgery.html"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/security/advisories/GHSA-7vpj-j5xv-29pr"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, "type": "CWE-918"}
| 93
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"attrs==21.2.0\nclick==7.1.2\nDjango==3.2.12\ndjango-appconf==1.0.4\ndjango-auth-ldap==2.2.0\ndjango-compressor==2.4\ndjango-rq==2.3.2\nEasyProcess==0.3\nPillow==9.0.1\nnumpy==1.22.0\npython-ldap==3.4.0\npytz==2020.1\npyunpack==0.2.1\nrcssmin==1.0.6\nredis==3.5.3\nrjsmin==1.1.0\nrequests==2.26.0\nrq==1.5.1\nrq-scheduler==0.10.0\nsqlparse==0.4.2\ndjango-sendfile2==0.6.1\ndj-pagination==2.5.0\npython-logstash-async==2.2.0\nrules==2.2\nGitPython==3.1.27\ncoreapi==2.3.3\ndjango-filter==2.4.0\nMarkdown==3.2.2\ndjangorestframework==3.12.4\nPygments==2.7.4\ndrf-spectacular==0.21.2\nShapely==1.7.1\npdf2image==1.14.0\ndjango-rest-auth[with_social]==0.9.5\nopencv-python-headless==4.4.0.42\nh5py==2.10.0\ndjango-cors-headers==3.5.0\nfurl==2.1.0\nav==8.0.2 --no-binary=av\ntensorflow==2.8.0 # Optional requirement of Datumaro\n# The package is used by pyunpack as a command line tool to support multiple\n# archives. Don't use as a python module because it has GPL license.\npatool==1.12\ndiskcache==5.0.2\nopen3d==0.11.2\nboto3==1.17.61\nazure-storage-blob==12.8.1\ngoogle-cloud-storage==1.42.0\n# --no-binary=datumaro: workaround for pip to install\n# opencv-headless instead of regular opencv, to actually run setup script\ndatumaro==0.2.0 --no-binary=datumaro\nurllib3>=1.26.5 # not directly required, pinned by Snyk to avoid a vulnerability\nnatsort==8.0.0\nmistune>=2.0.1 # not directly required, pinned by Snyk to avoid a vulnerability",
"dnspython==2.2.0"
] |
[
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [83, 212, 54], "buggy_code_start_loc": [83, 8, 54], "filenames": ["CHANGELOG.md", "cvat/apps/engine/task.py", "cvat/requirements/base.txt"], "fixing_code_end_loc": [85, 256, 56], "fixing_code_start_loc": [84, 9, 55], "message": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:cvat:cvat:*:*:*:*:*:*:*:*", "matchCriteriaId": "29D76D4E-B25E-4AE9-86EC-887059DBA160", "versionEndExcluding": "2.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "CVAT is an opensource interactive video and image annotation tool for computer vision. Versions prior to 2.0.0 were found to be subject to a Server-side request forgery (SSRF) vulnerability. Validation has been added to urls used in the affected code path in version 2.0.0. Users are advised to upgrade. There are no known workarounds for this issue."}, {"lang": "es", "value": "CVAT es una herramienta de anotaci\u00f3n de v\u00eddeo e imagen interactiva de c\u00f3digo abierto para la visi\u00f3n por ordenador. Las versiones anteriores a 2.0.0, est\u00e1n sujetas a una vulnerabilidad de tipo Server-side request forgery (SSRF). Ha sido a\u00f1adida la comprobaci\u00f3n de las urls usadas en la ruta de c\u00f3digo afectada en versi\u00f3n 2.0.0. Es recomendado a usuarios actualizar. No se presentan mitigaciones conocidas para este problema"}], "evaluatorComment": null, "id": "CVE-2022-31188", "lastModified": "2022-12-08T22:35:16.617", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 8.6, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 4.7, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2022-08-01T20:15:08.650", "references": [{"source": "security-advisories@github.com", "tags": ["Exploit", "Third Party Advisory", "VDB Entry"], "url": "http://packetstormsecurity.com/files/169814/CVAT-2.0-Server-Side-Request-Forgery.html"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/cvat-ai/cvat/security/advisories/GHSA-7vpj-j5xv-29pr"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-918"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-918"}], "source": "security-advisories@github.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/cvat-ai/cvat/commit/6fad1764efd922d99dbcda28c4ee72d071aa5a07"}, "type": "CWE-918"}
| 93
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * JBoss, Home of Professional Open Source\n *\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */",
"package org.xnio;",
"import java.io.IOException;\nimport java.util.concurrent.atomic.AtomicReference;\n",
"",
"import org.xnio.channels.CloseListenerSettable;\nimport org.xnio.conduits.ConduitStreamSinkChannel;\nimport org.xnio.conduits.ConduitStreamSourceChannel;\nimport org.xnio.conduits.StreamSinkConduit;\nimport org.xnio.conduits.StreamSourceConduit;",
"import static org.xnio._private.Messages.msg;",
"/**\n * A connection between peers.\n *\n * @author <a href=\"mailto:david.lloyd@redhat.com\">David M. Lloyd</a>\n * @author Flavia Rainone\n */\npublic abstract class StreamConnection extends Connection implements CloseListenerSettable<StreamConnection> {",
" /**\n * An empty listener used as a flag, to indicate that close listener has been invoked.\n */\n private static final ChannelListener<? super StreamConnection> INVOKED_CLOSE_LISTENER_FLAG = (StreamConnection connection)->{};",
"",
"\n private ConduitStreamSourceChannel sourceChannel;\n private ConduitStreamSinkChannel sinkChannel;\n private AtomicReference<ChannelListener<? super StreamConnection>> closeListener;",
" /**\n * Construct a new instance.\n *\n * @param thread the I/O thread\n */\n protected StreamConnection(final XnioIoThread thread) {\n super(thread);\n closeListener = new AtomicReference<>();\n }",
" public void setCloseListener(final ChannelListener<? super StreamConnection> listener) {\n ChannelListener<? super StreamConnection> currentListener;\n ChannelListener<? super StreamConnection> newListener;\n do {\n newListener = listener;\n currentListener = closeListener.get();\n if (currentListener != null) {\n // channel is closed, just invoke the new listener and do not update closeListener\n if (currentListener == INVOKED_CLOSE_LISTENER_FLAG) {\n ChannelListeners.invokeChannelListener(this, listener);\n return;\n } else {\n newListener = mergeListeners(currentListener, listener);\n }\n }\n } while (!closeListener.compareAndSet(currentListener, newListener));\n }",
" private final ChannelListener<? super StreamConnection> mergeListeners(final ChannelListener<? super StreamConnection> listener1, final ChannelListener<? super StreamConnection> listener2) {\n return (StreamConnection channel) -> {\n listener1.handleEvent(channel);\n listener2.handleEvent(channel);\n };\n }",
" @Override protected void notifyReadClosed() {",
" try {\n this.getSourceChannel().shutdownReads();\n } catch (IOException e) {",
" e.printStackTrace();",
" }\n }",
" @Override protected void notifyWriteClosed() {\n try {\n this.getSinkChannel().shutdownWrites();\n } catch (IOException e) {",
" e.printStackTrace();",
" }\n }",
" public ChannelListener<? super StreamConnection> getCloseListener() {\n return closeListener.get();\n }",
" public ChannelListener.Setter<? extends StreamConnection> getCloseSetter() {\n return new Setter<>(this);\n }",
" /**\n * Set the source conduit for this channel. The source channel will automatically be updated.\n *\n * @param conduit the source conduit for this channel\n */\n protected void setSourceConduit(StreamSourceConduit conduit) {\n this.sourceChannel = conduit == null ? null : new ConduitStreamSourceChannel(this, conduit);\n }",
" /**\n * Set the sink conduit for this channel. The sink channel will automatically be updated.\n *\n * @param conduit the sink conduit for this channel\n */\n protected void setSinkConduit(StreamSinkConduit conduit) {\n this.sinkChannel = conduit == null ? null : new ConduitStreamSinkChannel(this, conduit);\n }",
" void invokeCloseListener() {\n // use a flag to indicate that closeListener has been invoked\n final ChannelListener<? super StreamConnection> listener = closeListener.getAndSet(INVOKED_CLOSE_LISTENER_FLAG);\n ChannelListeners.invokeChannelListener(this, listener);\n }",
" private static <T> T notNull(T orig) throws IllegalStateException {\n if (orig == null) {\n throw msg.channelNotAvailable();\n }\n return orig;\n }",
" /**\n * Get the source channel.\n *\n * @return the source channel\n */\n public ConduitStreamSourceChannel getSourceChannel() {\n return notNull(sourceChannel);\n }",
" /**\n * Get the sink channel.\n *\n * @return the sink channel\n */\n public ConduitStreamSinkChannel getSinkChannel() {\n return notNull(sinkChannel);\n }\n}"
] |
[
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [98], "buggy_code_start_loc": [23], "filenames": ["api/src/main/java/org/xnio/StreamConnection.java"], "fixing_code_end_loc": [100], "fixing_code_start_loc": [24], "message": "A flaw was found in XNIO, specifically in the notifyReadClosed method. The issue revealed this method was logging a message to another expected end. This flaw allows an attacker to send flawed requests to a server, possibly causing log contention-related performance concerns or an unwanted disk fill-up.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:redhat:integration_camel_k:-:*:*:*:*:*:*:*", "matchCriteriaId": "B87C8AD3-8878-4546-86C2-BF411876648C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:integration_camel_quarkus:-:*:*:*:*:*:*:*", "matchCriteriaId": "F039C746-2001-4EE5-835F-49607A94F12B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:single_sign-on:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "9EFEC7CA-8DDA-48A6-A7B6-1F1D14792890", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:xnio:*:*:*:*:*:*:*:*", "matchCriteriaId": "0BE22D4E-4636-47CF-87B1-D97AB30A885B", "versionEndExcluding": "3.8.7", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A flaw was found in XNIO, specifically in the notifyReadClosed method. The issue revealed this method was logging a message to another expected end. This flaw allows an attacker to send flawed requests to a server, possibly causing log contention-related performance concerns or an unwanted disk fill-up."}, {"lang": "es", "value": "Se ha encontrado un fallo en XNIO, concretamente en el m\u00e9todo notifyReadClosed. El problema revel\u00f3 que este m\u00e9todo estaba registrando un mensaje a otro extremo esperado. Este fallo permite a un atacante enviar peticiones defectuosas a un servidor, causando posiblemente problemas de rendimiento relacionados con la contenci\u00f3n de registros o un llenado de disco no deseado."}], "evaluatorComment": null, "id": "CVE-2022-0084", "lastModified": "2022-09-01T15:34:55.887", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-08-26T18:15:08.487", "references": [{"source": "secalert@redhat.com", "tags": ["Vendor Advisory"], "url": "https://access.redhat.com/security/cve/CVE-2022-0084"}, {"source": "secalert@redhat.com", "tags": ["Issue Tracking", "Vendor Advisory"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=2064226"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/xnio/xnio/commit/fdefb3b8b715d33387cadc4d48991fb1989b0c12"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/xnio/xnio/pull/291"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-770"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-770"}], "source": "secalert@redhat.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/xnio/xnio/commit/fdefb3b8b715d33387cadc4d48991fb1989b0c12"}, "type": "CWE-770"}
| 94
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * JBoss, Home of Professional Open Source\n *\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */",
"package org.xnio;",
"import java.io.IOException;\nimport java.util.concurrent.atomic.AtomicReference;\n",
"import org.jboss.logging.Logger;",
"import org.xnio.channels.CloseListenerSettable;\nimport org.xnio.conduits.ConduitStreamSinkChannel;\nimport org.xnio.conduits.ConduitStreamSourceChannel;\nimport org.xnio.conduits.StreamSinkConduit;\nimport org.xnio.conduits.StreamSourceConduit;",
"import static org.xnio._private.Messages.msg;",
"/**\n * A connection between peers.\n *\n * @author <a href=\"mailto:david.lloyd@redhat.com\">David M. Lloyd</a>\n * @author Flavia Rainone\n */\npublic abstract class StreamConnection extends Connection implements CloseListenerSettable<StreamConnection> {",
" /**\n * An empty listener used as a flag, to indicate that close listener has been invoked.\n */\n private static final ChannelListener<? super StreamConnection> INVOKED_CLOSE_LISTENER_FLAG = (StreamConnection connection)->{};",
" private static final Logger log = Logger.getLogger(\"org.xnio.StreamConnection\");",
"\n private ConduitStreamSourceChannel sourceChannel;\n private ConduitStreamSinkChannel sinkChannel;\n private AtomicReference<ChannelListener<? super StreamConnection>> closeListener;",
" /**\n * Construct a new instance.\n *\n * @param thread the I/O thread\n */\n protected StreamConnection(final XnioIoThread thread) {\n super(thread);\n closeListener = new AtomicReference<>();\n }",
" public void setCloseListener(final ChannelListener<? super StreamConnection> listener) {\n ChannelListener<? super StreamConnection> currentListener;\n ChannelListener<? super StreamConnection> newListener;\n do {\n newListener = listener;\n currentListener = closeListener.get();\n if (currentListener != null) {\n // channel is closed, just invoke the new listener and do not update closeListener\n if (currentListener == INVOKED_CLOSE_LISTENER_FLAG) {\n ChannelListeners.invokeChannelListener(this, listener);\n return;\n } else {\n newListener = mergeListeners(currentListener, listener);\n }\n }\n } while (!closeListener.compareAndSet(currentListener, newListener));\n }",
" private final ChannelListener<? super StreamConnection> mergeListeners(final ChannelListener<? super StreamConnection> listener1, final ChannelListener<? super StreamConnection> listener2) {\n return (StreamConnection channel) -> {\n listener1.handleEvent(channel);\n listener2.handleEvent(channel);\n };\n }",
" @Override protected void notifyReadClosed() {",
" try {\n this.getSourceChannel().shutdownReads();\n } catch (IOException e) {",
" log.error(\"Error in read close\", e);",
" }\n }",
" @Override protected void notifyWriteClosed() {\n try {\n this.getSinkChannel().shutdownWrites();\n } catch (IOException e) {",
" log.error(\"Error in write close\", e);",
" }\n }",
" public ChannelListener<? super StreamConnection> getCloseListener() {\n return closeListener.get();\n }",
" public ChannelListener.Setter<? extends StreamConnection> getCloseSetter() {\n return new Setter<>(this);\n }",
" /**\n * Set the source conduit for this channel. The source channel will automatically be updated.\n *\n * @param conduit the source conduit for this channel\n */\n protected void setSourceConduit(StreamSourceConduit conduit) {\n this.sourceChannel = conduit == null ? null : new ConduitStreamSourceChannel(this, conduit);\n }",
" /**\n * Set the sink conduit for this channel. The sink channel will automatically be updated.\n *\n * @param conduit the sink conduit for this channel\n */\n protected void setSinkConduit(StreamSinkConduit conduit) {\n this.sinkChannel = conduit == null ? null : new ConduitStreamSinkChannel(this, conduit);\n }",
" void invokeCloseListener() {\n // use a flag to indicate that closeListener has been invoked\n final ChannelListener<? super StreamConnection> listener = closeListener.getAndSet(INVOKED_CLOSE_LISTENER_FLAG);\n ChannelListeners.invokeChannelListener(this, listener);\n }",
" private static <T> T notNull(T orig) throws IllegalStateException {\n if (orig == null) {\n throw msg.channelNotAvailable();\n }\n return orig;\n }",
" /**\n * Get the source channel.\n *\n * @return the source channel\n */\n public ConduitStreamSourceChannel getSourceChannel() {\n return notNull(sourceChannel);\n }",
" /**\n * Get the sink channel.\n *\n * @return the sink channel\n */\n public ConduitStreamSinkChannel getSinkChannel() {\n return notNull(sinkChannel);\n }\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [98], "buggy_code_start_loc": [23], "filenames": ["api/src/main/java/org/xnio/StreamConnection.java"], "fixing_code_end_loc": [100], "fixing_code_start_loc": [24], "message": "A flaw was found in XNIO, specifically in the notifyReadClosed method. The issue revealed this method was logging a message to another expected end. This flaw allows an attacker to send flawed requests to a server, possibly causing log contention-related performance concerns or an unwanted disk fill-up.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:redhat:integration_camel_k:-:*:*:*:*:*:*:*", "matchCriteriaId": "B87C8AD3-8878-4546-86C2-BF411876648C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:integration_camel_quarkus:-:*:*:*:*:*:*:*", "matchCriteriaId": "F039C746-2001-4EE5-835F-49607A94F12B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:single_sign-on:7.0:*:*:*:*:*:*:*", "matchCriteriaId": "9EFEC7CA-8DDA-48A6-A7B6-1F1D14792890", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:redhat:xnio:*:*:*:*:*:*:*:*", "matchCriteriaId": "0BE22D4E-4636-47CF-87B1-D97AB30A885B", "versionEndExcluding": "3.8.7", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "A flaw was found in XNIO, specifically in the notifyReadClosed method. The issue revealed this method was logging a message to another expected end. This flaw allows an attacker to send flawed requests to a server, possibly causing log contention-related performance concerns or an unwanted disk fill-up."}, {"lang": "es", "value": "Se ha encontrado un fallo en XNIO, concretamente en el m\u00e9todo notifyReadClosed. El problema revel\u00f3 que este m\u00e9todo estaba registrando un mensaje a otro extremo esperado. Este fallo permite a un atacante enviar peticiones defectuosas a un servidor, causando posiblemente problemas de rendimiento relacionados con la contenci\u00f3n de registros o un llenado de disco no deseado."}], "evaluatorComment": null, "id": "CVE-2022-0084", "lastModified": "2022-09-01T15:34:55.887", "metrics": {"cvssMetricV2": null, "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 7.5, "baseSeverity": "HIGH", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-08-26T18:15:08.487", "references": [{"source": "secalert@redhat.com", "tags": ["Vendor Advisory"], "url": "https://access.redhat.com/security/cve/CVE-2022-0084"}, {"source": "secalert@redhat.com", "tags": ["Issue Tracking", "Vendor Advisory"], "url": "https://bugzilla.redhat.com/show_bug.cgi?id=2064226"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/xnio/xnio/commit/fdefb3b8b715d33387cadc4d48991fb1989b0c12"}, {"source": "secalert@redhat.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/xnio/xnio/pull/291"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-770"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-770"}], "source": "secalert@redhat.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/xnio/xnio/commit/fdefb3b8b715d33387cadc4d48991fb1989b0c12"}, "type": "CWE-770"}
| 94
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"import datetime\nfrom StringIO import StringIO\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.serializers import json\nfrom django.utils import simplejson\nfrom django.utils.encoding import force_unicode\nfrom tastypie.bundle import Bundle\nfrom tastypie.exceptions import UnsupportedFormat\nfrom tastypie.utils import format_datetime, format_date, format_time\ntry:\n import lxml\n from lxml.etree import parse as parse_xml\n from lxml.etree import Element, tostring\nexcept ImportError:\n lxml = None\ntry:\n import yaml\n from django.core.serializers import pyyaml\nexcept ImportError:\n yaml = None\ntry:\n import biplist\nexcept ImportError:\n biplist = None",
"\nclass Serializer(object):\n \"\"\"\n A swappable class for serialization.",
" ",
" This handles most types of data as well as the following output formats::",
" ",
" * json\n * jsonp\n * xml\n * yaml\n * html\n * plist (see http://explorapp.com/biplist/)",
" ",
" It was designed to make changing behavior easy, either by overridding the\n various format methods (i.e. ``to_json``), by changing the\n ``formats/content_types`` options or by altering the other hook methods.\n \"\"\"\n formats = ['json', 'jsonp', 'xml', 'yaml', 'html', 'plist']\n content_types = {\n 'json': 'application/json',\n 'jsonp': 'text/javascript',\n 'xml': 'application/xml',\n 'yaml': 'text/yaml',\n 'html': 'text/html',\n 'plist': 'application/x-plist',\n }",
" ",
" def __init__(self, formats=None, content_types=None, datetime_formatting=None):\n self.supported_formats = []\n self.datetime_formatting = getattr(settings, 'TASTYPIE_DATETIME_FORMATTING', 'iso-8601')",
" ",
" if formats is not None:\n self.formats = formats",
" ",
" if content_types is not None:\n self.content_types = content_types",
" ",
" if datetime_formatting is not None:\n self.datetime_formatting = datetime_formatting",
" ",
" for format in self.formats:\n try:\n self.supported_formats.append(self.content_types[format])\n except KeyError:\n raise ImproperlyConfigured(\"Content type for specified type '%s' not found. Please provide it at either the class level or via the arguments.\" % format)",
" ",
" def get_mime_for_format(self, format):\n \"\"\"\n Given a format, attempts to determine the correct MIME type.",
" ",
" If not available on the current ``Serializer``, returns\n ``application/json`` by default.\n \"\"\"\n try:\n return self.content_types[format]\n except KeyError:\n return 'application/json'",
" ",
" def format_datetime(self, data):\n \"\"\"\n A hook to control how datetimes are formatted.",
" ",
" Can be overridden at the ``Serializer`` level (``datetime_formatting``)\n or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``).",
" ",
" Default is ``iso-8601``, which looks like \"2010-12-16T03:02:14\".\n \"\"\"\n if self.datetime_formatting == 'rfc-2822':\n return format_datetime(data)",
" ",
" return data.isoformat()",
" ",
" def format_date(self, data):\n \"\"\"\n A hook to control how dates are formatted.",
" ",
" Can be overridden at the ``Serializer`` level (``datetime_formatting``)\n or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``).",
" ",
" Default is ``iso-8601``, which looks like \"2010-12-16\".\n \"\"\"\n if self.datetime_formatting == 'rfc-2822':\n return format_date(data)",
" ",
" return data.isoformat()",
" ",
" def format_time(self, data):\n \"\"\"\n A hook to control how times are formatted.",
" ",
" Can be overridden at the ``Serializer`` level (``datetime_formatting``)\n or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``).",
" ",
" Default is ``iso-8601``, which looks like \"03:02:14\".\n \"\"\"\n if self.datetime_formatting == 'rfc-2822':\n return format_time(data)",
" ",
" return data.isoformat()",
" ",
" def serialize(self, bundle, format='application/json', options={}):\n \"\"\"\n Given some data and a format, calls the correct method to serialize\n the data and returns the result.\n \"\"\"\n desired_format = None",
" ",
" for short_format, long_format in self.content_types.items():\n if format == long_format:\n if hasattr(self, \"to_%s\" % short_format):\n desired_format = short_format\n break",
" ",
" if desired_format is None:\n raise UnsupportedFormat(\"The format indicated '%s' had no available serialization method. Please check your ``formats`` and ``content_types`` on your Serializer.\" % format)",
" ",
" serialized = getattr(self, \"to_%s\" % desired_format)(bundle, options)\n return serialized",
" ",
" def deserialize(self, content, format='application/json'):\n \"\"\"\n Given some data and a format, calls the correct method to deserialize\n the data and returns the result.\n \"\"\"\n desired_format = None",
" format = format.split(';')[0]",
" for short_format, long_format in self.content_types.items():\n if format == long_format:\n if hasattr(self, \"from_%s\" % short_format):\n desired_format = short_format\n break",
" ",
" if desired_format is None:\n raise UnsupportedFormat(\"The format indicated '%s' had no available deserialization method. Please check your ``formats`` and ``content_types`` on your Serializer.\" % format)",
" ",
" deserialized = getattr(self, \"from_%s\" % desired_format)(content)\n return deserialized",
" def to_simple(self, data, options):\n \"\"\"\n For a piece of data, attempts to recognize it and provide a simplified\n form of something complex.",
" ",
" This brings complex Python data structures down to native types of the\n serialization format(s).\n \"\"\"\n if isinstance(data, (list, tuple)):\n return [self.to_simple(item, options) for item in data]\n if isinstance(data, dict):\n return dict((key, self.to_simple(val, options)) for (key, val) in data.iteritems())\n elif isinstance(data, Bundle):\n return dict((key, self.to_simple(val, options)) for (key, val) in data.data.iteritems())\n elif hasattr(data, 'dehydrated_type'):\n if getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == False:\n if data.full:\n return self.to_simple(data.fk_resource, options)\n else:\n return self.to_simple(data.value, options)\n elif getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == True:\n if data.full:\n return [self.to_simple(bundle, options) for bundle in data.m2m_bundles]\n else:\n return [self.to_simple(val, options) for val in data.value]\n else:\n return self.to_simple(data.value, options)\n elif isinstance(data, datetime.datetime):\n return self.format_datetime(data)\n elif isinstance(data, datetime.date):\n return self.format_date(data)\n elif isinstance(data, datetime.time):\n return self.format_time(data)\n elif isinstance(data, bool):\n return data\n elif type(data) in (long, int, float):\n return data\n elif data is None:\n return None\n else:\n return force_unicode(data)",
" def to_etree(self, data, options=None, name=None, depth=0):\n \"\"\"\n Given some data, converts that data to an ``etree.Element`` suitable\n for use in the XML output.\n \"\"\"\n if isinstance(data, (list, tuple)):\n element = Element(name or 'objects')\n if name:\n element = Element(name)\n element.set('type', 'list')\n else:\n element = Element('objects')\n for item in data:\n element.append(self.to_etree(item, options, depth=depth+1))\n elif isinstance(data, dict):\n if depth == 0:\n element = Element(name or 'response')\n else:\n element = Element(name or 'object')\n element.set('type', 'hash')\n for (key, value) in data.iteritems():\n element.append(self.to_etree(value, options, name=key, depth=depth+1))\n elif isinstance(data, Bundle):\n element = Element(name or 'object')\n for field_name, field_object in data.data.items():\n element.append(self.to_etree(field_object, options, name=field_name, depth=depth+1))\n elif hasattr(data, 'dehydrated_type'):\n if getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == False:\n if data.full:\n return self.to_etree(data.fk_resource, options, name, depth+1)\n else:\n return self.to_etree(data.value, options, name, depth+1)\n elif getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == True:\n if data.full:\n element = Element(name or 'objects')\n for bundle in data.m2m_bundles:\n element.append(self.to_etree(bundle, options, bundle.resource_name, depth+1))\n else:\n element = Element(name or 'objects')\n for value in data.value:\n element.append(self.to_etree(value, options, name, depth=depth+1))\n else:\n return self.to_etree(data.value, options, name)\n else:\n element = Element(name or 'value')\n simple_data = self.to_simple(data, options)\n data_type = get_type_string(simple_data)\n if data_type != 'string':\n element.set('type', get_type_string(simple_data))\n if data_type != 'null':\n element.text = force_unicode(simple_data)\n return element",
" def from_etree(self, data):\n \"\"\"\n Not the smartest deserializer on the planet. At the request level,\n it first tries to output the deserialized subelement called \"object\"\n or \"objects\" and falls back to deserializing based on hinted types in\n the XML element attribute \"type\".\n \"\"\"\n if data.tag == 'request':\n # if \"object\" or \"objects\" exists, return deserialized forms.\n elements = data.getchildren()\n for element in elements:\n if element.tag in ('object', 'objects'):\n return self.from_etree(element)\n return dict((element.tag, self.from_etree(element)) for element in elements)\n elif data.tag == 'object' or data.get('type') == 'hash':\n return dict((element.tag, self.from_etree(element)) for element in data.getchildren())\n elif data.tag == 'objects' or data.get('type') == 'list':\n return [self.from_etree(element) for element in data.getchildren()]\n else:\n type_string = data.get('type')\n if type_string in ('string', None):\n return data.text\n elif type_string == 'integer':\n return int(data.text)\n elif type_string == 'float':\n return float(data.text)\n elif type_string == 'boolean':\n if data.text == 'True':\n return True\n else:\n return False\n else:\n return None",
" ",
" def to_json(self, data, options=None):\n \"\"\"\n Given some Python data, produces JSON output.\n \"\"\"\n options = options or {}\n data = self.to_simple(data, options)\n return simplejson.dumps(data, cls=json.DjangoJSONEncoder, sort_keys=True)",
" def from_json(self, content):\n \"\"\"\n Given some JSON data, returns a Python dictionary of the decoded data.\n \"\"\"\n return simplejson.loads(content)",
" def to_jsonp(self, data, options=None):\n \"\"\"\n Given some Python data, produces JSON output wrapped in the provided\n callback.\n \"\"\"\n options = options or {}\n return '%s(%s)' % (options['callback'], self.to_json(data, options))",
" def to_xml(self, data, options=None):\n \"\"\"\n Given some Python data, produces XML output.\n \"\"\"\n options = options or {}",
" ",
" if lxml is None:\n raise ImproperlyConfigured(\"Usage of the XML aspects requires lxml.\")",
" ",
" return tostring(self.to_etree(data, options), xml_declaration=True, encoding='utf-8')",
" ",
" def from_xml(self, content):\n \"\"\"\n Given some XML data, returns a Python dictionary of the decoded data.\n \"\"\"\n if lxml is None:\n raise ImproperlyConfigured(\"Usage of the XML aspects requires lxml.\")",
" ",
" return self.from_etree(parse_xml(StringIO(content)).getroot())",
" ",
" def to_yaml(self, data, options=None):\n \"\"\"\n Given some Python data, produces YAML output.\n \"\"\"\n options = options or {}",
" ",
" if yaml is None:\n raise ImproperlyConfigured(\"Usage of the YAML aspects requires yaml.\")",
" ",
" return yaml.dump(self.to_simple(data, options))",
" ",
" def from_yaml(self, content):\n \"\"\"\n Given some YAML data, returns a Python dictionary of the decoded data.\n \"\"\"\n if yaml is None:\n raise ImproperlyConfigured(\"Usage of the YAML aspects requires yaml.\")",
" \n return yaml.load(content)\n ",
" def to_plist(self, data, options=None):\n \"\"\"\n Given some Python data, produces binary plist output.\n \"\"\"\n options = options or {}",
" ",
" if biplist is None:\n raise ImproperlyConfigured(\"Usage of the plist aspects requires biplist.\")",
" ",
" return biplist.writePlistToString(self.to_simple(data, options))",
" ",
" def from_plist(self, content):\n \"\"\"\n Given some binary plist data, returns a Python dictionary of the decoded data.\n \"\"\"\n if biplist is None:\n raise ImproperlyConfigured(\"Usage of the plist aspects requires biplist.\")",
" ",
" return biplist.readPlistFromString(content)",
" ",
" def to_html(self, data, options=None):\n \"\"\"\n Reserved for future usage.",
" ",
" The desire is to provide HTML output of a resource, making an API\n available to a browser. This is on the TODO list but not currently\n implemented.\n \"\"\"\n options = options or {}\n return 'Sorry, not implemented yet. Please append \"?format=json\" to your URL.'",
" ",
" def from_html(self, content):\n \"\"\"\n Reserved for future usage.",
" ",
" The desire is to handle form-based (maybe Javascript?) input, making an\n API available to a browser. This is on the TODO list but not currently\n implemented.\n \"\"\"\n pass",
"def get_type_string(data):\n \"\"\"\n Translates a Python data type into a string format.\n \"\"\"\n data_type = type(data)",
" ",
" if data_type in (int, long):\n return 'integer'\n elif data_type == float:\n return 'float'\n elif data_type == bool:\n return 'boolean'\n elif data_type in (list, tuple):\n return 'list'\n elif data_type == dict:\n return 'hash'\n elif data is None:\n return 'null'\n elif isinstance(data, basestring):\n return 'string'"
] |
[
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
0,
1,
0,
1,
1,
0,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [406], "buggy_code_start_loc": [31], "filenames": ["tastypie/serializers.py"], "fixing_code_end_loc": [406], "fixing_code_start_loc": [31], "message": "The from_yaml method in serializers.py in Django Tastypie before 0.9.10 does not properly deserialize YAML data, which allows remote attackers to execute arbitrary Python code via vectors related to the yaml.load method.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:djangoproject:tastypie:*:*:*:*:*:*:*:*", "matchCriteriaId": "B6D983F7-056E-4271-B345-22B37205031B", "versionEndExcluding": null, "versionEndIncluding": "0.9.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The from_yaml method in serializers.py in Django Tastypie before 0.9.10 does not properly deserialize YAML data, which allows remote attackers to execute arbitrary Python code via vectors related to the yaml.load method."}, {"lang": "es", "value": "El m\u00e9todo from_yaml en serializers.py en Django Tastypie anterior a 0.9.10 no deserializa debidamente los datos YAML, lo que permite a atacantes remotos ejecutar c\u00f3digo Python arbitrario a trav\u00e9s de vectores relacionados con el m\u00e9todo yaml.load."}], "evaluatorComment": null, "id": "CVE-2011-4104", "lastModified": "2018-08-13T21:47:39.900", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": null}, "published": "2014-10-27T01:55:23.407", "references": [{"source": "secalert@redhat.com", "tags": ["Patch"], "url": "http://www.openwall.com/lists/oss-security/2011/11/02/1"}, {"source": "secalert@redhat.com", "tags": null, "url": "http://www.openwall.com/lists/oss-security/2011/11/02/7"}, {"source": "secalert@redhat.com", "tags": ["Patch"], "url": "https://github.com/toastdriven/django-tastypie/commit/e8af315211b07c8f48f32a063233cc3f76dd5bc2"}, {"source": "secalert@redhat.com", "tags": null, "url": "https://groups.google.com/forum/#!topic/django-tastypie/i2aNGDHTUBI"}, {"source": "secalert@redhat.com", "tags": ["Vendor Advisory"], "url": "https://www.djangoproject.com/weblog/2011/nov/01/piston-and-tastypie-security-releases/"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/toastdriven/django-tastypie/commit/e8af315211b07c8f48f32a063233cc3f76dd5bc2"}, "type": "CWE-20"}
| 95
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"import datetime\nfrom StringIO import StringIO\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.serializers import json\nfrom django.utils import simplejson\nfrom django.utils.encoding import force_unicode\nfrom tastypie.bundle import Bundle\nfrom tastypie.exceptions import UnsupportedFormat\nfrom tastypie.utils import format_datetime, format_date, format_time\ntry:\n import lxml\n from lxml.etree import parse as parse_xml\n from lxml.etree import Element, tostring\nexcept ImportError:\n lxml = None\ntry:\n import yaml\n from django.core.serializers import pyyaml\nexcept ImportError:\n yaml = None\ntry:\n import biplist\nexcept ImportError:\n biplist = None",
"\nclass Serializer(object):\n \"\"\"\n A swappable class for serialization.",
"",
" This handles most types of data as well as the following output formats::",
"",
" * json\n * jsonp\n * xml\n * yaml\n * html\n * plist (see http://explorapp.com/biplist/)",
"",
" It was designed to make changing behavior easy, either by overridding the\n various format methods (i.e. ``to_json``), by changing the\n ``formats/content_types`` options or by altering the other hook methods.\n \"\"\"\n formats = ['json', 'jsonp', 'xml', 'yaml', 'html', 'plist']\n content_types = {\n 'json': 'application/json',\n 'jsonp': 'text/javascript',\n 'xml': 'application/xml',\n 'yaml': 'text/yaml',\n 'html': 'text/html',\n 'plist': 'application/x-plist',\n }",
"",
" def __init__(self, formats=None, content_types=None, datetime_formatting=None):\n self.supported_formats = []\n self.datetime_formatting = getattr(settings, 'TASTYPIE_DATETIME_FORMATTING', 'iso-8601')",
"",
" if formats is not None:\n self.formats = formats",
"",
" if content_types is not None:\n self.content_types = content_types",
"",
" if datetime_formatting is not None:\n self.datetime_formatting = datetime_formatting",
"",
" for format in self.formats:\n try:\n self.supported_formats.append(self.content_types[format])\n except KeyError:\n raise ImproperlyConfigured(\"Content type for specified type '%s' not found. Please provide it at either the class level or via the arguments.\" % format)",
"",
" def get_mime_for_format(self, format):\n \"\"\"\n Given a format, attempts to determine the correct MIME type.",
"",
" If not available on the current ``Serializer``, returns\n ``application/json`` by default.\n \"\"\"\n try:\n return self.content_types[format]\n except KeyError:\n return 'application/json'",
"",
" def format_datetime(self, data):\n \"\"\"\n A hook to control how datetimes are formatted.",
"",
" Can be overridden at the ``Serializer`` level (``datetime_formatting``)\n or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``).",
"",
" Default is ``iso-8601``, which looks like \"2010-12-16T03:02:14\".\n \"\"\"\n if self.datetime_formatting == 'rfc-2822':\n return format_datetime(data)",
"",
" return data.isoformat()",
"",
" def format_date(self, data):\n \"\"\"\n A hook to control how dates are formatted.",
"",
" Can be overridden at the ``Serializer`` level (``datetime_formatting``)\n or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``).",
"",
" Default is ``iso-8601``, which looks like \"2010-12-16\".\n \"\"\"\n if self.datetime_formatting == 'rfc-2822':\n return format_date(data)",
"",
" return data.isoformat()",
"",
" def format_time(self, data):\n \"\"\"\n A hook to control how times are formatted.",
"",
" Can be overridden at the ``Serializer`` level (``datetime_formatting``)\n or globally (via ``settings.TASTYPIE_DATETIME_FORMATTING``).",
"",
" Default is ``iso-8601``, which looks like \"03:02:14\".\n \"\"\"\n if self.datetime_formatting == 'rfc-2822':\n return format_time(data)",
"",
" return data.isoformat()",
"",
" def serialize(self, bundle, format='application/json', options={}):\n \"\"\"\n Given some data and a format, calls the correct method to serialize\n the data and returns the result.\n \"\"\"\n desired_format = None",
"",
" for short_format, long_format in self.content_types.items():\n if format == long_format:\n if hasattr(self, \"to_%s\" % short_format):\n desired_format = short_format\n break",
"",
" if desired_format is None:\n raise UnsupportedFormat(\"The format indicated '%s' had no available serialization method. Please check your ``formats`` and ``content_types`` on your Serializer.\" % format)",
"",
" serialized = getattr(self, \"to_%s\" % desired_format)(bundle, options)\n return serialized",
"",
" def deserialize(self, content, format='application/json'):\n \"\"\"\n Given some data and a format, calls the correct method to deserialize\n the data and returns the result.\n \"\"\"\n desired_format = None",
" format = format.split(';')[0]",
" for short_format, long_format in self.content_types.items():\n if format == long_format:\n if hasattr(self, \"from_%s\" % short_format):\n desired_format = short_format\n break",
"",
" if desired_format is None:\n raise UnsupportedFormat(\"The format indicated '%s' had no available deserialization method. Please check your ``formats`` and ``content_types`` on your Serializer.\" % format)",
"",
" deserialized = getattr(self, \"from_%s\" % desired_format)(content)\n return deserialized",
" def to_simple(self, data, options):\n \"\"\"\n For a piece of data, attempts to recognize it and provide a simplified\n form of something complex.",
"",
" This brings complex Python data structures down to native types of the\n serialization format(s).\n \"\"\"\n if isinstance(data, (list, tuple)):\n return [self.to_simple(item, options) for item in data]\n if isinstance(data, dict):\n return dict((key, self.to_simple(val, options)) for (key, val) in data.iteritems())\n elif isinstance(data, Bundle):\n return dict((key, self.to_simple(val, options)) for (key, val) in data.data.iteritems())\n elif hasattr(data, 'dehydrated_type'):\n if getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == False:\n if data.full:\n return self.to_simple(data.fk_resource, options)\n else:\n return self.to_simple(data.value, options)\n elif getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == True:\n if data.full:\n return [self.to_simple(bundle, options) for bundle in data.m2m_bundles]\n else:\n return [self.to_simple(val, options) for val in data.value]\n else:\n return self.to_simple(data.value, options)\n elif isinstance(data, datetime.datetime):\n return self.format_datetime(data)\n elif isinstance(data, datetime.date):\n return self.format_date(data)\n elif isinstance(data, datetime.time):\n return self.format_time(data)\n elif isinstance(data, bool):\n return data\n elif type(data) in (long, int, float):\n return data\n elif data is None:\n return None\n else:\n return force_unicode(data)",
" def to_etree(self, data, options=None, name=None, depth=0):\n \"\"\"\n Given some data, converts that data to an ``etree.Element`` suitable\n for use in the XML output.\n \"\"\"\n if isinstance(data, (list, tuple)):\n element = Element(name or 'objects')\n if name:\n element = Element(name)\n element.set('type', 'list')\n else:\n element = Element('objects')\n for item in data:\n element.append(self.to_etree(item, options, depth=depth+1))\n elif isinstance(data, dict):\n if depth == 0:\n element = Element(name or 'response')\n else:\n element = Element(name or 'object')\n element.set('type', 'hash')\n for (key, value) in data.iteritems():\n element.append(self.to_etree(value, options, name=key, depth=depth+1))\n elif isinstance(data, Bundle):\n element = Element(name or 'object')\n for field_name, field_object in data.data.items():\n element.append(self.to_etree(field_object, options, name=field_name, depth=depth+1))\n elif hasattr(data, 'dehydrated_type'):\n if getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == False:\n if data.full:\n return self.to_etree(data.fk_resource, options, name, depth+1)\n else:\n return self.to_etree(data.value, options, name, depth+1)\n elif getattr(data, 'dehydrated_type', None) == 'related' and data.is_m2m == True:\n if data.full:\n element = Element(name or 'objects')\n for bundle in data.m2m_bundles:\n element.append(self.to_etree(bundle, options, bundle.resource_name, depth+1))\n else:\n element = Element(name or 'objects')\n for value in data.value:\n element.append(self.to_etree(value, options, name, depth=depth+1))\n else:\n return self.to_etree(data.value, options, name)\n else:\n element = Element(name or 'value')\n simple_data = self.to_simple(data, options)\n data_type = get_type_string(simple_data)\n if data_type != 'string':\n element.set('type', get_type_string(simple_data))\n if data_type != 'null':\n element.text = force_unicode(simple_data)\n return element",
" def from_etree(self, data):\n \"\"\"\n Not the smartest deserializer on the planet. At the request level,\n it first tries to output the deserialized subelement called \"object\"\n or \"objects\" and falls back to deserializing based on hinted types in\n the XML element attribute \"type\".\n \"\"\"\n if data.tag == 'request':\n # if \"object\" or \"objects\" exists, return deserialized forms.\n elements = data.getchildren()\n for element in elements:\n if element.tag in ('object', 'objects'):\n return self.from_etree(element)\n return dict((element.tag, self.from_etree(element)) for element in elements)\n elif data.tag == 'object' or data.get('type') == 'hash':\n return dict((element.tag, self.from_etree(element)) for element in data.getchildren())\n elif data.tag == 'objects' or data.get('type') == 'list':\n return [self.from_etree(element) for element in data.getchildren()]\n else:\n type_string = data.get('type')\n if type_string in ('string', None):\n return data.text\n elif type_string == 'integer':\n return int(data.text)\n elif type_string == 'float':\n return float(data.text)\n elif type_string == 'boolean':\n if data.text == 'True':\n return True\n else:\n return False\n else:\n return None",
"",
" def to_json(self, data, options=None):\n \"\"\"\n Given some Python data, produces JSON output.\n \"\"\"\n options = options or {}\n data = self.to_simple(data, options)\n return simplejson.dumps(data, cls=json.DjangoJSONEncoder, sort_keys=True)",
" def from_json(self, content):\n \"\"\"\n Given some JSON data, returns a Python dictionary of the decoded data.\n \"\"\"\n return simplejson.loads(content)",
" def to_jsonp(self, data, options=None):\n \"\"\"\n Given some Python data, produces JSON output wrapped in the provided\n callback.\n \"\"\"\n options = options or {}\n return '%s(%s)' % (options['callback'], self.to_json(data, options))",
" def to_xml(self, data, options=None):\n \"\"\"\n Given some Python data, produces XML output.\n \"\"\"\n options = options or {}",
"",
" if lxml is None:\n raise ImproperlyConfigured(\"Usage of the XML aspects requires lxml.\")",
"",
" return tostring(self.to_etree(data, options), xml_declaration=True, encoding='utf-8')",
"",
" def from_xml(self, content):\n \"\"\"\n Given some XML data, returns a Python dictionary of the decoded data.\n \"\"\"\n if lxml is None:\n raise ImproperlyConfigured(\"Usage of the XML aspects requires lxml.\")",
"",
" return self.from_etree(parse_xml(StringIO(content)).getroot())",
"",
" def to_yaml(self, data, options=None):\n \"\"\"\n Given some Python data, produces YAML output.\n \"\"\"\n options = options or {}",
"",
" if yaml is None:\n raise ImproperlyConfigured(\"Usage of the YAML aspects requires yaml.\")",
"",
" return yaml.dump(self.to_simple(data, options))",
"",
" def from_yaml(self, content):\n \"\"\"\n Given some YAML data, returns a Python dictionary of the decoded data.\n \"\"\"\n if yaml is None:\n raise ImproperlyConfigured(\"Usage of the YAML aspects requires yaml.\")",
"\n return yaml.safe_load(content)\n",
" def to_plist(self, data, options=None):\n \"\"\"\n Given some Python data, produces binary plist output.\n \"\"\"\n options = options or {}",
"",
" if biplist is None:\n raise ImproperlyConfigured(\"Usage of the plist aspects requires biplist.\")",
"",
" return biplist.writePlistToString(self.to_simple(data, options))",
"",
" def from_plist(self, content):\n \"\"\"\n Given some binary plist data, returns a Python dictionary of the decoded data.\n \"\"\"\n if biplist is None:\n raise ImproperlyConfigured(\"Usage of the plist aspects requires biplist.\")",
"",
" return biplist.readPlistFromString(content)",
"",
" def to_html(self, data, options=None):\n \"\"\"\n Reserved for future usage.",
"",
" The desire is to provide HTML output of a resource, making an API\n available to a browser. This is on the TODO list but not currently\n implemented.\n \"\"\"\n options = options or {}\n return 'Sorry, not implemented yet. Please append \"?format=json\" to your URL.'",
"",
" def from_html(self, content):\n \"\"\"\n Reserved for future usage.",
"",
" The desire is to handle form-based (maybe Javascript?) input, making an\n API available to a browser. This is on the TODO list but not currently\n implemented.\n \"\"\"\n pass",
"def get_type_string(data):\n \"\"\"\n Translates a Python data type into a string format.\n \"\"\"\n data_type = type(data)",
"",
" if data_type in (int, long):\n return 'integer'\n elif data_type == float:\n return 'float'\n elif data_type == bool:\n return 'boolean'\n elif data_type in (list, tuple):\n return 'list'\n elif data_type == dict:\n return 'hash'\n elif data is None:\n return 'null'\n elif isinstance(data, basestring):\n return 'string'"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [406], "buggy_code_start_loc": [31], "filenames": ["tastypie/serializers.py"], "fixing_code_end_loc": [406], "fixing_code_start_loc": [31], "message": "The from_yaml method in serializers.py in Django Tastypie before 0.9.10 does not properly deserialize YAML data, which allows remote attackers to execute arbitrary Python code via vectors related to the yaml.load method.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:djangoproject:tastypie:*:*:*:*:*:*:*:*", "matchCriteriaId": "B6D983F7-056E-4271-B345-22B37205031B", "versionEndExcluding": null, "versionEndIncluding": "0.9.9", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The from_yaml method in serializers.py in Django Tastypie before 0.9.10 does not properly deserialize YAML data, which allows remote attackers to execute arbitrary Python code via vectors related to the yaml.load method."}, {"lang": "es", "value": "El m\u00e9todo from_yaml en serializers.py en Django Tastypie anterior a 0.9.10 no deserializa debidamente los datos YAML, lo que permite a atacantes remotos ejecutar c\u00f3digo Python arbitrario a trav\u00e9s de vectores relacionados con el m\u00e9todo yaml.load."}], "evaluatorComment": null, "id": "CVE-2011-4104", "lastModified": "2018-08-13T21:47:39.900", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": null}, "published": "2014-10-27T01:55:23.407", "references": [{"source": "secalert@redhat.com", "tags": ["Patch"], "url": "http://www.openwall.com/lists/oss-security/2011/11/02/1"}, {"source": "secalert@redhat.com", "tags": null, "url": "http://www.openwall.com/lists/oss-security/2011/11/02/7"}, {"source": "secalert@redhat.com", "tags": ["Patch"], "url": "https://github.com/toastdriven/django-tastypie/commit/e8af315211b07c8f48f32a063233cc3f76dd5bc2"}, {"source": "secalert@redhat.com", "tags": null, "url": "https://groups.google.com/forum/#!topic/django-tastypie/i2aNGDHTUBI"}, {"source": "secalert@redhat.com", "tags": ["Vendor Advisory"], "url": "https://www.djangoproject.com/weblog/2011/nov/01/piston-and-tastypie-security-releases/"}], "sourceIdentifier": "secalert@redhat.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-20"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/toastdriven/django-tastypie/commit/e8af315211b07c8f48f32a063233cc3f76dd5bc2"}, "type": "CWE-20"}
| 95
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"target\n.classpath\n.metadata\n.project\ndoc",
""
] |
[
1,
0
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"target\n.classpath\n.metadata\n.project\ndoc",
"*.class"
] |
[
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import java.util.Arrays;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.ShortBufferException;",
"import com.southernstorm.noise.crypto.GHASH;\nimport com.southernstorm.noise.crypto.RijndaelAES;",
"/**\n * Fallback implementation of \"AESGCM\" on platforms where\n * the JCA/JCE does not have a suitable GCM or CTR provider.\n */\nclass AESGCMFallbackCipherState implements CipherState {",
"\tprivate RijndaelAES aes;\n\tprivate long n;\n\tprivate byte[] iv;\n\tprivate byte[] enciv;\n\tprivate byte[] hashKey;\n\tprivate GHASH ghash;\n\tprivate boolean haskey;",
"\t/**\n\t * Constructs a new cipher state for the \"AESGCM\" algorithm.\n\t */\n\tpublic AESGCMFallbackCipherState()\n\t{\n\t\taes = new RijndaelAES();\n\t\tn = 0;\n\t\tiv = new byte [16];\n\t\tenciv = new byte [16];\n\t\thashKey = new byte [16];\n\t\tghash = new GHASH();\n\t\thaskey = false;\n\t}",
"\t@Override\n\tpublic void destroy() {\n\t\taes.destroy();\n\t\tghash.destroy();\n\t\tNoise.destroy(hashKey);\n\t\tNoise.destroy(iv);\n\t\tNoise.destroy(enciv);\n\t}",
"\t@Override\n\tpublic String getCipherName() {\n\t\treturn \"AESGCM\";\n\t}",
"\t@Override\n\tpublic int getKeyLength() {\n\t\treturn 32;\n\t}",
"\t@Override\n\tpublic int getMACLength() {\n\t\treturn haskey ? 16 : 0;\n\t}",
"\t@Override\n\tpublic void initializeKey(byte[] key, int offset) {\n\t\t// Set up the AES key.\n\t\taes.setupEnc(key, offset, 256);\n\t\thaskey = true;",
"\t\t// Generate the hashing key by encrypting a block of zeroes.\n\t\tArrays.fill(hashKey, (byte)0);\n\t\taes.encrypt(hashKey, 0, hashKey, 0);\n\t\tghash.reset(hashKey, 0);\n\t\t\n\t\t// Reset the nonce.\n\t\tn = 0;\n\t}",
"\t@Override\n\tpublic boolean hasKey() {\n\t\treturn haskey;\n\t}\n\t\n\t/**\n\t * Set up to encrypt or decrypt the next packet.\n\t * \n\t * @param ad The associated data for the packet.\n\t */\n\tprivate void setup(byte[] ad)\n\t{\n\t\t// Check for nonce wrap-around.\n\t\tif (n == -1L)\n\t\t\tthrow new IllegalStateException(\"Nonce has wrapped around\");\n\t\t\n\t\t// Format the counter/IV block.\n\t\tiv[0] = 0;\n\t\tiv[1] = 0;\n\t\tiv[2] = 0;\n\t\tiv[3] = 0;\n\t\tiv[4] = (byte)(n >> 56);\n\t\tiv[5] = (byte)(n >> 48);\n\t\tiv[6] = (byte)(n >> 40);\n\t\tiv[7] = (byte)(n >> 32);\n\t\tiv[8] = (byte)(n >> 24);\n\t\tiv[9] = (byte)(n >> 16);\n\t\tiv[10] = (byte)(n >> 8);\n\t\tiv[11] = (byte)n;\n\t\tiv[12] = 0;\n\t\tiv[13] = 0;\n\t\tiv[14] = 0;\n\t\tiv[15] = 1;\n\t\t++n;\n\t\t\n\t\t// Encrypt a block of zeroes to generate the hash key to XOR\n\t\t// the GHASH tag with at the end of the encrypt/decrypt operation.\n\t\tArrays.fill(hashKey, (byte)0);\n\t\taes.encrypt(iv, 0, hashKey, 0);\n\t\t\n\t\t// Initialize the GHASH with the associated data value.\n\t\tghash.reset();\n\t\tif (ad != null) {\n\t\t\tghash.update(ad, 0, ad.length);\n\t\t\tghash.pad();\n\t\t}\n\t}",
"\t/**\n\t * Encrypts a block in CTR mode.\n\t * \n\t * @param plaintext The plaintext to encrypt.\n\t * @param plaintextOffset Offset of the first plaintext byte.\n\t * @param ciphertext The resulting ciphertext.\n\t * @param ciphertextOffset Offset of the first ciphertext byte.\n\t * @param length The number of bytes to encrypt.\n\t * \n\t * This function can also be used to decrypt.\n\t */\n\tprivate void encryptCTR(byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length)\n\t{\n\t\twhile (length > 0) {\n\t\t\t// Increment the IV and encrypt it to get the next keystream block.\n\t\t\tif (++(iv[15]) == 0)\n\t\t\t\tif (++(iv[14]) == 0)\n\t\t\t\t\tif (++(iv[13]) == 0)\n\t\t\t\t\t\t++(iv[12]);\n\t\t\taes.encrypt(iv, 0, enciv, 0);\n\t\t\t\n\t\t\t// XOR the keystream block with the plaintext to create the ciphertext.\n\t\t\tint temp = length;\n\t\t\tif (temp > 16)\n\t\t\t\ttemp = 16;\n\t\t\tfor (int index = 0; index < temp; ++index)\n\t\t\t\tciphertext[ciphertextOffset + index] = (byte)(plaintext[plaintextOffset + index] ^ enciv[index]);\n\t\t\t\n\t\t\t// Advance to the next block.\n\t\t\tplaintextOffset += temp;\n\t\t\tciphertextOffset += temp;\n\t\t\tlength -= temp;\n\t\t}\n\t}",
"\t@Override\n\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length)\n\t\t\tthrows ShortBufferException {\n\t\tint space;",
"\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tencryptCTR(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\tghash.update(ciphertext, ciphertextOffset, length);\n\t\tghash.pad(ad != null ? ad.length : 0, length);\n\t\tghash.finish(ciphertext, ciphertextOffset + length, 16);\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\tciphertext[ciphertextOffset + length + index] ^= hashKey[index];\n\t\treturn length + 16;\n\t}",
"\t@Override\n\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;",
"\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;",
"\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();",
"\t\tif (plaintextOffset > plaintext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = plaintext.length - plaintextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tghash.update(ciphertext, ciphertextOffset, dataLen);\n\t\tghash.pad(ad != null ? ad.length : 0, dataLen);\n\t\tghash.finish(enciv, 0, 16);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (hashKey[index] ^ enciv[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\tencryptCTR(ciphertext, ciphertextOffset, plaintext, plaintextOffset, dataLen);\n\t\treturn dataLen;\n\t}",
"\t@Override\n\tpublic CipherState fork(byte[] key, int offset) {\n\t\tCipherState cipher;\n\t\tcipher = new AESGCMFallbackCipherState();\n\t\tcipher.initializeKey(key, offset);\n\t\treturn cipher;\n\t}",
"\t@Override\n\tpublic void setNonce(long nonce) {\n\t\tn = nonce;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import java.util.Arrays;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.ShortBufferException;",
"import com.southernstorm.noise.crypto.GHASH;\nimport com.southernstorm.noise.crypto.RijndaelAES;",
"/**\n * Fallback implementation of \"AESGCM\" on platforms where\n * the JCA/JCE does not have a suitable GCM or CTR provider.\n */\nclass AESGCMFallbackCipherState implements CipherState {",
"\tprivate RijndaelAES aes;\n\tprivate long n;\n\tprivate byte[] iv;\n\tprivate byte[] enciv;\n\tprivate byte[] hashKey;\n\tprivate GHASH ghash;\n\tprivate boolean haskey;",
"\t/**\n\t * Constructs a new cipher state for the \"AESGCM\" algorithm.\n\t */\n\tpublic AESGCMFallbackCipherState()\n\t{\n\t\taes = new RijndaelAES();\n\t\tn = 0;\n\t\tiv = new byte [16];\n\t\tenciv = new byte [16];\n\t\thashKey = new byte [16];\n\t\tghash = new GHASH();\n\t\thaskey = false;\n\t}",
"\t@Override\n\tpublic void destroy() {\n\t\taes.destroy();\n\t\tghash.destroy();\n\t\tNoise.destroy(hashKey);\n\t\tNoise.destroy(iv);\n\t\tNoise.destroy(enciv);\n\t}",
"\t@Override\n\tpublic String getCipherName() {\n\t\treturn \"AESGCM\";\n\t}",
"\t@Override\n\tpublic int getKeyLength() {\n\t\treturn 32;\n\t}",
"\t@Override\n\tpublic int getMACLength() {\n\t\treturn haskey ? 16 : 0;\n\t}",
"\t@Override\n\tpublic void initializeKey(byte[] key, int offset) {\n\t\t// Set up the AES key.\n\t\taes.setupEnc(key, offset, 256);\n\t\thaskey = true;",
"\t\t// Generate the hashing key by encrypting a block of zeroes.\n\t\tArrays.fill(hashKey, (byte)0);\n\t\taes.encrypt(hashKey, 0, hashKey, 0);\n\t\tghash.reset(hashKey, 0);\n\t\t\n\t\t// Reset the nonce.\n\t\tn = 0;\n\t}",
"\t@Override\n\tpublic boolean hasKey() {\n\t\treturn haskey;\n\t}\n\t\n\t/**\n\t * Set up to encrypt or decrypt the next packet.\n\t * \n\t * @param ad The associated data for the packet.\n\t */\n\tprivate void setup(byte[] ad)\n\t{\n\t\t// Check for nonce wrap-around.\n\t\tif (n == -1L)\n\t\t\tthrow new IllegalStateException(\"Nonce has wrapped around\");\n\t\t\n\t\t// Format the counter/IV block.\n\t\tiv[0] = 0;\n\t\tiv[1] = 0;\n\t\tiv[2] = 0;\n\t\tiv[3] = 0;\n\t\tiv[4] = (byte)(n >> 56);\n\t\tiv[5] = (byte)(n >> 48);\n\t\tiv[6] = (byte)(n >> 40);\n\t\tiv[7] = (byte)(n >> 32);\n\t\tiv[8] = (byte)(n >> 24);\n\t\tiv[9] = (byte)(n >> 16);\n\t\tiv[10] = (byte)(n >> 8);\n\t\tiv[11] = (byte)n;\n\t\tiv[12] = 0;\n\t\tiv[13] = 0;\n\t\tiv[14] = 0;\n\t\tiv[15] = 1;\n\t\t++n;\n\t\t\n\t\t// Encrypt a block of zeroes to generate the hash key to XOR\n\t\t// the GHASH tag with at the end of the encrypt/decrypt operation.\n\t\tArrays.fill(hashKey, (byte)0);\n\t\taes.encrypt(iv, 0, hashKey, 0);\n\t\t\n\t\t// Initialize the GHASH with the associated data value.\n\t\tghash.reset();\n\t\tif (ad != null) {\n\t\t\tghash.update(ad, 0, ad.length);\n\t\t\tghash.pad();\n\t\t}\n\t}",
"\t/**\n\t * Encrypts a block in CTR mode.\n\t * \n\t * @param plaintext The plaintext to encrypt.\n\t * @param plaintextOffset Offset of the first plaintext byte.\n\t * @param ciphertext The resulting ciphertext.\n\t * @param ciphertextOffset Offset of the first ciphertext byte.\n\t * @param length The number of bytes to encrypt.\n\t * \n\t * This function can also be used to decrypt.\n\t */\n\tprivate void encryptCTR(byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length)\n\t{\n\t\twhile (length > 0) {\n\t\t\t// Increment the IV and encrypt it to get the next keystream block.\n\t\t\tif (++(iv[15]) == 0)\n\t\t\t\tif (++(iv[14]) == 0)\n\t\t\t\t\tif (++(iv[13]) == 0)\n\t\t\t\t\t\t++(iv[12]);\n\t\t\taes.encrypt(iv, 0, enciv, 0);\n\t\t\t\n\t\t\t// XOR the keystream block with the plaintext to create the ciphertext.\n\t\t\tint temp = length;\n\t\t\tif (temp > 16)\n\t\t\t\ttemp = 16;\n\t\t\tfor (int index = 0; index < temp; ++index)\n\t\t\t\tciphertext[ciphertextOffset + index] = (byte)(plaintext[plaintextOffset + index] ^ enciv[index]);\n\t\t\t\n\t\t\t// Advance to the next block.\n\t\t\tplaintextOffset += temp;\n\t\t\tciphertextOffset += temp;\n\t\t\tlength -= temp;\n\t\t}\n\t}",
"\t@Override\n\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length)\n\t\t\tthrows ShortBufferException {\n\t\tint space;",
"\t\tif (ciphertextOffset < 0 || ciphertextOffset > ciphertext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tif (length < 0 || plaintextOffset < 0 || plaintextOffset > plaintext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tspace = ciphertext.length - ciphertextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tencryptCTR(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\tghash.update(ciphertext, ciphertextOffset, length);\n\t\tghash.pad(ad != null ? ad.length : 0, length);\n\t\tghash.finish(ciphertext, ciphertextOffset + length, 16);\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\tciphertext[ciphertextOffset + length + index] ^= hashKey[index];\n\t\treturn length + 16;\n\t}",
"\t@Override\n\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;",
"\t\tif (ciphertextOffset < 0 || ciphertextOffset > ciphertext.length)\n\t\t\tthrow new IllegalArgumentException();",
"\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();",
"\t\tif (length < 0 || plaintextOffset < 0 || plaintextOffset > plaintext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tspace = plaintext.length - plaintextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tghash.update(ciphertext, ciphertextOffset, dataLen);\n\t\tghash.pad(ad != null ? ad.length : 0, dataLen);\n\t\tghash.finish(enciv, 0, 16);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (hashKey[index] ^ enciv[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\tencryptCTR(ciphertext, ciphertextOffset, plaintext, plaintextOffset, dataLen);\n\t\treturn dataLen;\n\t}",
"\t@Override\n\tpublic CipherState fork(byte[] key, int offset) {\n\t\tCipherState cipher;\n\t\tcipher = new AESGCMFallbackCipherState();\n\t\tcipher.initializeKey(key, offset);\n\t\treturn cipher;\n\t}",
"\t@Override\n\tpublic void setNonce(long nonce) {\n\t\tn = nonce;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import java.security.InvalidAlgorithmParameterException;\nimport java.security.InvalidKeyException;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Arrays;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.Cipher;\nimport javax.crypto.IllegalBlockSizeException;\nimport javax.crypto.NoSuchPaddingException;\nimport javax.crypto.ShortBufferException;\nimport javax.crypto.spec.IvParameterSpec;\nimport javax.crypto.spec.SecretKeySpec;",
"import com.southernstorm.noise.crypto.GHASH;",
"/**\n * Emulates the \"AESGCM\" cipher for Noise using the \"AES/CTR/NoPadding\"\n * transformation from JCA/JCE.\n * \n * This class is used on platforms that don't have \"AES/GCM/NoPadding\",\n * but which do have the older \"AES/CTR/NoPadding\".\n */\nclass AESGCMOnCtrCipherState implements CipherState {",
"\tprivate Cipher cipher;\n\tprivate SecretKeySpec keySpec;\n\tprivate long n;\n\tprivate byte[] iv;\n\tprivate byte[] hashKey;\n\tprivate GHASH ghash;",
"\t/**\n\t * Constructs a new cipher state for the \"AESGCM\" algorithm.\n\t * \n\t * @throws NoSuchAlgorithmException The system does not have a\n\t * provider for this algorithm.\n\t */\n\tpublic AESGCMOnCtrCipherState() throws NoSuchAlgorithmException\n\t{\n\t\ttry {\n\t\t\tcipher = Cipher.getInstance(\"AES/CTR/NoPadding\");\n\t\t} catch (NoSuchPaddingException e) {\n\t\t\t// AES/CTR is available, but not the unpadded version? Huh?\n\t\t\tthrow new NoSuchAlgorithmException(\"AES/CTR/NoPadding not available\", e);\n\t\t}\n\t\tkeySpec = null;\n\t\tn = 0;\n\t\tiv = new byte [16];\n\t\thashKey = new byte [16];\n\t\tghash = new GHASH();\n\t\t\n\t\t// Try to set a 256-bit key on the cipher. Some JCE's are\n\t\t// configured to disallow 256-bit AES if an extra policy\n\t\t// file has not been installed.\n\t\ttry {\n\t\t\tSecretKeySpec spec = new SecretKeySpec(new byte [32], \"AES\");\n\t\t\tIvParameterSpec params = new IvParameterSpec(iv);\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, spec, params);\n\t\t} catch (InvalidKeyException e) {\n\t\t\tthrow new NoSuchAlgorithmException(\"AES/CTR/NoPadding does not support 256-bit keys\", e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\tthrow new NoSuchAlgorithmException(\"AES/CTR/NoPadding does not support 256-bit keys\", e);\n\t\t}\n\t}",
"\t@Override\n\tpublic void destroy() {\n\t\t// There doesn't seem to be a standard API to clean out a Cipher.\n\t\t// So we instead set the key and IV to all-zeroes to hopefully\n\t\t// destroy the sensitive data in the cipher instance.\n\t\tghash.destroy();\n\t\tNoise.destroy(hashKey);\n\t\tNoise.destroy(iv);\n\t\tkeySpec = new SecretKeySpec(new byte [32], \"AES\");\n\t\tIvParameterSpec params = new IvParameterSpec(iv);\n\t\ttry {\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, keySpec, params);\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t}\n\t}",
"\t@Override\n\tpublic String getCipherName() {\n\t\treturn \"AESGCM\";\n\t}",
"\t@Override\n\tpublic int getKeyLength() {\n\t\treturn 32;\n\t}",
"\t@Override\n\tpublic int getMACLength() {\n\t\treturn keySpec != null ? 16 : 0;\n\t}",
"\t@Override\n\tpublic void initializeKey(byte[] key, int offset) {\n\t\t// Set the encryption key.\n\t\tkeySpec = new SecretKeySpec(key, offset, 32, \"AES\");\n\t\t\n\t\t// Generate the hashing key by encrypting a block of zeroes.\n\t\tArrays.fill(iv, (byte)0);\n\t\tArrays.fill(hashKey, (byte)0);\n\t\ttry {\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(iv));\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\ttry {\n\t\t\tint result = cipher.update(hashKey, 0, 16, hashKey, 0);\n\t\t\tcipher.doFinal(hashKey, result);\n\t\t} catch (ShortBufferException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (BadPaddingException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\tghash.reset(hashKey, 0);\n\t\t\n\t\t// Reset the nonce.\n\t\tn = 0;\n\t}",
"\t@Override\n\tpublic boolean hasKey() {\n\t\treturn keySpec != null;\n\t}",
"\t/**\n\t * Set up to encrypt or decrypt the next packet.\n\t * \n\t * @param ad The associated data for the packet.\n\t */\n\tprivate void setup(byte[] ad) throws InvalidKeyException, InvalidAlgorithmParameterException\n\t{\n\t\t// Check for nonce wrap-around.\n\t\tif (n == -1L)\n\t\t\tthrow new IllegalStateException(\"Nonce has wrapped around\");\n\t\t\n\t\t// Format the counter/IV block for AES/CTR/NoPadding.\n\t\tiv[0] = 0;\n\t\tiv[1] = 0;\n\t\tiv[2] = 0;\n\t\tiv[3] = 0;\n\t\tiv[4] = (byte)(n >> 56);\n\t\tiv[5] = (byte)(n >> 48);\n\t\tiv[6] = (byte)(n >> 40);\n\t\tiv[7] = (byte)(n >> 32);\n\t\tiv[8] = (byte)(n >> 24);\n\t\tiv[9] = (byte)(n >> 16);\n\t\tiv[10] = (byte)(n >> 8);\n\t\tiv[11] = (byte)n;\n\t\tiv[12] = 0;\n\t\tiv[13] = 0;\n\t\tiv[14] = 0;\n\t\tiv[15] = 1;\n\t\t++n;\n\t\t\n\t\t// Initialize the CTR mode cipher with the key and IV.\n\t\tcipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(iv));\n\t\t\n\t\t// Encrypt a block of zeroes to generate the hash key to XOR\n\t\t// the GHASH tag with at the end of the encrypt/decrypt operation.\n\t\tArrays.fill(hashKey, (byte)0);\n\t\ttry {\n\t\t\tcipher.update(hashKey, 0, 16, hashKey, 0);\n\t\t} catch (ShortBufferException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\t\n\t\t// Initialize the GHASH with the associated data value.\n\t\tghash.reset();\n\t\tif (ad != null) {\n\t\t\tghash.update(ad, 0, ad.length);\n\t\t\tghash.pad();\n\t\t}\n\t}",
"\t@Override\n\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length)\n\t\t\tthrows ShortBufferException {\n\t\tint space;",
"\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;",
"\t\tif (keySpec == null) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\ttry {\n\t\t\tsetup(ad);\n\t\t\tint result = cipher.update(plaintext, plaintextOffset, length, ciphertext, ciphertextOffset);\n\t\t\tcipher.doFinal(ciphertext, ciphertextOffset + result);\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (BadPaddingException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\tghash.update(ciphertext, ciphertextOffset, length);\n\t\tghash.pad(ad != null ? ad.length : 0, length);\n\t\tghash.finish(ciphertext, ciphertextOffset + length, 16);\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\tciphertext[ciphertextOffset + length + index] ^= hashKey[index];\n\t\treturn length + 16;\n\t}",
"\t@Override\n\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;",
"\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;",
"\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();",
"\t\tif (plaintextOffset > plaintext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = plaintext.length - plaintextOffset;",
"\t\tif (keySpec == null) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\ttry {\n\t\t\tsetup(ad);\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\tghash.update(ciphertext, ciphertextOffset, dataLen);\n\t\tghash.pad(ad != null ? ad.length : 0, dataLen);\n\t\tghash.finish(iv, 0, 16);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (hashKey[index] ^ iv[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\ttry {\n\t\t\tint result = cipher.update(ciphertext, ciphertextOffset, dataLen, plaintext, plaintextOffset);\n\t\t\tcipher.doFinal(plaintext, plaintextOffset + result);\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (BadPaddingException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\treturn dataLen;\n\t}",
"\t@Override\n\tpublic CipherState fork(byte[] key, int offset) {\n\t\tCipherState cipher;\n\t\ttry {\n\t\t\tcipher = new AESGCMOnCtrCipherState();\n\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\t// Shouldn't happen.\n\t\t\treturn null;\n\t\t}\n\t\tcipher.initializeKey(key, offset);\n\t\treturn cipher;\n\t}",
"\t@Override\n\tpublic void setNonce(long nonce) {\n\t\tn = nonce;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import java.security.InvalidAlgorithmParameterException;\nimport java.security.InvalidKeyException;\nimport java.security.NoSuchAlgorithmException;\nimport java.util.Arrays;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.Cipher;\nimport javax.crypto.IllegalBlockSizeException;\nimport javax.crypto.NoSuchPaddingException;\nimport javax.crypto.ShortBufferException;\nimport javax.crypto.spec.IvParameterSpec;\nimport javax.crypto.spec.SecretKeySpec;",
"import com.southernstorm.noise.crypto.GHASH;",
"/**\n * Emulates the \"AESGCM\" cipher for Noise using the \"AES/CTR/NoPadding\"\n * transformation from JCA/JCE.\n * \n * This class is used on platforms that don't have \"AES/GCM/NoPadding\",\n * but which do have the older \"AES/CTR/NoPadding\".\n */\nclass AESGCMOnCtrCipherState implements CipherState {",
"\tprivate Cipher cipher;\n\tprivate SecretKeySpec keySpec;\n\tprivate long n;\n\tprivate byte[] iv;\n\tprivate byte[] hashKey;\n\tprivate GHASH ghash;",
"\t/**\n\t * Constructs a new cipher state for the \"AESGCM\" algorithm.\n\t * \n\t * @throws NoSuchAlgorithmException The system does not have a\n\t * provider for this algorithm.\n\t */\n\tpublic AESGCMOnCtrCipherState() throws NoSuchAlgorithmException\n\t{\n\t\ttry {\n\t\t\tcipher = Cipher.getInstance(\"AES/CTR/NoPadding\");\n\t\t} catch (NoSuchPaddingException e) {\n\t\t\t// AES/CTR is available, but not the unpadded version? Huh?\n\t\t\tthrow new NoSuchAlgorithmException(\"AES/CTR/NoPadding not available\", e);\n\t\t}\n\t\tkeySpec = null;\n\t\tn = 0;\n\t\tiv = new byte [16];\n\t\thashKey = new byte [16];\n\t\tghash = new GHASH();\n\t\t\n\t\t// Try to set a 256-bit key on the cipher. Some JCE's are\n\t\t// configured to disallow 256-bit AES if an extra policy\n\t\t// file has not been installed.\n\t\ttry {\n\t\t\tSecretKeySpec spec = new SecretKeySpec(new byte [32], \"AES\");\n\t\t\tIvParameterSpec params = new IvParameterSpec(iv);\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, spec, params);\n\t\t} catch (InvalidKeyException e) {\n\t\t\tthrow new NoSuchAlgorithmException(\"AES/CTR/NoPadding does not support 256-bit keys\", e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\tthrow new NoSuchAlgorithmException(\"AES/CTR/NoPadding does not support 256-bit keys\", e);\n\t\t}\n\t}",
"\t@Override\n\tpublic void destroy() {\n\t\t// There doesn't seem to be a standard API to clean out a Cipher.\n\t\t// So we instead set the key and IV to all-zeroes to hopefully\n\t\t// destroy the sensitive data in the cipher instance.\n\t\tghash.destroy();\n\t\tNoise.destroy(hashKey);\n\t\tNoise.destroy(iv);\n\t\tkeySpec = new SecretKeySpec(new byte [32], \"AES\");\n\t\tIvParameterSpec params = new IvParameterSpec(iv);\n\t\ttry {\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, keySpec, params);\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t}\n\t}",
"\t@Override\n\tpublic String getCipherName() {\n\t\treturn \"AESGCM\";\n\t}",
"\t@Override\n\tpublic int getKeyLength() {\n\t\treturn 32;\n\t}",
"\t@Override\n\tpublic int getMACLength() {\n\t\treturn keySpec != null ? 16 : 0;\n\t}",
"\t@Override\n\tpublic void initializeKey(byte[] key, int offset) {\n\t\t// Set the encryption key.\n\t\tkeySpec = new SecretKeySpec(key, offset, 32, \"AES\");\n\t\t\n\t\t// Generate the hashing key by encrypting a block of zeroes.\n\t\tArrays.fill(iv, (byte)0);\n\t\tArrays.fill(hashKey, (byte)0);\n\t\ttry {\n\t\t\tcipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(iv));\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\ttry {\n\t\t\tint result = cipher.update(hashKey, 0, 16, hashKey, 0);\n\t\t\tcipher.doFinal(hashKey, result);\n\t\t} catch (ShortBufferException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (BadPaddingException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\tghash.reset(hashKey, 0);\n\t\t\n\t\t// Reset the nonce.\n\t\tn = 0;\n\t}",
"\t@Override\n\tpublic boolean hasKey() {\n\t\treturn keySpec != null;\n\t}",
"\t/**\n\t * Set up to encrypt or decrypt the next packet.\n\t * \n\t * @param ad The associated data for the packet.\n\t */\n\tprivate void setup(byte[] ad) throws InvalidKeyException, InvalidAlgorithmParameterException\n\t{\n\t\t// Check for nonce wrap-around.\n\t\tif (n == -1L)\n\t\t\tthrow new IllegalStateException(\"Nonce has wrapped around\");\n\t\t\n\t\t// Format the counter/IV block for AES/CTR/NoPadding.\n\t\tiv[0] = 0;\n\t\tiv[1] = 0;\n\t\tiv[2] = 0;\n\t\tiv[3] = 0;\n\t\tiv[4] = (byte)(n >> 56);\n\t\tiv[5] = (byte)(n >> 48);\n\t\tiv[6] = (byte)(n >> 40);\n\t\tiv[7] = (byte)(n >> 32);\n\t\tiv[8] = (byte)(n >> 24);\n\t\tiv[9] = (byte)(n >> 16);\n\t\tiv[10] = (byte)(n >> 8);\n\t\tiv[11] = (byte)n;\n\t\tiv[12] = 0;\n\t\tiv[13] = 0;\n\t\tiv[14] = 0;\n\t\tiv[15] = 1;\n\t\t++n;\n\t\t\n\t\t// Initialize the CTR mode cipher with the key and IV.\n\t\tcipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(iv));\n\t\t\n\t\t// Encrypt a block of zeroes to generate the hash key to XOR\n\t\t// the GHASH tag with at the end of the encrypt/decrypt operation.\n\t\tArrays.fill(hashKey, (byte)0);\n\t\ttry {\n\t\t\tcipher.update(hashKey, 0, 16, hashKey, 0);\n\t\t} catch (ShortBufferException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\t\n\t\t// Initialize the GHASH with the associated data value.\n\t\tghash.reset();\n\t\tif (ad != null) {\n\t\t\tghash.update(ad, 0, ad.length);\n\t\t\tghash.pad();\n\t\t}\n\t}",
"\t@Override\n\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length)\n\t\t\tthrows ShortBufferException {\n\t\tint space;",
"\t\tif (ciphertextOffset < 0 || ciphertextOffset > ciphertext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tif (length < 0 || plaintextOffset < 0 || plaintextOffset > plaintext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tspace = ciphertext.length - ciphertextOffset;",
"\t\tif (keySpec == null) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\ttry {\n\t\t\tsetup(ad);\n\t\t\tint result = cipher.update(plaintext, plaintextOffset, length, ciphertext, ciphertextOffset);\n\t\t\tcipher.doFinal(ciphertext, ciphertextOffset + result);\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (BadPaddingException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\tghash.update(ciphertext, ciphertextOffset, length);\n\t\tghash.pad(ad != null ? ad.length : 0, length);\n\t\tghash.finish(ciphertext, ciphertextOffset + length, 16);\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\tciphertext[ciphertextOffset + length + index] ^= hashKey[index];\n\t\treturn length + 16;\n\t}",
"\t@Override\n\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;",
"\t\tif (ciphertextOffset < 0 || ciphertextOffset > ciphertext.length)\n\t\t\tthrow new IllegalArgumentException();",
"\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();",
"\t\tif (length < 0 || plaintextOffset < 0 || plaintextOffset > plaintext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tspace = plaintext.length - plaintextOffset;",
"\t\tif (keySpec == null) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\ttry {\n\t\t\tsetup(ad);\n\t\t} catch (InvalidKeyException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (InvalidAlgorithmParameterException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\tghash.update(ciphertext, ciphertextOffset, dataLen);\n\t\tghash.pad(ad != null ? ad.length : 0, dataLen);\n\t\tghash.finish(iv, 0, 16);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (hashKey[index] ^ iv[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\ttry {\n\t\t\tint result = cipher.update(ciphertext, ciphertextOffset, dataLen, plaintext, plaintextOffset);\n\t\t\tcipher.doFinal(plaintext, plaintextOffset + result);\n\t\t} catch (IllegalBlockSizeException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t} catch (BadPaddingException e) {\n\t\t\t// Shouldn't happen.\n\t\t\tthrow new IllegalStateException(e);\n\t\t}\n\t\treturn dataLen;\n\t}",
"\t@Override\n\tpublic CipherState fork(byte[] key, int offset) {\n\t\tCipherState cipher;\n\t\ttry {\n\t\t\tcipher = new AESGCMOnCtrCipherState();\n\t\t} catch (NoSuchAlgorithmException e) {\n\t\t\t// Shouldn't happen.\n\t\t\treturn null;\n\t\t}\n\t\tcipher.initializeKey(key, offset);\n\t\treturn cipher;\n\t}",
"\t@Override\n\tpublic void setNonce(long nonce) {\n\t\tn = nonce;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import java.util.Arrays;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.ShortBufferException;",
"import com.southernstorm.noise.crypto.ChaChaCore;\nimport com.southernstorm.noise.crypto.Poly1305;",
"/**\n * Implements the ChaChaPoly cipher for Noise.\n */\nclass ChaChaPolyCipherState implements CipherState {",
"\tprivate Poly1305 poly;\n\tprivate int[] input;\n\tprivate int[] output;\n\tprivate byte[] polyKey;\n\tlong n;\n\tprivate boolean haskey;\n\t\n\t/**\n\t * Constructs a new cipher state for the \"ChaChaPoly\" algorithm.\n\t */\n\tpublic ChaChaPolyCipherState()\n\t{\n\t\tpoly = new Poly1305();\n\t\tinput = new int [16];\n\t\toutput = new int [16];\n\t\tpolyKey = new byte [32];\n\t\tn = 0;\n\t\thaskey = false;\n\t}",
"\t@Override\n\tpublic void destroy() {\n\t\tpoly.destroy();\n\t\tArrays.fill(input, 0);\n\t\tArrays.fill(output, 0);\n\t\tNoise.destroy(polyKey);\n\t}",
"\t@Override\n\tpublic String getCipherName() {\n\t\treturn \"ChaChaPoly\";\n\t}",
"\t@Override\n\tpublic int getKeyLength() {\n\t\treturn 32;\n\t}",
"\t@Override\n\tpublic int getMACLength() {\n\t\treturn haskey ? 16 : 0;\n\t}",
"\t@Override\n\tpublic void initializeKey(byte[] key, int offset) {\n\t\tChaChaCore.initKey256(input, key, offset);\n\t\tn = 0;\n\t\thaskey = true;\n\t}",
"\t@Override\n\tpublic boolean hasKey() {\n\t\treturn haskey;\n\t}",
"\t/**\n\t * XOR's the output of ChaCha20 with a byte buffer.\n\t * \n\t * @param input The input byte buffer.\n\t * @param inputOffset The offset of the first input byte.\n\t * @param output The output byte buffer (can be the same as the input).\n\t * @param outputOffset The offset of the first output byte.\n\t * @param length The number of bytes to XOR between 1 and 64.\n\t * @param block The ChaCha20 output block.\n\t */\n\tprivate static void xorBlock(byte[] input, int inputOffset, byte[] output, int outputOffset, int length, int[] block)\n\t{\n\t\tint posn = 0;\n\t\tint value;\n\t\twhile (length >= 4) {\n\t\t\tvalue = block[posn++];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t\toutput[outputOffset + 1] = (byte)(input[inputOffset + 1] ^ (value >> 8));\n\t\t\toutput[outputOffset + 2] = (byte)(input[inputOffset + 2] ^ (value >> 16));\n\t\t\toutput[outputOffset + 3] = (byte)(input[inputOffset + 3] ^ (value >> 24));\n\t\t\tinputOffset += 4;\n\t\t\toutputOffset += 4;\n\t\t\tlength -= 4;\n\t\t}\n\t\tif (length == 3) {\n\t\t\tvalue = block[posn];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t\toutput[outputOffset + 1] = (byte)(input[inputOffset + 1] ^ (value >> 8));\n\t\t\toutput[outputOffset + 2] = (byte)(input[inputOffset + 2] ^ (value >> 16));\n\t\t} else if (length == 2) {\n\t\t\tvalue = block[posn];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t\toutput[outputOffset + 1] = (byte)(input[inputOffset + 1] ^ (value >> 8));\n\t\t} else if (length == 1) {\n\t\t\tvalue = block[posn];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t}\n\t}\n\t\n\t/**\n\t * Set up to encrypt or decrypt the next packet.\n\t * \n\t * @param ad The associated data for the packet.\n\t */\n\tprivate void setup(byte[] ad)\n\t{\n\t\tif (n == -1L)\n\t\t\tthrow new IllegalStateException(\"Nonce has wrapped around\");\n\t\tChaChaCore.initIV(input, n++);\n\t\tChaChaCore.hash(output, input);\n\t\tArrays.fill(polyKey, (byte)0);\n\t\txorBlock(polyKey, 0, polyKey, 0, 32, output);\n\t\tpoly.reset(polyKey, 0);\n\t\tif (ad != null) {\n\t\t\tpoly.update(ad, 0, ad.length);\n\t\t\tpoly.pad();\n\t\t}\n\t\tif (++(input[12]) == 0)\n\t\t\t++(input[13]);\n\t}",
"\t/**\n\t * Puts a 64-bit integer into a buffer in little-endian order.\n\t * \n\t * @param output The output buffer.\n\t * @param offset The offset into the output buffer.\n\t * @param value The 64-bit integer value.\n\t */\n\tprivate static void putLittleEndian64(byte[] output, int offset, long value)\n\t{\n\t\toutput[offset] = (byte)value;\n\t\toutput[offset + 1] = (byte)(value >> 8);\n\t\toutput[offset + 2] = (byte)(value >> 16);\n\t\toutput[offset + 3] = (byte)(value >> 24);\n\t\toutput[offset + 4] = (byte)(value >> 32);\n\t\toutput[offset + 5] = (byte)(value >> 40);\n\t\toutput[offset + 6] = (byte)(value >> 48);\n\t\toutput[offset + 7] = (byte)(value >> 56);\n\t}",
"\t/**\n\t * Finishes up the authentication tag for a packet.\n\t * \n\t * @param ad The associated data.\n\t * @param length The length of the plaintext data.\n\t */\n\tprivate void finish(byte[] ad, int length)\n\t{\n\t\tpoly.pad();\n\t\tputLittleEndian64(polyKey, 0, ad != null ? ad.length : 0);\n\t\tputLittleEndian64(polyKey, 8, length);\n\t\tpoly.update(polyKey, 0, 16);\n\t\tpoly.finish(polyKey, 0);\n\t}",
"\t/**\n\t * Encrypts or decrypts a buffer of bytes for the active packet.\n\t * \n\t * @param plaintext The plaintext data to be encrypted.\n\t * @param plaintextOffset The offset to the first plaintext byte.\n\t * @param ciphertext The ciphertext data that results from encryption.\n\t * @param ciphertextOffset The offset to the first ciphertext byte.\n\t * @param length The number of bytes to encrypt.\n\t */\n\tprivate void encrypt(byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length) {\n\t\twhile (length > 0) {\n\t\t\tint tempLen = 64;\n\t\t\tif (tempLen > length)\n\t\t\t\ttempLen = length;\n\t\t\tChaChaCore.hash(output, input);\n\t\t\txorBlock(plaintext, plaintextOffset, ciphertext, ciphertextOffset, tempLen, output);\n\t\t\tif (++(input[12]) == 0)\n\t\t\t\t++(input[13]);\n\t\t\tplaintextOffset += tempLen;\n\t\t\tciphertextOffset += tempLen;\n\t\t\tlength -= tempLen;\n\t\t}\n\t}",
"\t@Override\n\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException {\n\t\tint space;",
"\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tencrypt(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\tpoly.update(ciphertext, ciphertextOffset, length);\n\t\tfinish(ad, length);\n\t\tSystem.arraycopy(polyKey, 0, ciphertext, ciphertextOffset + length, 16);\n\t\treturn length + 16;\n\t}",
"\t@Override\n\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;",
"\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;",
"\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();",
"\t\tif (plaintextOffset > plaintext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = plaintext.length - plaintextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tpoly.update(ciphertext, ciphertextOffset, dataLen);\n\t\tfinish(ad, dataLen);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (polyKey[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\tencrypt(ciphertext, ciphertextOffset, plaintext, plaintextOffset, dataLen);\n\t\treturn dataLen;\n\t}",
"\t@Override\n\tpublic CipherState fork(byte[] key, int offset) {\n\t\tCipherState cipher = new ChaChaPolyCipherState();\n\t\tcipher.initializeKey(key, offset);\n\t\treturn cipher;\n\t}",
"\t@Override\n\tpublic void setNonce(long nonce) {\n\t\tn = nonce;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import java.util.Arrays;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.ShortBufferException;",
"import com.southernstorm.noise.crypto.ChaChaCore;\nimport com.southernstorm.noise.crypto.Poly1305;",
"/**\n * Implements the ChaChaPoly cipher for Noise.\n */\nclass ChaChaPolyCipherState implements CipherState {",
"\tprivate Poly1305 poly;\n\tprivate int[] input;\n\tprivate int[] output;\n\tprivate byte[] polyKey;\n\tlong n;\n\tprivate boolean haskey;\n\t\n\t/**\n\t * Constructs a new cipher state for the \"ChaChaPoly\" algorithm.\n\t */\n\tpublic ChaChaPolyCipherState()\n\t{\n\t\tpoly = new Poly1305();\n\t\tinput = new int [16];\n\t\toutput = new int [16];\n\t\tpolyKey = new byte [32];\n\t\tn = 0;\n\t\thaskey = false;\n\t}",
"\t@Override\n\tpublic void destroy() {\n\t\tpoly.destroy();\n\t\tArrays.fill(input, 0);\n\t\tArrays.fill(output, 0);\n\t\tNoise.destroy(polyKey);\n\t}",
"\t@Override\n\tpublic String getCipherName() {\n\t\treturn \"ChaChaPoly\";\n\t}",
"\t@Override\n\tpublic int getKeyLength() {\n\t\treturn 32;\n\t}",
"\t@Override\n\tpublic int getMACLength() {\n\t\treturn haskey ? 16 : 0;\n\t}",
"\t@Override\n\tpublic void initializeKey(byte[] key, int offset) {\n\t\tChaChaCore.initKey256(input, key, offset);\n\t\tn = 0;\n\t\thaskey = true;\n\t}",
"\t@Override\n\tpublic boolean hasKey() {\n\t\treturn haskey;\n\t}",
"\t/**\n\t * XOR's the output of ChaCha20 with a byte buffer.\n\t * \n\t * @param input The input byte buffer.\n\t * @param inputOffset The offset of the first input byte.\n\t * @param output The output byte buffer (can be the same as the input).\n\t * @param outputOffset The offset of the first output byte.\n\t * @param length The number of bytes to XOR between 1 and 64.\n\t * @param block The ChaCha20 output block.\n\t */\n\tprivate static void xorBlock(byte[] input, int inputOffset, byte[] output, int outputOffset, int length, int[] block)\n\t{\n\t\tint posn = 0;\n\t\tint value;\n\t\twhile (length >= 4) {\n\t\t\tvalue = block[posn++];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t\toutput[outputOffset + 1] = (byte)(input[inputOffset + 1] ^ (value >> 8));\n\t\t\toutput[outputOffset + 2] = (byte)(input[inputOffset + 2] ^ (value >> 16));\n\t\t\toutput[outputOffset + 3] = (byte)(input[inputOffset + 3] ^ (value >> 24));\n\t\t\tinputOffset += 4;\n\t\t\toutputOffset += 4;\n\t\t\tlength -= 4;\n\t\t}\n\t\tif (length == 3) {\n\t\t\tvalue = block[posn];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t\toutput[outputOffset + 1] = (byte)(input[inputOffset + 1] ^ (value >> 8));\n\t\t\toutput[outputOffset + 2] = (byte)(input[inputOffset + 2] ^ (value >> 16));\n\t\t} else if (length == 2) {\n\t\t\tvalue = block[posn];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t\toutput[outputOffset + 1] = (byte)(input[inputOffset + 1] ^ (value >> 8));\n\t\t} else if (length == 1) {\n\t\t\tvalue = block[posn];\n\t\t\toutput[outputOffset] = (byte)(input[inputOffset] ^ value);\n\t\t}\n\t}\n\t\n\t/**\n\t * Set up to encrypt or decrypt the next packet.\n\t * \n\t * @param ad The associated data for the packet.\n\t */\n\tprivate void setup(byte[] ad)\n\t{\n\t\tif (n == -1L)\n\t\t\tthrow new IllegalStateException(\"Nonce has wrapped around\");\n\t\tChaChaCore.initIV(input, n++);\n\t\tChaChaCore.hash(output, input);\n\t\tArrays.fill(polyKey, (byte)0);\n\t\txorBlock(polyKey, 0, polyKey, 0, 32, output);\n\t\tpoly.reset(polyKey, 0);\n\t\tif (ad != null) {\n\t\t\tpoly.update(ad, 0, ad.length);\n\t\t\tpoly.pad();\n\t\t}\n\t\tif (++(input[12]) == 0)\n\t\t\t++(input[13]);\n\t}",
"\t/**\n\t * Puts a 64-bit integer into a buffer in little-endian order.\n\t * \n\t * @param output The output buffer.\n\t * @param offset The offset into the output buffer.\n\t * @param value The 64-bit integer value.\n\t */\n\tprivate static void putLittleEndian64(byte[] output, int offset, long value)\n\t{\n\t\toutput[offset] = (byte)value;\n\t\toutput[offset + 1] = (byte)(value >> 8);\n\t\toutput[offset + 2] = (byte)(value >> 16);\n\t\toutput[offset + 3] = (byte)(value >> 24);\n\t\toutput[offset + 4] = (byte)(value >> 32);\n\t\toutput[offset + 5] = (byte)(value >> 40);\n\t\toutput[offset + 6] = (byte)(value >> 48);\n\t\toutput[offset + 7] = (byte)(value >> 56);\n\t}",
"\t/**\n\t * Finishes up the authentication tag for a packet.\n\t * \n\t * @param ad The associated data.\n\t * @param length The length of the plaintext data.\n\t */\n\tprivate void finish(byte[] ad, int length)\n\t{\n\t\tpoly.pad();\n\t\tputLittleEndian64(polyKey, 0, ad != null ? ad.length : 0);\n\t\tputLittleEndian64(polyKey, 8, length);\n\t\tpoly.update(polyKey, 0, 16);\n\t\tpoly.finish(polyKey, 0);\n\t}",
"\t/**\n\t * Encrypts or decrypts a buffer of bytes for the active packet.\n\t * \n\t * @param plaintext The plaintext data to be encrypted.\n\t * @param plaintextOffset The offset to the first plaintext byte.\n\t * @param ciphertext The ciphertext data that results from encryption.\n\t * @param ciphertextOffset The offset to the first ciphertext byte.\n\t * @param length The number of bytes to encrypt.\n\t */\n\tprivate void encrypt(byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length) {\n\t\twhile (length > 0) {\n\t\t\tint tempLen = 64;\n\t\t\tif (tempLen > length)\n\t\t\t\ttempLen = length;\n\t\t\tChaChaCore.hash(output, input);\n\t\t\txorBlock(plaintext, plaintextOffset, ciphertext, ciphertextOffset, tempLen, output);\n\t\t\tif (++(input[12]) == 0)\n\t\t\t\t++(input[13]);\n\t\t\tplaintextOffset += tempLen;\n\t\t\tciphertextOffset += tempLen;\n\t\t\tlength -= tempLen;\n\t\t}\n\t}",
"\t@Override\n\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException {\n\t\tint space;",
"\t\tif (ciphertextOffset < 0 || ciphertextOffset > ciphertext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tif (length < 0 || plaintextOffset < 0 || plaintextOffset > plaintext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tspace = ciphertext.length - ciphertextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tencrypt(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\tpoly.update(ciphertext, ciphertextOffset, length);\n\t\tfinish(ad, length);\n\t\tSystem.arraycopy(polyKey, 0, ciphertext, ciphertextOffset + length, 16);\n\t\treturn length + 16;\n\t}",
"\t@Override\n\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;",
"\t\tif (ciphertextOffset < 0 || ciphertextOffset > ciphertext.length)\n\t\t\tthrow new IllegalArgumentException();",
"\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();",
"\t\tif (length < 0 || plaintextOffset < 0 || plaintextOffset > plaintext.length)\n\t\t\tthrow new IllegalArgumentException();\n\t\tspace = plaintext.length - plaintextOffset;",
"\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tpoly.update(ciphertext, ciphertextOffset, dataLen);\n\t\tfinish(ad, dataLen);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (polyKey[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\tencrypt(ciphertext, ciphertextOffset, plaintext, plaintextOffset, dataLen);\n\t\treturn dataLen;\n\t}",
"\t@Override\n\tpublic CipherState fork(byte[] key, int offset) {\n\t\tCipherState cipher = new ChaChaPolyCipherState();\n\t\tcipher.initializeKey(key, offset);\n\t\treturn cipher;\n\t}",
"\t@Override\n\tpublic void setNonce(long nonce) {\n\t\tn = nonce;\n\t}\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.ShortBufferException;",
"/**\n * Interface to an authenticated cipher for use in the Noise protocol.\n *\n * CipherState objects are used to encrypt or decrypt data during a\n * session. Once the handshake has completed, HandshakeState.split()\n * will create two CipherState objects for encrypting packets sent to\n * the other party, and decrypting packets received from the other party.\n */\npublic interface CipherState extends Destroyable {",
"\t/**\n\t * Gets the Noise protocol name for this cipher.\n\t * \n\t * @return The cipher name.\n\t */\n\tString getCipherName();",
"\t/**\n\t * Gets the length of the key values for this cipher.\n\t * \n\t * @return The length of the key in bytes; usually 32.\n\t */\n\tint getKeyLength();\n\t\n\t/**\n\t * Gets the length of the MAC values for this cipher.\n\t * \n\t * @return The length of MAC values in bytes, or zero if the\n\t * key has not yet been initialized.\n\t */\n\tint getMACLength();",
"\t/**\n\t * Initializes the key on this cipher object.\n\t * \n\t * @param key Points to a buffer that contains the key.\n\t * @param offset The offset of the key in the key buffer.\n\t * \n\t * The key buffer must contain at least getKeyLength() bytes\n\t * starting at offset.\n\t * \n\t * @see #hasKey()\n\t */\n\tvoid initializeKey(byte[] key, int offset);",
"\t/**\n\t * Determine if this cipher object has been configured with a key.\n\t * \n\t * @return true if this cipher object has a key; false if the\n\t * key has not yet been set with initializeKey().\n\t * \n\t * @see #initializeKey(byte[], int)\n\t */\n\tboolean hasKey();\n\t\n\t/**\n\t * Encrypts a plaintext buffer using the cipher and a block of associated data.\n\t * \n\t * @param ad The associated data, or null if there is none.\n\t * @param plaintext The buffer containing the plaintext to encrypt.\n\t * @param plaintextOffset The offset within the plaintext buffer of the\n\t * first byte or plaintext data.\n\t * @param ciphertext The buffer to place the ciphertext in. This can\n\t * be the same as the plaintext buffer.\n\t * @param ciphertextOffset The first offset within the ciphertext buffer\n\t * to place the ciphertext and the MAC tag.\n\t * @param length The length of the plaintext.\n\t * @return The length of the ciphertext plus the MAC tag, or -1 if the\n\t * ciphertext buffer is not large enough to hold the result.\n\t * \n\t * @throws ShortBufferException The ciphertext buffer does not have\n\t * enough space to hold the ciphertext plus MAC.\n\t * \n\t * @throws IllegalStateException The nonce has wrapped around.\n\t * ",
"",
"\t * The plaintext and ciphertext buffers can be the same for in-place\n\t * encryption. In that case, plaintextOffset must be identical to\n\t * ciphertextOffset.\n\t * \n\t * There must be enough space in the ciphertext buffer to accomodate\n\t * length + getMACLength() bytes of data starting at ciphertextOffset.\n\t */\n\tint encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException;",
"\t/**\n\t * Decrypts a ciphertext buffer using the cipher and a block of associated data.\n\t * \n\t * @param ad The associated data, or null if there is none.\n\t * @param ciphertext The buffer containing the ciphertext to decrypt.\n\t * @param ciphertextOffset The offset within the ciphertext buffer of\n\t * the first byte of ciphertext data.\n\t * @param plaintext The buffer to place the plaintext in. This can be\n\t * the same as the ciphertext buffer.\n\t * @param plaintextOffset The first offset within the plaintext buffer\n\t * to place the plaintext.\n\t * @param length The length of the incoming ciphertext plus the MAC tag.\n\t * @return The length of the plaintext with the MAC tag stripped off.\n\t * \n\t * @throws ShortBufferException The plaintext buffer does not have\n\t * enough space to store the decrypted data.\n\t * \n\t * @throws BadPaddingException The MAC value failed to verify.\n\t * \n\t * @throws IllegalStateException The nonce has wrapped around.\n\t * ",
"",
"\t * The plaintext and ciphertext buffers can be the same for in-place\n\t * decryption. In that case, ciphertextOffset must be identical to\n\t * plaintextOffset.\n\t */\n\tint decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException;",
"\t/**\n\t * Creates a new instance of this cipher and initializes it with a key.\n\t * \n\t * @param key The buffer containing the key.\n\t * @param offset The offset into the key buffer of the first key byte.\n\t * @return A new CipherState of the same class as this one.\n\t */\n\tCipherState fork(byte[] key, int offset);\n\t\n\t/**\n\t * Sets the nonce value.\n\t * \n\t * @param nonce The new nonce value, which must be greater than or equal\n\t * to the current value.\n\t * \n\t * This function is intended for testing purposes only. If the nonce\n\t * value goes backwards then security may be compromised.\n\t */\n\tvoid setNonce(long nonce);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n * Copyright (C) 2016 Southern Storm Software, Pty Ltd.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included\n * in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */",
"package com.southernstorm.noise.protocol;",
"import javax.crypto.BadPaddingException;\nimport javax.crypto.ShortBufferException;",
"/**\n * Interface to an authenticated cipher for use in the Noise protocol.\n *\n * CipherState objects are used to encrypt or decrypt data during a\n * session. Once the handshake has completed, HandshakeState.split()\n * will create two CipherState objects for encrypting packets sent to\n * the other party, and decrypting packets received from the other party.\n */\npublic interface CipherState extends Destroyable {",
"\t/**\n\t * Gets the Noise protocol name for this cipher.\n\t * \n\t * @return The cipher name.\n\t */\n\tString getCipherName();",
"\t/**\n\t * Gets the length of the key values for this cipher.\n\t * \n\t * @return The length of the key in bytes; usually 32.\n\t */\n\tint getKeyLength();\n\t\n\t/**\n\t * Gets the length of the MAC values for this cipher.\n\t * \n\t * @return The length of MAC values in bytes, or zero if the\n\t * key has not yet been initialized.\n\t */\n\tint getMACLength();",
"\t/**\n\t * Initializes the key on this cipher object.\n\t * \n\t * @param key Points to a buffer that contains the key.\n\t * @param offset The offset of the key in the key buffer.\n\t * \n\t * The key buffer must contain at least getKeyLength() bytes\n\t * starting at offset.\n\t * \n\t * @see #hasKey()\n\t */\n\tvoid initializeKey(byte[] key, int offset);",
"\t/**\n\t * Determine if this cipher object has been configured with a key.\n\t * \n\t * @return true if this cipher object has a key; false if the\n\t * key has not yet been set with initializeKey().\n\t * \n\t * @see #initializeKey(byte[], int)\n\t */\n\tboolean hasKey();\n\t\n\t/**\n\t * Encrypts a plaintext buffer using the cipher and a block of associated data.\n\t * \n\t * @param ad The associated data, or null if there is none.\n\t * @param plaintext The buffer containing the plaintext to encrypt.\n\t * @param plaintextOffset The offset within the plaintext buffer of the\n\t * first byte or plaintext data.\n\t * @param ciphertext The buffer to place the ciphertext in. This can\n\t * be the same as the plaintext buffer.\n\t * @param ciphertextOffset The first offset within the ciphertext buffer\n\t * to place the ciphertext and the MAC tag.\n\t * @param length The length of the plaintext.\n\t * @return The length of the ciphertext plus the MAC tag, or -1 if the\n\t * ciphertext buffer is not large enough to hold the result.\n\t * \n\t * @throws ShortBufferException The ciphertext buffer does not have\n\t * enough space to hold the ciphertext plus MAC.\n\t * \n\t * @throws IllegalStateException The nonce has wrapped around.\n\t * ",
"\t * @throws IllegalArgumentException One of the parameters is out of range.\n\t *",
"\t * The plaintext and ciphertext buffers can be the same for in-place\n\t * encryption. In that case, plaintextOffset must be identical to\n\t * ciphertextOffset.\n\t * \n\t * There must be enough space in the ciphertext buffer to accomodate\n\t * length + getMACLength() bytes of data starting at ciphertextOffset.\n\t */\n\tint encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException;",
"\t/**\n\t * Decrypts a ciphertext buffer using the cipher and a block of associated data.\n\t * \n\t * @param ad The associated data, or null if there is none.\n\t * @param ciphertext The buffer containing the ciphertext to decrypt.\n\t * @param ciphertextOffset The offset within the ciphertext buffer of\n\t * the first byte of ciphertext data.\n\t * @param plaintext The buffer to place the plaintext in. This can be\n\t * the same as the ciphertext buffer.\n\t * @param plaintextOffset The first offset within the plaintext buffer\n\t * to place the plaintext.\n\t * @param length The length of the incoming ciphertext plus the MAC tag.\n\t * @return The length of the plaintext with the MAC tag stripped off.\n\t * \n\t * @throws ShortBufferException The plaintext buffer does not have\n\t * enough space to store the decrypted data.\n\t * \n\t * @throws BadPaddingException The MAC value failed to verify.\n\t * \n\t * @throws IllegalStateException The nonce has wrapped around.\n\t * ",
"\t * @throws IllegalArgumentException One of the parameters is out of range.\n\t *",
"\t * The plaintext and ciphertext buffers can be the same for in-place\n\t * decryption. In that case, ciphertextOffset must be identical to\n\t * plaintextOffset.\n\t */\n\tint decryptWithAd(byte[] ad, byte[] ciphertext, int ciphertextOffset, byte[] plaintext, int plaintextOffset, int length) throws ShortBufferException, BadPaddingException;",
"\t/**\n\t * Creates a new instance of this cipher and initializes it with a key.\n\t * \n\t * @param key The buffer containing the key.\n\t * @param offset The offset into the key buffer of the first key byte.\n\t * @return A new CipherState of the same class as this one.\n\t */\n\tCipherState fork(byte[] key, int offset);\n\t\n\t/**\n\t * Sets the nonce value.\n\t * \n\t * @param nonce The new nonce value, which must be greater than or equal\n\t * to the current value.\n\t * \n\t * This function is intended for testing purposes only. If the nonce\n\t * value goes backwards then security may be compromised.\n\t */\n\tvoid setNonce(long nonce);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [5, 227, 275, 254, 132], "buggy_code_start_loc": [5, 188, 221, 217, 102], "filenames": [".gitignore", "src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java", "src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java", "src/main/java/com/southernstorm/noise/protocol/ChaChaPolyCipherState.java", "src/main/java/com/southernstorm/noise/protocol/CipherState.java"], "fixing_code_end_loc": [7, 227, 275, 254, 137], "fixing_code_start_loc": [6, 188, 221, 217, 103], "message": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:noise-java_project:noise-java:*:*:*:*:*:*:*:*", "matchCriteriaId": "37EF510A-14D0-4228-B8D8-B3A992913E96", "versionEndExcluding": null, "versionEndIncluding": "2020-08-27", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "An issue was discovered in Noise-Java through 2020-08-27. ChaChaPolyCipherState.encryptWithAd() allows out-of-bounds access."}, {"lang": "es", "value": "Se detect\u00f3 un problema en Noise-Java hasta el 27-08-2020. La funci\u00f3n ChaChaPolyCipherState.encryptWithAd() permite un acceso fuera de l\u00edmites"}], "evaluatorComment": null, "id": "CVE-2020-25021", "lastModified": "2021-07-21T11:39:23.747", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 7.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 10.0, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.8, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2020-09-04T04:15:12.140", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://packetstormsecurity.com/files/159057/Noise-Java-ChaChaPolyCipherState.encryptWithAd-Insufficient-Boundary-Checks.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2020/Sep/14"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://github.com/rweather/noise-java/pull/12"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-125"}, {"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/rweather/noise-java/commit/18e86b6f8bea7326934109aa9ffa705ebf4bde90"}, "type": "CWE-125"}
| 96
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"// SPDX-License-Identifier: GPL-2.0-or-later\n/*\n * Driver for the Conexant CX23885/7/8 PCIe bridge\n *\n * CX23888 Integrated Consumer Infrared Controller\n *\n * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net>\n */",
"#include \"cx23885.h\"\n#include \"cx23888-ir.h\"",
"#include <linux/kfifo.h>\n#include <linux/slab.h>",
"#include <media/v4l2-device.h>\n#include <media/rc-core.h>",
"static unsigned int ir_888_debug;\nmodule_param(ir_888_debug, int, 0644);\nMODULE_PARM_DESC(ir_888_debug, \"enable debug messages [CX23888 IR controller]\");",
"#define CX23888_IR_REG_BASE\t0x170000\n/*\n * These CX23888 register offsets have a straightforward one to one mapping\n * to the CX23885 register offsets of 0x200 through 0x218\n */\n#define CX23888_IR_CNTRL_REG\t0x170000\n#define CNTRL_WIN_3_3\t0x00000000\n#define CNTRL_WIN_4_3\t0x00000001\n#define CNTRL_WIN_3_4\t0x00000002\n#define CNTRL_WIN_4_4\t0x00000003\n#define CNTRL_WIN\t0x00000003\n#define CNTRL_EDG_NONE\t0x00000000\n#define CNTRL_EDG_FALL\t0x00000004\n#define CNTRL_EDG_RISE\t0x00000008\n#define CNTRL_EDG_BOTH\t0x0000000C\n#define CNTRL_EDG\t0x0000000C\n#define CNTRL_DMD\t0x00000010\n#define CNTRL_MOD\t0x00000020\n#define CNTRL_RFE\t0x00000040\n#define CNTRL_TFE\t0x00000080\n#define CNTRL_RXE\t0x00000100\n#define CNTRL_TXE\t0x00000200\n#define CNTRL_RIC\t0x00000400\n#define CNTRL_TIC\t0x00000800\n#define CNTRL_CPL\t0x00001000\n#define CNTRL_LBM\t0x00002000\n#define CNTRL_R\t\t0x00004000\n/* CX23888 specific control flag */\n#define CNTRL_IVO\t0x00008000",
"#define CX23888_IR_TXCLK_REG\t0x170004\n#define TXCLK_TCD\t0x0000FFFF",
"#define CX23888_IR_RXCLK_REG\t0x170008\n#define RXCLK_RCD\t0x0000FFFF",
"#define CX23888_IR_CDUTY_REG\t0x17000C\n#define CDUTY_CDC\t0x0000000F",
"#define CX23888_IR_STATS_REG\t0x170010\n#define STATS_RTO\t0x00000001\n#define STATS_ROR\t0x00000002\n#define STATS_RBY\t0x00000004\n#define STATS_TBY\t0x00000008\n#define STATS_RSR\t0x00000010\n#define STATS_TSR\t0x00000020",
"#define CX23888_IR_IRQEN_REG\t0x170014\n#define IRQEN_RTE\t0x00000001\n#define IRQEN_ROE\t0x00000002\n#define IRQEN_RSE\t0x00000010\n#define IRQEN_TSE\t0x00000020",
"#define CX23888_IR_FILTR_REG\t0x170018\n#define FILTR_LPF\t0x0000FFFF",
"/* This register doesn't follow the pattern; it's 0x23C on a CX23885 */\n#define CX23888_IR_FIFO_REG\t0x170040\n#define FIFO_RXTX\t0x0000FFFF\n#define FIFO_RXTX_LVL\t0x00010000\n#define FIFO_RXTX_RTO\t0x0001FFFF\n#define FIFO_RX_NDV\t0x00020000\n#define FIFO_RX_DEPTH\t8\n#define FIFO_TX_DEPTH\t8",
"/* CX23888 unique registers */\n#define CX23888_IR_SEEDP_REG\t0x17001C\n#define CX23888_IR_TIMOL_REG\t0x170020\n#define CX23888_IR_WAKE0_REG\t0x170024\n#define CX23888_IR_WAKE1_REG\t0x170028\n#define CX23888_IR_WAKE2_REG\t0x17002C\n#define CX23888_IR_MASK0_REG\t0x170030\n#define CX23888_IR_MASK1_REG\t0x170034\n#define CX23888_IR_MAKS2_REG\t0x170038\n#define CX23888_IR_DPIPG_REG\t0x17003C\n#define CX23888_IR_LEARN_REG\t0x170044",
"#define CX23888_VIDCLK_FREQ\t108000000 /* 108 MHz, BT.656 */\n#define CX23888_IR_REFCLK_FREQ\t(CX23888_VIDCLK_FREQ / 2)",
"/*\n * We use this union internally for convenience, but callers to tx_write\n * and rx_read will be expecting records of type struct ir_raw_event.\n * Always ensure the size of this union is dictated by struct ir_raw_event.\n */\nunion cx23888_ir_fifo_rec {\n\tu32 hw_fifo_data;\n\tstruct ir_raw_event ir_core_data;\n};",
"#define CX23888_IR_RX_KFIFO_SIZE (256 * sizeof(union cx23888_ir_fifo_rec))\n#define CX23888_IR_TX_KFIFO_SIZE (256 * sizeof(union cx23888_ir_fifo_rec))",
"struct cx23888_ir_state {\n\tstruct v4l2_subdev sd;\n\tstruct cx23885_dev *dev;",
"\tstruct v4l2_subdev_ir_parameters rx_params;\n\tstruct mutex rx_params_lock;\n\tatomic_t rxclk_divider;\n\tatomic_t rx_invert;",
"\tstruct kfifo rx_kfifo;\n\tspinlock_t rx_kfifo_lock;",
"\tstruct v4l2_subdev_ir_parameters tx_params;\n\tstruct mutex tx_params_lock;\n\tatomic_t txclk_divider;\n};",
"static inline struct cx23888_ir_state *to_state(struct v4l2_subdev *sd)\n{\n\treturn v4l2_get_subdevdata(sd);\n}",
"/*\n * IR register block read and write functions\n */\nstatic\ninline int cx23888_ir_write4(struct cx23885_dev *dev, u32 addr, u32 value)\n{\n\tcx_write(addr, value);\n\treturn 0;\n}",
"static inline u32 cx23888_ir_read4(struct cx23885_dev *dev, u32 addr)\n{\n\treturn cx_read(addr);\n}",
"static inline int cx23888_ir_and_or4(struct cx23885_dev *dev, u32 addr,\n\t\t\t\t u32 and_mask, u32 or_value)\n{\n\tcx_andor(addr, ~and_mask, or_value);\n\treturn 0;\n}",
"/*\n * Rx and Tx Clock Divider register computations\n *\n * Note the largest clock divider value of 0xffff corresponds to:\n *\t(0xffff + 1) * 1000 / 108/2 MHz = 1,213,629.629... ns\n * which fits in 21 bits, so we'll use unsigned int for time arguments.\n */\nstatic inline u16 count_to_clock_divider(unsigned int d)\n{\n\tif (d > RXCLK_RCD + 1)\n\t\td = RXCLK_RCD;\n\telse if (d < 2)\n\t\td = 1;\n\telse\n\t\td--;\n\treturn (u16) d;\n}",
"static inline u16 ns_to_clock_divider(unsigned int ns)\n{\n\treturn count_to_clock_divider(\n\t\tDIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ / 1000000 * ns, 1000));\n}",
"static inline unsigned int clock_divider_to_ns(unsigned int divider)\n{\n\t/* Period of the Rx or Tx clock in ns */\n\treturn DIV_ROUND_CLOSEST((divider + 1) * 1000,\n\t\t\t\t CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"static inline u16 carrier_freq_to_clock_divider(unsigned int freq)\n{\n\treturn count_to_clock_divider(\n\t\t\t DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * 16));\n}",
"static inline unsigned int clock_divider_to_carrier_freq(unsigned int divider)\n{\n\treturn DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, (divider + 1) * 16);\n}",
"static inline u16 freq_to_clock_divider(unsigned int freq,\n\t\t\t\t\tunsigned int rollovers)\n{\n\treturn count_to_clock_divider(\n\t\t DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * rollovers));\n}",
"static inline unsigned int clock_divider_to_freq(unsigned int divider,\n\t\t\t\t\t\t unsigned int rollovers)\n{\n\treturn DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ,\n\t\t\t\t (divider + 1) * rollovers);\n}",
"/*\n * Low Pass Filter register calculations\n *\n * Note the largest count value of 0xffff corresponds to:\n *\t0xffff * 1000 / 108/2 MHz = 1,213,611.11... ns\n * which fits in 21 bits, so we'll use unsigned int for time arguments.\n */\nstatic inline u16 count_to_lpf_count(unsigned int d)\n{\n\tif (d > FILTR_LPF)\n\t\td = FILTR_LPF;\n\telse if (d < 4)\n\t\td = 0;\n\treturn (u16) d;\n}",
"static inline u16 ns_to_lpf_count(unsigned int ns)\n{\n\treturn count_to_lpf_count(\n\t\tDIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ / 1000000 * ns, 1000));\n}",
"static inline unsigned int lpf_count_to_ns(unsigned int count)\n{\n\t/* Duration of the Low Pass Filter rejection window in ns */\n\treturn DIV_ROUND_CLOSEST(count * 1000,\n\t\t\t\t CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"static inline unsigned int lpf_count_to_us(unsigned int count)\n{\n\t/* Duration of the Low Pass Filter rejection window in us */\n\treturn DIV_ROUND_CLOSEST(count, CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"/*\n * FIFO register pulse width count computations\n */\nstatic u32 clock_divider_to_resolution(u16 divider)\n{\n\t/*\n\t * Resolution is the duration of 1 tick of the readable portion of\n\t * of the pulse width counter as read from the FIFO. The two lsb's are\n\t * not readable, hence the << 2. This function returns ns.\n\t */\n\treturn DIV_ROUND_CLOSEST((1 << 2) * ((u32) divider + 1) * 1000,\n\t\t\t\t CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"static u64 pulse_width_count_to_ns(u16 count, u16 divider)\n{\n\tu64 n;\n\tu32 rem;",
"\t/*\n\t * The 2 lsb's of the pulse width timer count are not readable, hence\n\t * the (count << 2) | 0x3\n\t */\n\tn = (((u64) count << 2) | 0x3) * (divider + 1) * 1000; /* millicycles */\n\trem = do_div(n, CX23888_IR_REFCLK_FREQ / 1000000); /* / MHz => ns */\n\tif (rem >= CX23888_IR_REFCLK_FREQ / 1000000 / 2)\n\t\tn++;\n\treturn n;\n}",
"static unsigned int pulse_width_count_to_us(u16 count, u16 divider)\n{\n\tu64 n;\n\tu32 rem;",
"\t/*\n\t * The 2 lsb's of the pulse width timer count are not readable, hence\n\t * the (count << 2) | 0x3\n\t */\n\tn = (((u64) count << 2) | 0x3) * (divider + 1); /* cycles */\n\trem = do_div(n, CX23888_IR_REFCLK_FREQ / 1000000); /* / MHz => us */\n\tif (rem >= CX23888_IR_REFCLK_FREQ / 1000000 / 2)\n\t\tn++;\n\treturn (unsigned int) n;\n}",
"/*\n * Pulse Clocks computations: Combined Pulse Width Count & Rx Clock Counts\n *\n * The total pulse clock count is an 18 bit pulse width timer count as the most\n * significant part and (up to) 16 bit clock divider count as a modulus.\n * When the Rx clock divider ticks down to 0, it increments the 18 bit pulse\n * width timer count's least significant bit.\n */\nstatic u64 ns_to_pulse_clocks(u32 ns)\n{\n\tu64 clocks;\n\tu32 rem;\n\tclocks = CX23888_IR_REFCLK_FREQ / 1000000 * (u64) ns; /* millicycles */\n\trem = do_div(clocks, 1000); /* /1000 = cycles */\n\tif (rem >= 1000 / 2)\n\t\tclocks++;\n\treturn clocks;\n}",
"static u16 pulse_clocks_to_clock_divider(u64 count)\n{\n\tdo_div(count, (FIFO_RXTX << 2) | 0x3);",
"\t/* net result needs to be rounded down and decremented by 1 */\n\tif (count > RXCLK_RCD + 1)\n\t\tcount = RXCLK_RCD;\n\telse if (count < 2)\n\t\tcount = 1;\n\telse\n\t\tcount--;\n\treturn (u16) count;\n}",
"/*\n * IR Control Register helpers\n */\nenum tx_fifo_watermark {\n\tTX_FIFO_HALF_EMPTY = 0,\n\tTX_FIFO_EMPTY = CNTRL_TIC,\n};",
"enum rx_fifo_watermark {\n\tRX_FIFO_HALF_FULL = 0,\n\tRX_FIFO_NOT_EMPTY = CNTRL_RIC,\n};",
"static inline void control_tx_irq_watermark(struct cx23885_dev *dev,\n\t\t\t\t\t enum tx_fifo_watermark level)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_TIC, level);\n}",
"static inline void control_rx_irq_watermark(struct cx23885_dev *dev,\n\t\t\t\t\t enum rx_fifo_watermark level)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_RIC, level);\n}",
"static inline void control_tx_enable(struct cx23885_dev *dev, bool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~(CNTRL_TXE | CNTRL_TFE),\n\t\t\t enable ? (CNTRL_TXE | CNTRL_TFE) : 0);\n}",
"static inline void control_rx_enable(struct cx23885_dev *dev, bool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~(CNTRL_RXE | CNTRL_RFE),\n\t\t\t enable ? (CNTRL_RXE | CNTRL_RFE) : 0);\n}",
"static inline void control_tx_modulation_enable(struct cx23885_dev *dev,\n\t\t\t\t\t\tbool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_MOD,\n\t\t\t enable ? CNTRL_MOD : 0);\n}",
"static inline void control_rx_demodulation_enable(struct cx23885_dev *dev,\n\t\t\t\t\t\t bool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_DMD,\n\t\t\t enable ? CNTRL_DMD : 0);\n}",
"static inline void control_rx_s_edge_detection(struct cx23885_dev *dev,\n\t\t\t\t\t u32 edge_types)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_EDG_BOTH,\n\t\t\t edge_types & CNTRL_EDG_BOTH);\n}",
"static void control_rx_s_carrier_window(struct cx23885_dev *dev,\n\t\t\t\t\tunsigned int carrier,\n\t\t\t\t\tunsigned int *carrier_range_low,\n\t\t\t\t\tunsigned int *carrier_range_high)\n{\n\tu32 v;\n\tunsigned int c16 = carrier * 16;",
"\tif (*carrier_range_low < DIV_ROUND_CLOSEST(c16, 16 + 3)) {\n\t\tv = CNTRL_WIN_3_4;\n\t\t*carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 4);\n\t} else {\n\t\tv = CNTRL_WIN_3_3;\n\t\t*carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 3);\n\t}",
"\tif (*carrier_range_high > DIV_ROUND_CLOSEST(c16, 16 - 3)) {\n\t\tv |= CNTRL_WIN_4_3;\n\t\t*carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 4);\n\t} else {\n\t\tv |= CNTRL_WIN_3_3;\n\t\t*carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 3);\n\t}\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_WIN, v);\n}",
"static inline void control_tx_polarity_invert(struct cx23885_dev *dev,\n\t\t\t\t\t bool invert)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_CPL,\n\t\t\t invert ? CNTRL_CPL : 0);\n}",
"static inline void control_tx_level_invert(struct cx23885_dev *dev,\n\t\t\t\t\t bool invert)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_IVO,\n\t\t\t invert ? CNTRL_IVO : 0);\n}",
"/*\n * IR Rx & Tx Clock Register helpers\n */\nstatic unsigned int txclk_tx_s_carrier(struct cx23885_dev *dev,\n\t\t\t\t unsigned int freq,\n\t\t\t\t u16 *divider)\n{\n\t*divider = carrier_freq_to_clock_divider(freq);\n\tcx23888_ir_write4(dev, CX23888_IR_TXCLK_REG, *divider);\n\treturn clock_divider_to_carrier_freq(*divider);\n}",
"static unsigned int rxclk_rx_s_carrier(struct cx23885_dev *dev,\n\t\t\t\t unsigned int freq,\n\t\t\t\t u16 *divider)\n{\n\t*divider = carrier_freq_to_clock_divider(freq);\n\tcx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, *divider);\n\treturn clock_divider_to_carrier_freq(*divider);\n}",
"static u32 txclk_tx_s_max_pulse_width(struct cx23885_dev *dev, u32 ns,\n\t\t\t\t u16 *divider)\n{\n\tu64 pulse_clocks;",
"\tif (ns > IR_MAX_DURATION)\n\t\tns = IR_MAX_DURATION;\n\tpulse_clocks = ns_to_pulse_clocks(ns);\n\t*divider = pulse_clocks_to_clock_divider(pulse_clocks);\n\tcx23888_ir_write4(dev, CX23888_IR_TXCLK_REG, *divider);\n\treturn (u32) pulse_width_count_to_ns(FIFO_RXTX, *divider);\n}",
"static u32 rxclk_rx_s_max_pulse_width(struct cx23885_dev *dev, u32 ns,\n\t\t\t\t u16 *divider)\n{\n\tu64 pulse_clocks;",
"\tif (ns > IR_MAX_DURATION)\n\t\tns = IR_MAX_DURATION;\n\tpulse_clocks = ns_to_pulse_clocks(ns);\n\t*divider = pulse_clocks_to_clock_divider(pulse_clocks);\n\tcx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, *divider);\n\treturn (u32) pulse_width_count_to_ns(FIFO_RXTX, *divider);\n}",
"/*\n * IR Tx Carrier Duty Cycle register helpers\n */\nstatic unsigned int cduty_tx_s_duty_cycle(struct cx23885_dev *dev,\n\t\t\t\t\t unsigned int duty_cycle)\n{\n\tu32 n;\n\tn = DIV_ROUND_CLOSEST(duty_cycle * 100, 625); /* 16ths of 100% */\n\tif (n != 0)\n\t\tn--;\n\tif (n > 15)\n\t\tn = 15;\n\tcx23888_ir_write4(dev, CX23888_IR_CDUTY_REG, n);\n\treturn DIV_ROUND_CLOSEST((n + 1) * 100, 16);\n}",
"/*\n * IR Filter Register helpers\n */\nstatic u32 filter_rx_s_min_width(struct cx23885_dev *dev, u32 min_width_ns)\n{\n\tu32 count = ns_to_lpf_count(min_width_ns);\n\tcx23888_ir_write4(dev, CX23888_IR_FILTR_REG, count);\n\treturn lpf_count_to_ns(count);\n}",
"/*\n * IR IRQ Enable Register helpers\n */\nstatic inline void irqenable_rx(struct cx23885_dev *dev, u32 mask)\n{\n\tmask &= (IRQEN_RTE | IRQEN_ROE | IRQEN_RSE);\n\tcx23888_ir_and_or4(dev, CX23888_IR_IRQEN_REG,\n\t\t\t ~(IRQEN_RTE | IRQEN_ROE | IRQEN_RSE), mask);\n}",
"static inline void irqenable_tx(struct cx23885_dev *dev, u32 mask)\n{\n\tmask &= IRQEN_TSE;\n\tcx23888_ir_and_or4(dev, CX23888_IR_IRQEN_REG, ~IRQEN_TSE, mask);\n}",
"/*\n * V4L2 Subdevice IR Ops\n */\nstatic int cx23888_ir_irq_handler(struct v4l2_subdev *sd, u32 status,\n\t\t\t\t bool *handled)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tunsigned long flags;",
"\tu32 cntrl = cx23888_ir_read4(dev, CX23888_IR_CNTRL_REG);\n\tu32 irqen = cx23888_ir_read4(dev, CX23888_IR_IRQEN_REG);\n\tu32 stats = cx23888_ir_read4(dev, CX23888_IR_STATS_REG);",
"\tunion cx23888_ir_fifo_rec rx_data[FIFO_RX_DEPTH];\n\tunsigned int i, j, k;\n\tu32 events, v;\n\tint tsr, rsr, rto, ror, tse, rse, rte, roe, kror;",
"\ttsr = stats & STATS_TSR; /* Tx FIFO Service Request */\n\trsr = stats & STATS_RSR; /* Rx FIFO Service Request */\n\trto = stats & STATS_RTO; /* Rx Pulse Width Timer Time Out */\n\tror = stats & STATS_ROR; /* Rx FIFO Over Run */",
"\ttse = irqen & IRQEN_TSE; /* Tx FIFO Service Request IRQ Enable */\n\trse = irqen & IRQEN_RSE; /* Rx FIFO Service Request IRQ Enable */\n\trte = irqen & IRQEN_RTE; /* Rx Pulse Width Timer Time Out IRQ Enable */\n\troe = irqen & IRQEN_ROE; /* Rx FIFO Over Run IRQ Enable */",
"\t*handled = false;\n\tv4l2_dbg(2, ir_888_debug, sd, \"IRQ Status: %s %s %s %s %s %s\\n\",\n\t\t tsr ? \"tsr\" : \" \", rsr ? \"rsr\" : \" \",\n\t\t rto ? \"rto\" : \" \", ror ? \"ror\" : \" \",\n\t\t stats & STATS_TBY ? \"tby\" : \" \",\n\t\t stats & STATS_RBY ? \"rby\" : \" \");",
"\tv4l2_dbg(2, ir_888_debug, sd, \"IRQ Enables: %s %s %s %s\\n\",\n\t\t tse ? \"tse\" : \" \", rse ? \"rse\" : \" \",\n\t\t rte ? \"rte\" : \" \", roe ? \"roe\" : \" \");",
"\t/*\n\t * Transmitter interrupt service\n\t */\n\tif (tse && tsr) {\n\t\t/*\n\t\t * TODO:\n\t\t * Check the watermark threshold setting\n\t\t * Pull FIFO_TX_DEPTH or FIFO_TX_DEPTH/2 entries from tx_kfifo\n\t\t * Push the data to the hardware FIFO.\n\t\t * If there was nothing more to send in the tx_kfifo, disable\n\t\t *\tthe TSR IRQ and notify the v4l2_device.\n\t\t * If there was something in the tx_kfifo, check the tx_kfifo\n\t\t * level and notify the v4l2_device, if it is low.\n\t\t */\n\t\t/* For now, inhibit TSR interrupt until Tx is implemented */\n\t\tirqenable_tx(dev, 0);\n\t\tevents = V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ;\n\t\tv4l2_subdev_notify(sd, V4L2_SUBDEV_IR_TX_NOTIFY, &events);\n\t\t*handled = true;\n\t}",
"\t/*\n\t * Receiver interrupt service\n\t */\n\tkror = 0;\n\tif ((rse && rsr) || (rte && rto)) {\n\t\t/*\n\t\t * Receive data on RSR to clear the STATS_RSR.\n\t\t * Receive data on RTO, since we may not have yet hit the RSR\n\t\t * watermark when we receive the RTO.\n\t\t */\n\t\tfor (i = 0, v = FIFO_RX_NDV;\n\t\t (v & FIFO_RX_NDV) && !kror; i = 0) {\n\t\t\tfor (j = 0;\n\t\t\t (v & FIFO_RX_NDV) && j < FIFO_RX_DEPTH; j++) {\n\t\t\t\tv = cx23888_ir_read4(dev, CX23888_IR_FIFO_REG);\n\t\t\t\trx_data[i].hw_fifo_data = v & ~FIFO_RX_NDV;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == 0)\n\t\t\t\tbreak;\n\t\t\tj = i * sizeof(union cx23888_ir_fifo_rec);\n\t\t\tk = kfifo_in_locked(&state->rx_kfifo,\n\t\t\t\t (unsigned char *) rx_data, j,\n\t\t\t\t &state->rx_kfifo_lock);\n\t\t\tif (k != j)\n\t\t\t\tkror++; /* rx_kfifo over run */\n\t\t}\n\t\t*handled = true;\n\t}",
"\tevents = 0;\n\tv = 0;\n\tif (kror) {\n\t\tevents |= V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN;\n\t\tv4l2_err(sd, \"IR receiver software FIFO overrun\\n\");\n\t}\n\tif (roe && ror) {\n\t\t/*\n\t\t * The RX FIFO Enable (CNTRL_RFE) must be toggled to clear\n\t\t * the Rx FIFO Over Run status (STATS_ROR)\n\t\t */\n\t\tv |= CNTRL_RFE;\n\t\tevents |= V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN;\n\t\tv4l2_err(sd, \"IR receiver hardware FIFO overrun\\n\");\n\t}\n\tif (rte && rto) {\n\t\t/*\n\t\t * The IR Receiver Enable (CNTRL_RXE) must be toggled to clear\n\t\t * the Rx Pulse Width Timer Time Out (STATS_RTO)\n\t\t */\n\t\tv |= CNTRL_RXE;\n\t\tevents |= V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED;\n\t}\n\tif (v) {\n\t\t/* Clear STATS_ROR & STATS_RTO as needed by resetting hardware */\n\t\tcx23888_ir_write4(dev, CX23888_IR_CNTRL_REG, cntrl & ~v);\n\t\tcx23888_ir_write4(dev, CX23888_IR_CNTRL_REG, cntrl);\n\t\t*handled = true;\n\t}",
"\tspin_lock_irqsave(&state->rx_kfifo_lock, flags);\n\tif (kfifo_len(&state->rx_kfifo) >= CX23888_IR_RX_KFIFO_SIZE / 2)\n\t\tevents |= V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ;\n\tspin_unlock_irqrestore(&state->rx_kfifo_lock, flags);",
"\tif (events)\n\t\tv4l2_subdev_notify(sd, V4L2_SUBDEV_IR_RX_NOTIFY, &events);\n\treturn 0;\n}",
"/* Receiver */\nstatic int cx23888_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,\n\t\t\t ssize_t *num)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tbool invert = (bool) atomic_read(&state->rx_invert);\n\tu16 divider = (u16) atomic_read(&state->rxclk_divider);",
"\tunsigned int i, n;\n\tunion cx23888_ir_fifo_rec *p;\n\tunsigned u, v, w;",
"\tn = count / sizeof(union cx23888_ir_fifo_rec)\n\t\t* sizeof(union cx23888_ir_fifo_rec);\n\tif (n == 0) {\n\t\t*num = 0;\n\t\treturn 0;\n\t}",
"\tn = kfifo_out_locked(&state->rx_kfifo, buf, n, &state->rx_kfifo_lock);",
"\tn /= sizeof(union cx23888_ir_fifo_rec);\n\t*num = n * sizeof(union cx23888_ir_fifo_rec);",
"\tfor (p = (union cx23888_ir_fifo_rec *) buf, i = 0; i < n; p++, i++) {",
"\t\tif ((p->hw_fifo_data & FIFO_RXTX_RTO) == FIFO_RXTX_RTO) {\n\t\t\t/* Assume RTO was because of no IR light input */\n\t\t\tu = 0;\n\t\t\tw = 1;\n\t\t} else {\n\t\t\tu = (p->hw_fifo_data & FIFO_RXTX_LVL) ? 1 : 0;\n\t\t\tif (invert)\n\t\t\t\tu = u ? 0 : 1;\n\t\t\tw = 0;\n\t\t}",
"\t\tv = (unsigned) pulse_width_count_to_ns(\n\t\t\t\t (u16) (p->hw_fifo_data & FIFO_RXTX), divider);\n\t\tif (v > IR_MAX_DURATION)\n\t\t\tv = IR_MAX_DURATION;",
"\t\tp->ir_core_data = (struct ir_raw_event)\n\t\t\t{ .pulse = u, .duration = v, .timeout = w };",
"\t\tv4l2_dbg(2, ir_888_debug, sd, \"rx read: %10u ns %s %s\\n\",\n\t\t\t v, u ? \"mark\" : \"space\", w ? \"(timed out)\" : \"\");\n\t\tif (w)\n\t\t\tv4l2_dbg(2, ir_888_debug, sd, \"rx read: end of rx\\n\");\n\t}\n\treturn 0;\n}",
"static int cx23888_ir_rx_g_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tmutex_lock(&state->rx_params_lock);\n\tmemcpy(p, &state->rx_params, sizeof(struct v4l2_subdev_ir_parameters));\n\tmutex_unlock(&state->rx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_rx_shutdown(struct v4l2_subdev *sd)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;",
"\tmutex_lock(&state->rx_params_lock);",
"\t/* Disable or slow down all IR Rx circuits and counters */\n\tirqenable_rx(dev, 0);\n\tcontrol_rx_enable(dev, false);\n\tcontrol_rx_demodulation_enable(dev, false);\n\tcontrol_rx_s_edge_detection(dev, CNTRL_EDG_NONE);\n\tfilter_rx_s_min_width(dev, 0);\n\tcx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, RXCLK_RCD);",
"\tstate->rx_params.shutdown = true;",
"\tmutex_unlock(&state->rx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_rx_s_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tstruct v4l2_subdev_ir_parameters *o = &state->rx_params;\n\tu16 rxclk_divider;",
"\tif (p->shutdown)\n\t\treturn cx23888_ir_rx_shutdown(sd);",
"\tif (p->mode != V4L2_SUBDEV_IR_MODE_PULSE_WIDTH)\n\t\treturn -ENOSYS;",
"\tmutex_lock(&state->rx_params_lock);",
"\to->shutdown = p->shutdown;",
"\to->mode = p->mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH;",
"\to->bytes_per_data_element = p->bytes_per_data_element\n\t\t\t\t = sizeof(union cx23888_ir_fifo_rec);",
"\t/* Before we tweak the hardware, we have to disable the receiver */\n\tirqenable_rx(dev, 0);\n\tcontrol_rx_enable(dev, false);",
"\tcontrol_rx_demodulation_enable(dev, p->modulation);\n\to->modulation = p->modulation;",
"\tif (p->modulation) {\n\t\tp->carrier_freq = rxclk_rx_s_carrier(dev, p->carrier_freq,\n\t\t\t\t\t\t &rxclk_divider);",
"\t\to->carrier_freq = p->carrier_freq;",
"\t\to->duty_cycle = p->duty_cycle = 50;",
"\t\tcontrol_rx_s_carrier_window(dev, p->carrier_freq,\n\t\t\t\t\t &p->carrier_range_lower,\n\t\t\t\t\t &p->carrier_range_upper);\n\t\to->carrier_range_lower = p->carrier_range_lower;\n\t\to->carrier_range_upper = p->carrier_range_upper;",
"\t\tp->max_pulse_width =\n\t\t\t(u32) pulse_width_count_to_ns(FIFO_RXTX, rxclk_divider);\n\t} else {\n\t\tp->max_pulse_width =\n\t\t\t rxclk_rx_s_max_pulse_width(dev, p->max_pulse_width,\n\t\t\t\t\t\t &rxclk_divider);\n\t}\n\to->max_pulse_width = p->max_pulse_width;\n\tatomic_set(&state->rxclk_divider, rxclk_divider);",
"\tp->noise_filter_min_width =\n\t\t\t filter_rx_s_min_width(dev, p->noise_filter_min_width);\n\to->noise_filter_min_width = p->noise_filter_min_width;",
"\tp->resolution = clock_divider_to_resolution(rxclk_divider);\n\to->resolution = p->resolution;",
"\t/* FIXME - make this dependent on resolution for better performance */\n\tcontrol_rx_irq_watermark(dev, RX_FIFO_HALF_FULL);",
"\tcontrol_rx_s_edge_detection(dev, CNTRL_EDG_BOTH);",
"\to->invert_level = p->invert_level;\n\tatomic_set(&state->rx_invert, p->invert_level);",
"\to->interrupt_enable = p->interrupt_enable;\n\to->enable = p->enable;\n\tif (p->enable) {\n\t\tunsigned long flags;",
"\t\tspin_lock_irqsave(&state->rx_kfifo_lock, flags);\n\t\tkfifo_reset(&state->rx_kfifo);\n\t\t/* reset tx_fifo too if there is one... */\n\t\tspin_unlock_irqrestore(&state->rx_kfifo_lock, flags);\n\t\tif (p->interrupt_enable)\n\t\t\tirqenable_rx(dev, IRQEN_RSE | IRQEN_RTE | IRQEN_ROE);\n\t\tcontrol_rx_enable(dev, p->enable);\n\t}",
"\tmutex_unlock(&state->rx_params_lock);\n\treturn 0;\n}",
"/* Transmitter */\nstatic int cx23888_ir_tx_write(struct v4l2_subdev *sd, u8 *buf, size_t count,\n\t\t\t ssize_t *num)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\t/* For now enable the Tx FIFO Service interrupt & pretend we did work */\n\tirqenable_tx(dev, IRQEN_TSE);\n\t*num = count;\n\treturn 0;\n}",
"static int cx23888_ir_tx_g_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tmutex_lock(&state->tx_params_lock);\n\tmemcpy(p, &state->tx_params, sizeof(struct v4l2_subdev_ir_parameters));\n\tmutex_unlock(&state->tx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_tx_shutdown(struct v4l2_subdev *sd)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;",
"\tmutex_lock(&state->tx_params_lock);",
"\t/* Disable or slow down all IR Tx circuits and counters */\n\tirqenable_tx(dev, 0);\n\tcontrol_tx_enable(dev, false);\n\tcontrol_tx_modulation_enable(dev, false);\n\tcx23888_ir_write4(dev, CX23888_IR_TXCLK_REG, TXCLK_TCD);",
"\tstate->tx_params.shutdown = true;",
"\tmutex_unlock(&state->tx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tstruct v4l2_subdev_ir_parameters *o = &state->tx_params;\n\tu16 txclk_divider;",
"\tif (p->shutdown)\n\t\treturn cx23888_ir_tx_shutdown(sd);",
"\tif (p->mode != V4L2_SUBDEV_IR_MODE_PULSE_WIDTH)\n\t\treturn -ENOSYS;",
"\tmutex_lock(&state->tx_params_lock);",
"\to->shutdown = p->shutdown;",
"\to->mode = p->mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH;",
"\to->bytes_per_data_element = p->bytes_per_data_element\n\t\t\t\t = sizeof(union cx23888_ir_fifo_rec);",
"\t/* Before we tweak the hardware, we have to disable the transmitter */\n\tirqenable_tx(dev, 0);\n\tcontrol_tx_enable(dev, false);",
"\tcontrol_tx_modulation_enable(dev, p->modulation);\n\to->modulation = p->modulation;",
"\tif (p->modulation) {\n\t\tp->carrier_freq = txclk_tx_s_carrier(dev, p->carrier_freq,\n\t\t\t\t\t\t &txclk_divider);\n\t\to->carrier_freq = p->carrier_freq;",
"\t\tp->duty_cycle = cduty_tx_s_duty_cycle(dev, p->duty_cycle);\n\t\to->duty_cycle = p->duty_cycle;",
"\t\tp->max_pulse_width =\n\t\t\t(u32) pulse_width_count_to_ns(FIFO_RXTX, txclk_divider);\n\t} else {\n\t\tp->max_pulse_width =\n\t\t\t txclk_tx_s_max_pulse_width(dev, p->max_pulse_width,\n\t\t\t\t\t\t &txclk_divider);\n\t}\n\to->max_pulse_width = p->max_pulse_width;\n\tatomic_set(&state->txclk_divider, txclk_divider);",
"\tp->resolution = clock_divider_to_resolution(txclk_divider);\n\to->resolution = p->resolution;",
"\t/* FIXME - make this dependent on resolution for better performance */\n\tcontrol_tx_irq_watermark(dev, TX_FIFO_HALF_EMPTY);",
"\tcontrol_tx_polarity_invert(dev, p->invert_carrier_sense);\n\to->invert_carrier_sense = p->invert_carrier_sense;",
"\tcontrol_tx_level_invert(dev, p->invert_level);\n\to->invert_level = p->invert_level;",
"\to->interrupt_enable = p->interrupt_enable;\n\to->enable = p->enable;\n\tif (p->enable) {\n\t\tif (p->interrupt_enable)\n\t\t\tirqenable_tx(dev, IRQEN_TSE);\n\t\tcontrol_tx_enable(dev, p->enable);\n\t}",
"\tmutex_unlock(&state->tx_params_lock);\n\treturn 0;\n}",
"\n/*\n * V4L2 Subdevice Core Ops\n */\nstatic int cx23888_ir_log_status(struct v4l2_subdev *sd)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tchar *s;\n\tint i, j;",
"\tu32 cntrl = cx23888_ir_read4(dev, CX23888_IR_CNTRL_REG);\n\tu32 txclk = cx23888_ir_read4(dev, CX23888_IR_TXCLK_REG) & TXCLK_TCD;\n\tu32 rxclk = cx23888_ir_read4(dev, CX23888_IR_RXCLK_REG) & RXCLK_RCD;\n\tu32 cduty = cx23888_ir_read4(dev, CX23888_IR_CDUTY_REG) & CDUTY_CDC;\n\tu32 stats = cx23888_ir_read4(dev, CX23888_IR_STATS_REG);\n\tu32 irqen = cx23888_ir_read4(dev, CX23888_IR_IRQEN_REG);\n\tu32 filtr = cx23888_ir_read4(dev, CX23888_IR_FILTR_REG) & FILTR_LPF;",
"\tv4l2_info(sd, \"IR Receiver:\\n\");\n\tv4l2_info(sd, \"\\tEnabled: %s\\n\",\n\t\t cntrl & CNTRL_RXE ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tDemodulation from a carrier: %s\\n\",\n\t\t cntrl & CNTRL_DMD ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO: %s\\n\",\n\t\t cntrl & CNTRL_RFE ? \"enabled\" : \"disabled\");\n\tswitch (cntrl & CNTRL_EDG) {\n\tcase CNTRL_EDG_NONE:\n\t\ts = \"disabled\";\n\t\tbreak;\n\tcase CNTRL_EDG_FALL:\n\t\ts = \"falling edge\";\n\t\tbreak;\n\tcase CNTRL_EDG_RISE:\n\t\ts = \"rising edge\";\n\t\tbreak;\n\tcase CNTRL_EDG_BOTH:\n\t\ts = \"rising & falling edges\";\n\t\tbreak;\n\tdefault:\n\t\ts = \"??? edge\";\n\t\tbreak;\n\t}\n\tv4l2_info(sd, \"\\tPulse timers' start/stop trigger: %s\\n\", s);\n\tv4l2_info(sd, \"\\tFIFO data on pulse timer overflow: %s\\n\",\n\t\t cntrl & CNTRL_R ? \"not loaded\" : \"overflow marker\");\n\tv4l2_info(sd, \"\\tFIFO interrupt watermark: %s\\n\",\n\t\t cntrl & CNTRL_RIC ? \"not empty\" : \"half full or greater\");\n\tv4l2_info(sd, \"\\tLoopback mode: %s\\n\",\n\t\t cntrl & CNTRL_LBM ? \"loopback active\" : \"normal receive\");\n\tif (cntrl & CNTRL_DMD) {\n\t\tv4l2_info(sd, \"\\tExpected carrier (16 clocks): %u Hz\\n\",\n\t\t\t clock_divider_to_carrier_freq(rxclk));\n\t\tswitch (cntrl & CNTRL_WIN) {\n\t\tcase CNTRL_WIN_3_3:\n\t\t\ti = 3;\n\t\t\tj = 3;\n\t\t\tbreak;\n\t\tcase CNTRL_WIN_4_3:\n\t\t\ti = 4;\n\t\t\tj = 3;\n\t\t\tbreak;\n\t\tcase CNTRL_WIN_3_4:\n\t\t\ti = 3;\n\t\t\tj = 4;\n\t\t\tbreak;\n\t\tcase CNTRL_WIN_4_4:\n\t\t\ti = 4;\n\t\t\tj = 4;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ti = 0;\n\t\t\tj = 0;\n\t\t\tbreak;\n\t\t}\n\t\tv4l2_info(sd, \"\\tNext carrier edge window:\t 16 clocks -%1d/+%1d, %u to %u Hz\\n\",\n\t\t\t i, j,\n\t\t\t clock_divider_to_freq(rxclk, 16 + j),\n\t\t\t clock_divider_to_freq(rxclk, 16 - i));\n\t}\n\tv4l2_info(sd, \"\\tMax measurable pulse width: %u us, %llu ns\\n\",\n\t\t pulse_width_count_to_us(FIFO_RXTX, rxclk),\n\t\t pulse_width_count_to_ns(FIFO_RXTX, rxclk));\n\tv4l2_info(sd, \"\\tLow pass filter: %s\\n\",\n\t\t filtr ? \"enabled\" : \"disabled\");\n\tif (filtr)\n\t\tv4l2_info(sd, \"\\tMin acceptable pulse width (LPF): %u us, %u ns\\n\",\n\t\t\t lpf_count_to_us(filtr),\n\t\t\t lpf_count_to_ns(filtr));\n\tv4l2_info(sd, \"\\tPulse width timer timed-out: %s\\n\",\n\t\t stats & STATS_RTO ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tPulse width timer time-out intr: %s\\n\",\n\t\t irqen & IRQEN_RTE ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO overrun: %s\\n\",\n\t\t stats & STATS_ROR ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO overrun interrupt: %s\\n\",\n\t\t irqen & IRQEN_ROE ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tBusy: %s\\n\",\n\t\t stats & STATS_RBY ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service requested: %s\\n\",\n\t\t stats & STATS_RSR ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service request interrupt: %s\\n\",\n\t\t irqen & IRQEN_RSE ? \"enabled\" : \"disabled\");",
"\tv4l2_info(sd, \"IR Transmitter:\\n\");\n\tv4l2_info(sd, \"\\tEnabled: %s\\n\",\n\t\t cntrl & CNTRL_TXE ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tModulation onto a carrier: %s\\n\",\n\t\t cntrl & CNTRL_MOD ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO: %s\\n\",\n\t\t cntrl & CNTRL_TFE ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO interrupt watermark: %s\\n\",\n\t\t cntrl & CNTRL_TIC ? \"not empty\" : \"half full or less\");\n\tv4l2_info(sd, \"\\tOutput pin level inversion %s\\n\",\n\t\t cntrl & CNTRL_IVO ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tCarrier polarity: %s\\n\",\n\t\t cntrl & CNTRL_CPL ? \"space:burst mark:noburst\"\n\t\t\t\t : \"space:noburst mark:burst\");\n\tif (cntrl & CNTRL_MOD) {\n\t\tv4l2_info(sd, \"\\tCarrier (16 clocks): %u Hz\\n\",\n\t\t\t clock_divider_to_carrier_freq(txclk));\n\t\tv4l2_info(sd, \"\\tCarrier duty cycle: %2u/16\\n\",\n\t\t\t cduty + 1);\n\t}\n\tv4l2_info(sd, \"\\tMax pulse width: %u us, %llu ns\\n\",\n\t\t pulse_width_count_to_us(FIFO_RXTX, txclk),\n\t\t pulse_width_count_to_ns(FIFO_RXTX, txclk));\n\tv4l2_info(sd, \"\\tBusy: %s\\n\",\n\t\t stats & STATS_TBY ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service requested: %s\\n\",\n\t\t stats & STATS_TSR ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service request interrupt: %s\\n\",\n\t\t irqen & IRQEN_TSE ? \"enabled\" : \"disabled\");",
"\treturn 0;\n}",
"#ifdef CONFIG_VIDEO_ADV_DEBUG\nstatic int cx23888_ir_g_register(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_dbg_register *reg)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tu32 addr = CX23888_IR_REG_BASE + (u32) reg->reg;",
"\tif ((addr & 0x3) != 0)\n\t\treturn -EINVAL;\n\tif (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG)\n\t\treturn -EINVAL;\n\treg->size = 4;\n\treg->val = cx23888_ir_read4(state->dev, addr);\n\treturn 0;\n}",
"static int cx23888_ir_s_register(struct v4l2_subdev *sd,\n\t\t\t\t const struct v4l2_dbg_register *reg)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tu32 addr = CX23888_IR_REG_BASE + (u32) reg->reg;",
"\tif ((addr & 0x3) != 0)\n\t\treturn -EINVAL;\n\tif (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG)\n\t\treturn -EINVAL;\n\tcx23888_ir_write4(state->dev, addr, reg->val);\n\treturn 0;\n}\n#endif",
"static const struct v4l2_subdev_core_ops cx23888_ir_core_ops = {\n\t.log_status = cx23888_ir_log_status,\n#ifdef CONFIG_VIDEO_ADV_DEBUG\n\t.g_register = cx23888_ir_g_register,\n\t.s_register = cx23888_ir_s_register,\n#endif\n\t.interrupt_service_routine = cx23888_ir_irq_handler,\n};",
"static const struct v4l2_subdev_ir_ops cx23888_ir_ir_ops = {\n\t.rx_read = cx23888_ir_rx_read,\n\t.rx_g_parameters = cx23888_ir_rx_g_parameters,\n\t.rx_s_parameters = cx23888_ir_rx_s_parameters,",
"\t.tx_write = cx23888_ir_tx_write,\n\t.tx_g_parameters = cx23888_ir_tx_g_parameters,\n\t.tx_s_parameters = cx23888_ir_tx_s_parameters,\n};",
"static const struct v4l2_subdev_ops cx23888_ir_controller_ops = {\n\t.core = &cx23888_ir_core_ops,\n\t.ir = &cx23888_ir_ir_ops,\n};",
"static const struct v4l2_subdev_ir_parameters default_rx_params = {\n\t.bytes_per_data_element = sizeof(union cx23888_ir_fifo_rec),\n\t.mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH,",
"\t.enable = false,\n\t.interrupt_enable = false,\n\t.shutdown = true,",
"\t.modulation = true,\n\t.carrier_freq = 36000, /* 36 kHz - RC-5, RC-6, and RC-6A carrier */",
"\t/* RC-5: 666,667 ns = 1/36 kHz * 32 cycles * 1 mark * 0.75 */\n\t/* RC-6A: 333,333 ns = 1/36 kHz * 16 cycles * 1 mark * 0.75 */\n\t.noise_filter_min_width = 333333, /* ns */\n\t.carrier_range_lower = 35000,\n\t.carrier_range_upper = 37000,\n\t.invert_level = false,\n};",
"static const struct v4l2_subdev_ir_parameters default_tx_params = {\n\t.bytes_per_data_element = sizeof(union cx23888_ir_fifo_rec),\n\t.mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH,",
"\t.enable = false,\n\t.interrupt_enable = false,\n\t.shutdown = true,",
"\t.modulation = true,\n\t.carrier_freq = 36000, /* 36 kHz - RC-5 carrier */\n\t.duty_cycle = 25, /* 25 % - RC-5 carrier */\n\t.invert_level = false,\n\t.invert_carrier_sense = false,\n};",
"int cx23888_ir_probe(struct cx23885_dev *dev)\n{\n\tstruct cx23888_ir_state *state;\n\tstruct v4l2_subdev *sd;\n\tstruct v4l2_subdev_ir_parameters default_params;\n\tint ret;",
"\tstate = kzalloc(sizeof(struct cx23888_ir_state), GFP_KERNEL);\n\tif (state == NULL)\n\t\treturn -ENOMEM;",
"\tspin_lock_init(&state->rx_kfifo_lock);",
"\tif (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL))",
"\t\treturn -ENOMEM;",
"",
"\n\tstate->dev = dev;\n\tsd = &state->sd;",
"\tv4l2_subdev_init(sd, &cx23888_ir_controller_ops);\n\tv4l2_set_subdevdata(sd, state);\n\t/* FIXME - fix the formatting of dev->v4l2_dev.name and use it */\n\tsnprintf(sd->name, sizeof(sd->name), \"%s/888-ir\", dev->name);\n\tsd->grp_id = CX23885_HW_888_IR;",
"\tret = v4l2_device_register_subdev(&dev->v4l2_dev, sd);\n\tif (ret == 0) {\n\t\t/*\n\t\t * Ensure no interrupts arrive from '888 specific conditions,\n\t\t * since we ignore them in this driver to have commonality with\n\t\t * similar IR controller cores.\n\t\t */\n\t\tcx23888_ir_write4(dev, CX23888_IR_IRQEN_REG, 0);",
"\t\tmutex_init(&state->rx_params_lock);\n\t\tdefault_params = default_rx_params;\n\t\tv4l2_subdev_call(sd, ir, rx_s_parameters, &default_params);",
"\t\tmutex_init(&state->tx_params_lock);\n\t\tdefault_params = default_tx_params;\n\t\tv4l2_subdev_call(sd, ir, tx_s_parameters, &default_params);\n\t} else {\n\t\tkfifo_free(&state->rx_kfifo);\n\t}\n\treturn ret;\n}",
"int cx23888_ir_remove(struct cx23885_dev *dev)\n{\n\tstruct v4l2_subdev *sd;\n\tstruct cx23888_ir_state *state;",
"\tsd = cx23885_find_hw(dev, CX23885_HW_888_IR);\n\tif (sd == NULL)\n\t\treturn -ENODEV;",
"\tcx23888_ir_rx_shutdown(sd);\n\tcx23888_ir_tx_shutdown(sd);",
"\tstate = to_state(sd);\n\tv4l2_device_unregister_subdev(sd);\n\tkfifo_free(&state->rx_kfifo);\n\tkfree(state);\n\t/* Nothing more to free() as state held the actual v4l2_subdev object */\n\treturn 0;\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1171], "buggy_code_start_loc": [1170], "filenames": ["drivers/media/pci/cx23885/cx23888-ir.c"], "fixing_code_end_loc": [1175], "fixing_code_start_loc": [1170], "message": "A memory leak in the cx23888_ir_probe() function in drivers/media/pci/cx23885/cx23888-ir.c in the Linux kernel through 5.3.11 allows attackers to cause a denial of service (memory consumption) by triggering kfifo_alloc() failures, aka CID-a7b2df76b42b.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "EB2904AC-AD7A-498D-8619-CBB421E9165D", "versionEndExcluding": null, "versionEndIncluding": "5.3.11", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:20.04:*:*:*:lts:*:*:*", "matchCriteriaId": "902B8056-9E37-443B-8905-8AA93E2447FB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:30:*:*:*:*:*:*:*", "matchCriteriaId": "97A4B8DF-58DA-4AB6-A1F9-331B36409BA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:31:*:*:*:*:*:*:*", "matchCriteriaId": "80F0FA5D-8D3B-4C0E-81E2-87998286AF33", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:active_iq_unified_manager:-:*:*:*:*:vmware_vsphere:*:*", "matchCriteriaId": "3A756737-1CC4-42C2-A4DF-E1C893B4E2D5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:aff_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "5C0ADE5D-F91D-4E0D-B6C5-3511B19665F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:cloud_backup:-:*:*:*:*:*:*:*", "matchCriteriaId": "5C2089EE-5D7F-47EC-8EA5-0F69790564C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:data_availability_services:-:*:*:*:*:*:*:*", "matchCriteriaId": "0EF46487-B64A-454E-AECC-D74B83170ACD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.0:*:*:*:*:*:*:*", "matchCriteriaId": "8AFF1109-26F3-43A5-A4CB-0F169FDBC0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "5AF71C49-ADEF-4EE2-802C-6159ADD51355", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.20:*:*:*:*:*:*:*", "matchCriteriaId": "B3BC6E59-2134-4A28-AAD2-77C8AE236BCF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.25:*:*:*:*:*:*:*", "matchCriteriaId": "24377899-5389-4BDC-AC82-0E4186F4DE53", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.30:*:*:*:*:*:*:*", "matchCriteriaId": "23FE83DE-AE7C-4313-88E3-886110C31302", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.30.5r3:*:*:*:*:*:*:*", "matchCriteriaId": "490B327B-AC20-419B-BB76-8AB6971304BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.40:*:*:*:*:*:*:*", "matchCriteriaId": "8DCE2754-7A9E-4B3B-91D1-DCF90C1BABE5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.40.3r2:*:*:*:*:*:*:*", "matchCriteriaId": "6CA74E8B-51E2-4A7C-8A98-0583D31134A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.40.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B64AB37-A1D9-4163-A51B-4C780361F1F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.50.1:*:*:*:*:*:*:*", "matchCriteriaId": "7BE9C9D7-9CED-4184-A190-1024A6FB8C82", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.50.2:-:*:*:*:*:*:*", "matchCriteriaId": "B73D4C3C-A511-4E14-B19F-91F561ACB1B8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.50.2:p1:*:*:*:*:*:*", "matchCriteriaId": "0C47D72C-9B6B-4E52-AF0E-56AD58E4A930", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60:*:*:*:*:*:*:*", "matchCriteriaId": "039C3790-5AA2-4895-AEAE-CC84A71DB907", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4592238-D1F2-43D6-9BAB-2F63ECF9C965", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60.1:*:*:*:*:*:*:*", "matchCriteriaId": "0BA78068-80E9-4E49-9056-88EAB7E3682C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60.3:*:*:*:*:*:*:*", "matchCriteriaId": "092F366C-E8B0-4BE5-B106-0B7A73B08D34", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.70.1:*:*:*:*:*:*:*", "matchCriteriaId": "E7992E92-B159-4810-B895-01A9B944058A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.70.2:*:*:*:*:*:*:*", "matchCriteriaId": "5BDD7AAB-2BF3-4E8C-BEE2-5217E2926C11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:fas\\/aff_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "66EEA3CA-8CC7-4F0B-8204-6132D4114873", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:hci_baseboard_management_controller:h610s:*:*:*:*:*:*:*", "matchCriteriaId": "DE7C6010-F736-4BDA-9E3B-C4370BBFA149", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:solidfire\\,_enterprise_sds_\\&_hci_storage_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "DAA3919C-B2B1-4CB5-BA76-7A079AAFFC52", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:solidfire_\\&_hci_management_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "D6D700C5-F67F-4FFB-BE69-D524592A3D2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:steelstore_cloud_integrated_storage:-:*:*:*:*:*:*:*", "matchCriteriaId": "E94F7F59-1785-493F-91A7-5F5EA5E87E4D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:broadcom:brocade_fabric_operating_system_firmware:-:*:*:*:*:*:*:*", "matchCriteriaId": "B2748912-FC54-47F6-8C0C-B96784765B8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:netapp:hci_compute_node_firmware:-:*:*:*:*:*:*:*", "matchCriteriaId": "F921BC85-568E-4B69-A3CD-CF75C76672F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}, {"cpeMatch": [{"criteria": "cpe:2.3:h:netapp:hci_compute_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "AD7447BC-F315-4298-A822-549942FC118B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": false}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:netapp:solidfire_baseboard_management_controller_firmware:-:*:*:*:*:*:*:*", "matchCriteriaId": "FB9B8171-F6CA-427D-81E0-6536D3BBFA8D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}, {"cpeMatch": [{"criteria": "cpe:2.3:h:netapp:solidfire_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "090AA6F4-4404-4E26-82AB-C3A22636F276", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": false}], "negate": false, "operator": "OR"}], "operator": "AND"}], "descriptions": [{"lang": "en", "value": "A memory leak in the cx23888_ir_probe() function in drivers/media/pci/cx23885/cx23888-ir.c in the Linux kernel through 5.3.11 allows attackers to cause a denial of service (memory consumption) by triggering kfifo_alloc() failures, aka CID-a7b2df76b42b."}, {"lang": "es", "value": "Una p\u00e9rdida de memoria en la funci\u00f3n cx23888_ir_probe() en el archivo drivers/media/pci/cx23885/cx23888-ir.c en el kernel de Linux versiones hasta la versi\u00f3n 5.3.11, permite a atacantes causar una denegaci\u00f3n de servicio (consumo de memoria) al desencadenar fallos de la funci\u00f3n de kfifo_alloc(), tambi\u00e9n se conoce como CID-a7b2df76b42b."}], "evaluatorComment": null, "id": "CVE-2019-19054", "lastModified": "2022-11-08T03:18:07.597", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 4.7, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:L/AC:M/Au:N/C:N/I:N/A:C", "version": "2.0"}, "exploitabilityScore": 3.4, "impactScore": 6.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 4.7, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.0, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-18T06:15:11.967", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2020-03/msg00021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/a7b2df76b42bdd026e3106cf2ba97db41345a177"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/O3PSDE6PTOTVBK2YTKB2TFQP2SUBVSNF/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PY7LJMSPAGRIKABJPDKQDTXYW3L5RX2T/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20191205-0001/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4525-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4526-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4527-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-401"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/a7b2df76b42bdd026e3106cf2ba97db41345a177"}, "type": "CWE-401"}
| 97
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"// SPDX-License-Identifier: GPL-2.0-or-later\n/*\n * Driver for the Conexant CX23885/7/8 PCIe bridge\n *\n * CX23888 Integrated Consumer Infrared Controller\n *\n * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net>\n */",
"#include \"cx23885.h\"\n#include \"cx23888-ir.h\"",
"#include <linux/kfifo.h>\n#include <linux/slab.h>",
"#include <media/v4l2-device.h>\n#include <media/rc-core.h>",
"static unsigned int ir_888_debug;\nmodule_param(ir_888_debug, int, 0644);\nMODULE_PARM_DESC(ir_888_debug, \"enable debug messages [CX23888 IR controller]\");",
"#define CX23888_IR_REG_BASE\t0x170000\n/*\n * These CX23888 register offsets have a straightforward one to one mapping\n * to the CX23885 register offsets of 0x200 through 0x218\n */\n#define CX23888_IR_CNTRL_REG\t0x170000\n#define CNTRL_WIN_3_3\t0x00000000\n#define CNTRL_WIN_4_3\t0x00000001\n#define CNTRL_WIN_3_4\t0x00000002\n#define CNTRL_WIN_4_4\t0x00000003\n#define CNTRL_WIN\t0x00000003\n#define CNTRL_EDG_NONE\t0x00000000\n#define CNTRL_EDG_FALL\t0x00000004\n#define CNTRL_EDG_RISE\t0x00000008\n#define CNTRL_EDG_BOTH\t0x0000000C\n#define CNTRL_EDG\t0x0000000C\n#define CNTRL_DMD\t0x00000010\n#define CNTRL_MOD\t0x00000020\n#define CNTRL_RFE\t0x00000040\n#define CNTRL_TFE\t0x00000080\n#define CNTRL_RXE\t0x00000100\n#define CNTRL_TXE\t0x00000200\n#define CNTRL_RIC\t0x00000400\n#define CNTRL_TIC\t0x00000800\n#define CNTRL_CPL\t0x00001000\n#define CNTRL_LBM\t0x00002000\n#define CNTRL_R\t\t0x00004000\n/* CX23888 specific control flag */\n#define CNTRL_IVO\t0x00008000",
"#define CX23888_IR_TXCLK_REG\t0x170004\n#define TXCLK_TCD\t0x0000FFFF",
"#define CX23888_IR_RXCLK_REG\t0x170008\n#define RXCLK_RCD\t0x0000FFFF",
"#define CX23888_IR_CDUTY_REG\t0x17000C\n#define CDUTY_CDC\t0x0000000F",
"#define CX23888_IR_STATS_REG\t0x170010\n#define STATS_RTO\t0x00000001\n#define STATS_ROR\t0x00000002\n#define STATS_RBY\t0x00000004\n#define STATS_TBY\t0x00000008\n#define STATS_RSR\t0x00000010\n#define STATS_TSR\t0x00000020",
"#define CX23888_IR_IRQEN_REG\t0x170014\n#define IRQEN_RTE\t0x00000001\n#define IRQEN_ROE\t0x00000002\n#define IRQEN_RSE\t0x00000010\n#define IRQEN_TSE\t0x00000020",
"#define CX23888_IR_FILTR_REG\t0x170018\n#define FILTR_LPF\t0x0000FFFF",
"/* This register doesn't follow the pattern; it's 0x23C on a CX23885 */\n#define CX23888_IR_FIFO_REG\t0x170040\n#define FIFO_RXTX\t0x0000FFFF\n#define FIFO_RXTX_LVL\t0x00010000\n#define FIFO_RXTX_RTO\t0x0001FFFF\n#define FIFO_RX_NDV\t0x00020000\n#define FIFO_RX_DEPTH\t8\n#define FIFO_TX_DEPTH\t8",
"/* CX23888 unique registers */\n#define CX23888_IR_SEEDP_REG\t0x17001C\n#define CX23888_IR_TIMOL_REG\t0x170020\n#define CX23888_IR_WAKE0_REG\t0x170024\n#define CX23888_IR_WAKE1_REG\t0x170028\n#define CX23888_IR_WAKE2_REG\t0x17002C\n#define CX23888_IR_MASK0_REG\t0x170030\n#define CX23888_IR_MASK1_REG\t0x170034\n#define CX23888_IR_MAKS2_REG\t0x170038\n#define CX23888_IR_DPIPG_REG\t0x17003C\n#define CX23888_IR_LEARN_REG\t0x170044",
"#define CX23888_VIDCLK_FREQ\t108000000 /* 108 MHz, BT.656 */\n#define CX23888_IR_REFCLK_FREQ\t(CX23888_VIDCLK_FREQ / 2)",
"/*\n * We use this union internally for convenience, but callers to tx_write\n * and rx_read will be expecting records of type struct ir_raw_event.\n * Always ensure the size of this union is dictated by struct ir_raw_event.\n */\nunion cx23888_ir_fifo_rec {\n\tu32 hw_fifo_data;\n\tstruct ir_raw_event ir_core_data;\n};",
"#define CX23888_IR_RX_KFIFO_SIZE (256 * sizeof(union cx23888_ir_fifo_rec))\n#define CX23888_IR_TX_KFIFO_SIZE (256 * sizeof(union cx23888_ir_fifo_rec))",
"struct cx23888_ir_state {\n\tstruct v4l2_subdev sd;\n\tstruct cx23885_dev *dev;",
"\tstruct v4l2_subdev_ir_parameters rx_params;\n\tstruct mutex rx_params_lock;\n\tatomic_t rxclk_divider;\n\tatomic_t rx_invert;",
"\tstruct kfifo rx_kfifo;\n\tspinlock_t rx_kfifo_lock;",
"\tstruct v4l2_subdev_ir_parameters tx_params;\n\tstruct mutex tx_params_lock;\n\tatomic_t txclk_divider;\n};",
"static inline struct cx23888_ir_state *to_state(struct v4l2_subdev *sd)\n{\n\treturn v4l2_get_subdevdata(sd);\n}",
"/*\n * IR register block read and write functions\n */\nstatic\ninline int cx23888_ir_write4(struct cx23885_dev *dev, u32 addr, u32 value)\n{\n\tcx_write(addr, value);\n\treturn 0;\n}",
"static inline u32 cx23888_ir_read4(struct cx23885_dev *dev, u32 addr)\n{\n\treturn cx_read(addr);\n}",
"static inline int cx23888_ir_and_or4(struct cx23885_dev *dev, u32 addr,\n\t\t\t\t u32 and_mask, u32 or_value)\n{\n\tcx_andor(addr, ~and_mask, or_value);\n\treturn 0;\n}",
"/*\n * Rx and Tx Clock Divider register computations\n *\n * Note the largest clock divider value of 0xffff corresponds to:\n *\t(0xffff + 1) * 1000 / 108/2 MHz = 1,213,629.629... ns\n * which fits in 21 bits, so we'll use unsigned int for time arguments.\n */\nstatic inline u16 count_to_clock_divider(unsigned int d)\n{\n\tif (d > RXCLK_RCD + 1)\n\t\td = RXCLK_RCD;\n\telse if (d < 2)\n\t\td = 1;\n\telse\n\t\td--;\n\treturn (u16) d;\n}",
"static inline u16 ns_to_clock_divider(unsigned int ns)\n{\n\treturn count_to_clock_divider(\n\t\tDIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ / 1000000 * ns, 1000));\n}",
"static inline unsigned int clock_divider_to_ns(unsigned int divider)\n{\n\t/* Period of the Rx or Tx clock in ns */\n\treturn DIV_ROUND_CLOSEST((divider + 1) * 1000,\n\t\t\t\t CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"static inline u16 carrier_freq_to_clock_divider(unsigned int freq)\n{\n\treturn count_to_clock_divider(\n\t\t\t DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * 16));\n}",
"static inline unsigned int clock_divider_to_carrier_freq(unsigned int divider)\n{\n\treturn DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, (divider + 1) * 16);\n}",
"static inline u16 freq_to_clock_divider(unsigned int freq,\n\t\t\t\t\tunsigned int rollovers)\n{\n\treturn count_to_clock_divider(\n\t\t DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * rollovers));\n}",
"static inline unsigned int clock_divider_to_freq(unsigned int divider,\n\t\t\t\t\t\t unsigned int rollovers)\n{\n\treturn DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ,\n\t\t\t\t (divider + 1) * rollovers);\n}",
"/*\n * Low Pass Filter register calculations\n *\n * Note the largest count value of 0xffff corresponds to:\n *\t0xffff * 1000 / 108/2 MHz = 1,213,611.11... ns\n * which fits in 21 bits, so we'll use unsigned int for time arguments.\n */\nstatic inline u16 count_to_lpf_count(unsigned int d)\n{\n\tif (d > FILTR_LPF)\n\t\td = FILTR_LPF;\n\telse if (d < 4)\n\t\td = 0;\n\treturn (u16) d;\n}",
"static inline u16 ns_to_lpf_count(unsigned int ns)\n{\n\treturn count_to_lpf_count(\n\t\tDIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ / 1000000 * ns, 1000));\n}",
"static inline unsigned int lpf_count_to_ns(unsigned int count)\n{\n\t/* Duration of the Low Pass Filter rejection window in ns */\n\treturn DIV_ROUND_CLOSEST(count * 1000,\n\t\t\t\t CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"static inline unsigned int lpf_count_to_us(unsigned int count)\n{\n\t/* Duration of the Low Pass Filter rejection window in us */\n\treturn DIV_ROUND_CLOSEST(count, CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"/*\n * FIFO register pulse width count computations\n */\nstatic u32 clock_divider_to_resolution(u16 divider)\n{\n\t/*\n\t * Resolution is the duration of 1 tick of the readable portion of\n\t * of the pulse width counter as read from the FIFO. The two lsb's are\n\t * not readable, hence the << 2. This function returns ns.\n\t */\n\treturn DIV_ROUND_CLOSEST((1 << 2) * ((u32) divider + 1) * 1000,\n\t\t\t\t CX23888_IR_REFCLK_FREQ / 1000000);\n}",
"static u64 pulse_width_count_to_ns(u16 count, u16 divider)\n{\n\tu64 n;\n\tu32 rem;",
"\t/*\n\t * The 2 lsb's of the pulse width timer count are not readable, hence\n\t * the (count << 2) | 0x3\n\t */\n\tn = (((u64) count << 2) | 0x3) * (divider + 1) * 1000; /* millicycles */\n\trem = do_div(n, CX23888_IR_REFCLK_FREQ / 1000000); /* / MHz => ns */\n\tif (rem >= CX23888_IR_REFCLK_FREQ / 1000000 / 2)\n\t\tn++;\n\treturn n;\n}",
"static unsigned int pulse_width_count_to_us(u16 count, u16 divider)\n{\n\tu64 n;\n\tu32 rem;",
"\t/*\n\t * The 2 lsb's of the pulse width timer count are not readable, hence\n\t * the (count << 2) | 0x3\n\t */\n\tn = (((u64) count << 2) | 0x3) * (divider + 1); /* cycles */\n\trem = do_div(n, CX23888_IR_REFCLK_FREQ / 1000000); /* / MHz => us */\n\tif (rem >= CX23888_IR_REFCLK_FREQ / 1000000 / 2)\n\t\tn++;\n\treturn (unsigned int) n;\n}",
"/*\n * Pulse Clocks computations: Combined Pulse Width Count & Rx Clock Counts\n *\n * The total pulse clock count is an 18 bit pulse width timer count as the most\n * significant part and (up to) 16 bit clock divider count as a modulus.\n * When the Rx clock divider ticks down to 0, it increments the 18 bit pulse\n * width timer count's least significant bit.\n */\nstatic u64 ns_to_pulse_clocks(u32 ns)\n{\n\tu64 clocks;\n\tu32 rem;\n\tclocks = CX23888_IR_REFCLK_FREQ / 1000000 * (u64) ns; /* millicycles */\n\trem = do_div(clocks, 1000); /* /1000 = cycles */\n\tif (rem >= 1000 / 2)\n\t\tclocks++;\n\treturn clocks;\n}",
"static u16 pulse_clocks_to_clock_divider(u64 count)\n{\n\tdo_div(count, (FIFO_RXTX << 2) | 0x3);",
"\t/* net result needs to be rounded down and decremented by 1 */\n\tif (count > RXCLK_RCD + 1)\n\t\tcount = RXCLK_RCD;\n\telse if (count < 2)\n\t\tcount = 1;\n\telse\n\t\tcount--;\n\treturn (u16) count;\n}",
"/*\n * IR Control Register helpers\n */\nenum tx_fifo_watermark {\n\tTX_FIFO_HALF_EMPTY = 0,\n\tTX_FIFO_EMPTY = CNTRL_TIC,\n};",
"enum rx_fifo_watermark {\n\tRX_FIFO_HALF_FULL = 0,\n\tRX_FIFO_NOT_EMPTY = CNTRL_RIC,\n};",
"static inline void control_tx_irq_watermark(struct cx23885_dev *dev,\n\t\t\t\t\t enum tx_fifo_watermark level)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_TIC, level);\n}",
"static inline void control_rx_irq_watermark(struct cx23885_dev *dev,\n\t\t\t\t\t enum rx_fifo_watermark level)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_RIC, level);\n}",
"static inline void control_tx_enable(struct cx23885_dev *dev, bool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~(CNTRL_TXE | CNTRL_TFE),\n\t\t\t enable ? (CNTRL_TXE | CNTRL_TFE) : 0);\n}",
"static inline void control_rx_enable(struct cx23885_dev *dev, bool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~(CNTRL_RXE | CNTRL_RFE),\n\t\t\t enable ? (CNTRL_RXE | CNTRL_RFE) : 0);\n}",
"static inline void control_tx_modulation_enable(struct cx23885_dev *dev,\n\t\t\t\t\t\tbool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_MOD,\n\t\t\t enable ? CNTRL_MOD : 0);\n}",
"static inline void control_rx_demodulation_enable(struct cx23885_dev *dev,\n\t\t\t\t\t\t bool enable)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_DMD,\n\t\t\t enable ? CNTRL_DMD : 0);\n}",
"static inline void control_rx_s_edge_detection(struct cx23885_dev *dev,\n\t\t\t\t\t u32 edge_types)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_EDG_BOTH,\n\t\t\t edge_types & CNTRL_EDG_BOTH);\n}",
"static void control_rx_s_carrier_window(struct cx23885_dev *dev,\n\t\t\t\t\tunsigned int carrier,\n\t\t\t\t\tunsigned int *carrier_range_low,\n\t\t\t\t\tunsigned int *carrier_range_high)\n{\n\tu32 v;\n\tunsigned int c16 = carrier * 16;",
"\tif (*carrier_range_low < DIV_ROUND_CLOSEST(c16, 16 + 3)) {\n\t\tv = CNTRL_WIN_3_4;\n\t\t*carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 4);\n\t} else {\n\t\tv = CNTRL_WIN_3_3;\n\t\t*carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 3);\n\t}",
"\tif (*carrier_range_high > DIV_ROUND_CLOSEST(c16, 16 - 3)) {\n\t\tv |= CNTRL_WIN_4_3;\n\t\t*carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 4);\n\t} else {\n\t\tv |= CNTRL_WIN_3_3;\n\t\t*carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 3);\n\t}\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_WIN, v);\n}",
"static inline void control_tx_polarity_invert(struct cx23885_dev *dev,\n\t\t\t\t\t bool invert)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_CPL,\n\t\t\t invert ? CNTRL_CPL : 0);\n}",
"static inline void control_tx_level_invert(struct cx23885_dev *dev,\n\t\t\t\t\t bool invert)\n{\n\tcx23888_ir_and_or4(dev, CX23888_IR_CNTRL_REG, ~CNTRL_IVO,\n\t\t\t invert ? CNTRL_IVO : 0);\n}",
"/*\n * IR Rx & Tx Clock Register helpers\n */\nstatic unsigned int txclk_tx_s_carrier(struct cx23885_dev *dev,\n\t\t\t\t unsigned int freq,\n\t\t\t\t u16 *divider)\n{\n\t*divider = carrier_freq_to_clock_divider(freq);\n\tcx23888_ir_write4(dev, CX23888_IR_TXCLK_REG, *divider);\n\treturn clock_divider_to_carrier_freq(*divider);\n}",
"static unsigned int rxclk_rx_s_carrier(struct cx23885_dev *dev,\n\t\t\t\t unsigned int freq,\n\t\t\t\t u16 *divider)\n{\n\t*divider = carrier_freq_to_clock_divider(freq);\n\tcx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, *divider);\n\treturn clock_divider_to_carrier_freq(*divider);\n}",
"static u32 txclk_tx_s_max_pulse_width(struct cx23885_dev *dev, u32 ns,\n\t\t\t\t u16 *divider)\n{\n\tu64 pulse_clocks;",
"\tif (ns > IR_MAX_DURATION)\n\t\tns = IR_MAX_DURATION;\n\tpulse_clocks = ns_to_pulse_clocks(ns);\n\t*divider = pulse_clocks_to_clock_divider(pulse_clocks);\n\tcx23888_ir_write4(dev, CX23888_IR_TXCLK_REG, *divider);\n\treturn (u32) pulse_width_count_to_ns(FIFO_RXTX, *divider);\n}",
"static u32 rxclk_rx_s_max_pulse_width(struct cx23885_dev *dev, u32 ns,\n\t\t\t\t u16 *divider)\n{\n\tu64 pulse_clocks;",
"\tif (ns > IR_MAX_DURATION)\n\t\tns = IR_MAX_DURATION;\n\tpulse_clocks = ns_to_pulse_clocks(ns);\n\t*divider = pulse_clocks_to_clock_divider(pulse_clocks);\n\tcx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, *divider);\n\treturn (u32) pulse_width_count_to_ns(FIFO_RXTX, *divider);\n}",
"/*\n * IR Tx Carrier Duty Cycle register helpers\n */\nstatic unsigned int cduty_tx_s_duty_cycle(struct cx23885_dev *dev,\n\t\t\t\t\t unsigned int duty_cycle)\n{\n\tu32 n;\n\tn = DIV_ROUND_CLOSEST(duty_cycle * 100, 625); /* 16ths of 100% */\n\tif (n != 0)\n\t\tn--;\n\tif (n > 15)\n\t\tn = 15;\n\tcx23888_ir_write4(dev, CX23888_IR_CDUTY_REG, n);\n\treturn DIV_ROUND_CLOSEST((n + 1) * 100, 16);\n}",
"/*\n * IR Filter Register helpers\n */\nstatic u32 filter_rx_s_min_width(struct cx23885_dev *dev, u32 min_width_ns)\n{\n\tu32 count = ns_to_lpf_count(min_width_ns);\n\tcx23888_ir_write4(dev, CX23888_IR_FILTR_REG, count);\n\treturn lpf_count_to_ns(count);\n}",
"/*\n * IR IRQ Enable Register helpers\n */\nstatic inline void irqenable_rx(struct cx23885_dev *dev, u32 mask)\n{\n\tmask &= (IRQEN_RTE | IRQEN_ROE | IRQEN_RSE);\n\tcx23888_ir_and_or4(dev, CX23888_IR_IRQEN_REG,\n\t\t\t ~(IRQEN_RTE | IRQEN_ROE | IRQEN_RSE), mask);\n}",
"static inline void irqenable_tx(struct cx23885_dev *dev, u32 mask)\n{\n\tmask &= IRQEN_TSE;\n\tcx23888_ir_and_or4(dev, CX23888_IR_IRQEN_REG, ~IRQEN_TSE, mask);\n}",
"/*\n * V4L2 Subdevice IR Ops\n */\nstatic int cx23888_ir_irq_handler(struct v4l2_subdev *sd, u32 status,\n\t\t\t\t bool *handled)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tunsigned long flags;",
"\tu32 cntrl = cx23888_ir_read4(dev, CX23888_IR_CNTRL_REG);\n\tu32 irqen = cx23888_ir_read4(dev, CX23888_IR_IRQEN_REG);\n\tu32 stats = cx23888_ir_read4(dev, CX23888_IR_STATS_REG);",
"\tunion cx23888_ir_fifo_rec rx_data[FIFO_RX_DEPTH];\n\tunsigned int i, j, k;\n\tu32 events, v;\n\tint tsr, rsr, rto, ror, tse, rse, rte, roe, kror;",
"\ttsr = stats & STATS_TSR; /* Tx FIFO Service Request */\n\trsr = stats & STATS_RSR; /* Rx FIFO Service Request */\n\trto = stats & STATS_RTO; /* Rx Pulse Width Timer Time Out */\n\tror = stats & STATS_ROR; /* Rx FIFO Over Run */",
"\ttse = irqen & IRQEN_TSE; /* Tx FIFO Service Request IRQ Enable */\n\trse = irqen & IRQEN_RSE; /* Rx FIFO Service Request IRQ Enable */\n\trte = irqen & IRQEN_RTE; /* Rx Pulse Width Timer Time Out IRQ Enable */\n\troe = irqen & IRQEN_ROE; /* Rx FIFO Over Run IRQ Enable */",
"\t*handled = false;\n\tv4l2_dbg(2, ir_888_debug, sd, \"IRQ Status: %s %s %s %s %s %s\\n\",\n\t\t tsr ? \"tsr\" : \" \", rsr ? \"rsr\" : \" \",\n\t\t rto ? \"rto\" : \" \", ror ? \"ror\" : \" \",\n\t\t stats & STATS_TBY ? \"tby\" : \" \",\n\t\t stats & STATS_RBY ? \"rby\" : \" \");",
"\tv4l2_dbg(2, ir_888_debug, sd, \"IRQ Enables: %s %s %s %s\\n\",\n\t\t tse ? \"tse\" : \" \", rse ? \"rse\" : \" \",\n\t\t rte ? \"rte\" : \" \", roe ? \"roe\" : \" \");",
"\t/*\n\t * Transmitter interrupt service\n\t */\n\tif (tse && tsr) {\n\t\t/*\n\t\t * TODO:\n\t\t * Check the watermark threshold setting\n\t\t * Pull FIFO_TX_DEPTH or FIFO_TX_DEPTH/2 entries from tx_kfifo\n\t\t * Push the data to the hardware FIFO.\n\t\t * If there was nothing more to send in the tx_kfifo, disable\n\t\t *\tthe TSR IRQ and notify the v4l2_device.\n\t\t * If there was something in the tx_kfifo, check the tx_kfifo\n\t\t * level and notify the v4l2_device, if it is low.\n\t\t */\n\t\t/* For now, inhibit TSR interrupt until Tx is implemented */\n\t\tirqenable_tx(dev, 0);\n\t\tevents = V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ;\n\t\tv4l2_subdev_notify(sd, V4L2_SUBDEV_IR_TX_NOTIFY, &events);\n\t\t*handled = true;\n\t}",
"\t/*\n\t * Receiver interrupt service\n\t */\n\tkror = 0;\n\tif ((rse && rsr) || (rte && rto)) {\n\t\t/*\n\t\t * Receive data on RSR to clear the STATS_RSR.\n\t\t * Receive data on RTO, since we may not have yet hit the RSR\n\t\t * watermark when we receive the RTO.\n\t\t */\n\t\tfor (i = 0, v = FIFO_RX_NDV;\n\t\t (v & FIFO_RX_NDV) && !kror; i = 0) {\n\t\t\tfor (j = 0;\n\t\t\t (v & FIFO_RX_NDV) && j < FIFO_RX_DEPTH; j++) {\n\t\t\t\tv = cx23888_ir_read4(dev, CX23888_IR_FIFO_REG);\n\t\t\t\trx_data[i].hw_fifo_data = v & ~FIFO_RX_NDV;\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (i == 0)\n\t\t\t\tbreak;\n\t\t\tj = i * sizeof(union cx23888_ir_fifo_rec);\n\t\t\tk = kfifo_in_locked(&state->rx_kfifo,\n\t\t\t\t (unsigned char *) rx_data, j,\n\t\t\t\t &state->rx_kfifo_lock);\n\t\t\tif (k != j)\n\t\t\t\tkror++; /* rx_kfifo over run */\n\t\t}\n\t\t*handled = true;\n\t}",
"\tevents = 0;\n\tv = 0;\n\tif (kror) {\n\t\tevents |= V4L2_SUBDEV_IR_RX_SW_FIFO_OVERRUN;\n\t\tv4l2_err(sd, \"IR receiver software FIFO overrun\\n\");\n\t}\n\tif (roe && ror) {\n\t\t/*\n\t\t * The RX FIFO Enable (CNTRL_RFE) must be toggled to clear\n\t\t * the Rx FIFO Over Run status (STATS_ROR)\n\t\t */\n\t\tv |= CNTRL_RFE;\n\t\tevents |= V4L2_SUBDEV_IR_RX_HW_FIFO_OVERRUN;\n\t\tv4l2_err(sd, \"IR receiver hardware FIFO overrun\\n\");\n\t}\n\tif (rte && rto) {\n\t\t/*\n\t\t * The IR Receiver Enable (CNTRL_RXE) must be toggled to clear\n\t\t * the Rx Pulse Width Timer Time Out (STATS_RTO)\n\t\t */\n\t\tv |= CNTRL_RXE;\n\t\tevents |= V4L2_SUBDEV_IR_RX_END_OF_RX_DETECTED;\n\t}\n\tif (v) {\n\t\t/* Clear STATS_ROR & STATS_RTO as needed by resetting hardware */\n\t\tcx23888_ir_write4(dev, CX23888_IR_CNTRL_REG, cntrl & ~v);\n\t\tcx23888_ir_write4(dev, CX23888_IR_CNTRL_REG, cntrl);\n\t\t*handled = true;\n\t}",
"\tspin_lock_irqsave(&state->rx_kfifo_lock, flags);\n\tif (kfifo_len(&state->rx_kfifo) >= CX23888_IR_RX_KFIFO_SIZE / 2)\n\t\tevents |= V4L2_SUBDEV_IR_RX_FIFO_SERVICE_REQ;\n\tspin_unlock_irqrestore(&state->rx_kfifo_lock, flags);",
"\tif (events)\n\t\tv4l2_subdev_notify(sd, V4L2_SUBDEV_IR_RX_NOTIFY, &events);\n\treturn 0;\n}",
"/* Receiver */\nstatic int cx23888_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,\n\t\t\t ssize_t *num)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tbool invert = (bool) atomic_read(&state->rx_invert);\n\tu16 divider = (u16) atomic_read(&state->rxclk_divider);",
"\tunsigned int i, n;\n\tunion cx23888_ir_fifo_rec *p;\n\tunsigned u, v, w;",
"\tn = count / sizeof(union cx23888_ir_fifo_rec)\n\t\t* sizeof(union cx23888_ir_fifo_rec);\n\tif (n == 0) {\n\t\t*num = 0;\n\t\treturn 0;\n\t}",
"\tn = kfifo_out_locked(&state->rx_kfifo, buf, n, &state->rx_kfifo_lock);",
"\tn /= sizeof(union cx23888_ir_fifo_rec);\n\t*num = n * sizeof(union cx23888_ir_fifo_rec);",
"\tfor (p = (union cx23888_ir_fifo_rec *) buf, i = 0; i < n; p++, i++) {",
"\t\tif ((p->hw_fifo_data & FIFO_RXTX_RTO) == FIFO_RXTX_RTO) {\n\t\t\t/* Assume RTO was because of no IR light input */\n\t\t\tu = 0;\n\t\t\tw = 1;\n\t\t} else {\n\t\t\tu = (p->hw_fifo_data & FIFO_RXTX_LVL) ? 1 : 0;\n\t\t\tif (invert)\n\t\t\t\tu = u ? 0 : 1;\n\t\t\tw = 0;\n\t\t}",
"\t\tv = (unsigned) pulse_width_count_to_ns(\n\t\t\t\t (u16) (p->hw_fifo_data & FIFO_RXTX), divider);\n\t\tif (v > IR_MAX_DURATION)\n\t\t\tv = IR_MAX_DURATION;",
"\t\tp->ir_core_data = (struct ir_raw_event)\n\t\t\t{ .pulse = u, .duration = v, .timeout = w };",
"\t\tv4l2_dbg(2, ir_888_debug, sd, \"rx read: %10u ns %s %s\\n\",\n\t\t\t v, u ? \"mark\" : \"space\", w ? \"(timed out)\" : \"\");\n\t\tif (w)\n\t\t\tv4l2_dbg(2, ir_888_debug, sd, \"rx read: end of rx\\n\");\n\t}\n\treturn 0;\n}",
"static int cx23888_ir_rx_g_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tmutex_lock(&state->rx_params_lock);\n\tmemcpy(p, &state->rx_params, sizeof(struct v4l2_subdev_ir_parameters));\n\tmutex_unlock(&state->rx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_rx_shutdown(struct v4l2_subdev *sd)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;",
"\tmutex_lock(&state->rx_params_lock);",
"\t/* Disable or slow down all IR Rx circuits and counters */\n\tirqenable_rx(dev, 0);\n\tcontrol_rx_enable(dev, false);\n\tcontrol_rx_demodulation_enable(dev, false);\n\tcontrol_rx_s_edge_detection(dev, CNTRL_EDG_NONE);\n\tfilter_rx_s_min_width(dev, 0);\n\tcx23888_ir_write4(dev, CX23888_IR_RXCLK_REG, RXCLK_RCD);",
"\tstate->rx_params.shutdown = true;",
"\tmutex_unlock(&state->rx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_rx_s_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tstruct v4l2_subdev_ir_parameters *o = &state->rx_params;\n\tu16 rxclk_divider;",
"\tif (p->shutdown)\n\t\treturn cx23888_ir_rx_shutdown(sd);",
"\tif (p->mode != V4L2_SUBDEV_IR_MODE_PULSE_WIDTH)\n\t\treturn -ENOSYS;",
"\tmutex_lock(&state->rx_params_lock);",
"\to->shutdown = p->shutdown;",
"\to->mode = p->mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH;",
"\to->bytes_per_data_element = p->bytes_per_data_element\n\t\t\t\t = sizeof(union cx23888_ir_fifo_rec);",
"\t/* Before we tweak the hardware, we have to disable the receiver */\n\tirqenable_rx(dev, 0);\n\tcontrol_rx_enable(dev, false);",
"\tcontrol_rx_demodulation_enable(dev, p->modulation);\n\to->modulation = p->modulation;",
"\tif (p->modulation) {\n\t\tp->carrier_freq = rxclk_rx_s_carrier(dev, p->carrier_freq,\n\t\t\t\t\t\t &rxclk_divider);",
"\t\to->carrier_freq = p->carrier_freq;",
"\t\to->duty_cycle = p->duty_cycle = 50;",
"\t\tcontrol_rx_s_carrier_window(dev, p->carrier_freq,\n\t\t\t\t\t &p->carrier_range_lower,\n\t\t\t\t\t &p->carrier_range_upper);\n\t\to->carrier_range_lower = p->carrier_range_lower;\n\t\to->carrier_range_upper = p->carrier_range_upper;",
"\t\tp->max_pulse_width =\n\t\t\t(u32) pulse_width_count_to_ns(FIFO_RXTX, rxclk_divider);\n\t} else {\n\t\tp->max_pulse_width =\n\t\t\t rxclk_rx_s_max_pulse_width(dev, p->max_pulse_width,\n\t\t\t\t\t\t &rxclk_divider);\n\t}\n\to->max_pulse_width = p->max_pulse_width;\n\tatomic_set(&state->rxclk_divider, rxclk_divider);",
"\tp->noise_filter_min_width =\n\t\t\t filter_rx_s_min_width(dev, p->noise_filter_min_width);\n\to->noise_filter_min_width = p->noise_filter_min_width;",
"\tp->resolution = clock_divider_to_resolution(rxclk_divider);\n\to->resolution = p->resolution;",
"\t/* FIXME - make this dependent on resolution for better performance */\n\tcontrol_rx_irq_watermark(dev, RX_FIFO_HALF_FULL);",
"\tcontrol_rx_s_edge_detection(dev, CNTRL_EDG_BOTH);",
"\to->invert_level = p->invert_level;\n\tatomic_set(&state->rx_invert, p->invert_level);",
"\to->interrupt_enable = p->interrupt_enable;\n\to->enable = p->enable;\n\tif (p->enable) {\n\t\tunsigned long flags;",
"\t\tspin_lock_irqsave(&state->rx_kfifo_lock, flags);\n\t\tkfifo_reset(&state->rx_kfifo);\n\t\t/* reset tx_fifo too if there is one... */\n\t\tspin_unlock_irqrestore(&state->rx_kfifo_lock, flags);\n\t\tif (p->interrupt_enable)\n\t\t\tirqenable_rx(dev, IRQEN_RSE | IRQEN_RTE | IRQEN_ROE);\n\t\tcontrol_rx_enable(dev, p->enable);\n\t}",
"\tmutex_unlock(&state->rx_params_lock);\n\treturn 0;\n}",
"/* Transmitter */\nstatic int cx23888_ir_tx_write(struct v4l2_subdev *sd, u8 *buf, size_t count,\n\t\t\t ssize_t *num)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\t/* For now enable the Tx FIFO Service interrupt & pretend we did work */\n\tirqenable_tx(dev, IRQEN_TSE);\n\t*num = count;\n\treturn 0;\n}",
"static int cx23888_ir_tx_g_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tmutex_lock(&state->tx_params_lock);\n\tmemcpy(p, &state->tx_params, sizeof(struct v4l2_subdev_ir_parameters));\n\tmutex_unlock(&state->tx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_tx_shutdown(struct v4l2_subdev *sd)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;",
"\tmutex_lock(&state->tx_params_lock);",
"\t/* Disable or slow down all IR Tx circuits and counters */\n\tirqenable_tx(dev, 0);\n\tcontrol_tx_enable(dev, false);\n\tcontrol_tx_modulation_enable(dev, false);\n\tcx23888_ir_write4(dev, CX23888_IR_TXCLK_REG, TXCLK_TCD);",
"\tstate->tx_params.shutdown = true;",
"\tmutex_unlock(&state->tx_params_lock);\n\treturn 0;\n}",
"static int cx23888_ir_tx_s_parameters(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_subdev_ir_parameters *p)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tstruct v4l2_subdev_ir_parameters *o = &state->tx_params;\n\tu16 txclk_divider;",
"\tif (p->shutdown)\n\t\treturn cx23888_ir_tx_shutdown(sd);",
"\tif (p->mode != V4L2_SUBDEV_IR_MODE_PULSE_WIDTH)\n\t\treturn -ENOSYS;",
"\tmutex_lock(&state->tx_params_lock);",
"\to->shutdown = p->shutdown;",
"\to->mode = p->mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH;",
"\to->bytes_per_data_element = p->bytes_per_data_element\n\t\t\t\t = sizeof(union cx23888_ir_fifo_rec);",
"\t/* Before we tweak the hardware, we have to disable the transmitter */\n\tirqenable_tx(dev, 0);\n\tcontrol_tx_enable(dev, false);",
"\tcontrol_tx_modulation_enable(dev, p->modulation);\n\to->modulation = p->modulation;",
"\tif (p->modulation) {\n\t\tp->carrier_freq = txclk_tx_s_carrier(dev, p->carrier_freq,\n\t\t\t\t\t\t &txclk_divider);\n\t\to->carrier_freq = p->carrier_freq;",
"\t\tp->duty_cycle = cduty_tx_s_duty_cycle(dev, p->duty_cycle);\n\t\to->duty_cycle = p->duty_cycle;",
"\t\tp->max_pulse_width =\n\t\t\t(u32) pulse_width_count_to_ns(FIFO_RXTX, txclk_divider);\n\t} else {\n\t\tp->max_pulse_width =\n\t\t\t txclk_tx_s_max_pulse_width(dev, p->max_pulse_width,\n\t\t\t\t\t\t &txclk_divider);\n\t}\n\to->max_pulse_width = p->max_pulse_width;\n\tatomic_set(&state->txclk_divider, txclk_divider);",
"\tp->resolution = clock_divider_to_resolution(txclk_divider);\n\to->resolution = p->resolution;",
"\t/* FIXME - make this dependent on resolution for better performance */\n\tcontrol_tx_irq_watermark(dev, TX_FIFO_HALF_EMPTY);",
"\tcontrol_tx_polarity_invert(dev, p->invert_carrier_sense);\n\to->invert_carrier_sense = p->invert_carrier_sense;",
"\tcontrol_tx_level_invert(dev, p->invert_level);\n\to->invert_level = p->invert_level;",
"\to->interrupt_enable = p->interrupt_enable;\n\to->enable = p->enable;\n\tif (p->enable) {\n\t\tif (p->interrupt_enable)\n\t\t\tirqenable_tx(dev, IRQEN_TSE);\n\t\tcontrol_tx_enable(dev, p->enable);\n\t}",
"\tmutex_unlock(&state->tx_params_lock);\n\treturn 0;\n}",
"\n/*\n * V4L2 Subdevice Core Ops\n */\nstatic int cx23888_ir_log_status(struct v4l2_subdev *sd)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tstruct cx23885_dev *dev = state->dev;\n\tchar *s;\n\tint i, j;",
"\tu32 cntrl = cx23888_ir_read4(dev, CX23888_IR_CNTRL_REG);\n\tu32 txclk = cx23888_ir_read4(dev, CX23888_IR_TXCLK_REG) & TXCLK_TCD;\n\tu32 rxclk = cx23888_ir_read4(dev, CX23888_IR_RXCLK_REG) & RXCLK_RCD;\n\tu32 cduty = cx23888_ir_read4(dev, CX23888_IR_CDUTY_REG) & CDUTY_CDC;\n\tu32 stats = cx23888_ir_read4(dev, CX23888_IR_STATS_REG);\n\tu32 irqen = cx23888_ir_read4(dev, CX23888_IR_IRQEN_REG);\n\tu32 filtr = cx23888_ir_read4(dev, CX23888_IR_FILTR_REG) & FILTR_LPF;",
"\tv4l2_info(sd, \"IR Receiver:\\n\");\n\tv4l2_info(sd, \"\\tEnabled: %s\\n\",\n\t\t cntrl & CNTRL_RXE ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tDemodulation from a carrier: %s\\n\",\n\t\t cntrl & CNTRL_DMD ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO: %s\\n\",\n\t\t cntrl & CNTRL_RFE ? \"enabled\" : \"disabled\");\n\tswitch (cntrl & CNTRL_EDG) {\n\tcase CNTRL_EDG_NONE:\n\t\ts = \"disabled\";\n\t\tbreak;\n\tcase CNTRL_EDG_FALL:\n\t\ts = \"falling edge\";\n\t\tbreak;\n\tcase CNTRL_EDG_RISE:\n\t\ts = \"rising edge\";\n\t\tbreak;\n\tcase CNTRL_EDG_BOTH:\n\t\ts = \"rising & falling edges\";\n\t\tbreak;\n\tdefault:\n\t\ts = \"??? edge\";\n\t\tbreak;\n\t}\n\tv4l2_info(sd, \"\\tPulse timers' start/stop trigger: %s\\n\", s);\n\tv4l2_info(sd, \"\\tFIFO data on pulse timer overflow: %s\\n\",\n\t\t cntrl & CNTRL_R ? \"not loaded\" : \"overflow marker\");\n\tv4l2_info(sd, \"\\tFIFO interrupt watermark: %s\\n\",\n\t\t cntrl & CNTRL_RIC ? \"not empty\" : \"half full or greater\");\n\tv4l2_info(sd, \"\\tLoopback mode: %s\\n\",\n\t\t cntrl & CNTRL_LBM ? \"loopback active\" : \"normal receive\");\n\tif (cntrl & CNTRL_DMD) {\n\t\tv4l2_info(sd, \"\\tExpected carrier (16 clocks): %u Hz\\n\",\n\t\t\t clock_divider_to_carrier_freq(rxclk));\n\t\tswitch (cntrl & CNTRL_WIN) {\n\t\tcase CNTRL_WIN_3_3:\n\t\t\ti = 3;\n\t\t\tj = 3;\n\t\t\tbreak;\n\t\tcase CNTRL_WIN_4_3:\n\t\t\ti = 4;\n\t\t\tj = 3;\n\t\t\tbreak;\n\t\tcase CNTRL_WIN_3_4:\n\t\t\ti = 3;\n\t\t\tj = 4;\n\t\t\tbreak;\n\t\tcase CNTRL_WIN_4_4:\n\t\t\ti = 4;\n\t\t\tj = 4;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\ti = 0;\n\t\t\tj = 0;\n\t\t\tbreak;\n\t\t}\n\t\tv4l2_info(sd, \"\\tNext carrier edge window:\t 16 clocks -%1d/+%1d, %u to %u Hz\\n\",\n\t\t\t i, j,\n\t\t\t clock_divider_to_freq(rxclk, 16 + j),\n\t\t\t clock_divider_to_freq(rxclk, 16 - i));\n\t}\n\tv4l2_info(sd, \"\\tMax measurable pulse width: %u us, %llu ns\\n\",\n\t\t pulse_width_count_to_us(FIFO_RXTX, rxclk),\n\t\t pulse_width_count_to_ns(FIFO_RXTX, rxclk));\n\tv4l2_info(sd, \"\\tLow pass filter: %s\\n\",\n\t\t filtr ? \"enabled\" : \"disabled\");\n\tif (filtr)\n\t\tv4l2_info(sd, \"\\tMin acceptable pulse width (LPF): %u us, %u ns\\n\",\n\t\t\t lpf_count_to_us(filtr),\n\t\t\t lpf_count_to_ns(filtr));\n\tv4l2_info(sd, \"\\tPulse width timer timed-out: %s\\n\",\n\t\t stats & STATS_RTO ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tPulse width timer time-out intr: %s\\n\",\n\t\t irqen & IRQEN_RTE ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO overrun: %s\\n\",\n\t\t stats & STATS_ROR ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO overrun interrupt: %s\\n\",\n\t\t irqen & IRQEN_ROE ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tBusy: %s\\n\",\n\t\t stats & STATS_RBY ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service requested: %s\\n\",\n\t\t stats & STATS_RSR ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service request interrupt: %s\\n\",\n\t\t irqen & IRQEN_RSE ? \"enabled\" : \"disabled\");",
"\tv4l2_info(sd, \"IR Transmitter:\\n\");\n\tv4l2_info(sd, \"\\tEnabled: %s\\n\",\n\t\t cntrl & CNTRL_TXE ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tModulation onto a carrier: %s\\n\",\n\t\t cntrl & CNTRL_MOD ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO: %s\\n\",\n\t\t cntrl & CNTRL_TFE ? \"enabled\" : \"disabled\");\n\tv4l2_info(sd, \"\\tFIFO interrupt watermark: %s\\n\",\n\t\t cntrl & CNTRL_TIC ? \"not empty\" : \"half full or less\");\n\tv4l2_info(sd, \"\\tOutput pin level inversion %s\\n\",\n\t\t cntrl & CNTRL_IVO ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tCarrier polarity: %s\\n\",\n\t\t cntrl & CNTRL_CPL ? \"space:burst mark:noburst\"\n\t\t\t\t : \"space:noburst mark:burst\");\n\tif (cntrl & CNTRL_MOD) {\n\t\tv4l2_info(sd, \"\\tCarrier (16 clocks): %u Hz\\n\",\n\t\t\t clock_divider_to_carrier_freq(txclk));\n\t\tv4l2_info(sd, \"\\tCarrier duty cycle: %2u/16\\n\",\n\t\t\t cduty + 1);\n\t}\n\tv4l2_info(sd, \"\\tMax pulse width: %u us, %llu ns\\n\",\n\t\t pulse_width_count_to_us(FIFO_RXTX, txclk),\n\t\t pulse_width_count_to_ns(FIFO_RXTX, txclk));\n\tv4l2_info(sd, \"\\tBusy: %s\\n\",\n\t\t stats & STATS_TBY ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service requested: %s\\n\",\n\t\t stats & STATS_TSR ? \"yes\" : \"no\");\n\tv4l2_info(sd, \"\\tFIFO service request interrupt: %s\\n\",\n\t\t irqen & IRQEN_TSE ? \"enabled\" : \"disabled\");",
"\treturn 0;\n}",
"#ifdef CONFIG_VIDEO_ADV_DEBUG\nstatic int cx23888_ir_g_register(struct v4l2_subdev *sd,\n\t\t\t\t struct v4l2_dbg_register *reg)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tu32 addr = CX23888_IR_REG_BASE + (u32) reg->reg;",
"\tif ((addr & 0x3) != 0)\n\t\treturn -EINVAL;\n\tif (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG)\n\t\treturn -EINVAL;\n\treg->size = 4;\n\treg->val = cx23888_ir_read4(state->dev, addr);\n\treturn 0;\n}",
"static int cx23888_ir_s_register(struct v4l2_subdev *sd,\n\t\t\t\t const struct v4l2_dbg_register *reg)\n{\n\tstruct cx23888_ir_state *state = to_state(sd);\n\tu32 addr = CX23888_IR_REG_BASE + (u32) reg->reg;",
"\tif ((addr & 0x3) != 0)\n\t\treturn -EINVAL;\n\tif (addr < CX23888_IR_CNTRL_REG || addr > CX23888_IR_LEARN_REG)\n\t\treturn -EINVAL;\n\tcx23888_ir_write4(state->dev, addr, reg->val);\n\treturn 0;\n}\n#endif",
"static const struct v4l2_subdev_core_ops cx23888_ir_core_ops = {\n\t.log_status = cx23888_ir_log_status,\n#ifdef CONFIG_VIDEO_ADV_DEBUG\n\t.g_register = cx23888_ir_g_register,\n\t.s_register = cx23888_ir_s_register,\n#endif\n\t.interrupt_service_routine = cx23888_ir_irq_handler,\n};",
"static const struct v4l2_subdev_ir_ops cx23888_ir_ir_ops = {\n\t.rx_read = cx23888_ir_rx_read,\n\t.rx_g_parameters = cx23888_ir_rx_g_parameters,\n\t.rx_s_parameters = cx23888_ir_rx_s_parameters,",
"\t.tx_write = cx23888_ir_tx_write,\n\t.tx_g_parameters = cx23888_ir_tx_g_parameters,\n\t.tx_s_parameters = cx23888_ir_tx_s_parameters,\n};",
"static const struct v4l2_subdev_ops cx23888_ir_controller_ops = {\n\t.core = &cx23888_ir_core_ops,\n\t.ir = &cx23888_ir_ir_ops,\n};",
"static const struct v4l2_subdev_ir_parameters default_rx_params = {\n\t.bytes_per_data_element = sizeof(union cx23888_ir_fifo_rec),\n\t.mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH,",
"\t.enable = false,\n\t.interrupt_enable = false,\n\t.shutdown = true,",
"\t.modulation = true,\n\t.carrier_freq = 36000, /* 36 kHz - RC-5, RC-6, and RC-6A carrier */",
"\t/* RC-5: 666,667 ns = 1/36 kHz * 32 cycles * 1 mark * 0.75 */\n\t/* RC-6A: 333,333 ns = 1/36 kHz * 16 cycles * 1 mark * 0.75 */\n\t.noise_filter_min_width = 333333, /* ns */\n\t.carrier_range_lower = 35000,\n\t.carrier_range_upper = 37000,\n\t.invert_level = false,\n};",
"static const struct v4l2_subdev_ir_parameters default_tx_params = {\n\t.bytes_per_data_element = sizeof(union cx23888_ir_fifo_rec),\n\t.mode = V4L2_SUBDEV_IR_MODE_PULSE_WIDTH,",
"\t.enable = false,\n\t.interrupt_enable = false,\n\t.shutdown = true,",
"\t.modulation = true,\n\t.carrier_freq = 36000, /* 36 kHz - RC-5 carrier */\n\t.duty_cycle = 25, /* 25 % - RC-5 carrier */\n\t.invert_level = false,\n\t.invert_carrier_sense = false,\n};",
"int cx23888_ir_probe(struct cx23885_dev *dev)\n{\n\tstruct cx23888_ir_state *state;\n\tstruct v4l2_subdev *sd;\n\tstruct v4l2_subdev_ir_parameters default_params;\n\tint ret;",
"\tstate = kzalloc(sizeof(struct cx23888_ir_state), GFP_KERNEL);\n\tif (state == NULL)\n\t\treturn -ENOMEM;",
"\tspin_lock_init(&state->rx_kfifo_lock);",
"\tif (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE,\n\t\t\tGFP_KERNEL)) {\n\t\tkfree(state);",
"\t\treturn -ENOMEM;",
"\t}",
"\n\tstate->dev = dev;\n\tsd = &state->sd;",
"\tv4l2_subdev_init(sd, &cx23888_ir_controller_ops);\n\tv4l2_set_subdevdata(sd, state);\n\t/* FIXME - fix the formatting of dev->v4l2_dev.name and use it */\n\tsnprintf(sd->name, sizeof(sd->name), \"%s/888-ir\", dev->name);\n\tsd->grp_id = CX23885_HW_888_IR;",
"\tret = v4l2_device_register_subdev(&dev->v4l2_dev, sd);\n\tif (ret == 0) {\n\t\t/*\n\t\t * Ensure no interrupts arrive from '888 specific conditions,\n\t\t * since we ignore them in this driver to have commonality with\n\t\t * similar IR controller cores.\n\t\t */\n\t\tcx23888_ir_write4(dev, CX23888_IR_IRQEN_REG, 0);",
"\t\tmutex_init(&state->rx_params_lock);\n\t\tdefault_params = default_rx_params;\n\t\tv4l2_subdev_call(sd, ir, rx_s_parameters, &default_params);",
"\t\tmutex_init(&state->tx_params_lock);\n\t\tdefault_params = default_tx_params;\n\t\tv4l2_subdev_call(sd, ir, tx_s_parameters, &default_params);\n\t} else {\n\t\tkfifo_free(&state->rx_kfifo);\n\t}\n\treturn ret;\n}",
"int cx23888_ir_remove(struct cx23885_dev *dev)\n{\n\tstruct v4l2_subdev *sd;\n\tstruct cx23888_ir_state *state;",
"\tsd = cx23885_find_hw(dev, CX23885_HW_888_IR);\n\tif (sd == NULL)\n\t\treturn -ENODEV;",
"\tcx23888_ir_rx_shutdown(sd);\n\tcx23888_ir_tx_shutdown(sd);",
"\tstate = to_state(sd);\n\tv4l2_device_unregister_subdev(sd);\n\tkfifo_free(&state->rx_kfifo);\n\tkfree(state);\n\t/* Nothing more to free() as state held the actual v4l2_subdev object */\n\treturn 0;\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1171], "buggy_code_start_loc": [1170], "filenames": ["drivers/media/pci/cx23885/cx23888-ir.c"], "fixing_code_end_loc": [1175], "fixing_code_start_loc": [1170], "message": "A memory leak in the cx23888_ir_probe() function in drivers/media/pci/cx23885/cx23888-ir.c in the Linux kernel through 5.3.11 allows attackers to cause a denial of service (memory consumption) by triggering kfifo_alloc() failures, aka CID-a7b2df76b42b.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "matchCriteriaId": "EB2904AC-AD7A-498D-8619-CBB421E9165D", "versionEndExcluding": null, "versionEndIncluding": "5.3.11", "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:esm:*:*:*", "matchCriteriaId": "815D70A8-47D3-459C-A32C-9FEACA0659D1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:20.04:*:*:*:lts:*:*:*", "matchCriteriaId": "902B8056-9E37-443B-8905-8AA93E2447FB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:30:*:*:*:*:*:*:*", "matchCriteriaId": "97A4B8DF-58DA-4AB6-A1F9-331B36409BA3", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:31:*:*:*:*:*:*:*", "matchCriteriaId": "80F0FA5D-8D3B-4C0E-81E2-87998286AF33", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:netapp:active_iq_unified_manager:-:*:*:*:*:vmware_vsphere:*:*", "matchCriteriaId": "3A756737-1CC4-42C2-A4DF-E1C893B4E2D5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:aff_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "5C0ADE5D-F91D-4E0D-B6C5-3511B19665F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:cloud_backup:-:*:*:*:*:*:*:*", "matchCriteriaId": "5C2089EE-5D7F-47EC-8EA5-0F69790564C4", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:data_availability_services:-:*:*:*:*:*:*:*", "matchCriteriaId": "0EF46487-B64A-454E-AECC-D74B83170ACD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.0:*:*:*:*:*:*:*", "matchCriteriaId": "8AFF1109-26F3-43A5-A4CB-0F169FDBC0DE", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.0.0:*:*:*:*:*:*:*", "matchCriteriaId": "5AF71C49-ADEF-4EE2-802C-6159ADD51355", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.20:*:*:*:*:*:*:*", "matchCriteriaId": "B3BC6E59-2134-4A28-AAD2-77C8AE236BCF", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.25:*:*:*:*:*:*:*", "matchCriteriaId": "24377899-5389-4BDC-AC82-0E4186F4DE53", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.30:*:*:*:*:*:*:*", "matchCriteriaId": "23FE83DE-AE7C-4313-88E3-886110C31302", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.30.5r3:*:*:*:*:*:*:*", "matchCriteriaId": "490B327B-AC20-419B-BB76-8AB6971304BB", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.40:*:*:*:*:*:*:*", "matchCriteriaId": "8DCE2754-7A9E-4B3B-91D1-DCF90C1BABE5", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.40.3r2:*:*:*:*:*:*:*", "matchCriteriaId": "6CA74E8B-51E2-4A7C-8A98-0583D31134A6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.40.5:*:*:*:*:*:*:*", "matchCriteriaId": "7B64AB37-A1D9-4163-A51B-4C780361F1F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.50.1:*:*:*:*:*:*:*", "matchCriteriaId": "7BE9C9D7-9CED-4184-A190-1024A6FB8C82", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.50.2:-:*:*:*:*:*:*", "matchCriteriaId": "B73D4C3C-A511-4E14-B19F-91F561ACB1B8", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.50.2:p1:*:*:*:*:*:*", "matchCriteriaId": "0C47D72C-9B6B-4E52-AF0E-56AD58E4A930", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60:*:*:*:*:*:*:*", "matchCriteriaId": "039C3790-5AA2-4895-AEAE-CC84A71DB907", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60.0:*:*:*:*:*:*:*", "matchCriteriaId": "B4592238-D1F2-43D6-9BAB-2F63ECF9C965", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60.1:*:*:*:*:*:*:*", "matchCriteriaId": "0BA78068-80E9-4E49-9056-88EAB7E3682C", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.60.3:*:*:*:*:*:*:*", "matchCriteriaId": "092F366C-E8B0-4BE5-B106-0B7A73B08D34", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.70.1:*:*:*:*:*:*:*", "matchCriteriaId": "E7992E92-B159-4810-B895-01A9B944058A", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:e-series_santricity_os_controller:11.70.2:*:*:*:*:*:*:*", "matchCriteriaId": "5BDD7AAB-2BF3-4E8C-BEE2-5217E2926C11", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:fas\\/aff_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "66EEA3CA-8CC7-4F0B-8204-6132D4114873", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:hci_baseboard_management_controller:h610s:*:*:*:*:*:*:*", "matchCriteriaId": "DE7C6010-F736-4BDA-9E3B-C4370BBFA149", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:solidfire\\,_enterprise_sds_\\&_hci_storage_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "DAA3919C-B2B1-4CB5-BA76-7A079AAFFC52", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:solidfire_\\&_hci_management_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "D6D700C5-F67F-4FFB-BE69-D524592A3D2E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:netapp:steelstore_cloud_integrated_storage:-:*:*:*:*:*:*:*", "matchCriteriaId": "E94F7F59-1785-493F-91A7-5F5EA5E87E4D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:broadcom:brocade_fabric_operating_system_firmware:-:*:*:*:*:*:*:*", "matchCriteriaId": "B2748912-FC54-47F6-8C0C-B96784765B8E", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:netapp:hci_compute_node_firmware:-:*:*:*:*:*:*:*", "matchCriteriaId": "F921BC85-568E-4B69-A3CD-CF75C76672F1", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}, {"cpeMatch": [{"criteria": "cpe:2.3:h:netapp:hci_compute_node:-:*:*:*:*:*:*:*", "matchCriteriaId": "AD7447BC-F315-4298-A822-549942FC118B", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": false}], "negate": false, "operator": "OR"}], "operator": "AND"}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:netapp:solidfire_baseboard_management_controller_firmware:-:*:*:*:*:*:*:*", "matchCriteriaId": "FB9B8171-F6CA-427D-81E0-6536D3BBFA8D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}, {"cpeMatch": [{"criteria": "cpe:2.3:h:netapp:solidfire_baseboard_management_controller:-:*:*:*:*:*:*:*", "matchCriteriaId": "090AA6F4-4404-4E26-82AB-C3A22636F276", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": false}], "negate": false, "operator": "OR"}], "operator": "AND"}], "descriptions": [{"lang": "en", "value": "A memory leak in the cx23888_ir_probe() function in drivers/media/pci/cx23885/cx23888-ir.c in the Linux kernel through 5.3.11 allows attackers to cause a denial of service (memory consumption) by triggering kfifo_alloc() failures, aka CID-a7b2df76b42b."}, {"lang": "es", "value": "Una p\u00e9rdida de memoria en la funci\u00f3n cx23888_ir_probe() en el archivo drivers/media/pci/cx23885/cx23888-ir.c en el kernel de Linux versiones hasta la versi\u00f3n 5.3.11, permite a atacantes causar una denegaci\u00f3n de servicio (consumo de memoria) al desencadenar fallos de la funci\u00f3n de kfifo_alloc(), tambi\u00e9n se conoce como CID-a7b2df76b42b."}], "evaluatorComment": null, "id": "CVE-2019-19054", "lastModified": "2022-11-08T03:18:07.597", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "LOCAL", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 4.7, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:L/AC:M/Au:N/C:N/I:N/A:C", "version": "2.0"}, "exploitabilityScore": 3.4, "impactScore": 6.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 4.7, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 1.0, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-11-18T06:15:11.967", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2020-03/msg00021.html"}, {"source": "cve@mitre.org", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/torvalds/linux/commit/a7b2df76b42bdd026e3106cf2ba97db41345a177"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/O3PSDE6PTOTVBK2YTKB2TFQP2SUBVSNF/"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PY7LJMSPAGRIKABJPDKQDTXYW3L5RX2T/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://security.netapp.com/advisory/ntap-20191205-0001/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4525-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4526-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4527-1/"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-401"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/torvalds/linux/commit/a7b2df76b42bdd026e3106cf2ba97db41345a177"}, "type": "CWE-401"}
| 97
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"'use strict';",
"var doctypes = require('doctypes');\nvar makeError = require('pug-error');\nvar buildRuntime = require('pug-runtime/build');\nvar runtime = require('pug-runtime');\nvar compileAttrs = require('pug-attrs');\nvar selfClosing = require('void-elements');\nvar constantinople = require('constantinople');\nvar stringify = require('js-stringify');\nvar addWith = require('with');",
"// This is used to prevent pretty printing inside certain tags\nvar WHITE_SPACE_SENSITIVE_TAGS = {\n pre: true,\n textarea: true,\n};",
"var INTERNAL_VARIABLES = [\n 'pug',\n 'pug_mixins',\n 'pug_interp',\n 'pug_debug_filename',\n 'pug_debug_line',\n 'pug_debug_sources',\n 'pug_html',\n];",
"module.exports = generateCode;\nmodule.exports.CodeGenerator = Compiler;\nfunction generateCode(ast, options) {\n return new Compiler(ast, options).compile();\n}",
"function isConstant(src) {\n return constantinople(src, {pug: runtime, pug_interp: undefined});\n}\nfunction toConstant(src) {\n return constantinople.toConstant(src, {pug: runtime, pug_interp: undefined});\n}",
"/**\n * Initialize `Compiler` with the given `node`.\n *\n * @param {Node} node\n * @param {Object} options\n * @api public\n */",
"function Compiler(node, options) {\n this.options = options = options || {};\n this.node = node;\n this.bufferedConcatenationCount = 0;\n this.hasCompiledDoctype = false;\n this.hasCompiledTag = false;\n this.pp = options.pretty || false;\n if (this.pp && typeof this.pp !== 'string') {\n this.pp = ' ';",
"",
" }\n this.debug = false !== options.compileDebug;\n this.indents = 0;\n this.parentIndents = 0;\n this.terse = false;\n this.mixins = {};\n this.dynamicMixins = false;\n this.eachCount = 0;\n if (options.doctype) this.setDoctype(options.doctype);\n this.runtimeFunctionsUsed = [];\n this.inlineRuntimeFunctions = options.inlineRuntimeFunctions || false;\n if (this.debug && this.inlineRuntimeFunctions) {\n this.runtimeFunctionsUsed.push('rethrow');\n }\n}",
"/**\n * Compiler prototype.\n */",
"Compiler.prototype = {\n runtime: function(name) {\n if (this.inlineRuntimeFunctions) {\n this.runtimeFunctionsUsed.push(name);\n return 'pug_' + name;\n } else {\n return 'pug.' + name;\n }\n },",
" error: function(message, code, node) {\n var err = makeError(code, message, {\n line: node.line,\n column: node.column,\n filename: node.filename,\n });\n throw err;\n },",
" /**\n * Compile parse tree to JavaScript.\n *\n * @api public\n */",
" compile: function() {\n this.buf = [];\n if (this.pp) this.buf.push('var pug_indent = [];');\n this.lastBufferedIdx = -1;\n this.visit(this.node);\n if (!this.dynamicMixins) {\n // if there are no dynamic mixins we can remove any un-used mixins\n var mixinNames = Object.keys(this.mixins);\n for (var i = 0; i < mixinNames.length; i++) {\n var mixin = this.mixins[mixinNames[i]];\n if (!mixin.used) {\n for (var x = 0; x < mixin.instances.length; x++) {\n for (\n var y = mixin.instances[x].start;\n y < mixin.instances[x].end;\n y++\n ) {\n this.buf[y] = '';\n }\n }\n }\n }\n }\n var js = this.buf.join('\\n');\n var globals = this.options.globals\n ? this.options.globals.concat(INTERNAL_VARIABLES)\n : INTERNAL_VARIABLES;\n if (this.options.self) {\n js = 'var self = locals || {};' + js;\n } else {\n js = addWith(\n 'locals || {}',\n js,\n globals.concat(\n this.runtimeFunctionsUsed.map(function(name) {\n return 'pug_' + name;\n })\n )\n );\n }\n if (this.debug) {\n if (this.options.includeSources) {\n js =\n 'var pug_debug_sources = ' +\n stringify(this.options.includeSources) +\n ';\\n' +\n js;\n }\n js =\n 'var pug_debug_filename, pug_debug_line;' +\n 'try {' +\n js +\n '} catch (err) {' +\n (this.inlineRuntimeFunctions ? 'pug_rethrow' : 'pug.rethrow') +\n '(err, pug_debug_filename, pug_debug_line' +\n (this.options.includeSources\n ? ', pug_debug_sources[pug_debug_filename]'\n : '') +\n ');' +\n '}';\n }\n return (\n buildRuntime(this.runtimeFunctionsUsed) +\n 'function ' +\n (this.options.templateName || 'template') +\n '(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;' +\n js +\n ';return pug_html;}'\n );\n },",
" /**\n * Sets the default doctype `name`. Sets terse mode to `true` when\n * html 5 is used, causing self-closing tags to end with \">\" vs \"/>\",\n * and boolean attributes are not mirrored.\n *\n * @param {string} name\n * @api public\n */",
" setDoctype: function(name) {\n this.doctype = doctypes[name.toLowerCase()] || '<!DOCTYPE ' + name + '>';\n this.terse = this.doctype.toLowerCase() == '<!doctype html>';\n this.xml = 0 == this.doctype.indexOf('<?xml');\n },",
" /**\n * Buffer the given `str` exactly as is or with interpolation\n *\n * @param {String} str\n * @param {Boolean} interpolate\n * @api public\n */",
" buffer: function(str) {\n var self = this;",
" str = stringify(str);\n str = str.substr(1, str.length - 2);",
" if (\n this.lastBufferedIdx == this.buf.length &&\n this.bufferedConcatenationCount < 100\n ) {\n if (this.lastBufferedType === 'code') {\n this.lastBuffered += ' + \"';\n this.bufferedConcatenationCount++;\n }\n this.lastBufferedType = 'text';\n this.lastBuffered += str;\n this.buf[this.lastBufferedIdx - 1] =\n 'pug_html = pug_html + ' +\n this.bufferStartChar +\n this.lastBuffered +\n '\";';\n } else {\n this.bufferedConcatenationCount = 0;\n this.buf.push('pug_html = pug_html + \"' + str + '\";');\n this.lastBufferedType = 'text';\n this.bufferStartChar = '\"';\n this.lastBuffered = str;\n this.lastBufferedIdx = this.buf.length;\n }\n },",
" /**\n * Buffer the given `src` so it is evaluated at run time\n *\n * @param {String} src\n * @api public\n */",
" bufferExpression: function(src) {\n if (isConstant(src)) {\n return this.buffer(toConstant(src) + '');\n }\n if (\n this.lastBufferedIdx == this.buf.length &&\n this.bufferedConcatenationCount < 100\n ) {\n this.bufferedConcatenationCount++;\n if (this.lastBufferedType === 'text') this.lastBuffered += '\"';\n this.lastBufferedType = 'code';\n this.lastBuffered += ' + (' + src + ')';\n this.buf[this.lastBufferedIdx - 1] =\n 'pug_html = pug_html + (' +\n this.bufferStartChar +\n this.lastBuffered +\n ');';\n } else {\n this.bufferedConcatenationCount = 0;\n this.buf.push('pug_html = pug_html + (' + src + ');');\n this.lastBufferedType = 'code';\n this.bufferStartChar = '';\n this.lastBuffered = '(' + src + ')';\n this.lastBufferedIdx = this.buf.length;\n }\n },",
" /**\n * Buffer an indent based on the current `indent`\n * property and an additional `offset`.\n *\n * @param {Number} offset\n * @param {Boolean} newline\n * @api public\n */",
" prettyIndent: function(offset, newline) {\n offset = offset || 0;\n newline = newline ? '\\n' : '';\n this.buffer(newline + Array(this.indents + offset).join(this.pp));\n if (this.parentIndents)\n this.buf.push('pug_html = pug_html + pug_indent.join(\"\");');\n },",
" /**\n * Visit `node`.\n *\n * @param {Node} node\n * @api public\n */",
" visit: function(node, parent) {\n var debug = this.debug;",
" if (!node) {\n var msg;\n if (parent) {\n msg =\n 'A child of ' +\n parent.type +\n ' (' +\n (parent.filename || 'Pug') +\n ':' +\n parent.line +\n ')';\n } else {\n msg = 'A top-level node';\n }\n msg += ' is ' + node + ', expected a Pug AST Node.';\n throw new TypeError(msg);\n }",
" if (debug && node.debug !== false && node.type !== 'Block') {\n if (node.line) {\n var js = ';pug_debug_line = ' + node.line;\n if (node.filename)\n js += ';pug_debug_filename = ' + stringify(node.filename);\n this.buf.push(js + ';');\n }\n }",
" if (!this['visit' + node.type]) {\n var msg;\n if (parent) {\n msg = 'A child of ' + parent.type;\n } else {\n msg = 'A top-level node';\n }\n msg +=\n ' (' +\n (node.filename || 'Pug') +\n ':' +\n node.line +\n ')' +\n ' is of type ' +\n node.type +\n ',' +\n ' which is not supported by pug-code-gen.';\n switch (node.type) {\n case 'Filter':\n msg += ' Please use pug-filters to preprocess this AST.';\n break;\n case 'Extends':\n case 'Include':\n case 'NamedBlock':\n case 'FileReference': // unlikely but for the sake of completeness\n msg += ' Please use pug-linker to preprocess this AST.';\n break;\n }\n throw new TypeError(msg);\n }",
" this.visitNode(node);\n },",
" /**\n * Visit `node`.\n *\n * @param {Node} node\n * @api public\n */",
" visitNode: function(node) {\n return this['visit' + node.type](node);\n },",
" /**\n * Visit case `node`.\n *\n * @param {Literal} node\n * @api public\n */",
" visitCase: function(node) {\n this.buf.push('switch (' + node.expr + '){');\n this.visit(node.block, node);\n this.buf.push('}');\n },",
" /**\n * Visit when `node`.\n *\n * @param {Literal} node\n * @api public\n */",
" visitWhen: function(node) {\n if ('default' == node.expr) {\n this.buf.push('default:');\n } else {\n this.buf.push('case ' + node.expr + ':');\n }\n if (node.block) {\n this.visit(node.block, node);\n this.buf.push(' break;');\n }\n },",
" /**\n * Visit literal `node`.\n *\n * @param {Literal} node\n * @api public\n */",
" visitLiteral: function(node) {\n this.buffer(node.str);\n },",
" visitNamedBlock: function(block) {\n return this.visitBlock(block);\n },\n /**\n * Visit all nodes in `block`.\n *\n * @param {Block} block\n * @api public\n */",
" visitBlock: function(block) {\n var escapePrettyMode = this.escapePrettyMode;\n var pp = this.pp;",
" // Pretty print multi-line text\n if (\n pp &&\n block.nodes.length > 1 &&\n !escapePrettyMode &&\n block.nodes[0].type === 'Text' &&\n block.nodes[1].type === 'Text'\n ) {\n this.prettyIndent(1, true);\n }\n for (var i = 0; i < block.nodes.length; ++i) {\n // Pretty print text\n if (\n pp &&\n i > 0 &&\n !escapePrettyMode &&\n block.nodes[i].type === 'Text' &&\n block.nodes[i - 1].type === 'Text' &&\n /\\n$/.test(block.nodes[i - 1].val)\n ) {\n this.prettyIndent(1, false);\n }\n this.visit(block.nodes[i], block);\n }\n },",
" /**\n * Visit a mixin's `block` keyword.\n *\n * @param {MixinBlock} block\n * @api public\n */",
" visitMixinBlock: function(block) {\n if (this.pp)\n this.buf.push(",
" \"pug_indent.push('\" + Array(this.indents + 1).join(this.pp) + \"');\"",
" );\n this.buf.push('block && block();');\n if (this.pp) this.buf.push('pug_indent.pop();');\n },",
" /**\n * Visit `doctype`. Sets terse mode to `true` when html 5\n * is used, causing self-closing tags to end with \">\" vs \"/>\",\n * and boolean attributes are not mirrored.\n *\n * @param {Doctype} doctype\n * @api public\n */",
" visitDoctype: function(doctype) {\n if (doctype && (doctype.val || !this.doctype)) {\n this.setDoctype(doctype.val || 'html');\n }",
" if (this.doctype) this.buffer(this.doctype);\n this.hasCompiledDoctype = true;\n },",
" /**\n * Visit `mixin`, generating a function that\n * may be called within the template.\n *\n * @param {Mixin} mixin\n * @api public\n */",
" visitMixin: function(mixin) {\n var name = 'pug_mixins[';\n var args = mixin.args || '';\n var block = mixin.block;\n var attrs = mixin.attrs;\n var attrsBlocks = this.attributeBlocks(mixin.attributeBlocks);\n var pp = this.pp;\n var dynamic = mixin.name[0] === '#';\n var key = mixin.name;\n if (dynamic) this.dynamicMixins = true;\n name +=\n (dynamic\n ? mixin.name.substr(2, mixin.name.length - 3)\n : '\"' + mixin.name + '\"') + ']';",
" this.mixins[key] = this.mixins[key] || {used: false, instances: []};\n if (mixin.call) {\n this.mixins[key].used = true;\n if (pp)\n this.buf.push(",
" \"pug_indent.push('\" + Array(this.indents + 1).join(pp) + \"');\"",
" );\n if (block || attrs.length || attrsBlocks.length) {\n this.buf.push(name + '.call({');",
" if (block) {\n this.buf.push('block: function(){');",
" // Render block with no indents, dynamically added when rendered\n this.parentIndents++;\n var _indents = this.indents;\n this.indents = 0;\n this.visit(mixin.block, mixin);\n this.indents = _indents;\n this.parentIndents--;",
" if (attrs.length || attrsBlocks.length) {\n this.buf.push('},');\n } else {\n this.buf.push('}');\n }\n }",
" if (attrsBlocks.length) {\n if (attrs.length) {\n var val = this.attrs(attrs);\n attrsBlocks.unshift(val);\n }\n if (attrsBlocks.length > 1) {\n this.buf.push(\n 'attributes: ' +\n this.runtime('merge') +\n '([' +\n attrsBlocks.join(',') +\n '])'\n );\n } else {\n this.buf.push('attributes: ' + attrsBlocks[0]);\n }\n } else if (attrs.length) {\n var val = this.attrs(attrs);\n this.buf.push('attributes: ' + val);\n }",
" if (args) {\n this.buf.push('}, ' + args + ');');\n } else {\n this.buf.push('});');\n }\n } else {\n this.buf.push(name + '(' + args + ');');\n }\n if (pp) this.buf.push('pug_indent.pop();');\n } else {\n var mixin_start = this.buf.length;\n args = args ? args.split(',') : [];\n var rest;\n if (args.length && /^\\.\\.\\./.test(args[args.length - 1].trim())) {\n rest = args\n .pop()\n .trim()\n .replace(/^\\.\\.\\./, '');\n }\n // we need use pug_interp here for v8: https://code.google.com/p/v8/issues/detail?id=4165\n // once fixed, use this: this.buf.push(name + ' = function(' + args.join(',') + '){');\n this.buf.push(name + ' = pug_interp = function(' + args.join(',') + '){');\n this.buf.push(\n 'var block = (this && this.block), attributes = (this && this.attributes) || {};'\n );\n if (rest) {\n this.buf.push('var ' + rest + ' = [];');\n this.buf.push(\n 'for (pug_interp = ' +\n args.length +\n '; pug_interp < arguments.length; pug_interp++) {'\n );\n this.buf.push(' ' + rest + '.push(arguments[pug_interp]);');\n this.buf.push('}');\n }\n this.parentIndents++;\n this.visit(block, mixin);\n this.parentIndents--;\n this.buf.push('};');\n var mixin_end = this.buf.length;\n this.mixins[key].instances.push({start: mixin_start, end: mixin_end});\n }\n },",
" /**\n * Visit `tag` buffering tag markup, generating\n * attributes, visiting the `tag`'s code and block.\n *\n * @param {Tag} tag\n * @param {boolean} interpolated\n * @api public\n */",
" visitTag: function(tag, interpolated) {\n this.indents++;\n var name = tag.name,\n pp = this.pp,\n self = this;",
" function bufferName() {\n if (interpolated) self.bufferExpression(tag.expr);\n else self.buffer(name);\n }",
" if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true)\n this.escapePrettyMode = true;",
" if (!this.hasCompiledTag) {\n if (!this.hasCompiledDoctype && 'html' == name) {\n this.visitDoctype();\n }\n this.hasCompiledTag = true;\n }",
" // pretty print\n if (pp && !tag.isInline) this.prettyIndent(0, true);\n if (tag.selfClosing || (!this.xml && selfClosing[tag.name])) {\n this.buffer('<');\n bufferName();\n this.visitAttributes(\n tag.attrs,\n this.attributeBlocks(tag.attributeBlocks)\n );\n if (this.terse && !tag.selfClosing) {\n this.buffer('>');\n } else {\n this.buffer('/>');\n }\n // if it is non-empty throw an error\n if (\n tag.code ||\n (tag.block &&\n !(tag.block.type === 'Block' && tag.block.nodes.length === 0) &&\n tag.block.nodes.some(function(tag) {\n return tag.type !== 'Text' || !/^\\s*$/.test(tag.val);\n }))\n ) {\n this.error(\n name +\n ' is a self closing element: <' +\n name +\n '/> but contains nested content.',\n 'SELF_CLOSING_CONTENT',\n tag\n );\n }\n } else {\n // Optimize attributes buffering\n this.buffer('<');\n bufferName();\n this.visitAttributes(\n tag.attrs,\n this.attributeBlocks(tag.attributeBlocks)\n );\n this.buffer('>');\n if (tag.code) this.visitCode(tag.code);\n this.visit(tag.block, tag);",
" // pretty print\n if (\n pp &&\n !tag.isInline &&\n WHITE_SPACE_SENSITIVE_TAGS[tag.name] !== true &&\n !tagCanInline(tag)\n )\n this.prettyIndent(0, true);",
" this.buffer('</');\n bufferName();\n this.buffer('>');\n }",
" if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true)\n this.escapePrettyMode = false;",
" this.indents--;\n },",
" /**\n * Visit InterpolatedTag.\n *\n * @param {InterpolatedTag} tag\n * @api public\n */",
" visitInterpolatedTag: function(tag) {\n return this.visitTag(tag, true);\n },",
" /**\n * Visit `text` node.\n *\n * @param {Text} text\n * @api public\n */",
" visitText: function(text) {\n this.buffer(text.val);\n },",
" /**\n * Visit a `comment`, only buffering when the buffer flag is set.\n *\n * @param {Comment} comment\n * @api public\n */",
" visitComment: function(comment) {\n if (!comment.buffer) return;\n if (this.pp) this.prettyIndent(1, true);\n this.buffer('<!--' + comment.val + '-->');\n },",
" /**\n * Visit a `YieldBlock`.\n *\n * This is necessary since we allow compiling a file with `yield`.\n *\n * @param {YieldBlock} block\n * @api public\n */",
" visitYieldBlock: function(block) {},",
" /**\n * Visit a `BlockComment`.\n *\n * @param {Comment} comment\n * @api public\n */",
" visitBlockComment: function(comment) {\n if (!comment.buffer) return;\n if (this.pp) this.prettyIndent(1, true);\n this.buffer('<!--' + (comment.val || ''));\n this.visit(comment.block, comment);\n if (this.pp) this.prettyIndent(1, true);\n this.buffer('-->');\n },",
" /**\n * Visit `code`, respecting buffer / escape flags.\n * If the code is followed by a block, wrap it in\n * a self-calling function.\n *\n * @param {Code} code\n * @api public\n */",
" visitCode: function(code) {\n // Wrap code blocks with {}.\n // we only wrap unbuffered code blocks ATM\n // since they are usually flow control",
" // Buffer code\n if (code.buffer) {\n var val = code.val.trim();\n val = 'null == (pug_interp = ' + val + ') ? \"\" : pug_interp';\n if (code.mustEscape !== false)\n val = this.runtime('escape') + '(' + val + ')';\n this.bufferExpression(val);\n } else {\n this.buf.push(code.val);\n }",
" // Block support\n if (code.block) {\n if (!code.buffer) this.buf.push('{');\n this.visit(code.block, code);\n if (!code.buffer) this.buf.push('}');\n }\n },",
" /**\n * Visit `Conditional`.\n *\n * @param {Conditional} cond\n * @api public\n */",
" visitConditional: function(cond) {\n var test = cond.test;\n this.buf.push('if (' + test + ') {');\n this.visit(cond.consequent, cond);\n this.buf.push('}');\n if (cond.alternate) {\n if (cond.alternate.type === 'Conditional') {\n this.buf.push('else');\n this.visitConditional(cond.alternate);\n } else {\n this.buf.push('else {');\n this.visit(cond.alternate, cond);\n this.buf.push('}');\n }\n }\n },",
" /**\n * Visit `While`.\n *\n * @param {While} loop\n * @api public\n */",
" visitWhile: function(loop) {\n var test = loop.test;\n this.buf.push('while (' + test + ') {');\n this.visit(loop.block, loop);\n this.buf.push('}');\n },",
" /**\n * Visit `each` block.\n *\n * @param {Each} each\n * @api public\n */",
" visitEach: function(each) {\n var indexVarName = each.key || 'pug_index' + this.eachCount;\n this.eachCount++;",
" this.buf.push(\n '' +\n '// iterate ' +\n each.obj +\n '\\n' +\n ';(function(){\\n' +\n ' var $$obj = ' +\n each.obj +\n ';\\n' +\n \" if ('number' == typeof $$obj.length) {\"\n );",
" if (each.alternate) {\n this.buf.push(' if ($$obj.length) {');\n }",
" this.buf.push(\n '' +\n ' for (var ' +\n indexVarName +\n ' = 0, $$l = $$obj.length; ' +\n indexVarName +\n ' < $$l; ' +\n indexVarName +\n '++) {\\n' +\n ' var ' +\n each.val +\n ' = $$obj[' +\n indexVarName +\n '];'\n );",
" this.visit(each.block, each);",
" this.buf.push(' }');",
" if (each.alternate) {\n this.buf.push(' } else {');\n this.visit(each.alternate, each);\n this.buf.push(' }');\n }",
" this.buf.push(\n '' +\n ' } else {\\n' +\n ' var $$l = 0;\\n' +\n ' for (var ' +\n indexVarName +\n ' in $$obj) {\\n' +\n ' $$l++;\\n' +\n ' var ' +\n each.val +\n ' = $$obj[' +\n indexVarName +\n '];'\n );",
" this.visit(each.block, each);",
" this.buf.push(' }');\n if (each.alternate) {\n this.buf.push(' if ($$l === 0) {');\n this.visit(each.alternate, each);\n this.buf.push(' }');\n }\n this.buf.push(' }\\n}).call(this);\\n');\n },",
" visitEachOf: function(each) {\n this.buf.push(\n '' +\n '// iterate ' +\n each.obj +\n '\\n' +\n 'for (const ' +\n each.val +\n ' of ' +\n each.obj +\n ') {\\n'\n );",
" this.visit(each.block, each);",
" this.buf.push('}\\n');\n },",
" /**\n * Visit `attrs`.\n *\n * @param {Array} attrs\n * @api public\n */",
" visitAttributes: function(attrs, attributeBlocks) {\n if (attributeBlocks.length) {\n if (attrs.length) {\n var val = this.attrs(attrs);\n attributeBlocks.unshift(val);\n }\n if (attributeBlocks.length > 1) {\n this.bufferExpression(\n this.runtime('attrs') +\n '(' +\n this.runtime('merge') +\n '([' +\n attributeBlocks.join(',') +\n ']), ' +\n stringify(this.terse) +\n ')'\n );\n } else {\n this.bufferExpression(\n this.runtime('attrs') +\n '(' +\n attributeBlocks[0] +\n ', ' +\n stringify(this.terse) +\n ')'\n );\n }\n } else if (attrs.length) {\n this.attrs(attrs, true);\n }\n },",
" /**\n * Compile attributes.\n */",
" attrs: function(attrs, buffer) {\n var res = compileAttrs(attrs, {\n terse: this.terse,\n format: buffer ? 'html' : 'object',\n runtime: this.runtime.bind(this),\n });\n if (buffer) {\n this.bufferExpression(res);\n }\n return res;\n },",
" /**\n * Compile attribute blocks.\n */",
" attributeBlocks: function(attributeBlocks) {\n return (\n attributeBlocks &&\n attributeBlocks.slice().map(function(attrBlock) {\n return attrBlock.val;\n })\n );\n },\n};",
"function tagCanInline(tag) {\n function isInline(node) {\n // Recurse if the node is a block\n if (node.type === 'Block') return node.nodes.every(isInline);\n // When there is a YieldBlock here, it is an indication that the file is\n // expected to be included but is not. If this is the case, the block\n // must be empty.\n if (node.type === 'YieldBlock') return true;\n return (node.type === 'Text' && !/\\n/.test(node.val)) || node.isInline;\n }",
" return tag.block.nodes.every(isInline);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [508], "buggy_code_start_loc": [58], "filenames": ["packages/pug-code-gen/index.js"], "fixing_code_end_loc": [517], "fixing_code_start_loc": [59], "message": "Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend. This is fixed in version 3.0.1. This advisory applies to multiple pug packages including \"pug\", \"pug-code-gen\". pug-code-gen has a backported fix at version 2.0.3. This advisory is not exploitable if there is no way for un-trusted input to be passed to pug as the `pretty` option, e.g. if you compile templates in advance before applying user input to them, you do not need to upgrade.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:pugjs:pug:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "AE43CE50-8DE8-4487-BCCB-9E3931241EB2", "versionEndExcluding": "3.0.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "F0CD8CA7-F670-4B0A-9639-E7D60F401DBB", "versionEndExcluding": "2.0.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "55FCB9F1-8C93-474D-9137-CB14C8F9F05E", "versionEndExcluding": "3.0.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "3.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend. This is fixed in version 3.0.1. This advisory applies to multiple pug packages including \"pug\", \"pug-code-gen\". pug-code-gen has a backported fix at version 2.0.3. This advisory is not exploitable if there is no way for un-trusted input to be passed to pug as the `pretty` option, e.g. if you compile templates in advance before applying user input to them, you do not need to upgrade."}, {"lang": "es", "value": "Pug es un paquete npm que es un motor de plantillas de alto rendimiento. En pug antes de la versi\u00f3n 3.0.1, si un atacante remoto era capaz de controlar la opci\u00f3n `pretty` del compilador de pug, por ejemplo, si extend\u00eda un objeto proporcionado por el usuario, como los par\u00e1metros de consulta de una solicitud, en las entradas de la plantilla de pug, era posible que lograra la ejecuci\u00f3n remota de c\u00f3digo en el backend de node.js. Esto se ha corregido en la versi\u00f3n 3.0.1. Este aviso se aplica a varios paquetes de pug, incluyendo \"pug\", \"pug-code-gen\". pug-code-gen tiene una correcci\u00f3n con soporte en la versi\u00f3n 2.0.3. Este aviso no es explotable si no hay forma de pasar a pug entradas no confiables como la opci\u00f3n `pretty`, por ejemplo, si compila las plantillas por adelantado antes de aplicarles las entradas del usuario, no necesita actualizar"}], "evaluatorComment": null, "id": "CVE-2021-21353", "lastModified": "2021-03-09T15:35:21.997", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.0, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 6.0, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 4.0, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-03-03T02:15:13.143", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/issues/3312"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/pull/3314"}, {"source": "security-advisories@github.com", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/releases/tag/pug%403.0.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://www.npmjs.com/package/pug"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://www.npmjs.com/package/pug-code-gen"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"}, "type": "CWE-74"}
| 98
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"'use strict';",
"var doctypes = require('doctypes');\nvar makeError = require('pug-error');\nvar buildRuntime = require('pug-runtime/build');\nvar runtime = require('pug-runtime');\nvar compileAttrs = require('pug-attrs');\nvar selfClosing = require('void-elements');\nvar constantinople = require('constantinople');\nvar stringify = require('js-stringify');\nvar addWith = require('with');",
"// This is used to prevent pretty printing inside certain tags\nvar WHITE_SPACE_SENSITIVE_TAGS = {\n pre: true,\n textarea: true,\n};",
"var INTERNAL_VARIABLES = [\n 'pug',\n 'pug_mixins',\n 'pug_interp',\n 'pug_debug_filename',\n 'pug_debug_line',\n 'pug_debug_sources',\n 'pug_html',\n];",
"module.exports = generateCode;\nmodule.exports.CodeGenerator = Compiler;\nfunction generateCode(ast, options) {\n return new Compiler(ast, options).compile();\n}",
"function isConstant(src) {\n return constantinople(src, {pug: runtime, pug_interp: undefined});\n}\nfunction toConstant(src) {\n return constantinople.toConstant(src, {pug: runtime, pug_interp: undefined});\n}",
"/**\n * Initialize `Compiler` with the given `node`.\n *\n * @param {Node} node\n * @param {Object} options\n * @api public\n */",
"function Compiler(node, options) {\n this.options = options = options || {};\n this.node = node;\n this.bufferedConcatenationCount = 0;\n this.hasCompiledDoctype = false;\n this.hasCompiledTag = false;\n this.pp = options.pretty || false;\n if (this.pp && typeof this.pp !== 'string') {\n this.pp = ' ';",
" }\n if (this.pp && !/^\\s+$/.test(this.pp)) {\n throw new Error(\n 'The pretty parameter should either be a boolean or whitespace only string'\n );",
" }\n this.debug = false !== options.compileDebug;\n this.indents = 0;\n this.parentIndents = 0;\n this.terse = false;\n this.mixins = {};\n this.dynamicMixins = false;\n this.eachCount = 0;\n if (options.doctype) this.setDoctype(options.doctype);\n this.runtimeFunctionsUsed = [];\n this.inlineRuntimeFunctions = options.inlineRuntimeFunctions || false;\n if (this.debug && this.inlineRuntimeFunctions) {\n this.runtimeFunctionsUsed.push('rethrow');\n }\n}",
"/**\n * Compiler prototype.\n */",
"Compiler.prototype = {\n runtime: function(name) {\n if (this.inlineRuntimeFunctions) {\n this.runtimeFunctionsUsed.push(name);\n return 'pug_' + name;\n } else {\n return 'pug.' + name;\n }\n },",
" error: function(message, code, node) {\n var err = makeError(code, message, {\n line: node.line,\n column: node.column,\n filename: node.filename,\n });\n throw err;\n },",
" /**\n * Compile parse tree to JavaScript.\n *\n * @api public\n */",
" compile: function() {\n this.buf = [];\n if (this.pp) this.buf.push('var pug_indent = [];');\n this.lastBufferedIdx = -1;\n this.visit(this.node);\n if (!this.dynamicMixins) {\n // if there are no dynamic mixins we can remove any un-used mixins\n var mixinNames = Object.keys(this.mixins);\n for (var i = 0; i < mixinNames.length; i++) {\n var mixin = this.mixins[mixinNames[i]];\n if (!mixin.used) {\n for (var x = 0; x < mixin.instances.length; x++) {\n for (\n var y = mixin.instances[x].start;\n y < mixin.instances[x].end;\n y++\n ) {\n this.buf[y] = '';\n }\n }\n }\n }\n }\n var js = this.buf.join('\\n');\n var globals = this.options.globals\n ? this.options.globals.concat(INTERNAL_VARIABLES)\n : INTERNAL_VARIABLES;\n if (this.options.self) {\n js = 'var self = locals || {};' + js;\n } else {\n js = addWith(\n 'locals || {}',\n js,\n globals.concat(\n this.runtimeFunctionsUsed.map(function(name) {\n return 'pug_' + name;\n })\n )\n );\n }\n if (this.debug) {\n if (this.options.includeSources) {\n js =\n 'var pug_debug_sources = ' +\n stringify(this.options.includeSources) +\n ';\\n' +\n js;\n }\n js =\n 'var pug_debug_filename, pug_debug_line;' +\n 'try {' +\n js +\n '} catch (err) {' +\n (this.inlineRuntimeFunctions ? 'pug_rethrow' : 'pug.rethrow') +\n '(err, pug_debug_filename, pug_debug_line' +\n (this.options.includeSources\n ? ', pug_debug_sources[pug_debug_filename]'\n : '') +\n ');' +\n '}';\n }\n return (\n buildRuntime(this.runtimeFunctionsUsed) +\n 'function ' +\n (this.options.templateName || 'template') +\n '(locals) {var pug_html = \"\", pug_mixins = {}, pug_interp;' +\n js +\n ';return pug_html;}'\n );\n },",
" /**\n * Sets the default doctype `name`. Sets terse mode to `true` when\n * html 5 is used, causing self-closing tags to end with \">\" vs \"/>\",\n * and boolean attributes are not mirrored.\n *\n * @param {string} name\n * @api public\n */",
" setDoctype: function(name) {\n this.doctype = doctypes[name.toLowerCase()] || '<!DOCTYPE ' + name + '>';\n this.terse = this.doctype.toLowerCase() == '<!doctype html>';\n this.xml = 0 == this.doctype.indexOf('<?xml');\n },",
" /**\n * Buffer the given `str` exactly as is or with interpolation\n *\n * @param {String} str\n * @param {Boolean} interpolate\n * @api public\n */",
" buffer: function(str) {\n var self = this;",
" str = stringify(str);\n str = str.substr(1, str.length - 2);",
" if (\n this.lastBufferedIdx == this.buf.length &&\n this.bufferedConcatenationCount < 100\n ) {\n if (this.lastBufferedType === 'code') {\n this.lastBuffered += ' + \"';\n this.bufferedConcatenationCount++;\n }\n this.lastBufferedType = 'text';\n this.lastBuffered += str;\n this.buf[this.lastBufferedIdx - 1] =\n 'pug_html = pug_html + ' +\n this.bufferStartChar +\n this.lastBuffered +\n '\";';\n } else {\n this.bufferedConcatenationCount = 0;\n this.buf.push('pug_html = pug_html + \"' + str + '\";');\n this.lastBufferedType = 'text';\n this.bufferStartChar = '\"';\n this.lastBuffered = str;\n this.lastBufferedIdx = this.buf.length;\n }\n },",
" /**\n * Buffer the given `src` so it is evaluated at run time\n *\n * @param {String} src\n * @api public\n */",
" bufferExpression: function(src) {\n if (isConstant(src)) {\n return this.buffer(toConstant(src) + '');\n }\n if (\n this.lastBufferedIdx == this.buf.length &&\n this.bufferedConcatenationCount < 100\n ) {\n this.bufferedConcatenationCount++;\n if (this.lastBufferedType === 'text') this.lastBuffered += '\"';\n this.lastBufferedType = 'code';\n this.lastBuffered += ' + (' + src + ')';\n this.buf[this.lastBufferedIdx - 1] =\n 'pug_html = pug_html + (' +\n this.bufferStartChar +\n this.lastBuffered +\n ');';\n } else {\n this.bufferedConcatenationCount = 0;\n this.buf.push('pug_html = pug_html + (' + src + ');');\n this.lastBufferedType = 'code';\n this.bufferStartChar = '';\n this.lastBuffered = '(' + src + ')';\n this.lastBufferedIdx = this.buf.length;\n }\n },",
" /**\n * Buffer an indent based on the current `indent`\n * property and an additional `offset`.\n *\n * @param {Number} offset\n * @param {Boolean} newline\n * @api public\n */",
" prettyIndent: function(offset, newline) {\n offset = offset || 0;\n newline = newline ? '\\n' : '';\n this.buffer(newline + Array(this.indents + offset).join(this.pp));\n if (this.parentIndents)\n this.buf.push('pug_html = pug_html + pug_indent.join(\"\");');\n },",
" /**\n * Visit `node`.\n *\n * @param {Node} node\n * @api public\n */",
" visit: function(node, parent) {\n var debug = this.debug;",
" if (!node) {\n var msg;\n if (parent) {\n msg =\n 'A child of ' +\n parent.type +\n ' (' +\n (parent.filename || 'Pug') +\n ':' +\n parent.line +\n ')';\n } else {\n msg = 'A top-level node';\n }\n msg += ' is ' + node + ', expected a Pug AST Node.';\n throw new TypeError(msg);\n }",
" if (debug && node.debug !== false && node.type !== 'Block') {\n if (node.line) {\n var js = ';pug_debug_line = ' + node.line;\n if (node.filename)\n js += ';pug_debug_filename = ' + stringify(node.filename);\n this.buf.push(js + ';');\n }\n }",
" if (!this['visit' + node.type]) {\n var msg;\n if (parent) {\n msg = 'A child of ' + parent.type;\n } else {\n msg = 'A top-level node';\n }\n msg +=\n ' (' +\n (node.filename || 'Pug') +\n ':' +\n node.line +\n ')' +\n ' is of type ' +\n node.type +\n ',' +\n ' which is not supported by pug-code-gen.';\n switch (node.type) {\n case 'Filter':\n msg += ' Please use pug-filters to preprocess this AST.';\n break;\n case 'Extends':\n case 'Include':\n case 'NamedBlock':\n case 'FileReference': // unlikely but for the sake of completeness\n msg += ' Please use pug-linker to preprocess this AST.';\n break;\n }\n throw new TypeError(msg);\n }",
" this.visitNode(node);\n },",
" /**\n * Visit `node`.\n *\n * @param {Node} node\n * @api public\n */",
" visitNode: function(node) {\n return this['visit' + node.type](node);\n },",
" /**\n * Visit case `node`.\n *\n * @param {Literal} node\n * @api public\n */",
" visitCase: function(node) {\n this.buf.push('switch (' + node.expr + '){');\n this.visit(node.block, node);\n this.buf.push('}');\n },",
" /**\n * Visit when `node`.\n *\n * @param {Literal} node\n * @api public\n */",
" visitWhen: function(node) {\n if ('default' == node.expr) {\n this.buf.push('default:');\n } else {\n this.buf.push('case ' + node.expr + ':');\n }\n if (node.block) {\n this.visit(node.block, node);\n this.buf.push(' break;');\n }\n },",
" /**\n * Visit literal `node`.\n *\n * @param {Literal} node\n * @api public\n */",
" visitLiteral: function(node) {\n this.buffer(node.str);\n },",
" visitNamedBlock: function(block) {\n return this.visitBlock(block);\n },\n /**\n * Visit all nodes in `block`.\n *\n * @param {Block} block\n * @api public\n */",
" visitBlock: function(block) {\n var escapePrettyMode = this.escapePrettyMode;\n var pp = this.pp;",
" // Pretty print multi-line text\n if (\n pp &&\n block.nodes.length > 1 &&\n !escapePrettyMode &&\n block.nodes[0].type === 'Text' &&\n block.nodes[1].type === 'Text'\n ) {\n this.prettyIndent(1, true);\n }\n for (var i = 0; i < block.nodes.length; ++i) {\n // Pretty print text\n if (\n pp &&\n i > 0 &&\n !escapePrettyMode &&\n block.nodes[i].type === 'Text' &&\n block.nodes[i - 1].type === 'Text' &&\n /\\n$/.test(block.nodes[i - 1].val)\n ) {\n this.prettyIndent(1, false);\n }\n this.visit(block.nodes[i], block);\n }\n },",
" /**\n * Visit a mixin's `block` keyword.\n *\n * @param {MixinBlock} block\n * @api public\n */",
" visitMixinBlock: function(block) {\n if (this.pp)\n this.buf.push(",
" 'pug_indent.push(' +\n stringify(Array(this.indents + 1).join(this.pp)) +\n ');'",
" );\n this.buf.push('block && block();');\n if (this.pp) this.buf.push('pug_indent.pop();');\n },",
" /**\n * Visit `doctype`. Sets terse mode to `true` when html 5\n * is used, causing self-closing tags to end with \">\" vs \"/>\",\n * and boolean attributes are not mirrored.\n *\n * @param {Doctype} doctype\n * @api public\n */",
" visitDoctype: function(doctype) {\n if (doctype && (doctype.val || !this.doctype)) {\n this.setDoctype(doctype.val || 'html');\n }",
" if (this.doctype) this.buffer(this.doctype);\n this.hasCompiledDoctype = true;\n },",
" /**\n * Visit `mixin`, generating a function that\n * may be called within the template.\n *\n * @param {Mixin} mixin\n * @api public\n */",
" visitMixin: function(mixin) {\n var name = 'pug_mixins[';\n var args = mixin.args || '';\n var block = mixin.block;\n var attrs = mixin.attrs;\n var attrsBlocks = this.attributeBlocks(mixin.attributeBlocks);\n var pp = this.pp;\n var dynamic = mixin.name[0] === '#';\n var key = mixin.name;\n if (dynamic) this.dynamicMixins = true;\n name +=\n (dynamic\n ? mixin.name.substr(2, mixin.name.length - 3)\n : '\"' + mixin.name + '\"') + ']';",
" this.mixins[key] = this.mixins[key] || {used: false, instances: []};\n if (mixin.call) {\n this.mixins[key].used = true;\n if (pp)\n this.buf.push(",
" 'pug_indent.push(' +\n stringify(Array(this.indents + 1).join(pp)) +\n ');'",
" );\n if (block || attrs.length || attrsBlocks.length) {\n this.buf.push(name + '.call({');",
" if (block) {\n this.buf.push('block: function(){');",
" // Render block with no indents, dynamically added when rendered\n this.parentIndents++;\n var _indents = this.indents;\n this.indents = 0;\n this.visit(mixin.block, mixin);\n this.indents = _indents;\n this.parentIndents--;",
" if (attrs.length || attrsBlocks.length) {\n this.buf.push('},');\n } else {\n this.buf.push('}');\n }\n }",
" if (attrsBlocks.length) {\n if (attrs.length) {\n var val = this.attrs(attrs);\n attrsBlocks.unshift(val);\n }\n if (attrsBlocks.length > 1) {\n this.buf.push(\n 'attributes: ' +\n this.runtime('merge') +\n '([' +\n attrsBlocks.join(',') +\n '])'\n );\n } else {\n this.buf.push('attributes: ' + attrsBlocks[0]);\n }\n } else if (attrs.length) {\n var val = this.attrs(attrs);\n this.buf.push('attributes: ' + val);\n }",
" if (args) {\n this.buf.push('}, ' + args + ');');\n } else {\n this.buf.push('});');\n }\n } else {\n this.buf.push(name + '(' + args + ');');\n }\n if (pp) this.buf.push('pug_indent.pop();');\n } else {\n var mixin_start = this.buf.length;\n args = args ? args.split(',') : [];\n var rest;\n if (args.length && /^\\.\\.\\./.test(args[args.length - 1].trim())) {\n rest = args\n .pop()\n .trim()\n .replace(/^\\.\\.\\./, '');\n }\n // we need use pug_interp here for v8: https://code.google.com/p/v8/issues/detail?id=4165\n // once fixed, use this: this.buf.push(name + ' = function(' + args.join(',') + '){');\n this.buf.push(name + ' = pug_interp = function(' + args.join(',') + '){');\n this.buf.push(\n 'var block = (this && this.block), attributes = (this && this.attributes) || {};'\n );\n if (rest) {\n this.buf.push('var ' + rest + ' = [];');\n this.buf.push(\n 'for (pug_interp = ' +\n args.length +\n '; pug_interp < arguments.length; pug_interp++) {'\n );\n this.buf.push(' ' + rest + '.push(arguments[pug_interp]);');\n this.buf.push('}');\n }\n this.parentIndents++;\n this.visit(block, mixin);\n this.parentIndents--;\n this.buf.push('};');\n var mixin_end = this.buf.length;\n this.mixins[key].instances.push({start: mixin_start, end: mixin_end});\n }\n },",
" /**\n * Visit `tag` buffering tag markup, generating\n * attributes, visiting the `tag`'s code and block.\n *\n * @param {Tag} tag\n * @param {boolean} interpolated\n * @api public\n */",
" visitTag: function(tag, interpolated) {\n this.indents++;\n var name = tag.name,\n pp = this.pp,\n self = this;",
" function bufferName() {\n if (interpolated) self.bufferExpression(tag.expr);\n else self.buffer(name);\n }",
" if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true)\n this.escapePrettyMode = true;",
" if (!this.hasCompiledTag) {\n if (!this.hasCompiledDoctype && 'html' == name) {\n this.visitDoctype();\n }\n this.hasCompiledTag = true;\n }",
" // pretty print\n if (pp && !tag.isInline) this.prettyIndent(0, true);\n if (tag.selfClosing || (!this.xml && selfClosing[tag.name])) {\n this.buffer('<');\n bufferName();\n this.visitAttributes(\n tag.attrs,\n this.attributeBlocks(tag.attributeBlocks)\n );\n if (this.terse && !tag.selfClosing) {\n this.buffer('>');\n } else {\n this.buffer('/>');\n }\n // if it is non-empty throw an error\n if (\n tag.code ||\n (tag.block &&\n !(tag.block.type === 'Block' && tag.block.nodes.length === 0) &&\n tag.block.nodes.some(function(tag) {\n return tag.type !== 'Text' || !/^\\s*$/.test(tag.val);\n }))\n ) {\n this.error(\n name +\n ' is a self closing element: <' +\n name +\n '/> but contains nested content.',\n 'SELF_CLOSING_CONTENT',\n tag\n );\n }\n } else {\n // Optimize attributes buffering\n this.buffer('<');\n bufferName();\n this.visitAttributes(\n tag.attrs,\n this.attributeBlocks(tag.attributeBlocks)\n );\n this.buffer('>');\n if (tag.code) this.visitCode(tag.code);\n this.visit(tag.block, tag);",
" // pretty print\n if (\n pp &&\n !tag.isInline &&\n WHITE_SPACE_SENSITIVE_TAGS[tag.name] !== true &&\n !tagCanInline(tag)\n )\n this.prettyIndent(0, true);",
" this.buffer('</');\n bufferName();\n this.buffer('>');\n }",
" if (WHITE_SPACE_SENSITIVE_TAGS[tag.name] === true)\n this.escapePrettyMode = false;",
" this.indents--;\n },",
" /**\n * Visit InterpolatedTag.\n *\n * @param {InterpolatedTag} tag\n * @api public\n */",
" visitInterpolatedTag: function(tag) {\n return this.visitTag(tag, true);\n },",
" /**\n * Visit `text` node.\n *\n * @param {Text} text\n * @api public\n */",
" visitText: function(text) {\n this.buffer(text.val);\n },",
" /**\n * Visit a `comment`, only buffering when the buffer flag is set.\n *\n * @param {Comment} comment\n * @api public\n */",
" visitComment: function(comment) {\n if (!comment.buffer) return;\n if (this.pp) this.prettyIndent(1, true);\n this.buffer('<!--' + comment.val + '-->');\n },",
" /**\n * Visit a `YieldBlock`.\n *\n * This is necessary since we allow compiling a file with `yield`.\n *\n * @param {YieldBlock} block\n * @api public\n */",
" visitYieldBlock: function(block) {},",
" /**\n * Visit a `BlockComment`.\n *\n * @param {Comment} comment\n * @api public\n */",
" visitBlockComment: function(comment) {\n if (!comment.buffer) return;\n if (this.pp) this.prettyIndent(1, true);\n this.buffer('<!--' + (comment.val || ''));\n this.visit(comment.block, comment);\n if (this.pp) this.prettyIndent(1, true);\n this.buffer('-->');\n },",
" /**\n * Visit `code`, respecting buffer / escape flags.\n * If the code is followed by a block, wrap it in\n * a self-calling function.\n *\n * @param {Code} code\n * @api public\n */",
" visitCode: function(code) {\n // Wrap code blocks with {}.\n // we only wrap unbuffered code blocks ATM\n // since they are usually flow control",
" // Buffer code\n if (code.buffer) {\n var val = code.val.trim();\n val = 'null == (pug_interp = ' + val + ') ? \"\" : pug_interp';\n if (code.mustEscape !== false)\n val = this.runtime('escape') + '(' + val + ')';\n this.bufferExpression(val);\n } else {\n this.buf.push(code.val);\n }",
" // Block support\n if (code.block) {\n if (!code.buffer) this.buf.push('{');\n this.visit(code.block, code);\n if (!code.buffer) this.buf.push('}');\n }\n },",
" /**\n * Visit `Conditional`.\n *\n * @param {Conditional} cond\n * @api public\n */",
" visitConditional: function(cond) {\n var test = cond.test;\n this.buf.push('if (' + test + ') {');\n this.visit(cond.consequent, cond);\n this.buf.push('}');\n if (cond.alternate) {\n if (cond.alternate.type === 'Conditional') {\n this.buf.push('else');\n this.visitConditional(cond.alternate);\n } else {\n this.buf.push('else {');\n this.visit(cond.alternate, cond);\n this.buf.push('}');\n }\n }\n },",
" /**\n * Visit `While`.\n *\n * @param {While} loop\n * @api public\n */",
" visitWhile: function(loop) {\n var test = loop.test;\n this.buf.push('while (' + test + ') {');\n this.visit(loop.block, loop);\n this.buf.push('}');\n },",
" /**\n * Visit `each` block.\n *\n * @param {Each} each\n * @api public\n */",
" visitEach: function(each) {\n var indexVarName = each.key || 'pug_index' + this.eachCount;\n this.eachCount++;",
" this.buf.push(\n '' +\n '// iterate ' +\n each.obj +\n '\\n' +\n ';(function(){\\n' +\n ' var $$obj = ' +\n each.obj +\n ';\\n' +\n \" if ('number' == typeof $$obj.length) {\"\n );",
" if (each.alternate) {\n this.buf.push(' if ($$obj.length) {');\n }",
" this.buf.push(\n '' +\n ' for (var ' +\n indexVarName +\n ' = 0, $$l = $$obj.length; ' +\n indexVarName +\n ' < $$l; ' +\n indexVarName +\n '++) {\\n' +\n ' var ' +\n each.val +\n ' = $$obj[' +\n indexVarName +\n '];'\n );",
" this.visit(each.block, each);",
" this.buf.push(' }');",
" if (each.alternate) {\n this.buf.push(' } else {');\n this.visit(each.alternate, each);\n this.buf.push(' }');\n }",
" this.buf.push(\n '' +\n ' } else {\\n' +\n ' var $$l = 0;\\n' +\n ' for (var ' +\n indexVarName +\n ' in $$obj) {\\n' +\n ' $$l++;\\n' +\n ' var ' +\n each.val +\n ' = $$obj[' +\n indexVarName +\n '];'\n );",
" this.visit(each.block, each);",
" this.buf.push(' }');\n if (each.alternate) {\n this.buf.push(' if ($$l === 0) {');\n this.visit(each.alternate, each);\n this.buf.push(' }');\n }\n this.buf.push(' }\\n}).call(this);\\n');\n },",
" visitEachOf: function(each) {\n this.buf.push(\n '' +\n '// iterate ' +\n each.obj +\n '\\n' +\n 'for (const ' +\n each.val +\n ' of ' +\n each.obj +\n ') {\\n'\n );",
" this.visit(each.block, each);",
" this.buf.push('}\\n');\n },",
" /**\n * Visit `attrs`.\n *\n * @param {Array} attrs\n * @api public\n */",
" visitAttributes: function(attrs, attributeBlocks) {\n if (attributeBlocks.length) {\n if (attrs.length) {\n var val = this.attrs(attrs);\n attributeBlocks.unshift(val);\n }\n if (attributeBlocks.length > 1) {\n this.bufferExpression(\n this.runtime('attrs') +\n '(' +\n this.runtime('merge') +\n '([' +\n attributeBlocks.join(',') +\n ']), ' +\n stringify(this.terse) +\n ')'\n );\n } else {\n this.bufferExpression(\n this.runtime('attrs') +\n '(' +\n attributeBlocks[0] +\n ', ' +\n stringify(this.terse) +\n ')'\n );\n }\n } else if (attrs.length) {\n this.attrs(attrs, true);\n }\n },",
" /**\n * Compile attributes.\n */",
" attrs: function(attrs, buffer) {\n var res = compileAttrs(attrs, {\n terse: this.terse,\n format: buffer ? 'html' : 'object',\n runtime: this.runtime.bind(this),\n });\n if (buffer) {\n this.bufferExpression(res);\n }\n return res;\n },",
" /**\n * Compile attribute blocks.\n */",
" attributeBlocks: function(attributeBlocks) {\n return (\n attributeBlocks &&\n attributeBlocks.slice().map(function(attrBlock) {\n return attrBlock.val;\n })\n );\n },\n};",
"function tagCanInline(tag) {\n function isInline(node) {\n // Recurse if the node is a block\n if (node.type === 'Block') return node.nodes.every(isInline);\n // When there is a YieldBlock here, it is an indication that the file is\n // expected to be included but is not. If this is the case, the block\n // must be empty.\n if (node.type === 'YieldBlock') return true;\n return (node.type === 'Text' && !/\\n/.test(node.val)) || node.isInline;\n }",
" return tag.block.nodes.every(isInline);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [508], "buggy_code_start_loc": [58], "filenames": ["packages/pug-code-gen/index.js"], "fixing_code_end_loc": [517], "fixing_code_start_loc": [59], "message": "Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend. This is fixed in version 3.0.1. This advisory applies to multiple pug packages including \"pug\", \"pug-code-gen\". pug-code-gen has a backported fix at version 2.0.3. This advisory is not exploitable if there is no way for un-trusted input to be passed to pug as the `pretty` option, e.g. if you compile templates in advance before applying user input to them, you do not need to upgrade.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:pugjs:pug:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "AE43CE50-8DE8-4487-BCCB-9E3931241EB2", "versionEndExcluding": "3.0.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "F0CD8CA7-F670-4B0A-9639-E7D60F401DBB", "versionEndExcluding": "2.0.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:a:pugjs:pug-code-gen:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "55FCB9F1-8C93-474D-9137-CB14C8F9F05E", "versionEndExcluding": "3.0.2", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "3.0.0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Pug is an npm package which is a high-performance template engine. In pug before version 3.0.1, if a remote attacker was able to control the `pretty` option of the pug compiler, e.g. if you spread a user provided object such as the query parameters of a request into the pug template inputs, it was possible for them to achieve remote code execution on the node.js backend. This is fixed in version 3.0.1. This advisory applies to multiple pug packages including \"pug\", \"pug-code-gen\". pug-code-gen has a backported fix at version 2.0.3. This advisory is not exploitable if there is no way for un-trusted input to be passed to pug as the `pretty` option, e.g. if you compile templates in advance before applying user input to them, you do not need to upgrade."}, {"lang": "es", "value": "Pug es un paquete npm que es un motor de plantillas de alto rendimiento. En pug antes de la versi\u00f3n 3.0.1, si un atacante remoto era capaz de controlar la opci\u00f3n `pretty` del compilador de pug, por ejemplo, si extend\u00eda un objeto proporcionado por el usuario, como los par\u00e1metros de consulta de una solicitud, en las entradas de la plantilla de pug, era posible que lograra la ejecuci\u00f3n remota de c\u00f3digo en el backend de node.js. Esto se ha corregido en la versi\u00f3n 3.0.1. Este aviso se aplica a varios paquetes de pug, incluyendo \"pug\", \"pug-code-gen\". pug-code-gen tiene una correcci\u00f3n con soporte en la versi\u00f3n 2.0.3. Este aviso no es explotable si no hay forma de pasar a pug entradas no confiables como la opci\u00f3n `pretty`, por ejemplo, si compila las plantillas por adelantado antes de aplicarles las entradas del usuario, no necesita actualizar"}], "evaluatorComment": null, "id": "CVE-2021-21353", "lastModified": "2021-03-09T15:35:21.997", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 9.0, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 6.0, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 4.0, "source": "security-advisories@github.com", "type": "Secondary"}]}, "published": "2021-03-03T02:15:13.143", "references": [{"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"}, {"source": "security-advisories@github.com", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/issues/3312"}, {"source": "security-advisories@github.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/pull/3314"}, {"source": "security-advisories@github.com", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/pugjs/pug/releases/tag/pug%403.0.1"}, {"source": "security-advisories@github.com", "tags": ["Third Party Advisory"], "url": "https://github.com/pugjs/pug/security/advisories/GHSA-p493-635q-r6gr"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://www.npmjs.com/package/pug"}, {"source": "security-advisories@github.com", "tags": ["Product", "Third Party Advisory"], "url": "https://www.npmjs.com/package/pug-code-gen"}], "sourceIdentifier": "security-advisories@github.com", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-74"}], "source": "security-advisories@github.com", "type": "Primary"}]}, "github_commit_url": "https://github.com/pugjs/pug/commit/991e78f7c4220b2f8da042877c6f0ef5a4683be0"}, "type": "CWE-74"}
| 98
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% BBBB L OOO BBBB %\n% B B L O O B B %\n% BBBB L O O BBBB %\n% B B L O O B B %\n% BBBB LLLLL OOO BBBB %\n% %\n% %\n% MagickCore Binary Large OBjectS Methods %\n% %\n% Software Design %\n% Cristy %\n% July 1999 %\n% %\n% %\n% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#ifdef __VMS\n#include <types.h>\n#include <mman.h>\n#endif\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/blob-private.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/client.h\"\n#include \"MagickCore/constitute.h\"\n#include \"MagickCore/delegate.h\"\n#include \"MagickCore/exception.h\"\n#include \"MagickCore/exception-private.h\"\n#include \"MagickCore/geometry.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/locale_.h\"\n#include \"MagickCore/log.h\"\n#include \"MagickCore/magick.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/memory-private.h\"\n#include \"MagickCore/nt-base-private.h\"\n#include \"MagickCore/option.h\"\n#include \"MagickCore/policy.h\"\n#include \"MagickCore/resource_.h\"\n#include \"MagickCore/semaphore.h\"\n#include \"MagickCore/string_.h\"\n#include \"MagickCore/string-private.h\"\n#include \"MagickCore/timer-private.h\"\n#include \"MagickCore/token.h\"\n#include \"MagickCore/utility.h\"\n#include \"MagickCore/utility-private.h\"\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n#include \"zlib.h\"\n#endif\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n#include \"bzlib.h\"\n#endif\n\f\n/*\n Define declarations.\n*/\n#define MagickMaxBlobExtent (8*8192)\n#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)\n# define MAP_ANONYMOUS MAP_ANON\n#endif\n#if !defined(MAP_FAILED)\n#define MAP_FAILED ((void *) -1)\n#endif\n#if defined(__OS2__)\n#include <io.h>\n#define _O_BINARY O_BINARY\n#endif\n\f\n/*\n Typedef declarations.\n*/\ntypedef union FileInfo\n{\n FILE\n *file;",
"#if defined(MAGICKCORE_ZLIB_DELEGATE)\n gzFile\n gzfile;\n#endif",
"#if defined(MAGICKCORE_BZLIB_DELEGATE)\n BZFILE\n *bzfile;\n#endif\n} FileInfo;",
"struct _BlobInfo\n{\n size_t\n length,\n extent,\n quantum;",
" BlobMode\n mode;",
" MagickBooleanType\n mapped,\n eof;",
" int\n error;",
" MagickOffsetType\n offset;",
" MagickSizeType\n size;",
" MagickBooleanType\n exempt,\n synchronize,\n status,\n temporary;",
" StreamType\n type;",
" FileInfo\n file_info;",
" struct stat\n properties;",
" StreamHandler\n stream;",
" CustomStreamInfo\n *custom_stream;",
" unsigned char\n *data;",
" MagickBooleanType\n debug;",
" SemaphoreInfo\n *semaphore;",
" ssize_t\n reference_count;",
" size_t\n signature;\n};",
"struct _CustomStreamInfo\n{\n CustomStreamHandler\n reader,\n writer;",
" CustomStreamSeeker\n seeker;",
" CustomStreamTeller\n teller;",
" void\n *data;",
" size_t\n signature;\n};\n\f\n/*\n Forward declarations.\n*/\nstatic int\n SyncBlob(Image *);\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ A c q u i r e C u s t o m S t r e a m I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% AcquireCustomStreamInfo() allocates the CustomStreamInfo structure.\n%\n% The format of the AcquireCustomStreamInfo method is:\n%\n% CustomStreamInfo *AcquireCustomStreamInfo(ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport CustomStreamInfo *AcquireCustomStreamInfo(\n ExceptionInfo *magick_unused(exception))\n{\n CustomStreamInfo\n *custom_stream;",
" magick_unreferenced(exception);\n custom_stream=(CustomStreamInfo *) AcquireCriticalMemory(\n sizeof(*custom_stream));\n (void) memset(custom_stream,0,sizeof(*custom_stream));\n custom_stream->signature=MagickCoreSignature;\n return(custom_stream);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ A t t a c h B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% AttachBlob() attaches a blob to the BlobInfo structure.\n%\n% The format of the AttachBlob method is:\n%\n% void AttachBlob(BlobInfo *blob_info,const void *blob,const size_t length)\n%\n% A description of each parameter follows:\n%\n% o blob_info: Specifies a pointer to a BlobInfo structure.\n%\n% o blob: the address of a character stream in one of the image formats\n% understood by ImageMagick.\n%\n% o length: This size_t integer reflects the length in bytes of the blob.\n%\n*/\nMagickExport void AttachBlob(BlobInfo *blob_info,const void *blob,\n const size_t length)\n{\n assert(blob_info != (BlobInfo *) NULL);\n if (blob_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n blob_info->length=length;\n blob_info->extent=length;\n blob_info->quantum=(size_t) MagickMaxBlobExtent;\n blob_info->offset=0;\n blob_info->type=BlobStream;\n blob_info->file_info.file=(FILE *) NULL;\n blob_info->data=(unsigned char *) blob;\n blob_info->mapped=MagickFalse;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ A t t a c h C u s t o m S t r e a m %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% AttachCustomStream() attaches a CustomStreamInfo to the BlobInfo structure.\n%\n% The format of the AttachCustomStream method is:\n%\n% void AttachCustomStream(BlobInfo *blob_info,\n% CustomStreamInfo *custom_stream)\n%\n% A description of each parameter follows:\n%\n% o blob_info: specifies a pointer to a BlobInfo structure.\n%\n% o custom_stream: the custom stream info.\n%\n*/\nMagickExport void AttachCustomStream(BlobInfo *blob_info,\n CustomStreamInfo *custom_stream)\n{\n assert(blob_info != (BlobInfo *) NULL);\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n if (blob_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n blob_info->type=CustomStream;\n blob_info->custom_stream=custom_stream;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ B l o b T o F i l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% BlobToFile() writes a blob to a file. It returns MagickFalse if an error\n% occurs otherwise MagickTrue.\n%\n% The format of the BlobToFile method is:\n%\n% MagickBooleanType BlobToFile(char *filename,const void *blob,\n% const size_t length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o filename: Write the blob to this file.\n%\n% o blob: the address of a blob.\n%\n% o length: This length in bytes of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport MagickBooleanType BlobToFile(char *filename,const void *blob,\n const size_t length,ExceptionInfo *exception)\n{\n int\n file;",
" register size_t\n i;",
" ssize_t\n count;",
" assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(blob != (const void *) NULL);\n if (*filename == '\\0')\n file=AcquireUniqueFileResource(filename);\n else\n file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n for (i=0; i < length; i+=count)\n {\n count=write(file,(const char *) blob+i,MagickMin(length-i,(size_t)\n SSIZE_MAX));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n file=close(file);\n if ((file == -1) || (i < length))\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% B l o b T o I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% BlobToImage() implements direct to memory image formats. It returns the\n% blob as an image.\n%\n% The format of the BlobToImage method is:\n%\n% Image *BlobToImage(const ImageInfo *image_info,const void *blob,\n% const size_t length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o blob: the address of a character stream in one of the image formats\n% understood by ImageMagick.\n%\n% o length: This size_t integer reflects the length in bytes of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport Image *BlobToImage(const ImageInfo *image_info,const void *blob,\n const size_t length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" Image\n *image;",
" ImageInfo\n *blob_info,\n *clone_info;",
" MagickBooleanType\n status;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n if ((blob == (const void *) NULL) || (length == 0))\n {\n (void) ThrowMagickException(exception,GetMagickModule(),BlobError,\n \"ZeroLengthBlobNotPermitted\",\"`%s'\",image_info->filename);\n return((Image *) NULL);\n }\n blob_info=CloneImageInfo(image_info);\n blob_info->blob=(void *) blob;\n blob_info->length=length;\n if (*blob_info->magick == '\\0')\n (void) SetImageInfo(blob_info,0,exception);\n magick_info=GetMagickInfo(blob_info->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n blob_info->magick);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n char\n filename[MagickPathExtent];",
" /*\n Native blob support for this image format.\n */\n (void) CopyMagickString(filename,blob_info->filename,MagickPathExtent);\n (void) FormatLocaleString(blob_info->filename,MagickPathExtent,\"%s:%s\",\n blob_info->magick,filename);\n image=ReadImage(blob_info,exception);\n if (image != (Image *) NULL)\n (void) DetachBlob(image->blob);\n blob_info=DestroyImageInfo(blob_info);\n return(image);\n }\n /*\n Write blob to a temporary file on disk.\n */\n blob_info->blob=(void *) NULL;\n blob_info->length=0;\n *blob_info->filename='\\0';\n status=BlobToFile(blob_info->filename,blob,length,exception);\n if (status == MagickFalse)\n {\n (void) RelinquishUniqueFileResource(blob_info->filename);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n clone_info=CloneImageInfo(blob_info);\n (void) FormatLocaleString(clone_info->filename,MagickPathExtent,\"%s:%s\",\n blob_info->magick,blob_info->filename);\n image=ReadImage(clone_info,exception);\n if (image != (Image *) NULL)\n {\n Image\n *images;",
" /*\n Restore original filenames and image format.\n */\n for (images=GetFirstImageInList(image); images != (Image *) NULL; )\n {\n (void) CopyMagickString(images->filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick_filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick,magick_info->name,\n MagickPathExtent);\n images=GetNextImageInList(images);\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n (void) RelinquishUniqueFileResource(blob_info->filename);\n blob_info=DestroyImageInfo(blob_info);\n return(image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ C l o n e B l o b I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% CloneBlobInfo() makes a duplicate of the given blob info structure, or if\n% blob info is NULL, a new one.\n%\n% The format of the CloneBlobInfo method is:\n%\n% BlobInfo *CloneBlobInfo(const BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: the blob info.\n%\n*/\nMagickExport BlobInfo *CloneBlobInfo(const BlobInfo *blob_info)\n{\n BlobInfo\n *clone_info;",
" SemaphoreInfo\n *semaphore;",
" clone_info=(BlobInfo *) AcquireCriticalMemory(sizeof(*clone_info));\n GetBlobInfo(clone_info);\n if (blob_info == (BlobInfo *) NULL)\n return(clone_info);\n semaphore=clone_info->semaphore;\n (void) memcpy(clone_info,blob_info,sizeof(*clone_info));\n if (blob_info->mapped != MagickFalse)\n (void) AcquireMagickResource(MapResource,blob_info->length);\n clone_info->semaphore=semaphore;\n LockSemaphoreInfo(clone_info->semaphore);\n clone_info->reference_count=1;\n UnlockSemaphoreInfo(clone_info->semaphore);\n return(clone_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ C l o s e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% CloseBlob() closes a stream associated with the image.\n%\n% The format of the CloseBlob method is:\n%\n% MagickBooleanType CloseBlob(Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType CloseBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n status;",
" /*\n Close image file.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n blob_info=image->blob;\n if ((blob_info == (BlobInfo *) NULL) || (blob_info->type == UndefinedStream))\n return(MagickTrue);\n status=SyncBlob(image);\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n if (blob_info->synchronize != MagickFalse)\n status=fsync(fileno(blob_info->file_info.file));\n status=ferror(blob_info->file_info.file);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n (void) gzerror(blob_info->file_info.gzfile,&status);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n (void) BZ2_bzerror(blob_info->file_info.bzfile,&status);\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n {\n if (blob_info->synchronize != MagickFalse)\n status=fsync(fileno(blob_info->file_info.file));\n status=ferror(blob_info->file_info.file);\n }\n break;\n }\n case CustomStream:\n break;\n }\n blob_info->status=status < 0 ? MagickTrue : MagickFalse;\n blob_info->size=GetBlobSize(image);\n image->extent=blob_info->size;\n blob_info->eof=MagickFalse;\n blob_info->error=0;\n blob_info->mode=UndefinedBlobMode;\n if (blob_info->exempt != MagickFalse)\n {\n blob_info->type=UndefinedStream;\n return(blob_info->status);\n }\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n {\n if (fileno(blob_info->file_info.file) != -1)\n status=fclose(blob_info->file_info.file);\n break;\n }\n case PipeStream:\n {\n#if defined(MAGICKCORE_HAVE_PCLOSE)\n status=pclose(blob_info->file_info.file);\n#endif\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n status=gzclose(blob_info->file_info.gzfile);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n BZ2_bzclose(blob_info->file_info.bzfile);\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n status=fclose(blob_info->file_info.file);\n break;\n }\n case CustomStream:\n break;\n }\n (void) DetachBlob(blob_info);\n blob_info->status=status < 0 ? MagickTrue : MagickFalse;\n return(blob_info->status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% C u s t o m S t r e a m T o I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% CustomStreamToImage() is the equivalent of ReadImage(), but reads the\n% formatted \"file\" from the suplied method rather than to an actual file.\n%\n% The format of the CustomStreamToImage method is:\n%\n% Image *CustomStreamToImage(const ImageInfo *image_info,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport Image *CustomStreamToImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" Image\n *image;",
" ImageInfo\n *blob_info;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image_info->custom_stream != (CustomStreamInfo *) NULL);\n assert(image_info->custom_stream->signature == MagickCoreSignature);\n assert(image_info->custom_stream->reader != (CustomStreamHandler) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n blob_info=CloneImageInfo(image_info);\n if (*blob_info->magick == '\\0')\n (void) SetImageInfo(blob_info,0,exception);\n magick_info=GetMagickInfo(blob_info->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n blob_info->magick);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n image=(Image *) NULL;\n if ((GetMagickBlobSupport(magick_info) != MagickFalse) ||\n (*blob_info->filename != '\\0'))\n {\n char\n filename[MagickPathExtent];",
" /*\n Native blob support for this image format or SetImageInfo changed the\n blob to a file.\n */\n (void) CopyMagickString(filename,blob_info->filename,MagickPathExtent);\n (void) FormatLocaleString(blob_info->filename,MagickPathExtent,\"%s:%s\",\n blob_info->magick,filename);\n image=ReadImage(blob_info,exception);\n if (image != (Image *) NULL)\n (void) CloseBlob(image);\n }\n else\n {\n char\n unique[MagickPathExtent];",
" int\n file;",
" ImageInfo\n *clone_info;",
" unsigned char\n *blob;",
" /*\n Write data to file on disk.\n */\n blob_info->custom_stream=(CustomStreamInfo *) NULL;\n blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",\n image_info->filename);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",\n image_info->filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n clone_info=CloneImageInfo(blob_info);\n blob_info->file=fdopen(file,\"wb+\");\n if (blob_info->file != (FILE *) NULL)\n {\n ssize_t\n count;",
" count=(ssize_t) MagickMaxBufferExtent;\n while (count == (ssize_t) MagickMaxBufferExtent)\n {\n count=image_info->custom_stream->reader(blob,MagickMaxBufferExtent,\n image_info->custom_stream->data);\n count=(ssize_t) write(file,(const char *) blob,(size_t) count);\n }\n (void) fclose(blob_info->file);\n (void) FormatLocaleString(clone_info->filename,MagickPathExtent,\n \"%s:%s\",blob_info->magick,unique);\n image=ReadImage(clone_info,exception);\n if (image != (Image *) NULL)\n {\n Image\n *images;",
" /*\n Restore original filenames and image format.\n */\n for (images=GetFirstImageInList(image); images != (Image *) NULL; )\n {\n (void) CopyMagickString(images->filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick_filename,\n image_info->filename,MagickPathExtent);\n (void) CopyMagickString(images->magick,magick_info->name,\n MagickPathExtent);\n (void) CloseBlob(images);\n images=GetNextImageInList(images);\n }\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n (void) RelinquishUniqueFileResource(unique);\n }\n blob_info=DestroyImageInfo(blob_info);\n return(image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D e s t r o y B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DestroyBlob() deallocates memory associated with a blob.\n%\n% The format of the DestroyBlob method is:\n%\n% void DestroyBlob(Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport void DestroyBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickBooleanType\n destroy;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->signature == MagickCoreSignature);\n blob_info=image->blob;\n destroy=MagickFalse;\n LockSemaphoreInfo(blob_info->semaphore);\n blob_info->reference_count--;\n assert(blob_info->reference_count >= 0);\n if (blob_info->reference_count == 0)\n destroy=MagickTrue;\n UnlockSemaphoreInfo(blob_info->semaphore);\n if (destroy == MagickFalse)\n {\n image->blob=(BlobInfo *) NULL;\n return;\n }\n (void) CloseBlob(image);\n if (blob_info->mapped != MagickFalse)\n {\n (void) UnmapBlob(blob_info->data,blob_info->length);\n RelinquishMagickResource(MapResource,blob_info->length);\n }\n if (blob_info->semaphore != (SemaphoreInfo *) NULL)\n RelinquishSemaphoreInfo(&blob_info->semaphore);\n blob_info->signature=(~MagickCoreSignature);\n image->blob=(BlobInfo *) RelinquishMagickMemory(blob_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D e s t r o y C u s t o m S t r e a m I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DestroyCustomStreamInfo() destroys memory associated with the\n% CustomStreamInfo structure.\n%\n% The format of the DestroyCustomStreamInfo method is:\n%\n% CustomStreamInfo *DestroyCustomStreamInfo(CustomStreamInfo *stream_info)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n*/\nMagickExport CustomStreamInfo *DestroyCustomStreamInfo(\n CustomStreamInfo *custom_stream)\n{\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->signature=(~MagickCoreSignature);\n custom_stream=(CustomStreamInfo *) RelinquishMagickMemory(custom_stream);\n return(custom_stream);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D e t a c h B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DetachBlob() detaches a blob from the BlobInfo structure.\n%\n% The format of the DetachBlob method is:\n%\n% void *DetachBlob(BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: Specifies a pointer to a BlobInfo structure.\n%\n*/\nMagickExport void *DetachBlob(BlobInfo *blob_info)\n{\n void\n *data;",
" assert(blob_info != (BlobInfo *) NULL);\n if (blob_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n if (blob_info->mapped != MagickFalse)\n {\n (void) UnmapBlob(blob_info->data,blob_info->length);",
"",
" RelinquishMagickResource(MapResource,blob_info->length);\n }\n blob_info->mapped=MagickFalse;\n blob_info->length=0;\n blob_info->offset=0;\n blob_info->eof=MagickFalse;\n blob_info->error=0;\n blob_info->exempt=MagickFalse;\n blob_info->type=UndefinedStream;\n blob_info->file_info.file=(FILE *) NULL;\n data=blob_info->data;\n blob_info->data=(unsigned char *) NULL;\n blob_info->stream=(StreamHandler) NULL;\n blob_info->custom_stream=(CustomStreamInfo *) NULL;\n return(data);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D i s a s s o c i a t e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DisassociateBlob() disassociates the image stream. It checks if the\n% blob of the specified image is referenced by other images. If the reference\n% count is higher then 1 a new blob is assigned to the specified image.\n%\n% The format of the DisassociateBlob method is:\n%\n% void DisassociateBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport void DisassociateBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info,\n *clone_info;",
" MagickBooleanType\n clone;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->signature == MagickCoreSignature);\n blob_info=image->blob;\n clone=MagickFalse;\n LockSemaphoreInfo(blob_info->semaphore);\n assert(blob_info->reference_count >= 0);\n if (blob_info->reference_count > 1)\n clone=MagickTrue;\n UnlockSemaphoreInfo(blob_info->semaphore);\n if (clone == MagickFalse)\n return;\n clone_info=CloneBlobInfo(blob_info);\n DestroyBlob(image);\n image->blob=clone_info;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D i s c a r d B l o b B y t e s %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DiscardBlobBytes() discards bytes in a blob.\n%\n% The format of the DiscardBlobBytes method is:\n%\n% MagickBooleanType DiscardBlobBytes(Image *image,\n% const MagickSizeType length)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o length: the number of bytes to skip.\n%\n*/\nMagickExport MagickBooleanType DiscardBlobBytes(Image *image,\n const MagickSizeType length)\n{\n register MagickOffsetType\n i;",
" size_t\n quantum;",
" ssize_t\n count;",
" unsigned char\n buffer[16384];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (length != (MagickSizeType) ((MagickOffsetType) length))\n return(MagickFalse);\n count=0;\n for (i=0; i < (MagickOffsetType) length; i+=count)\n {\n quantum=(size_t) MagickMin(length-i,sizeof(buffer));\n (void) ReadBlobStream(image,quantum,buffer,&count);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n return(i < (MagickOffsetType) length ? MagickFalse : MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D u p l i c a t e s B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DuplicateBlob() duplicates a blob descriptor.\n%\n% The format of the DuplicateBlob method is:\n%\n% void DuplicateBlob(Image *image,const Image *duplicate)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o duplicate: the duplicate image.\n%\n*/\nMagickExport void DuplicateBlob(Image *image,const Image *duplicate)\n{\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(duplicate != (Image *) NULL);\n assert(duplicate->signature == MagickCoreSignature);\n DestroyBlob(image);\n image->blob=ReferenceBlob(duplicate->blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ E O F B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% EOFBlob() returns a non-zero value when EOF has been detected reading from\n% a blob or file.\n%\n% The format of the EOFBlob method is:\n%\n% int EOFBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport int EOFBlob(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n blob_info->eof=feof(blob_info->file_info.file) != 0 ? MagickTrue :\n MagickFalse;\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n blob_info->eof=gzeof(blob_info->file_info.gzfile) != 0 ? MagickTrue :\n MagickFalse;\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n int\n status;",
" status=0;\n (void) BZ2_bzerror(blob_info->file_info.bzfile,&status);\n blob_info->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse;\n#endif\n break;\n }\n case FifoStream:\n {\n blob_info->eof=MagickFalse;\n break;\n }\n case BlobStream:\n break;\n case CustomStream:\n break;\n }\n return((int) blob_info->eof);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ E r r o r B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ErrorBlob() returns a non-zero value when an error has been detected reading\n% from a blob or file.\n%\n% The format of the ErrorBlob method is:\n%\n% int ErrorBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport int ErrorBlob(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n blob_info->error=ferror(blob_info->file_info.file);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n (void) gzerror(blob_info->file_info.gzfile,&blob_info->error);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n (void) BZ2_bzerror(blob_info->file_info.bzfile,&blob_info->error);\n#endif\n break;\n }\n case FifoStream:\n {\n blob_info->error=0;\n break;\n }\n case BlobStream:\n break;\n case CustomStream:\n break;\n }\n return(blob_info->error);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% F i l e T o B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% FileToBlob() returns the contents of a file as a buffer terminated with\n% the '\\0' character. The length of the buffer (not including the extra\n% terminating '\\0' character) is returned via the 'length' parameter. Free\n% the buffer with RelinquishMagickMemory().\n%\n% The format of the FileToBlob method is:\n%\n% void *FileToBlob(const char *filename,const size_t extent,\n% size_t *length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o blob: FileToBlob() returns the contents of a file as a blob. If\n% an error occurs NULL is returned.\n%\n% o filename: the filename.\n%\n% o extent: The maximum length of the blob.\n%\n% o length: On return, this reflects the actual length of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void *FileToBlob(const char *filename,const size_t extent,\n size_t *length,ExceptionInfo *exception)\n{\n int\n file;",
" MagickBooleanType\n status;",
" MagickOffsetType\n offset;",
" register size_t\n i;",
" ssize_t\n count;",
" struct stat\n attributes;",
" unsigned char\n *blob;",
" void\n *map;",
" assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(exception != (ExceptionInfo *) NULL);\n *length=0;\n status=IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,filename);\n if (status == MagickFalse)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",filename);\n return(NULL);\n }\n file=fileno(stdin);\n if (LocaleCompare(filename,\"-\") != 0)\n {\n status=GetPathAttributes(filename,&attributes);\n if ((status == MagickFalse) || (S_ISDIR(attributes.st_mode) != 0))\n {\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n return(NULL);\n }\n file=open_utf8(filename,O_RDONLY | O_BINARY,0);\n }\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenFile\",filename);\n return(NULL);\n }\n offset=(MagickOffsetType) lseek(file,0,SEEK_END);\n count=0;\n if ((file == fileno(stdin)) || (offset < 0) ||\n (offset != (MagickOffsetType) ((ssize_t) offset)))\n {\n size_t\n quantum;",
" struct stat\n file_stats;",
" /*\n Stream is not seekable.\n */\n offset=(MagickOffsetType) lseek(file,0,SEEK_SET);\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob));\n for (i=0; blob != (unsigned char *) NULL; i+=count)\n {\n count=read(file,blob+i,quantum);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n if (~((size_t) i) < (quantum+1))\n {\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n break;\n }\n blob=(unsigned char *) ResizeQuantumMemory(blob,i+quantum+1,\n sizeof(*blob));\n if ((size_t) (i+count) >= extent)\n break;\n }\n if (LocaleCompare(filename,\"-\") != 0)\n file=close(file);\n if (blob == (unsigned char *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",filename);\n return(NULL);\n }\n if (file == -1)\n {\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n return(NULL);\n }\n *length=(size_t) MagickMin(i+count,extent);\n blob[*length]='\\0';\n return(blob);\n }\n *length=(size_t) MagickMin(offset,(MagickOffsetType)\n MagickMin(extent,(size_t) SSIZE_MAX));\n blob=(unsigned char *) NULL;\n if (~(*length) >= (MagickPathExtent-1))\n blob=(unsigned char *) AcquireQuantumMemory(*length+MagickPathExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n file=close(file);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",filename);\n return(NULL);\n }\n map=MapBlob(file,ReadMode,0,*length);\n if (map != (unsigned char *) NULL)\n {\n (void) memcpy(blob,map,*length);\n (void) UnmapBlob(map,*length);\n }\n else\n {\n (void) lseek(file,0,SEEK_SET);\n for (i=0; i < *length; i+=count)\n {\n count=read(file,blob+i,(size_t) MagickMin(*length-i,(size_t)\n SSIZE_MAX));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n if (i < *length)\n {\n file=close(file)-1;\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n return(NULL);\n }\n }\n blob[*length]='\\0';\n if (LocaleCompare(filename,\"-\") != 0)\n file=close(file);\n if (file == -1)\n {\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n }\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% F i l e T o I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% FileToImage() write the contents of a file to an image.\n%\n% The format of the FileToImage method is:\n%\n% MagickBooleanType FileToImage(Image *,const char *filename)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o filename: the filename.\n%\n*/",
"static inline ssize_t WriteBlobStream(Image *image,const size_t length,\n const void *data)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickSizeType\n extent;",
" register unsigned char\n *q;",
" assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n assert(data != NULL);\n blob_info=image->blob;\n if (blob_info->type != BlobStream)\n return(WriteBlob(image,length,(const unsigned char *) data));\n extent=(MagickSizeType) (blob_info->offset+(MagickOffsetType) length);\n if (extent >= blob_info->extent)\n {\n extent=blob_info->extent+blob_info->quantum+length;\n blob_info->quantum<<=1;\n if (SetBlobExtent(image,extent) == MagickFalse)\n return(0);\n }\n q=blob_info->data+blob_info->offset;\n (void) memcpy(q,data,length);\n blob_info->offset+=length;\n if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n blob_info->length=(size_t) blob_info->offset;\n return((ssize_t) length);\n}",
"MagickExport MagickBooleanType FileToImage(Image *image,const char *filename,\n ExceptionInfo *exception)\n{\n int\n file;",
" MagickBooleanType\n status;",
" size_t\n length,\n quantum;",
" ssize_t\n count;",
" struct stat\n file_stats;",
" unsigned char\n *blob;",
" assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n status=IsRightsAuthorized(PathPolicyDomain,WritePolicyRights,filename);\n if (status == MagickFalse)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",filename);\n return(MagickFalse);\n }\n file=fileno(stdin);\n if (LocaleCompare(filename,\"-\") != 0)\n file=open_utf8(filename,O_RDONLY | O_BINARY,0);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n file=close(file);\n ThrowFileException(exception,ResourceLimitError,\"MemoryAllocationFailed\",\n filename);\n return(MagickFalse);\n }\n for ( ; ; )\n {\n count=read(file,blob,quantum);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n length=(size_t) count;\n count=WriteBlobStream(image,length,blob);\n if (count != (ssize_t) length)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n break;\n }\n }\n file=close(file);\n if (file == -1)\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b E r r o r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobError() returns MagickTrue if the blob associated with the specified\n% image encountered an error.\n%\n% The format of the GetBlobError method is:\n%\n% MagickBooleanType GetBlobError(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType GetBlobError(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b F i l e H a n d l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobFileHandle() returns the file handle associated with the image blob.\n%\n% The format of the GetBlobFile method is:\n%\n% FILE *GetBlobFileHandle(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport FILE *GetBlobFileHandle(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n return(image->blob->file_info.file);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobInfo() initializes the BlobInfo structure.\n%\n% The format of the GetBlobInfo method is:\n%\n% void GetBlobInfo(BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: Specifies a pointer to a BlobInfo structure.\n%\n*/\nMagickExport void GetBlobInfo(BlobInfo *blob_info)\n{\n assert(blob_info != (BlobInfo *) NULL);\n (void) memset(blob_info,0,sizeof(*blob_info));\n blob_info->type=UndefinedStream;\n blob_info->quantum=(size_t) MagickMaxBlobExtent;\n blob_info->properties.st_mtime=GetMagickTime();\n blob_info->properties.st_ctime=blob_info->properties.st_mtime;\n blob_info->debug=IsEventLogging();\n blob_info->reference_count=1;\n blob_info->semaphore=AcquireSemaphoreInfo();\n blob_info->signature=MagickCoreSignature;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% G e t B l o b P r o p e r t i e s %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobProperties() returns information about an image blob.\n%\n% The format of the GetBlobProperties method is:\n%\n% const struct stat *GetBlobProperties(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport const struct stat *GetBlobProperties(const Image *image)\n{\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(&image->blob->properties);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b S i z e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobSize() returns the current length of the image file or blob; zero is\n% returned if the size cannot be determined.\n%\n% The format of the GetBlobSize method is:\n%\n% MagickSizeType GetBlobSize(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickSizeType GetBlobSize(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickSizeType\n extent;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n blob_info=image->blob;\n extent=0;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n {\n extent=blob_info->size;\n break;\n }\n case FileStream:\n {\n int\n file_descriptor;",
" extent=(MagickSizeType) blob_info->properties.st_size;\n if (extent == 0)\n extent=blob_info->size;\n file_descriptor=fileno(blob_info->file_info.file);\n if (file_descriptor == -1)\n break;\n if (fstat(file_descriptor,&blob_info->properties) == 0)\n extent=(MagickSizeType) blob_info->properties.st_size;\n break;\n }\n case PipeStream:\n {\n extent=blob_info->size;\n break;\n }\n case ZipStream:\n case BZipStream:\n {\n MagickBooleanType\n status;",
" status=GetPathAttributes(image->filename,&blob_info->properties);\n if (status != MagickFalse)\n extent=(MagickSizeType) blob_info->properties.st_size;\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n extent=(MagickSizeType) blob_info->length;\n break;\n }\n case CustomStream:\n {\n if ((blob_info->custom_stream->teller != (CustomStreamTeller) NULL) &&\n (blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL))\n {\n MagickOffsetType\n offset;",
" offset=blob_info->custom_stream->teller(\n blob_info->custom_stream->data);\n extent=(MagickSizeType) blob_info->custom_stream->seeker(0,SEEK_END,\n blob_info->custom_stream->data);\n (void) blob_info->custom_stream->seeker(offset,SEEK_SET,\n blob_info->custom_stream->data);\n }\n break;\n }\n }\n return(extent);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b S t r e a m D a t a %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobStreamData() returns the stream data for the image.\n%\n% The format of the GetBlobStreamData method is:\n%\n% void *GetBlobStreamData(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport void *GetBlobStreamData(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n return(image->blob->data);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b S t r e a m H a n d l e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobStreamHandler() returns the stream handler for the image.\n%\n% The format of the GetBlobStreamHandler method is:\n%\n% StreamHandler GetBlobStreamHandler(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport StreamHandler GetBlobStreamHandler(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->stream);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I m a g e T o B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImageToBlob() implements direct to memory image formats. It returns the\n% image as a formatted blob and its length. The magick member of the Image\n% structure determines the format of the returned blob (GIF, JPEG, PNG,\n% etc.). This method is the equivalent of WriteImage(), but writes the\n% formatted \"file\" to a memory buffer rather than to an actual file.\n%\n% The format of the ImageToBlob method is:\n%\n% void *ImageToBlob(const ImageInfo *image_info,Image *image,\n% size_t *length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the image.\n%\n% o length: return the actual length of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void *ImageToBlob(const ImageInfo *image_info,\n Image *image,size_t *length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *blob_info;",
" MagickBooleanType\n status;",
" void\n *blob;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n *length=0;\n blob=(unsigned char *) NULL;\n blob_info=CloneImageInfo(image_info);\n blob_info->adjoin=MagickFalse;\n (void) SetImageInfo(blob_info,1,exception);\n if (*blob_info->magick != '\\0')\n (void) CopyMagickString(image->magick,blob_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(image->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n image->magick);\n blob_info=DestroyImageInfo(blob_info);\n return(blob);\n }\n (void) CopyMagickString(blob_info->magick,image->magick,MagickPathExtent);\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n /*\n Native blob support for this image format.\n */\n blob_info->length=0;\n blob_info->blob=AcquireQuantumMemory(MagickMaxBlobExtent,\n sizeof(unsigned char));\n if (blob_info->blob == NULL)\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n else\n {\n (void) CloseBlob(image);\n image->blob->exempt=MagickTrue;\n *image->filename='\\0';\n status=WriteImage(blob_info,image,exception);\n *length=image->blob->length;\n blob=DetachBlob(image->blob);\n if (blob == (void *) NULL)\n blob_info->blob=RelinquishMagickMemory(blob_info->blob);\n else if (status == MagickFalse)\n blob=RelinquishMagickMemory(blob);\n else\n blob=ResizeQuantumMemory(blob,*length+1,sizeof(unsigned char));\n }\n }\n else\n {\n char\n unique[MagickPathExtent];",
" int\n file;",
" /*\n Write file to disk in blob image format.\n */\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n }\n else\n {\n blob_info->file=fdopen(file,\"wb\");\n if (blob_info->file != (FILE *) NULL)\n {\n (void) FormatLocaleString(image->filename,MagickPathExtent,\n \"%s:%s\",image->magick,unique);\n status=WriteImage(blob_info,image,exception);\n (void) CloseBlob(image);\n (void) fclose(blob_info->file);\n if (status != MagickFalse)\n blob=FileToBlob(unique,~0UL,length,exception);\n }\n (void) RelinquishUniqueFileResource(unique);\n }\n }\n blob_info=DestroyImageInfo(blob_info);\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ I m a g e T o C u s t o m S t r e a m %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImageToCustomStream() is the equivalent of WriteImage(), but writes the\n% formatted \"file\" to the custom stream rather than to an actual file.\n%\n% The format of the ImageToCustomStream method is:\n%\n% void ImageToCustomStream(const ImageInfo *image_info,Image *image,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the image.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void ImageToCustomStream(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *clone_info;",
" MagickBooleanType\n blob_support,\n status;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image_info->custom_stream != (CustomStreamInfo *) NULL);\n assert(image_info->custom_stream->signature == MagickCoreSignature);\n assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n clone_info=CloneImageInfo(image_info);\n clone_info->adjoin=MagickFalse;\n (void) SetImageInfo(clone_info,1,exception);\n if (*clone_info->magick != '\\0')\n (void) CopyMagickString(image->magick,clone_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(image->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoEncodeDelegateForThisImageFormat\",\"`%s'\",\n image->magick);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n (void) CopyMagickString(clone_info->magick,image->magick,MagickPathExtent);\n blob_support=GetMagickBlobSupport(magick_info);\n if ((blob_support != MagickFalse) &&\n (GetMagickEncoderSeekableStream(magick_info) != MagickFalse))\n {\n if ((clone_info->custom_stream->seeker == (CustomStreamSeeker) NULL) ||\n (clone_info->custom_stream->teller == (CustomStreamTeller) NULL))\n blob_support=MagickFalse;\n }\n if (blob_support != MagickFalse)\n {\n /*\n Native blob support for this image format.\n */\n (void) CloseBlob(image);\n *image->filename='\\0';\n (void) WriteImage(clone_info,image,exception);\n (void) CloseBlob(image);\n }\n else\n {\n char\n unique[MagickPathExtent];",
" int\n file;",
" unsigned char\n *blob;",
" /*\n Write file to disk in blob image format.\n */\n clone_info->custom_stream=(CustomStreamInfo *) NULL;\n blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n clone_info->file=fdopen(file,\"wb+\");\n if (clone_info->file != (FILE *) NULL)\n {\n ssize_t\n count;",
" (void) FormatLocaleString(image->filename,MagickPathExtent,\n \"%s:%s\",image->magick,unique);\n status=WriteImage(clone_info,image,exception);\n (void) CloseBlob(image);\n if (status != MagickFalse)\n {\n (void) fseek(clone_info->file,0,SEEK_SET);\n count=(ssize_t) MagickMaxBufferExtent;\n while (count == (ssize_t) MagickMaxBufferExtent)\n {\n count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent,\n clone_info->file);\n (void) image_info->custom_stream->writer(blob,(size_t) count,\n image_info->custom_stream->data);\n }\n }\n (void) fclose(clone_info->file);\n }\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n (void) RelinquishUniqueFileResource(unique);\n }\n clone_info=DestroyImageInfo(clone_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I m a g e T o F i l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImageToFile() writes an image to a file. It returns MagickFalse if an error\n% occurs otherwise MagickTrue.\n%\n% The format of the ImageToFile method is:\n%\n% MagickBooleanType ImageToFile(Image *image,char *filename,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o filename: Write the image to this file.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport MagickBooleanType ImageToFile(Image *image,char *filename,\n ExceptionInfo *exception)\n{\n int\n file;",
" register const unsigned char\n *p;",
" register size_t\n i;",
" size_t\n length,\n quantum;",
" ssize_t\n count;",
" struct stat\n file_stats;",
" unsigned char\n *buffer;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(filename != (const char *) NULL);\n if (*filename == '\\0')\n file=AcquireUniqueFileResource(filename);\n else\n if (LocaleCompare(filename,\"-\") == 0)\n file=fileno(stdout);\n else\n file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer));\n if (buffer == (unsigned char *) NULL)\n {\n file=close(file)-1;\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationError\",\"`%s'\",filename);\n return(MagickFalse);\n }\n length=0;\n p=(const unsigned char *) ReadBlobStream(image,quantum,buffer,&count);\n for (i=0; count > 0; )\n {\n length=(size_t) count;\n for (i=0; i < length; i+=count)\n {\n count=write(file,p+i,(size_t) (length-i));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n if (i < length)\n break;\n p=(const unsigned char *) ReadBlobStream(image,quantum,buffer,&count);\n }\n if (LocaleCompare(filename,\"-\") != 0)\n file=close(file);\n buffer=(unsigned char *) RelinquishMagickMemory(buffer);\n if ((file == -1) || (i < length))\n {\n if (file != -1)\n file=close(file);\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I m a g e s T o B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImagesToBlob() implements direct to memory image formats. It returns the\n% image sequence as a blob and its length. The magick member of the ImageInfo\n% structure determines the format of the returned blob (GIF, JPEG, PNG, etc.)\n%\n% Note, some image formats do not permit multiple images to the same image\n% stream (e.g. JPEG). in this instance, just the first image of the\n% sequence is returned as a blob.\n%\n% The format of the ImagesToBlob method is:\n%\n% void *ImagesToBlob(const ImageInfo *image_info,Image *images,\n% size_t *length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o images: the image list.\n%\n% o length: return the actual length of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void *ImagesToBlob(const ImageInfo *image_info,Image *images,\n size_t *length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *clone_info;",
" MagickBooleanType\n status;",
" void\n *blob;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n *length=0;\n blob=(unsigned char *) NULL;\n clone_info=CloneImageInfo(image_info);\n (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images),\n exception);\n if (*clone_info->magick != '\\0')\n (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(images->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n images->magick);\n clone_info=DestroyImageInfo(clone_info);\n return(blob);\n }\n if (GetMagickAdjoin(magick_info) == MagickFalse)\n {\n clone_info=DestroyImageInfo(clone_info);\n return(ImageToBlob(image_info,images,length,exception));\n }\n (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent);\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n /*\n Native blob support for this images format.\n */\n clone_info->length=0;\n clone_info->blob=(void *) AcquireQuantumMemory(MagickMaxBlobExtent,\n sizeof(unsigned char));\n if (clone_info->blob == (void *) NULL)\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",images->filename);\n else\n {\n (void) CloseBlob(images);\n images->blob->exempt=MagickTrue;\n *images->filename='\\0';\n status=WriteImages(clone_info,images,images->filename,exception);\n *length=images->blob->length;\n blob=DetachBlob(images->blob);\n if (blob == (void *) NULL)\n clone_info->blob=RelinquishMagickMemory(clone_info->blob);\n else if (status == MagickFalse)\n blob=RelinquishMagickMemory(blob);\n else\n blob=ResizeQuantumMemory(blob,*length+1,sizeof(unsigned char));\n }\n }\n else\n {\n char\n filename[MagickPathExtent],\n unique[MagickPathExtent];",
" int\n file;",
" /*\n Write file to disk in blob images format.\n */\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,FileOpenError,\"UnableToWriteBlob\",\n image_info->filename);\n }\n else\n {\n clone_info->file=fdopen(file,\"wb\");\n if (clone_info->file != (FILE *) NULL)\n {\n (void) FormatLocaleString(filename,MagickPathExtent,\"%s:%s\",\n images->magick,unique);\n status=WriteImages(clone_info,images,filename,exception);\n (void) CloseBlob(images);\n (void) fclose(clone_info->file);\n if (status != MagickFalse)\n blob=FileToBlob(unique,~0UL,length,exception);\n }\n (void) RelinquishUniqueFileResource(unique);\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ I m a g e s T o C u s t o m B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImagesToCustomStream() is the equivalent of WriteImages(), but writes the\n% formatted \"file\" to the custom stream rather than to an actual file.\n%\n% The format of the ImageToCustomStream method is:\n%\n% void ImagesToCustomStream(const ImageInfo *image_info,Image *images,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o images: the image list.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void ImagesToCustomStream(const ImageInfo *image_info,\n Image *images,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *clone_info;",
" MagickBooleanType\n blob_support,\n status;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n assert(image_info->custom_stream != (CustomStreamInfo *) NULL);\n assert(image_info->custom_stream->signature == MagickCoreSignature);\n assert(image_info->custom_stream->reader != (CustomStreamHandler) NULL);\n assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n clone_info=CloneImageInfo(image_info);\n (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images),\n exception);\n if (*clone_info->magick != '\\0')\n (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(images->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoEncodeDelegateForThisImageFormat\",\"`%s'\",\n images->magick);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent);\n blob_support=GetMagickBlobSupport(magick_info);\n if ((blob_support != MagickFalse) &&\n (GetMagickEncoderSeekableStream(magick_info) != MagickFalse))\n {\n if ((clone_info->custom_stream->seeker == (CustomStreamSeeker) NULL) ||\n (clone_info->custom_stream->teller == (CustomStreamTeller) NULL))\n blob_support=MagickFalse;\n }\n if (blob_support != MagickFalse)\n {\n /*\n Native blob support for this image format.\n */\n (void) CloseBlob(images);\n *images->filename='\\0';\n (void) WriteImages(clone_info,images,images->filename,exception);\n (void) CloseBlob(images);\n }\n else\n {\n char\n filename[MagickPathExtent],\n unique[MagickPathExtent];",
" int\n file;",
" unsigned char\n *blob;",
" /*\n Write file to disk in blob image format.\n */\n clone_info->custom_stream=(CustomStreamInfo *) NULL;\n blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n clone_info->file=fdopen(file,\"wb+\");\n if (clone_info->file != (FILE *) NULL)\n {\n ssize_t\n count;",
" (void) FormatLocaleString(filename,MagickPathExtent,\"%s:%s\",\n images->magick,unique);\n status=WriteImages(clone_info,images,filename,exception);\n (void) CloseBlob(images);\n if (status != MagickFalse)\n {\n (void) fseek(clone_info->file,0,SEEK_SET);\n count=(ssize_t) MagickMaxBufferExtent;\n while (count == (ssize_t) MagickMaxBufferExtent)\n {\n count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent,\n clone_info->file);\n (void) image_info->custom_stream->writer(blob,(size_t) count,\n image_info->custom_stream->data);\n }\n }\n (void) fclose(clone_info->file);\n }\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n (void) RelinquishUniqueFileResource(unique);\n }\n clone_info=DestroyImageInfo(clone_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I n j e c t I m a g e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% InjectImageBlob() injects the image with a copy of itself in the specified\n% format (e.g. inject JPEG into a PDF image).\n%\n% The format of the InjectImageBlob method is:\n%\n% MagickBooleanType InjectImageBlob(const ImageInfo *image_info,\n% Image *image,Image *inject_image,const char *format,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info..\n%\n% o image: the image.\n%\n% o inject_image: inject into the image stream.\n%\n% o format: the image format.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport MagickBooleanType InjectImageBlob(const ImageInfo *image_info,\n Image *image,Image *inject_image,const char *format,ExceptionInfo *exception)\n{\n char\n filename[MagickPathExtent];",
" FILE\n *unique_file;",
" Image\n *byte_image;",
" ImageInfo\n *write_info;",
" int\n file;",
" MagickBooleanType\n status;",
" register ssize_t\n i;",
" size_t\n quantum;",
" ssize_t\n count;",
" struct stat\n file_stats;",
" unsigned char\n *buffer;",
" /*\n Write inject image to a temporary file.\n */\n assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(inject_image != (Image *) NULL);\n assert(inject_image->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n unique_file=(FILE *) NULL;\n file=AcquireUniqueFileResource(filename);\n if (file != -1)\n unique_file=fdopen(file,\"wb\");\n if ((file == -1) || (unique_file == (FILE *) NULL))\n {\n (void) CopyMagickString(image->filename,filename,MagickPathExtent);\n ThrowFileException(exception,FileOpenError,\"UnableToCreateTemporaryFile\",\n image->filename);\n return(MagickFalse);\n }\n byte_image=CloneImage(inject_image,0,0,MagickFalse,exception);\n if (byte_image == (Image *) NULL)\n {\n (void) fclose(unique_file);\n (void) RelinquishUniqueFileResource(filename);\n return(MagickFalse);\n }\n (void) FormatLocaleString(byte_image->filename,MagickPathExtent,\"%s:%s\",\n format,filename);\n DestroyBlob(byte_image);\n byte_image->blob=CloneBlobInfo((BlobInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n SetImageInfoFile(write_info,unique_file);\n status=WriteImage(write_info,byte_image,exception);\n write_info=DestroyImageInfo(write_info);\n byte_image=DestroyImage(byte_image);\n (void) fclose(unique_file);\n if (status == MagickFalse)\n {\n (void) RelinquishUniqueFileResource(filename);\n return(MagickFalse);\n }\n /*\n Inject into image stream.\n */\n file=open_utf8(filename,O_RDONLY | O_BINARY,0);\n if (file == -1)\n {\n (void) RelinquishUniqueFileResource(filename);\n ThrowFileException(exception,FileOpenError,\"UnableToOpenFile\",\n image_info->filename);\n return(MagickFalse);\n }\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer));\n if (buffer == (unsigned char *) NULL)\n {\n (void) RelinquishUniqueFileResource(filename);\n file=close(file);\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n }\n for (i=0; ; i+=count)\n {\n count=read(file,buffer,quantum);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n status=WriteBlobStream(image,(size_t) count,buffer) == count ? MagickTrue :\n MagickFalse;\n }\n file=close(file);\n if (file == -1)\n ThrowFileException(exception,FileOpenError,\"UnableToWriteBlob\",filename);\n (void) RelinquishUniqueFileResource(filename);\n buffer=(unsigned char *) RelinquishMagickMemory(buffer);\n return(status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s B l o b E x e m p t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsBlobExempt() returns true if the blob is exempt.\n%\n% The format of the IsBlobExempt method is:\n%\n% MagickBooleanType IsBlobExempt(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType IsBlobExempt(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->exempt);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s B l o b S e e k a b l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsBlobSeekable() returns true if the blob is seekable.\n%\n% The format of the IsBlobSeekable method is:\n%\n% MagickBooleanType IsBlobSeekable(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType IsBlobSeekable(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case BlobStream:\n return(MagickTrue);\n case FileStream:\n {\n int\n status;",
" if (blob_info->file_info.file == (FILE *) NULL)\n return(MagickFalse);\n status=fseek(blob_info->file_info.file,0,SEEK_CUR);\n return(status == -1 ? MagickFalse : MagickTrue);\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n MagickOffsetType\n offset;",
" if (blob_info->file_info.gzfile == (gzFile) NULL)\n return(MagickFalse);\n offset=gzseek(blob_info->file_info.gzfile,0,SEEK_CUR);\n return(offset < 0 ? MagickFalse : MagickTrue);\n#else\n break;\n#endif\n }\n case UndefinedStream:\n case BZipStream:\n case FifoStream:\n case PipeStream:\n case StandardStream:\n break;\n case CustomStream:\n {\n if ((blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL) &&\n (blob_info->custom_stream->teller != (CustomStreamTeller) NULL))\n return(MagickTrue);\n break;\n }\n default:\n break;\n }\n return(MagickFalse);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s B l o b T e m p o r a r y %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsBlobTemporary() returns true if the blob is temporary.\n%\n% The format of the IsBlobTemporary method is:\n%\n% MagickBooleanType IsBlobTemporary(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType IsBlobTemporary(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->temporary);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ M a p B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% MapBlob() creates a mapping from a file to a binary large object.\n%\n% The format of the MapBlob method is:\n%\n% void *MapBlob(int file,const MapMode mode,const MagickOffsetType offset,\n% const size_t length)\n%\n% A description of each parameter follows:\n%\n% o file: map this file descriptor.\n%\n% o mode: ReadMode, WriteMode, or IOMode.\n%\n% o offset: starting at this offset within the file.\n%\n% o length: the length of the mapping is returned in this pointer.\n%\n*/\nMagickExport void *MapBlob(int file,const MapMode mode,\n const MagickOffsetType offset,const size_t length)\n{\n#if defined(MAGICKCORE_HAVE_MMAP)\n int\n flags,\n protection;",
" void\n *map;",
" /*\n Map file.\n */\n flags=0;\n if (file == -1)\n#if defined(MAP_ANONYMOUS)\n flags|=MAP_ANONYMOUS;\n#else\n return(NULL);\n#endif\n switch (mode)\n {\n case ReadMode:\n default:\n {\n protection=PROT_READ;\n flags|=MAP_PRIVATE;\n break;\n }\n case WriteMode:\n {\n protection=PROT_WRITE;\n flags|=MAP_SHARED;\n break;\n }\n case IOMode:\n {\n protection=PROT_READ | PROT_WRITE;\n flags|=MAP_SHARED;\n break;\n }\n }\n#if !defined(MAGICKCORE_HAVE_HUGEPAGES) || !defined(MAP_HUGETLB)\n map=mmap((char *) NULL,length,protection,flags,file,offset);\n#else\n map=mmap((char *) NULL,length,protection,flags | MAP_HUGETLB,file,offset);\n if (map == MAP_FAILED)\n map=mmap((char *) NULL,length,protection,flags,file,offset);\n#endif\n if (map == MAP_FAILED)\n return(NULL);\n return(map);\n#else\n (void) file;\n (void) mode;\n (void) offset;\n (void) length;\n return(NULL);\n#endif\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ M S B O r d e r L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% MSBOrderLong() converts a least-significant byte first buffer of integers to\n% most-significant byte first.\n%\n% The format of the MSBOrderLong method is:\n%\n% void MSBOrderLong(unsigned char *buffer,const size_t length)\n%\n% A description of each parameter follows.\n%\n% o buffer: Specifies a pointer to a buffer of integers.\n%\n% o length: Specifies the length of the buffer.\n%\n*/\nMagickExport void MSBOrderLong(unsigned char *buffer,const size_t length)\n{\n int\n c;",
" register unsigned char\n *p,\n *q;",
" assert(buffer != (unsigned char *) NULL);\n q=buffer+length;\n while (buffer < q)\n {\n p=buffer+3;\n c=(int) (*p);\n *p=(*buffer);\n *buffer++=(unsigned char) c;\n p=buffer+1;\n c=(int) (*p);\n *p=(*buffer);\n *buffer++=(unsigned char) c;\n buffer+=2;\n }\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ M S B O r d e r S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% MSBOrderShort() converts a least-significant byte first buffer of integers\n% to most-significant byte first.\n%\n% The format of the MSBOrderShort method is:\n%\n% void MSBOrderShort(unsigned char *p,const size_t length)\n%\n% A description of each parameter follows.\n%\n% o p: Specifies a pointer to a buffer of integers.\n%\n% o length: Specifies the length of the buffer.\n%\n*/\nMagickExport void MSBOrderShort(unsigned char *p,const size_t length)\n{\n int\n c;",
" register unsigned char\n *q;",
" assert(p != (unsigned char *) NULL);\n q=p+length;\n while (p < q)\n {\n c=(int) (*p);\n *p=(*(p+1));\n p++;\n *p++=(unsigned char) c;\n }\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ O p e n B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% OpenBlob() opens a file associated with the image. A file name of '-' sets\n% the file to stdin for type 'r' and stdout for type 'w'. If the filename\n% suffix is '.gz' or '.Z', the image is decompressed for type 'r' and\n% compressed for type 'w'. If the filename prefix is '|', it is piped to or\n% from a system command.\n%\n% The format of the OpenBlob method is:\n%\n% MagickBooleanType OpenBlob(const ImageInfo *image_info,Image *image,\n% const BlobMode mode,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the image.\n%\n% o mode: the mode for opening the file.\n%\n*/",
"static inline MagickBooleanType SetStreamBuffering(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *option;",
" int\n status;",
" size_t\n size;",
" size=16384;\n option=GetImageOption(image_info,\"stream:buffer-size\");\n if (option != (const char *) NULL)\n size=StringToUnsignedLong(option);\n status=setvbuf(image->blob->file_info.file,(char *) NULL,size == 0 ?\n _IONBF : _IOFBF,size);\n return(status == 0 ? MagickTrue : MagickFalse);\n}",
"MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,\n Image *image,const BlobMode mode,ExceptionInfo *exception)\n{\n BlobInfo\n *magick_restrict blob_info;",
" char\n extension[MagickPathExtent],\n filename[MagickPathExtent];",
" const char\n *type;",
" MagickBooleanType\n status;",
" PolicyRights\n rights;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n blob_info=image->blob;\n if (image_info->blob != (void *) NULL)\n {\n if (image_info->stream != (StreamHandler) NULL)\n blob_info->stream=(StreamHandler) image_info->stream;\n AttachBlob(blob_info,image_info->blob,image_info->length);\n return(MagickTrue);\n }\n if ((image_info->custom_stream != (CustomStreamInfo *) NULL) &&\n (*image->filename == '\\0'))\n {\n blob_info->type=CustomStream;\n blob_info->custom_stream=image_info->custom_stream;\n return(MagickTrue);\n }\n (void) DetachBlob(blob_info);\n blob_info->mode=mode;\n switch (mode)\n {\n default: type=\"r\"; break;\n case ReadBlobMode: type=\"r\"; break;\n case ReadBinaryBlobMode: type=\"rb\"; break;\n case WriteBlobMode: type=\"w\"; break;\n case WriteBinaryBlobMode: type=\"w+b\"; break;\n case AppendBlobMode: type=\"a\"; break;\n case AppendBinaryBlobMode: type=\"a+b\"; break;\n }\n if (*type != 'r')\n blob_info->synchronize=image_info->synchronize;\n if (image_info->stream != (StreamHandler) NULL)\n {\n blob_info->stream=image_info->stream;\n if (*type == 'w')\n {\n blob_info->type=FifoStream;\n return(MagickTrue);\n }\n }\n /*\n Open image file.\n */\n *filename='\\0';\n (void) CopyMagickString(filename,image->filename,MagickPathExtent);\n rights=ReadPolicyRights;\n if (*type == 'w')\n rights=WritePolicyRights;\n if (IsRightsAuthorized(PathPolicyDomain,rights,filename) == MagickFalse)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",filename);\n return(MagickFalse);\n }\n if ((LocaleCompare(filename,\"-\") == 0) ||\n ((*filename == '\\0') && (image_info->file == (FILE *) NULL)))\n {\n blob_info->file_info.file=(*type == 'r') ? stdin : stdout;\n#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)\n if (strchr(type,'b') != (char *) NULL)\n setmode(fileno(blob_info->file_info.file),_O_BINARY);\n#endif\n blob_info->type=StandardStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n if ((LocaleNCompare(filename,\"fd:\",3) == 0) &&\n (IsGeometry(filename+3) != MagickFalse))\n {\n char\n fileMode[MagickPathExtent];",
" *fileMode =(*type);\n fileMode[1]='\\0';\n blob_info->file_info.file=fdopen(StringToLong(filename+3),fileMode);\n if (blob_info->file_info.file == (FILE *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)\n if (strchr(type,'b') != (char *) NULL)\n setmode(fileno(blob_info->file_info.file),_O_BINARY);\n#endif\n blob_info->type=FileStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n#if defined(MAGICKCORE_HAVE_POPEN) && defined(MAGICKCORE_PIPES_SUPPORT)\n if (*filename == '|')\n {\n char\n fileMode[MagickPathExtent],\n *sanitize_command;",
" /*\n Pipe image to or from a system command.\n */\n#if defined(SIGPIPE)\n if (*type == 'w')\n (void) signal(SIGPIPE,SIG_IGN);\n#endif\n *fileMode =(*type);\n fileMode[1]='\\0';\n sanitize_command=SanitizeString(filename+1);\n blob_info->file_info.file=(FILE *) popen_utf8(sanitize_command,fileMode);\n sanitize_command=DestroyString(sanitize_command);\n if (blob_info->file_info.file == (FILE *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n blob_info->type=PipeStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n#endif\n status=GetPathAttributes(filename,&blob_info->properties);\n#if defined(S_ISFIFO)\n if ((status != MagickFalse) && S_ISFIFO(blob_info->properties.st_mode))\n {\n blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);\n if (blob_info->file_info.file == (FILE *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n blob_info->type=FileStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n#endif\n GetPathComponent(image->filename,ExtensionPath,extension);\n if (*type == 'w')\n {\n (void) CopyMagickString(filename,image->filename,MagickPathExtent);\n if ((image_info->adjoin == MagickFalse) ||\n (strchr(filename,'%') != (char *) NULL))\n {\n /*\n Form filename for multi-part images.\n */\n (void) InterpretImageFilename(image_info,image,image->filename,(int)\n image->scene,filename,exception);\n if ((LocaleCompare(filename,image->filename) == 0) &&\n ((GetPreviousImageInList(image) != (Image *) NULL) ||\n (GetNextImageInList(image) != (Image *) NULL)))\n {\n char\n path[MagickPathExtent];",
" GetPathComponent(image->filename,RootPath,path);\n if (*extension == '\\0')\n (void) FormatLocaleString(filename,MagickPathExtent,\"%s-%.20g\",\n path,(double) image->scene);\n else\n (void) FormatLocaleString(filename,MagickPathExtent,\n \"%s-%.20g.%s\",path,(double) image->scene,extension);\n }\n (void) CopyMagickString(image->filename,filename,MagickPathExtent);\n#if defined(macintosh)\n SetApplicationType(filename,image_info->magick,'8BIM');\n#endif\n }\n }\n if (image_info->file != (FILE *) NULL)\n {\n blob_info->file_info.file=image_info->file;\n blob_info->type=FileStream;\n blob_info->exempt=MagickTrue;\n }\n else\n if (*type == 'r')\n {\n blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);\n if (blob_info->file_info.file != (FILE *) NULL)\n {\n size_t\n count;",
" unsigned char\n magick[3];",
" blob_info->type=FileStream;\n (void) SetStreamBuffering(image_info,image);\n (void) memset(magick,0,sizeof(magick));\n count=fread(magick,1,sizeof(magick),blob_info->file_info.file);\n (void) fseek(blob_info->file_info.file,-((off_t) count),SEEK_CUR);\n#if defined(MAGICKCORE_POSIX_SUPPORT)\n (void) fflush(blob_info->file_info.file);\n#endif\n (void) LogMagickEvent(BlobEvent,GetMagickModule(),\n \" read %.20g magic header bytes\",(double) count);\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if (((int) magick[0] == 0x1F) && ((int) magick[1] == 0x8B) &&\n ((int) magick[2] == 0x08))\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n (void) fclose(blob_info->file_info.file);\n blob_info->file_info.file=(FILE *) NULL;\n blob_info->file_info.gzfile=gzopen(filename,\"rb\");\n if (blob_info->file_info.gzfile != (gzFile) NULL)\n blob_info->type=ZipStream;\n }\n#endif\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n if (strncmp((char *) magick,\"BZh\",3) == 0)\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n (void) fclose(blob_info->file_info.file);\n blob_info->file_info.file=(FILE *) NULL;\n blob_info->file_info.bzfile=BZ2_bzopen(filename,\"r\");\n if (blob_info->file_info.bzfile != (BZFILE *) NULL)\n blob_info->type=BZipStream;\n }\n#endif\n if (blob_info->type == FileStream)\n {\n const MagickInfo\n *magick_info;",
" ExceptionInfo\n *sans_exception;",
" size_t\n length;",
" sans_exception=AcquireExceptionInfo();\n magick_info=GetMagickInfo(image_info->magick,sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n length=(size_t) blob_info->properties.st_size;\n if ((magick_info != (const MagickInfo *) NULL) &&\n (GetMagickBlobSupport(magick_info) != MagickFalse) &&\n (length > MagickMaxBufferExtent) &&\n (AcquireMagickResource(MapResource,length) != MagickFalse))\n {\n void\n *blob;",
" blob=MapBlob(fileno(blob_info->file_info.file),ReadMode,0,\n length);\n if (blob == (void *) NULL)\n RelinquishMagickResource(MapResource,length);\n else\n {\n /*\n Format supports blobs-- use memory-mapped I/O.\n */\n if (image_info->file != (FILE *) NULL)\n blob_info->exempt=MagickFalse;\n else\n {\n (void) fclose(blob_info->file_info.file);\n blob_info->file_info.file=(FILE *) NULL;\n }\n AttachBlob(blob_info,blob,length);\n blob_info->mapped=MagickTrue;\n }\n }\n }\n }\n }\n else\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if ((LocaleCompare(extension,\"Z\") == 0) ||\n (LocaleCompare(extension,\"gz\") == 0) ||\n (LocaleCompare(extension,\"wmz\") == 0) ||\n (LocaleCompare(extension,\"svgz\") == 0))\n {\n blob_info->file_info.gzfile=gzopen(filename,\"wb\");\n if (blob_info->file_info.gzfile != (gzFile) NULL)\n blob_info->type=ZipStream;\n }\n else\n#endif\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n if (LocaleCompare(extension,\"bz2\") == 0)\n {\n blob_info->file_info.bzfile=BZ2_bzopen(filename,\"w\");\n if (blob_info->file_info.bzfile != (BZFILE *) NULL)\n blob_info->type=BZipStream;\n }\n else\n#endif\n {\n blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);\n if (blob_info->file_info.file != (FILE *) NULL)\n {\n blob_info->type=FileStream;\n (void) SetStreamBuffering(image_info,image);\n }\n }\n blob_info->status=MagickFalse;\n if (blob_info->type != UndefinedStream)\n blob_info->size=GetBlobSize(image);\n else\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ P i n g B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% PingBlob() returns all the attributes of an image or image sequence except\n% for the pixels. It is much faster and consumes far less memory than\n% BlobToImage(). On failure, a NULL image is returned and exception\n% describes the reason for the failure.\n%\n% The format of the PingBlob method is:\n%\n% Image *PingBlob(const ImageInfo *image_info,const void *blob,\n% const size_t length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o blob: the address of a character stream in one of the image formats\n% understood by ImageMagick.\n%\n% o length: This size_t integer reflects the length in bytes of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"#if defined(__cplusplus) || defined(c_plusplus)\nextern \"C\" {\n#endif",
"static size_t PingStream(const Image *magick_unused(image),\n const void *magick_unused(pixels),const size_t columns)\n{\n magick_unreferenced(image);\n magick_unreferenced(pixels);\n return(columns);\n}",
"#if defined(__cplusplus) || defined(c_plusplus)\n}\n#endif",
"MagickExport Image *PingBlob(const ImageInfo *image_info,const void *blob,\n const size_t length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" Image\n *image;",
" ImageInfo\n *clone_info,\n *ping_info;",
" MagickBooleanType\n status;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n if ((blob == (const void *) NULL) || (length == 0))\n {\n (void) ThrowMagickException(exception,GetMagickModule(),BlobError,\n \"ZeroLengthBlobNotPermitted\",\"`%s'\",image_info->filename);\n return((Image *) NULL);\n }\n ping_info=CloneImageInfo(image_info);\n ping_info->blob=(void *) blob;\n ping_info->length=length;\n ping_info->ping=MagickTrue;\n if (*ping_info->magick == '\\0')\n (void) SetImageInfo(ping_info,0,exception);\n magick_info=GetMagickInfo(ping_info->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n ping_info->magick);\n ping_info=DestroyImageInfo(ping_info);\n return((Image *) NULL);\n }\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n char\n filename[MagickPathExtent];",
" /*\n Native blob support for this image format.\n */\n (void) CopyMagickString(filename,ping_info->filename,MagickPathExtent);\n (void) FormatLocaleString(ping_info->filename,MagickPathExtent,\"%s:%s\",\n ping_info->magick,filename);\n image=ReadStream(ping_info,&PingStream,exception);\n if (image != (Image *) NULL)\n (void) DetachBlob(image->blob);\n ping_info=DestroyImageInfo(ping_info);\n return(image);\n }\n /*\n Write blob to a temporary file on disk.\n */\n ping_info->blob=(void *) NULL;\n ping_info->length=0;\n *ping_info->filename='\\0';\n status=BlobToFile(ping_info->filename,blob,length,exception);\n if (status == MagickFalse)\n {\n (void) RelinquishUniqueFileResource(ping_info->filename);\n ping_info=DestroyImageInfo(ping_info);\n return((Image *) NULL);\n }\n clone_info=CloneImageInfo(ping_info);\n (void) FormatLocaleString(clone_info->filename,MagickPathExtent,\"%s:%s\",\n ping_info->magick,ping_info->filename);\n image=ReadStream(clone_info,&PingStream,exception);\n if (image != (Image *) NULL)\n {\n Image\n *images;",
" /*\n Restore original filenames and image format.\n */\n for (images=GetFirstImageInList(image); images != (Image *) NULL; )\n {\n (void) CopyMagickString(images->filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick_filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick,magick_info->name,\n MagickPathExtent);\n images=GetNextImageInList(images);\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n (void) RelinquishUniqueFileResource(ping_info->filename);\n ping_info=DestroyImageInfo(ping_info);\n return(image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlob() reads data from the blob or image file and returns it. It\n% returns the number of bytes read. If length is zero, ReadBlob() returns\n% zero and has no other results. If length is greater than SSIZE_MAX, the\n% result is unspecified.\n%\n% The format of the ReadBlob method is:\n%\n% ssize_t ReadBlob(Image *image,const size_t length,void *data)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o length: Specifies an integer representing the number of bytes to read\n% from the file.\n%\n% o data: Specifies an area to place the information requested from the\n% file.\n%\n*/\nMagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n c;",
" register unsigned char\n *q;",
" ssize_t\n count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n if (length == 0)\n return(0);\n assert(data != (void *) NULL);\n blob_info=image->blob;\n count=0;\n q=(unsigned char *) data;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n switch (length)\n {\n default:\n {\n count=(ssize_t) fread(q,1,length,blob_info->file_info.file);\n break;\n }\n case 4:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 3:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 2:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 1:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 0:\n break;\n }\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n switch (length)\n {\n default:\n {\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) gzread(blob_info->file_info.gzfile,q+i,\n (unsigned int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n break;\n }\n case 4:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 3:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 2:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 1:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 0:\n break;\n }\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) BZ2_bzread(blob_info->file_info.bzfile,q+i,\n (unsigned int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n register const unsigned char\n *p;",
" if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n {\n blob_info->eof=MagickTrue;\n break;\n }\n p=blob_info->data+blob_info->offset;\n count=(ssize_t) MagickMin((MagickOffsetType) length,(MagickOffsetType)\n blob_info->length-blob_info->offset);\n blob_info->offset+=count;\n if (count != (ssize_t) length)\n blob_info->eof=MagickTrue;\n (void) memcpy(q,p,(size_t) count);\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->reader != (CustomStreamHandler) NULL)\n count=blob_info->custom_stream->reader(q,length,\n blob_info->custom_stream->data);\n break;\n }\n }\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b B y t e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobByte() reads a single byte from the image file and returns it.\n%\n% The format of the ReadBlobByte method is:\n%\n% int ReadBlobByte(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport int ReadBlobByte(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" register const unsigned char\n *p;",
" unsigned char\n buffer[1];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n int\n c;",
" p=(const unsigned char *) buffer;\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n return(EOF);\n *buffer=(unsigned char) c;\n break;\n }\n default:\n {\n ssize_t\n count;",
" p=(const unsigned char *) ReadBlobStream(image,1,buffer,&count);\n if (count != 1)\n return(EOF);\n break;\n }\n }\n return((int) (*p));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b D o u b l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobDouble() reads a double value as a 64-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the ReadBlobDouble method is:\n%\n% double ReadBlobDouble(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport double ReadBlobDouble(Image *image)\n{\n union\n {\n MagickSizeType\n unsigned_value;",
" double\n double_value;\n } quantum;",
" quantum.double_value=0.0;\n quantum.unsigned_value=ReadBlobLongLong(image);\n return(quantum.double_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b F l o a t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobFloat() reads a float value as a 32-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the ReadBlobFloat method is:\n%\n% float ReadBlobFloat(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport float ReadBlobFloat(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" float\n float_value;\n } quantum;",
" quantum.float_value=0.0;\n quantum.unsigned_value=ReadBlobLong(image);\n return(quantum.float_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLong() reads a unsigned int value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobLong method is:\n%\n% unsigned int ReadBlobLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned int ReadBlobLong(Image *image)\n{\n register const unsigned char\n *p;",
" ssize_t\n count;",
" unsigned char\n buffer[4];",
" unsigned int\n value;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,4,buffer,&count);\n if (count != 4)\n return(0UL);\n if (image->endian == LSBEndian)\n {\n value=(unsigned int) (*p++);\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 24;\n return(value);\n }\n value=(unsigned int) (*p++) << 24;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L o n g L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLongLong() reads a long long value as a 64-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobLongLong method is:\n%\n% MagickSizeType ReadBlobLongLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport MagickSizeType ReadBlobLongLong(Image *image)\n{\n MagickSizeType\n value;",
" register const unsigned char\n *p;",
" ssize_t\n count;",
" unsigned char\n buffer[8];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,8,buffer,&count);\n if (count != 8)\n return(MagickULLConstant(0));\n if (image->endian == LSBEndian)\n {\n value=(MagickSizeType) (*p++);\n value|=(MagickSizeType) (*p++) << 8;\n value|=(MagickSizeType) (*p++) << 16;\n value|=(MagickSizeType) (*p++) << 24;\n value|=(MagickSizeType) (*p++) << 32;\n value|=(MagickSizeType) (*p++) << 40;\n value|=(MagickSizeType) (*p++) << 48;\n value|=(MagickSizeType) (*p++) << 56;\n return(value);\n }\n value=(MagickSizeType) (*p++) << 56;\n value|=(MagickSizeType) (*p++) << 48;\n value|=(MagickSizeType) (*p++) << 40;\n value|=(MagickSizeType) (*p++) << 32;\n value|=(MagickSizeType) (*p++) << 24;\n value|=(MagickSizeType) (*p++) << 16;\n value|=(MagickSizeType) (*p++) << 8;\n value|=(MagickSizeType) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobShort() reads a short value as a 16-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the ReadBlobShort method is:\n%\n% unsigned short ReadBlobShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned short ReadBlobShort(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned short\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,2,buffer,&count);\n if (count != 2)\n return((unsigned short) 0U);\n if (image->endian == LSBEndian)\n {\n value=(unsigned short) (*p++);\n value|=(unsigned short) (*p++) << 8;\n return(value);\n }\n value=(unsigned short) ((unsigned short) (*p++) << 8);\n value|=(unsigned short) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBLong() reads a unsigned int value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the ReadBlobLSBLong method is:\n%\n% unsigned int ReadBlobLSBLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned int ReadBlobLSBLong(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned int\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,4,buffer,&count);\n if (count != 4)\n return(0U);\n value=(unsigned int) (*p++);\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 24;\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBSignedLong() reads a signed int value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the ReadBlobLSBSignedLong method is:\n%\n% signed int ReadBlobLSBSignedLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed int ReadBlobLSBSignedLong(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobLSBLong(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBShort() reads a short value as a 16-bit quantity in\n% least-significant byte first order.\n%\n% The format of the ReadBlobLSBShort method is:\n%\n% unsigned short ReadBlobLSBShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned short ReadBlobLSBShort(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned short\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,2,buffer,&count);\n if (count != 2)\n return((unsigned short) 0U);\n value=(unsigned short) (*p++);\n value|=(unsigned short) (*p++) << 8;\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBSignedShort() reads a signed short value as a 16-bit quantity in\n% least-significant byte-order.\n%\n% The format of the ReadBlobLSBSignedShort method is:\n%\n% signed short ReadBlobLSBSignedShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed short ReadBlobLSBSignedShort(Image *image)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobLSBShort(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBLong() reads a unsigned int value as a 32-bit quantity in\n% most-significant byte first order.\n%\n% The format of the ReadBlobMSBLong method is:\n%\n% unsigned int ReadBlobMSBLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned int ReadBlobMSBLong(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned int\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,4,buffer,&count);\n if (count != 4)\n return(0UL);\n value=(unsigned int) (*p++) << 24;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B L o n g L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBLongLong() reads a unsigned long long value as a 64-bit quantity\n% in most-significant byte first order.\n%\n% The format of the ReadBlobMSBLongLong method is:\n%\n% unsigned int ReadBlobMSBLongLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport MagickSizeType ReadBlobMSBLongLong(Image *image)\n{\n register const unsigned char\n *p;",
" register MagickSizeType\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[8];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,8,buffer,&count);\n if (count != 8)\n return(MagickULLConstant(0));\n value=(MagickSizeType) (*p++) << 56;\n value|=(MagickSizeType) (*p++) << 48;\n value|=(MagickSizeType) (*p++) << 40;\n value|=(MagickSizeType) (*p++) << 32;\n value|=(MagickSizeType) (*p++) << 24;\n value|=(MagickSizeType) (*p++) << 16;\n value|=(MagickSizeType) (*p++) << 8;\n value|=(MagickSizeType) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBShort() reads a short value as a 16-bit quantity in\n% most-significant byte first order.\n%\n% The format of the ReadBlobMSBShort method is:\n%\n% unsigned short ReadBlobMSBShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned short ReadBlobMSBShort(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned short\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,2,buffer,&count);\n if (count != 2)\n return((unsigned short) 0U);\n value=(unsigned short) ((*p++) << 8);\n value|=(unsigned short) (*p++);\n return((unsigned short) (value & 0xffff));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBSignedLong() reads a signed int value as a 32-bit quantity in\n% most-significant byte-order.\n%\n% The format of the ReadBlobMSBSignedLong method is:\n%\n% signed int ReadBlobMSBSignedLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed int ReadBlobMSBSignedLong(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobMSBLong(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBSignedShort() reads a signed short value as a 16-bit quantity in\n% most-significant byte-order.\n%\n% The format of the ReadBlobMSBSignedShort method is:\n%\n% signed short ReadBlobMSBSignedShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed short ReadBlobMSBSignedShort(Image *image)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobMSBShort(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobSignedLong() reads a signed int value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobSignedLong method is:\n%\n% signed int ReadBlobSignedLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed int ReadBlobSignedLong(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobLong(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobSignedShort() reads a signed short value as a 16-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobSignedShort method is:\n%\n% signed short ReadBlobSignedShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed short ReadBlobSignedShort(Image *image)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobShort(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S t r e a m %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobStream() reads data from the blob or image file and returns it. It\n% returns a pointer to the data buffer you supply or to the image memory\n% buffer if its supported (zero-copy). If length is zero, ReadBlobStream()\n% returns a count of zero and has no other results. If length is greater than\n% SSIZE_MAX, the result is unspecified.\n%\n% The format of the ReadBlobStream method is:\n%\n% const void *ReadBlobStream(Image *image,const size_t length,void *data,\n% ssize_t *count)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o length: Specifies an integer representing the number of bytes to read\n% from the file.\n%\n% o count: returns the number of bytes read.\n%\n% o data: Specifies an area to place the information requested from the\n% file.\n%\n*/\nMagickExport const void *ReadBlobStream(Image *image,const size_t length,\n void *data,ssize_t *count)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n assert(count != (ssize_t *) NULL);\n blob_info=image->blob;\n if (blob_info->type != BlobStream)\n {\n assert(data != NULL);\n *count=ReadBlob(image,length,(unsigned char *) data);\n return(data);\n }\n if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n {\n *count=0;\n blob_info->eof=MagickTrue;\n return(data);\n }\n data=blob_info->data+blob_info->offset;\n *count=(ssize_t) MagickMin((MagickOffsetType) length,(MagickOffsetType)\n blob_info->length-blob_info->offset);\n blob_info->offset+=(*count);\n if (*count != (ssize_t) length)\n blob_info->eof=MagickTrue;\n return(data);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S t r i n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobString() reads characters from a blob or file until a newline\n% character is read or an end-of-file condition is encountered.\n%\n% The format of the ReadBlobString method is:\n%\n% char *ReadBlobString(Image *image,char *string)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o string: the address of a character buffer.\n%\n*/\nMagickExport char *ReadBlobString(Image *image,char *string)\n{\n int\n c;",
" register ssize_t\n i;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n for (i=0; i < (MagickPathExtent-1L); i++)\n {\n c=ReadBlobByte(image);\n if (c == EOF)\n {\n if (i == 0)\n return((char *) NULL);\n break;\n }\n string[i]=c;\n if (c == '\\n')\n {\n if ((i > 0) && (string[i-1] == '\\r'))\n i--;\n break;\n }\n }\n string[i]='\\0';\n return(string);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e f e r e n c e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReferenceBlob() increments the reference count associated with the pixel\n% blob returning a pointer to the blob.\n%\n% The format of the ReferenceBlob method is:\n%\n% BlobInfo ReferenceBlob(BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: the blob_info.\n%\n*/\nMagickExport BlobInfo *ReferenceBlob(BlobInfo *blob)\n{\n assert(blob != (BlobInfo *) NULL);\n assert(blob->signature == MagickCoreSignature);\n if (blob->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n LockSemaphoreInfo(blob->semaphore);\n blob->reference_count++;\n UnlockSemaphoreInfo(blob->semaphore);\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e e k B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SeekBlob() sets the offset in bytes from the beginning of a blob or file\n% and returns the resulting offset.\n%\n% The format of the SeekBlob method is:\n%\n% MagickOffsetType SeekBlob(Image *image,const MagickOffsetType offset,\n% const int whence)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o offset: Specifies an integer representing the offset in bytes.\n%\n% o whence: Specifies an integer representing how the offset is\n% treated relative to the beginning of the blob as follows:\n%\n% SEEK_SET Set position equal to offset bytes.\n% SEEK_CUR Set position to current location plus offset.\n% SEEK_END Set position to EOF plus offset.\n%\n*/\nMagickExport MagickOffsetType SeekBlob(Image *image,\n const MagickOffsetType offset,const int whence)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n case PipeStream:\n return(-1);\n case FileStream:\n {\n if ((offset < 0) && (whence == SEEK_SET))\n return(-1);\n if (fseek(blob_info->file_info.file,offset,whence) < 0)\n return(-1);\n blob_info->offset=TellBlob(image);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if (gzseek(blob_info->file_info.gzfile,offset,whence) < 0)\n return(-1);\n#endif\n blob_info->offset=TellBlob(image);\n break;\n }\n case BZipStream:\n return(-1);\n case FifoStream:\n return(-1);\n case BlobStream:\n {\n switch (whence)\n {\n case SEEK_SET:\n default:\n {\n if (offset < 0)\n return(-1);\n blob_info->offset=offset;\n break;\n }\n case SEEK_CUR:\n {\n if (((offset > 0) && (blob_info->offset > (SSIZE_MAX-offset))) ||\n ((offset < 0) && (blob_info->offset < (-SSIZE_MAX-offset))))\n {\n errno=EOVERFLOW;\n return(-1);\n }\n if ((blob_info->offset+offset) < 0)\n return(-1);\n blob_info->offset+=offset;\n break;\n }\n case SEEK_END:\n {\n if (((MagickOffsetType) blob_info->length+offset) < 0)\n return(-1);\n blob_info->offset=blob_info->length+offset;\n break;\n }\n }\n if (blob_info->offset < (MagickOffsetType) ((off_t) blob_info->length))\n {\n blob_info->eof=MagickFalse;\n break;\n }\n if (blob_info->offset >= (MagickOffsetType) ((off_t) blob_info->extent))\n return(-1);\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->seeker == (CustomStreamSeeker) NULL)\n return(-1);\n blob_info->offset=blob_info->custom_stream->seeker(offset,whence,\n blob_info->custom_stream->data);\n break;\n }\n }\n return(blob_info->offset);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t B l o b E x e m p t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetBlobExempt() sets the blob exempt status.\n%\n% The format of the SetBlobExempt method is:\n%\n% MagickBooleanType SetBlobExempt(const Image *image,\n% const MagickBooleanType exempt)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o exempt: Set to true if this blob is exempt from being closed.\n%\n*/\nMagickExport void SetBlobExempt(Image *image,const MagickBooleanType exempt)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n image->blob->exempt=exempt;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t B l o b E x t e n t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetBlobExtent() ensures enough space is allocated for the blob. If the\n% method is successful, subsequent writes to bytes in the specified range are\n% guaranteed not to fail.\n%\n% The format of the SetBlobExtent method is:\n%\n% MagickBooleanType SetBlobExtent(Image *image,const MagickSizeType extent)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o extent: the blob maximum extent.\n%\n*/\nMagickExport MagickBooleanType SetBlobExtent(Image *image,\n const MagickSizeType extent)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n return(MagickFalse);\n case FileStream:\n {\n MagickOffsetType\n offset;",
" ssize_t\n count;",
" if (extent != (MagickSizeType) ((off_t) extent))\n return(MagickFalse);\n offset=SeekBlob(image,0,SEEK_END);\n if (offset < 0)\n return(MagickFalse);\n if ((MagickSizeType) offset >= extent)\n break;\n offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);\n if (offset < 0)\n break;\n count=(ssize_t) fwrite((const unsigned char *) \"\",1,1,\n blob_info->file_info.file);\n#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)\n if (blob_info->synchronize != MagickFalse)\n {\n int\n file;",
" file=fileno(blob_info->file_info.file);\n if ((file == -1) || (offset < 0))\n return(MagickFalse);\n (void) posix_fallocate(file,offset,extent-offset);\n }\n#endif\n offset=SeekBlob(image,offset,SEEK_SET);\n if (count != 1)\n return(MagickFalse);\n break;\n }\n case PipeStream:\n case ZipStream:\n return(MagickFalse);\n case BZipStream:\n return(MagickFalse);\n case FifoStream:\n return(MagickFalse);\n case BlobStream:\n {\n if (extent != (MagickSizeType) ((size_t) extent))\n return(MagickFalse);\n if (blob_info->mapped != MagickFalse)\n {\n MagickOffsetType\n offset;",
" ssize_t\n count;",
" (void) UnmapBlob(blob_info->data,blob_info->length);\n RelinquishMagickResource(MapResource,blob_info->length);\n if (extent != (MagickSizeType) ((off_t) extent))\n return(MagickFalse);\n offset=SeekBlob(image,0,SEEK_END);\n if (offset < 0)\n return(MagickFalse);\n if ((MagickSizeType) offset >= extent)\n break;\n offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);\n count=(ssize_t) fwrite((const unsigned char *) \"\",1,1,\n blob_info->file_info.file);\n#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)\n if (blob_info->synchronize != MagickFalse)\n {\n int\n file;",
" file=fileno(blob_info->file_info.file);\n if ((file == -1) || (offset < 0))\n return(MagickFalse);\n (void) posix_fallocate(file,offset,extent-offset);\n }\n#endif\n offset=SeekBlob(image,offset,SEEK_SET);\n if (count != 1)\n return(MagickFalse);\n (void) AcquireMagickResource(MapResource,extent);\n blob_info->data=(unsigned char*) MapBlob(fileno(\n blob_info->file_info.file),WriteMode,0,(size_t) extent);\n blob_info->extent=(size_t) extent;\n blob_info->length=(size_t) extent;\n (void) SyncBlob(image);\n break;\n }\n blob_info->extent=(size_t) extent;\n blob_info->data=(unsigned char *) ResizeQuantumMemory(blob_info->data,\n blob_info->extent+1,sizeof(*blob_info->data));\n (void) SyncBlob(image);\n if (blob_info->data == (unsigned char *) NULL)\n {\n (void) DetachBlob(blob_info);\n return(MagickFalse);\n }\n break;\n }\n case CustomStream:\n break;\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m D a t a %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamData() sets the stream info data member.\n%\n% The format of the SetCustomStreamData method is:\n%\n% void SetCustomStreamData(CustomStreamInfo *custom_stream,void *)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o data: an object containing information about the custom stream.\n%\n*/\nMagickExport void SetCustomStreamData(CustomStreamInfo *custom_stream,\n void *data)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->data=data;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m R e a d e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamReader() sets the stream info reader member.\n%\n% The format of the SetCustomStreamReader method is:\n%\n% void SetCustomStreamReader(CustomStreamInfo *custom_stream,\n% CustomStreamHandler reader)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o reader: a function to read from the stream.\n%\n*/\nMagickExport void SetCustomStreamReader(CustomStreamInfo *custom_stream,\n CustomStreamHandler reader)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->reader=reader;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m S e e k e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamSeeker() sets the stream info seeker member.\n%\n% The format of the SetCustomStreamReader method is:\n%\n% void SetCustomStreamSeeker(CustomStreamInfo *custom_stream,\n% CustomStreamSeeker seeker)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o seeker: a function to seek in the custom stream.\n%\n*/\nMagickExport void SetCustomStreamSeeker(CustomStreamInfo *custom_stream,\n CustomStreamSeeker seeker)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->seeker=seeker;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m T e l l e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamTeller() sets the stream info teller member.\n%\n% The format of the SetCustomStreamTeller method is:\n%\n% void SetCustomStreamTeller(CustomStreamInfo *custom_stream,\n% CustomStreamTeller *teller)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o teller: a function to set the position in the stream.\n%\n*/\nMagickExport void SetCustomStreamTeller(CustomStreamInfo *custom_stream,\n CustomStreamTeller teller)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->teller=teller;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m W r i t e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamWriter() sets the stream info writer member.\n%\n% The format of the SetCustomStreamWriter method is:\n%\n% void SetCustomStreamWriter(CustomStreamInfo *custom_stream,\n% CustomStreamHandler *writer)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o writer: a function to write to the custom stream.\n%\n*/\nMagickExport void SetCustomStreamWriter(CustomStreamInfo *custom_stream,\n CustomStreamHandler writer)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->writer=writer;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S y n c B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SyncBlob() flushes the datastream if it is a file or synchronizes the data\n% attributes if it is an blob.\n%\n% The format of the SyncBlob method is:\n%\n% int SyncBlob(Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nstatic int SyncBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n status;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n status=0;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n status=fflush(blob_info->file_info.file);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n status=gzflush(blob_info->file_info.gzfile,Z_SYNC_FLUSH);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n status=BZ2_bzflush(blob_info->file_info.bzfile);\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n break;\n case CustomStream:\n break;\n }\n return(status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ T e l l B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% TellBlob() obtains the current value of the blob or file position.\n%\n% The format of the TellBlob method is:\n%\n% MagickOffsetType TellBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickOffsetType TellBlob(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickOffsetType\n offset;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n offset=(-1);\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n {\n offset=ftell(blob_info->file_info.file);\n break;\n }\n case PipeStream:\n break;\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n offset=(MagickOffsetType) gztell(blob_info->file_info.gzfile);\n#endif\n break;\n }\n case BZipStream:\n break;\n case FifoStream:\n break;\n case BlobStream:\n {\n offset=blob_info->offset;\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->teller != (CustomStreamTeller) NULL)\n offset=blob_info->custom_stream->teller(blob_info->custom_stream->data);\n break;\n }\n }\n return(offset);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ U n m a p B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% UnmapBlob() deallocates the binary large object previously allocated with\n% the MapBlob method.\n%\n% The format of the UnmapBlob method is:\n%\n% MagickBooleanType UnmapBlob(void *map,const size_t length)\n%\n% A description of each parameter follows:\n%\n% o map: the address of the binary large object.\n%\n% o length: the length of the binary large object.\n%\n*/\nMagickExport MagickBooleanType UnmapBlob(void *map,const size_t length)\n{\n#if defined(MAGICKCORE_HAVE_MMAP)\n int\n status;",
" status=munmap(map,length);\n return(status == -1 ? MagickFalse : MagickTrue);\n#else\n (void) map;\n (void) length;\n return(MagickFalse);\n#endif\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlob() writes data to a blob or image file. It returns the number of\n% bytes written.\n%\n% The format of the WriteBlob method is:\n%\n% ssize_t WriteBlob(Image *image,const size_t length,const void *data)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o length: Specifies an integer representing the number of bytes to\n% write to the file.\n%\n% o data: The address of the data to write to the blob or file.\n%\n*/\nMagickExport ssize_t WriteBlob(Image *image,const size_t length,\n const void *data)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n c;",
" register const unsigned char\n *p;",
" register unsigned char\n *q;",
" ssize_t\n count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n if (length == 0)\n return(0);\n assert(data != (const void *) NULL);\n blob_info=image->blob;\n count=0;\n p=(const unsigned char *) data;\n q=(unsigned char *) data;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n switch (length)\n {\n default:\n {\n count=(ssize_t) fwrite((const char *) data,1,length,\n blob_info->file_info.file);\n break;\n }\n case 4:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 3:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 2:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 1:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 0:\n break;\n }\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n switch (length)\n {\n default:\n {\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) gzwrite(blob_info->file_info.gzfile,q+i,\n (unsigned int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n break;\n }\n case 4:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 3:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 2:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 1:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 0:\n break;\n }\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) BZ2_bzwrite(blob_info->file_info.bzfile,q+i,\n (int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n#endif\n break;\n }\n case FifoStream:\n {\n count=(ssize_t) blob_info->stream(image,data,length);\n break;\n }\n case BlobStream:\n {\n if ((blob_info->offset+(MagickOffsetType) length) >=\n (MagickOffsetType) blob_info->extent)\n {\n if (blob_info->mapped != MagickFalse)\n return(0);\n blob_info->extent+=length+blob_info->quantum;\n blob_info->quantum<<=1;\n blob_info->data=(unsigned char *) ResizeQuantumMemory(\n blob_info->data,blob_info->extent+1,sizeof(*blob_info->data));\n (void) SyncBlob(image);\n if (blob_info->data == (unsigned char *) NULL)\n {\n (void) DetachBlob(blob_info);\n return(0);\n }\n }\n q=blob_info->data+blob_info->offset;\n (void) memcpy(q,p,length);\n blob_info->offset+=length;\n if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n blob_info->length=(size_t) blob_info->offset;\n count=(ssize_t) length;\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->writer != (CustomStreamHandler) NULL)\n count=blob_info->custom_stream->writer((unsigned char *) data,\n length,blob_info->custom_stream->data);\n break;\n }\n }\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b B y t e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobByte() write an integer to a blob. It returns the number of bytes\n% written (either 0 or 1);\n%\n% The format of the WriteBlobByte method is:\n%\n% ssize_t WriteBlobByte(Image *image,const unsigned char value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobByte(Image *image,const unsigned char value)\n{\n BlobInfo\n *magick_restrict blob_info;",
" ssize_t\n count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n count=0;\n switch (blob_info->type)\n {\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n int\n c;",
" c=putc((int) value,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n break;\n }\n default:\n {\n count=WriteBlobStream(image,1,&value);\n break;\n }\n }\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b F l o a t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobFloat() writes a float value as a 32-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the WriteBlobFloat method is:\n%\n% ssize_t WriteBlobFloat(Image *image,const float value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobFloat(Image *image,const float value)\n{\n union\n {\n unsigned int\n unsigned_value;",
" float\n float_value;\n } quantum;",
" quantum.unsigned_value=0U;\n quantum.float_value=value;\n return(WriteBlobLong(image,quantum.unsigned_value));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLong() writes a unsigned int value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobLong method is:\n%\n% ssize_t WriteBlobLong(Image *image,const unsigned int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLong(Image *image,const unsigned int value)\n{\n unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n buffer[2]=(unsigned char) (value >> 16);\n buffer[3]=(unsigned char) (value >> 24);\n return(WriteBlobStream(image,4,buffer));\n }\n buffer[0]=(unsigned char) (value >> 24);\n buffer[1]=(unsigned char) (value >> 16);\n buffer[2]=(unsigned char) (value >> 8);\n buffer[3]=(unsigned char) value;\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L o n g L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBLongLong() writes a long long value as a 64-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobLongLong method is:\n%\n% ssize_t WriteBlobLongLong(Image *image,const MagickSizeType value)\n%\n% A description of each parameter follows.\n%\n% o value: Specifies the value to write.\n%\n% o image: the image.\n%\n*/\nMagickExport ssize_t WriteBlobLongLong(Image *image,const MagickSizeType value)\n{\n unsigned char\n buffer[8];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n buffer[2]=(unsigned char) (value >> 16);\n buffer[3]=(unsigned char) (value >> 24);\n buffer[4]=(unsigned char) (value >> 32);\n buffer[5]=(unsigned char) (value >> 40);\n buffer[6]=(unsigned char) (value >> 48);\n buffer[7]=(unsigned char) (value >> 56);\n return(WriteBlobStream(image,8,buffer));\n }\n buffer[0]=(unsigned char) (value >> 56);\n buffer[1]=(unsigned char) (value >> 48);\n buffer[2]=(unsigned char) (value >> 40);\n buffer[3]=(unsigned char) (value >> 32);\n buffer[4]=(unsigned char) (value >> 24);\n buffer[5]=(unsigned char) (value >> 16);\n buffer[6]=(unsigned char) (value >> 8);\n buffer[7]=(unsigned char) value;\n return(WriteBlobStream(image,8,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobShort() writes a short value as a 16-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobShort method is:\n%\n% ssize_t WriteBlobShort(Image *image,const unsigned short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobShort(Image *image,const unsigned short value)\n{\n unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n return(WriteBlobStream(image,2,buffer));\n }\n buffer[0]=(unsigned char) (value >> 8);\n buffer[1]=(unsigned char) value;\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobSignedLong() writes a signed value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobSignedLong method is:\n%\n% ssize_t WriteBlobSignedLong(Image *image,const signed int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobSignedLong(Image *image,const signed int value)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) quantum.unsigned_value;\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[2]=(unsigned char) (quantum.unsigned_value >> 16);\n buffer[3]=(unsigned char) (quantum.unsigned_value >> 24);\n return(WriteBlobStream(image,4,buffer));\n }\n buffer[0]=(unsigned char) (quantum.unsigned_value >> 24);\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 16);\n buffer[2]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[3]=(unsigned char) quantum.unsigned_value;\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBLong() writes a unsigned int value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the WriteBlobLSBLong method is:\n%\n% ssize_t WriteBlobLSBLong(Image *image,const unsigned int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBLong(Image *image,const unsigned int value)\n{\n unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n buffer[2]=(unsigned char) (value >> 16);\n buffer[3]=(unsigned char) (value >> 24);\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBShort() writes a unsigned short value as a 16-bit quantity in\n% least-significant byte first order.\n%\n% The format of the WriteBlobLSBShort method is:\n%\n% ssize_t WriteBlobLSBShort(Image *image,const unsigned short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBShort(Image *image,const unsigned short value)\n{\n unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBSignedLong() writes a signed value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the WriteBlobLSBSignedLong method is:\n%\n% ssize_t WriteBlobLSBSignedLong(Image *image,const signed int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBSignedLong(Image *image,const signed int value)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n buffer[0]=(unsigned char) quantum.unsigned_value;\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[2]=(unsigned char) (quantum.unsigned_value >> 16);\n buffer[3]=(unsigned char) (quantum.unsigned_value >> 24);\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBSignedShort() writes a signed short value as a 16-bit quantity\n% in least-significant byte first order.\n%\n% The format of the WriteBlobLSBSignedShort method is:\n%\n% ssize_t WriteBlobLSBSignedShort(Image *image,const signed short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBSignedShort(Image *image,\n const signed short value)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n buffer[0]=(unsigned char) quantum.unsigned_value;\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b M S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBLong() writes a unsigned int value as a 32-bit quantity in\n% most-significant byte first order.\n%\n% The format of the WriteBlobMSBLong method is:\n%\n% ssize_t WriteBlobMSBLong(Image *image,const unsigned int value)\n%\n% A description of each parameter follows.\n%\n% o value: Specifies the value to write.\n%\n% o image: the image.\n%\n*/\nMagickExport ssize_t WriteBlobMSBLong(Image *image,const unsigned int value)\n{\n unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) (value >> 24);\n buffer[1]=(unsigned char) (value >> 16);\n buffer[2]=(unsigned char) (value >> 8);\n buffer[3]=(unsigned char) value;\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b M S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBSignedShort() writes a signed short value as a 16-bit quantity\n% in most-significant byte first order.\n%\n% The format of the WriteBlobMSBSignedShort method is:\n%\n% ssize_t WriteBlobMSBSignedShort(Image *image,const signed short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobMSBSignedShort(Image *image,\n const signed short value)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n buffer[0]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[1]=(unsigned char) quantum.unsigned_value;\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b M S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBShort() writes a unsigned short value as a 16-bit quantity in\n% most-significant byte first order.\n%\n% The format of the WriteBlobMSBShort method is:\n%\n% ssize_t WriteBlobMSBShort(Image *image,const unsigned short value)\n%\n% A description of each parameter follows.\n%\n% o value: Specifies the value to write.\n%\n% o file: Specifies the file to write the data to.\n%\n*/\nMagickExport ssize_t WriteBlobMSBShort(Image *image,const unsigned short value)\n{\n unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) (value >> 8);\n buffer[1]=(unsigned char) value;\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b S t r i n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobString() write a string to a blob. It returns the number of\n% characters written.\n%\n% The format of the WriteBlobString method is:\n%\n% ssize_t WriteBlobString(Image *image,const char *string)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o string: Specifies the string to write.\n%\n*/\nMagickExport ssize_t WriteBlobString(Image *image,const char *string)\n{\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(string != (const char *) NULL);\n return(WriteBlobStream(image,strlen(string),(const unsigned char *) string));\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1013], "buggy_code_start_loc": [1013], "filenames": ["MagickCore/blob.c"], "fixing_code_end_loc": [1015], "fixing_code_start_loc": [1014], "message": "In ImageMagick 7.x before 7.0.8-42 and 6.x before 6.9.10-42, there is a use after free vulnerability in the UnmapBlob function that allows an attacker to cause a denial of service by sending a crafted file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:*", "matchCriteriaId": "20ADD76D-50E8-4DCE-8572-28070BFE3835", "versionEndExcluding": "6.9.10-42", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:*", "matchCriteriaId": "5F512348-96B1-4F5F-94A2-3112BD1FEA9A", "versionEndExcluding": "7.0.8-42", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "7.0.0-0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "F1E78106-58E6-4D59-990F-75DA575BFAD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In ImageMagick 7.x before 7.0.8-42 and 6.x before 6.9.10-42, there is a use after free vulnerability in the UnmapBlob function that allows an attacker to cause a denial of service by sending a crafted file."}, {"lang": "es", "value": "En ImageMagick versiones 7.x anteriores a 7.0.8-42 y versiones 6.x anteriores a 6.9.10-42, hay una vulnerabilidad de uso de la memoria previamente liberada en la funci\u00f3n UnmapBlob que permite a un atacante causar una denegaci\u00f3n de servicio mediante el env\u00edo de un archivo especialmente dise\u00f1ado."}], "evaluatorComment": null, "id": "CVE-2019-14980", "lastModified": "2023-03-02T18:00:56.910", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-08-12T23:15:11.493", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-11/msg00040.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-11/msg00042.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/commit/c5d012a46ae22be9444326aa37969a3f75daa3ba"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/compare/7.0.8-41...7.0.8-42"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick6/commit/614a257295bdcdeda347086761062ac7658b6830"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick6/issues/43"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/c5d012a46ae22be9444326aa37969a3f75daa3ba"}, "type": "CWE-416"}
| 99
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% BBBB L OOO BBBB %\n% B B L O O B B %\n% BBBB L O O BBBB %\n% B B L O O B B %\n% BBBB LLLLL OOO BBBB %\n% %\n% %\n% MagickCore Binary Large OBjectS Methods %\n% %\n% Software Design %\n% Cristy %\n% July 1999 %\n% %\n% %\n% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#ifdef __VMS\n#include <types.h>\n#include <mman.h>\n#endif\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/blob-private.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/client.h\"\n#include \"MagickCore/constitute.h\"\n#include \"MagickCore/delegate.h\"\n#include \"MagickCore/exception.h\"\n#include \"MagickCore/exception-private.h\"\n#include \"MagickCore/geometry.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/locale_.h\"\n#include \"MagickCore/log.h\"\n#include \"MagickCore/magick.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/memory-private.h\"\n#include \"MagickCore/nt-base-private.h\"\n#include \"MagickCore/option.h\"\n#include \"MagickCore/policy.h\"\n#include \"MagickCore/resource_.h\"\n#include \"MagickCore/semaphore.h\"\n#include \"MagickCore/string_.h\"\n#include \"MagickCore/string-private.h\"\n#include \"MagickCore/timer-private.h\"\n#include \"MagickCore/token.h\"\n#include \"MagickCore/utility.h\"\n#include \"MagickCore/utility-private.h\"\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n#include \"zlib.h\"\n#endif\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n#include \"bzlib.h\"\n#endif\n\f\n/*\n Define declarations.\n*/\n#define MagickMaxBlobExtent (8*8192)\n#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)\n# define MAP_ANONYMOUS MAP_ANON\n#endif\n#if !defined(MAP_FAILED)\n#define MAP_FAILED ((void *) -1)\n#endif\n#if defined(__OS2__)\n#include <io.h>\n#define _O_BINARY O_BINARY\n#endif\n\f\n/*\n Typedef declarations.\n*/\ntypedef union FileInfo\n{\n FILE\n *file;",
"#if defined(MAGICKCORE_ZLIB_DELEGATE)\n gzFile\n gzfile;\n#endif",
"#if defined(MAGICKCORE_BZLIB_DELEGATE)\n BZFILE\n *bzfile;\n#endif\n} FileInfo;",
"struct _BlobInfo\n{\n size_t\n length,\n extent,\n quantum;",
" BlobMode\n mode;",
" MagickBooleanType\n mapped,\n eof;",
" int\n error;",
" MagickOffsetType\n offset;",
" MagickSizeType\n size;",
" MagickBooleanType\n exempt,\n synchronize,\n status,\n temporary;",
" StreamType\n type;",
" FileInfo\n file_info;",
" struct stat\n properties;",
" StreamHandler\n stream;",
" CustomStreamInfo\n *custom_stream;",
" unsigned char\n *data;",
" MagickBooleanType\n debug;",
" SemaphoreInfo\n *semaphore;",
" ssize_t\n reference_count;",
" size_t\n signature;\n};",
"struct _CustomStreamInfo\n{\n CustomStreamHandler\n reader,\n writer;",
" CustomStreamSeeker\n seeker;",
" CustomStreamTeller\n teller;",
" void\n *data;",
" size_t\n signature;\n};\n\f\n/*\n Forward declarations.\n*/\nstatic int\n SyncBlob(Image *);\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ A c q u i r e C u s t o m S t r e a m I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% AcquireCustomStreamInfo() allocates the CustomStreamInfo structure.\n%\n% The format of the AcquireCustomStreamInfo method is:\n%\n% CustomStreamInfo *AcquireCustomStreamInfo(ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport CustomStreamInfo *AcquireCustomStreamInfo(\n ExceptionInfo *magick_unused(exception))\n{\n CustomStreamInfo\n *custom_stream;",
" magick_unreferenced(exception);\n custom_stream=(CustomStreamInfo *) AcquireCriticalMemory(\n sizeof(*custom_stream));\n (void) memset(custom_stream,0,sizeof(*custom_stream));\n custom_stream->signature=MagickCoreSignature;\n return(custom_stream);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ A t t a c h B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% AttachBlob() attaches a blob to the BlobInfo structure.\n%\n% The format of the AttachBlob method is:\n%\n% void AttachBlob(BlobInfo *blob_info,const void *blob,const size_t length)\n%\n% A description of each parameter follows:\n%\n% o blob_info: Specifies a pointer to a BlobInfo structure.\n%\n% o blob: the address of a character stream in one of the image formats\n% understood by ImageMagick.\n%\n% o length: This size_t integer reflects the length in bytes of the blob.\n%\n*/\nMagickExport void AttachBlob(BlobInfo *blob_info,const void *blob,\n const size_t length)\n{\n assert(blob_info != (BlobInfo *) NULL);\n if (blob_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n blob_info->length=length;\n blob_info->extent=length;\n blob_info->quantum=(size_t) MagickMaxBlobExtent;\n blob_info->offset=0;\n blob_info->type=BlobStream;\n blob_info->file_info.file=(FILE *) NULL;\n blob_info->data=(unsigned char *) blob;\n blob_info->mapped=MagickFalse;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ A t t a c h C u s t o m S t r e a m %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% AttachCustomStream() attaches a CustomStreamInfo to the BlobInfo structure.\n%\n% The format of the AttachCustomStream method is:\n%\n% void AttachCustomStream(BlobInfo *blob_info,\n% CustomStreamInfo *custom_stream)\n%\n% A description of each parameter follows:\n%\n% o blob_info: specifies a pointer to a BlobInfo structure.\n%\n% o custom_stream: the custom stream info.\n%\n*/\nMagickExport void AttachCustomStream(BlobInfo *blob_info,\n CustomStreamInfo *custom_stream)\n{\n assert(blob_info != (BlobInfo *) NULL);\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n if (blob_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n blob_info->type=CustomStream;\n blob_info->custom_stream=custom_stream;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ B l o b T o F i l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% BlobToFile() writes a blob to a file. It returns MagickFalse if an error\n% occurs otherwise MagickTrue.\n%\n% The format of the BlobToFile method is:\n%\n% MagickBooleanType BlobToFile(char *filename,const void *blob,\n% const size_t length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o filename: Write the blob to this file.\n%\n% o blob: the address of a blob.\n%\n% o length: This length in bytes of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport MagickBooleanType BlobToFile(char *filename,const void *blob,\n const size_t length,ExceptionInfo *exception)\n{\n int\n file;",
" register size_t\n i;",
" ssize_t\n count;",
" assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(blob != (const void *) NULL);\n if (*filename == '\\0')\n file=AcquireUniqueFileResource(filename);\n else\n file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n for (i=0; i < length; i+=count)\n {\n count=write(file,(const char *) blob+i,MagickMin(length-i,(size_t)\n SSIZE_MAX));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n file=close(file);\n if ((file == -1) || (i < length))\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% B l o b T o I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% BlobToImage() implements direct to memory image formats. It returns the\n% blob as an image.\n%\n% The format of the BlobToImage method is:\n%\n% Image *BlobToImage(const ImageInfo *image_info,const void *blob,\n% const size_t length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o blob: the address of a character stream in one of the image formats\n% understood by ImageMagick.\n%\n% o length: This size_t integer reflects the length in bytes of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport Image *BlobToImage(const ImageInfo *image_info,const void *blob,\n const size_t length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" Image\n *image;",
" ImageInfo\n *blob_info,\n *clone_info;",
" MagickBooleanType\n status;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n if ((blob == (const void *) NULL) || (length == 0))\n {\n (void) ThrowMagickException(exception,GetMagickModule(),BlobError,\n \"ZeroLengthBlobNotPermitted\",\"`%s'\",image_info->filename);\n return((Image *) NULL);\n }\n blob_info=CloneImageInfo(image_info);\n blob_info->blob=(void *) blob;\n blob_info->length=length;\n if (*blob_info->magick == '\\0')\n (void) SetImageInfo(blob_info,0,exception);\n magick_info=GetMagickInfo(blob_info->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n blob_info->magick);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n char\n filename[MagickPathExtent];",
" /*\n Native blob support for this image format.\n */\n (void) CopyMagickString(filename,blob_info->filename,MagickPathExtent);\n (void) FormatLocaleString(blob_info->filename,MagickPathExtent,\"%s:%s\",\n blob_info->magick,filename);\n image=ReadImage(blob_info,exception);\n if (image != (Image *) NULL)\n (void) DetachBlob(image->blob);\n blob_info=DestroyImageInfo(blob_info);\n return(image);\n }\n /*\n Write blob to a temporary file on disk.\n */\n blob_info->blob=(void *) NULL;\n blob_info->length=0;\n *blob_info->filename='\\0';\n status=BlobToFile(blob_info->filename,blob,length,exception);\n if (status == MagickFalse)\n {\n (void) RelinquishUniqueFileResource(blob_info->filename);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n clone_info=CloneImageInfo(blob_info);\n (void) FormatLocaleString(clone_info->filename,MagickPathExtent,\"%s:%s\",\n blob_info->magick,blob_info->filename);\n image=ReadImage(clone_info,exception);\n if (image != (Image *) NULL)\n {\n Image\n *images;",
" /*\n Restore original filenames and image format.\n */\n for (images=GetFirstImageInList(image); images != (Image *) NULL; )\n {\n (void) CopyMagickString(images->filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick_filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick,magick_info->name,\n MagickPathExtent);\n images=GetNextImageInList(images);\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n (void) RelinquishUniqueFileResource(blob_info->filename);\n blob_info=DestroyImageInfo(blob_info);\n return(image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ C l o n e B l o b I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% CloneBlobInfo() makes a duplicate of the given blob info structure, or if\n% blob info is NULL, a new one.\n%\n% The format of the CloneBlobInfo method is:\n%\n% BlobInfo *CloneBlobInfo(const BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: the blob info.\n%\n*/\nMagickExport BlobInfo *CloneBlobInfo(const BlobInfo *blob_info)\n{\n BlobInfo\n *clone_info;",
" SemaphoreInfo\n *semaphore;",
" clone_info=(BlobInfo *) AcquireCriticalMemory(sizeof(*clone_info));\n GetBlobInfo(clone_info);\n if (blob_info == (BlobInfo *) NULL)\n return(clone_info);\n semaphore=clone_info->semaphore;\n (void) memcpy(clone_info,blob_info,sizeof(*clone_info));\n if (blob_info->mapped != MagickFalse)\n (void) AcquireMagickResource(MapResource,blob_info->length);\n clone_info->semaphore=semaphore;\n LockSemaphoreInfo(clone_info->semaphore);\n clone_info->reference_count=1;\n UnlockSemaphoreInfo(clone_info->semaphore);\n return(clone_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ C l o s e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% CloseBlob() closes a stream associated with the image.\n%\n% The format of the CloseBlob method is:\n%\n% MagickBooleanType CloseBlob(Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType CloseBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n status;",
" /*\n Close image file.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n blob_info=image->blob;\n if ((blob_info == (BlobInfo *) NULL) || (blob_info->type == UndefinedStream))\n return(MagickTrue);\n status=SyncBlob(image);\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n if (blob_info->synchronize != MagickFalse)\n status=fsync(fileno(blob_info->file_info.file));\n status=ferror(blob_info->file_info.file);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n (void) gzerror(blob_info->file_info.gzfile,&status);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n (void) BZ2_bzerror(blob_info->file_info.bzfile,&status);\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n {\n if (blob_info->synchronize != MagickFalse)\n status=fsync(fileno(blob_info->file_info.file));\n status=ferror(blob_info->file_info.file);\n }\n break;\n }\n case CustomStream:\n break;\n }\n blob_info->status=status < 0 ? MagickTrue : MagickFalse;\n blob_info->size=GetBlobSize(image);\n image->extent=blob_info->size;\n blob_info->eof=MagickFalse;\n blob_info->error=0;\n blob_info->mode=UndefinedBlobMode;\n if (blob_info->exempt != MagickFalse)\n {\n blob_info->type=UndefinedStream;\n return(blob_info->status);\n }\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n {\n if (fileno(blob_info->file_info.file) != -1)\n status=fclose(blob_info->file_info.file);\n break;\n }\n case PipeStream:\n {\n#if defined(MAGICKCORE_HAVE_PCLOSE)\n status=pclose(blob_info->file_info.file);\n#endif\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n status=gzclose(blob_info->file_info.gzfile);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n BZ2_bzclose(blob_info->file_info.bzfile);\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n status=fclose(blob_info->file_info.file);\n break;\n }\n case CustomStream:\n break;\n }\n (void) DetachBlob(blob_info);\n blob_info->status=status < 0 ? MagickTrue : MagickFalse;\n return(blob_info->status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% C u s t o m S t r e a m T o I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% CustomStreamToImage() is the equivalent of ReadImage(), but reads the\n% formatted \"file\" from the suplied method rather than to an actual file.\n%\n% The format of the CustomStreamToImage method is:\n%\n% Image *CustomStreamToImage(const ImageInfo *image_info,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport Image *CustomStreamToImage(const ImageInfo *image_info,\n ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" Image\n *image;",
" ImageInfo\n *blob_info;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image_info->custom_stream != (CustomStreamInfo *) NULL);\n assert(image_info->custom_stream->signature == MagickCoreSignature);\n assert(image_info->custom_stream->reader != (CustomStreamHandler) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n blob_info=CloneImageInfo(image_info);\n if (*blob_info->magick == '\\0')\n (void) SetImageInfo(blob_info,0,exception);\n magick_info=GetMagickInfo(blob_info->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n blob_info->magick);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n image=(Image *) NULL;\n if ((GetMagickBlobSupport(magick_info) != MagickFalse) ||\n (*blob_info->filename != '\\0'))\n {\n char\n filename[MagickPathExtent];",
" /*\n Native blob support for this image format or SetImageInfo changed the\n blob to a file.\n */\n (void) CopyMagickString(filename,blob_info->filename,MagickPathExtent);\n (void) FormatLocaleString(blob_info->filename,MagickPathExtent,\"%s:%s\",\n blob_info->magick,filename);\n image=ReadImage(blob_info,exception);\n if (image != (Image *) NULL)\n (void) CloseBlob(image);\n }\n else\n {\n char\n unique[MagickPathExtent];",
" int\n file;",
" ImageInfo\n *clone_info;",
" unsigned char\n *blob;",
" /*\n Write data to file on disk.\n */\n blob_info->custom_stream=(CustomStreamInfo *) NULL;\n blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",\n image_info->filename);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",\n image_info->filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n blob_info=DestroyImageInfo(blob_info);\n return((Image *) NULL);\n }\n clone_info=CloneImageInfo(blob_info);\n blob_info->file=fdopen(file,\"wb+\");\n if (blob_info->file != (FILE *) NULL)\n {\n ssize_t\n count;",
" count=(ssize_t) MagickMaxBufferExtent;\n while (count == (ssize_t) MagickMaxBufferExtent)\n {\n count=image_info->custom_stream->reader(blob,MagickMaxBufferExtent,\n image_info->custom_stream->data);\n count=(ssize_t) write(file,(const char *) blob,(size_t) count);\n }\n (void) fclose(blob_info->file);\n (void) FormatLocaleString(clone_info->filename,MagickPathExtent,\n \"%s:%s\",blob_info->magick,unique);\n image=ReadImage(clone_info,exception);\n if (image != (Image *) NULL)\n {\n Image\n *images;",
" /*\n Restore original filenames and image format.\n */\n for (images=GetFirstImageInList(image); images != (Image *) NULL; )\n {\n (void) CopyMagickString(images->filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick_filename,\n image_info->filename,MagickPathExtent);\n (void) CopyMagickString(images->magick,magick_info->name,\n MagickPathExtent);\n (void) CloseBlob(images);\n images=GetNextImageInList(images);\n }\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n (void) RelinquishUniqueFileResource(unique);\n }\n blob_info=DestroyImageInfo(blob_info);\n return(image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D e s t r o y B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DestroyBlob() deallocates memory associated with a blob.\n%\n% The format of the DestroyBlob method is:\n%\n% void DestroyBlob(Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport void DestroyBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickBooleanType\n destroy;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->signature == MagickCoreSignature);\n blob_info=image->blob;\n destroy=MagickFalse;\n LockSemaphoreInfo(blob_info->semaphore);\n blob_info->reference_count--;\n assert(blob_info->reference_count >= 0);\n if (blob_info->reference_count == 0)\n destroy=MagickTrue;\n UnlockSemaphoreInfo(blob_info->semaphore);\n if (destroy == MagickFalse)\n {\n image->blob=(BlobInfo *) NULL;\n return;\n }\n (void) CloseBlob(image);\n if (blob_info->mapped != MagickFalse)\n {\n (void) UnmapBlob(blob_info->data,blob_info->length);\n RelinquishMagickResource(MapResource,blob_info->length);\n }\n if (blob_info->semaphore != (SemaphoreInfo *) NULL)\n RelinquishSemaphoreInfo(&blob_info->semaphore);\n blob_info->signature=(~MagickCoreSignature);\n image->blob=(BlobInfo *) RelinquishMagickMemory(blob_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D e s t r o y C u s t o m S t r e a m I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DestroyCustomStreamInfo() destroys memory associated with the\n% CustomStreamInfo structure.\n%\n% The format of the DestroyCustomStreamInfo method is:\n%\n% CustomStreamInfo *DestroyCustomStreamInfo(CustomStreamInfo *stream_info)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n*/\nMagickExport CustomStreamInfo *DestroyCustomStreamInfo(\n CustomStreamInfo *custom_stream)\n{\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->signature=(~MagickCoreSignature);\n custom_stream=(CustomStreamInfo *) RelinquishMagickMemory(custom_stream);\n return(custom_stream);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D e t a c h B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DetachBlob() detaches a blob from the BlobInfo structure.\n%\n% The format of the DetachBlob method is:\n%\n% void *DetachBlob(BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: Specifies a pointer to a BlobInfo structure.\n%\n*/\nMagickExport void *DetachBlob(BlobInfo *blob_info)\n{\n void\n *data;",
" assert(blob_info != (BlobInfo *) NULL);\n if (blob_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n if (blob_info->mapped != MagickFalse)\n {\n (void) UnmapBlob(blob_info->data,blob_info->length);",
" blob_info->data=NULL;",
" RelinquishMagickResource(MapResource,blob_info->length);\n }\n blob_info->mapped=MagickFalse;\n blob_info->length=0;\n blob_info->offset=0;\n blob_info->eof=MagickFalse;\n blob_info->error=0;\n blob_info->exempt=MagickFalse;\n blob_info->type=UndefinedStream;\n blob_info->file_info.file=(FILE *) NULL;\n data=blob_info->data;\n blob_info->data=(unsigned char *) NULL;\n blob_info->stream=(StreamHandler) NULL;\n blob_info->custom_stream=(CustomStreamInfo *) NULL;\n return(data);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D i s a s s o c i a t e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DisassociateBlob() disassociates the image stream. It checks if the\n% blob of the specified image is referenced by other images. If the reference\n% count is higher then 1 a new blob is assigned to the specified image.\n%\n% The format of the DisassociateBlob method is:\n%\n% void DisassociateBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport void DisassociateBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info,\n *clone_info;",
" MagickBooleanType\n clone;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->signature == MagickCoreSignature);\n blob_info=image->blob;\n clone=MagickFalse;\n LockSemaphoreInfo(blob_info->semaphore);\n assert(blob_info->reference_count >= 0);\n if (blob_info->reference_count > 1)\n clone=MagickTrue;\n UnlockSemaphoreInfo(blob_info->semaphore);\n if (clone == MagickFalse)\n return;\n clone_info=CloneBlobInfo(blob_info);\n DestroyBlob(image);\n image->blob=clone_info;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D i s c a r d B l o b B y t e s %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DiscardBlobBytes() discards bytes in a blob.\n%\n% The format of the DiscardBlobBytes method is:\n%\n% MagickBooleanType DiscardBlobBytes(Image *image,\n% const MagickSizeType length)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o length: the number of bytes to skip.\n%\n*/\nMagickExport MagickBooleanType DiscardBlobBytes(Image *image,\n const MagickSizeType length)\n{\n register MagickOffsetType\n i;",
" size_t\n quantum;",
" ssize_t\n count;",
" unsigned char\n buffer[16384];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (length != (MagickSizeType) ((MagickOffsetType) length))\n return(MagickFalse);\n count=0;\n for (i=0; i < (MagickOffsetType) length; i+=count)\n {\n quantum=(size_t) MagickMin(length-i,sizeof(buffer));\n (void) ReadBlobStream(image,quantum,buffer,&count);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n return(i < (MagickOffsetType) length ? MagickFalse : MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ D u p l i c a t e s B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DuplicateBlob() duplicates a blob descriptor.\n%\n% The format of the DuplicateBlob method is:\n%\n% void DuplicateBlob(Image *image,const Image *duplicate)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o duplicate: the duplicate image.\n%\n*/\nMagickExport void DuplicateBlob(Image *image,const Image *duplicate)\n{\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(duplicate != (Image *) NULL);\n assert(duplicate->signature == MagickCoreSignature);\n DestroyBlob(image);\n image->blob=ReferenceBlob(duplicate->blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ E O F B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% EOFBlob() returns a non-zero value when EOF has been detected reading from\n% a blob or file.\n%\n% The format of the EOFBlob method is:\n%\n% int EOFBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport int EOFBlob(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n blob_info->eof=feof(blob_info->file_info.file) != 0 ? MagickTrue :\n MagickFalse;\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n blob_info->eof=gzeof(blob_info->file_info.gzfile) != 0 ? MagickTrue :\n MagickFalse;\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n int\n status;",
" status=0;\n (void) BZ2_bzerror(blob_info->file_info.bzfile,&status);\n blob_info->eof=status == BZ_UNEXPECTED_EOF ? MagickTrue : MagickFalse;\n#endif\n break;\n }\n case FifoStream:\n {\n blob_info->eof=MagickFalse;\n break;\n }\n case BlobStream:\n break;\n case CustomStream:\n break;\n }\n return((int) blob_info->eof);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ E r r o r B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ErrorBlob() returns a non-zero value when an error has been detected reading\n% from a blob or file.\n%\n% The format of the ErrorBlob method is:\n%\n% int ErrorBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport int ErrorBlob(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n blob_info->error=ferror(blob_info->file_info.file);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n (void) gzerror(blob_info->file_info.gzfile,&blob_info->error);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n (void) BZ2_bzerror(blob_info->file_info.bzfile,&blob_info->error);\n#endif\n break;\n }\n case FifoStream:\n {\n blob_info->error=0;\n break;\n }\n case BlobStream:\n break;\n case CustomStream:\n break;\n }\n return(blob_info->error);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% F i l e T o B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% FileToBlob() returns the contents of a file as a buffer terminated with\n% the '\\0' character. The length of the buffer (not including the extra\n% terminating '\\0' character) is returned via the 'length' parameter. Free\n% the buffer with RelinquishMagickMemory().\n%\n% The format of the FileToBlob method is:\n%\n% void *FileToBlob(const char *filename,const size_t extent,\n% size_t *length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o blob: FileToBlob() returns the contents of a file as a blob. If\n% an error occurs NULL is returned.\n%\n% o filename: the filename.\n%\n% o extent: The maximum length of the blob.\n%\n% o length: On return, this reflects the actual length of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void *FileToBlob(const char *filename,const size_t extent,\n size_t *length,ExceptionInfo *exception)\n{\n int\n file;",
" MagickBooleanType\n status;",
" MagickOffsetType\n offset;",
" register size_t\n i;",
" ssize_t\n count;",
" struct stat\n attributes;",
" unsigned char\n *blob;",
" void\n *map;",
" assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(exception != (ExceptionInfo *) NULL);\n *length=0;\n status=IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,filename);\n if (status == MagickFalse)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",filename);\n return(NULL);\n }\n file=fileno(stdin);\n if (LocaleCompare(filename,\"-\") != 0)\n {\n status=GetPathAttributes(filename,&attributes);\n if ((status == MagickFalse) || (S_ISDIR(attributes.st_mode) != 0))\n {\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n return(NULL);\n }\n file=open_utf8(filename,O_RDONLY | O_BINARY,0);\n }\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenFile\",filename);\n return(NULL);\n }\n offset=(MagickOffsetType) lseek(file,0,SEEK_END);\n count=0;\n if ((file == fileno(stdin)) || (offset < 0) ||\n (offset != (MagickOffsetType) ((ssize_t) offset)))\n {\n size_t\n quantum;",
" struct stat\n file_stats;",
" /*\n Stream is not seekable.\n */\n offset=(MagickOffsetType) lseek(file,0,SEEK_SET);\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob));\n for (i=0; blob != (unsigned char *) NULL; i+=count)\n {\n count=read(file,blob+i,quantum);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n if (~((size_t) i) < (quantum+1))\n {\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n break;\n }\n blob=(unsigned char *) ResizeQuantumMemory(blob,i+quantum+1,\n sizeof(*blob));\n if ((size_t) (i+count) >= extent)\n break;\n }\n if (LocaleCompare(filename,\"-\") != 0)\n file=close(file);\n if (blob == (unsigned char *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",filename);\n return(NULL);\n }\n if (file == -1)\n {\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n return(NULL);\n }\n *length=(size_t) MagickMin(i+count,extent);\n blob[*length]='\\0';\n return(blob);\n }\n *length=(size_t) MagickMin(offset,(MagickOffsetType)\n MagickMin(extent,(size_t) SSIZE_MAX));\n blob=(unsigned char *) NULL;\n if (~(*length) >= (MagickPathExtent-1))\n blob=(unsigned char *) AcquireQuantumMemory(*length+MagickPathExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n file=close(file);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",filename);\n return(NULL);\n }\n map=MapBlob(file,ReadMode,0,*length);\n if (map != (unsigned char *) NULL)\n {\n (void) memcpy(blob,map,*length);\n (void) UnmapBlob(map,*length);\n }\n else\n {\n (void) lseek(file,0,SEEK_SET);\n for (i=0; i < *length; i+=count)\n {\n count=read(file,blob+i,(size_t) MagickMin(*length-i,(size_t)\n SSIZE_MAX));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n if (i < *length)\n {\n file=close(file)-1;\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n return(NULL);\n }\n }\n blob[*length]='\\0';\n if (LocaleCompare(filename,\"-\") != 0)\n file=close(file);\n if (file == -1)\n {\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n ThrowFileException(exception,BlobError,\"UnableToReadBlob\",filename);\n }\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% F i l e T o I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% FileToImage() write the contents of a file to an image.\n%\n% The format of the FileToImage method is:\n%\n% MagickBooleanType FileToImage(Image *,const char *filename)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o filename: the filename.\n%\n*/",
"static inline ssize_t WriteBlobStream(Image *image,const size_t length,\n const void *data)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickSizeType\n extent;",
" register unsigned char\n *q;",
" assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n assert(data != NULL);\n blob_info=image->blob;\n if (blob_info->type != BlobStream)\n return(WriteBlob(image,length,(const unsigned char *) data));\n extent=(MagickSizeType) (blob_info->offset+(MagickOffsetType) length);\n if (extent >= blob_info->extent)\n {\n extent=blob_info->extent+blob_info->quantum+length;\n blob_info->quantum<<=1;\n if (SetBlobExtent(image,extent) == MagickFalse)\n return(0);\n }\n q=blob_info->data+blob_info->offset;\n (void) memcpy(q,data,length);\n blob_info->offset+=length;\n if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n blob_info->length=(size_t) blob_info->offset;\n return((ssize_t) length);\n}",
"MagickExport MagickBooleanType FileToImage(Image *image,const char *filename,\n ExceptionInfo *exception)\n{\n int\n file;",
" MagickBooleanType\n status;",
" size_t\n length,\n quantum;",
" ssize_t\n count;",
" struct stat\n file_stats;",
" unsigned char\n *blob;",
" assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(filename != (const char *) NULL);\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n status=IsRightsAuthorized(PathPolicyDomain,WritePolicyRights,filename);\n if (status == MagickFalse)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",filename);\n return(MagickFalse);\n }\n file=fileno(stdin);\n if (LocaleCompare(filename,\"-\") != 0)\n file=open_utf8(filename,O_RDONLY | O_BINARY,0);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n blob=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n file=close(file);\n ThrowFileException(exception,ResourceLimitError,\"MemoryAllocationFailed\",\n filename);\n return(MagickFalse);\n }\n for ( ; ; )\n {\n count=read(file,blob,quantum);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n length=(size_t) count;\n count=WriteBlobStream(image,length,blob);\n if (count != (ssize_t) length)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n break;\n }\n }\n file=close(file);\n if (file == -1)\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b E r r o r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobError() returns MagickTrue if the blob associated with the specified\n% image encountered an error.\n%\n% The format of the GetBlobError method is:\n%\n% MagickBooleanType GetBlobError(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType GetBlobError(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b F i l e H a n d l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobFileHandle() returns the file handle associated with the image blob.\n%\n% The format of the GetBlobFile method is:\n%\n% FILE *GetBlobFileHandle(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport FILE *GetBlobFileHandle(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n return(image->blob->file_info.file);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b I n f o %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobInfo() initializes the BlobInfo structure.\n%\n% The format of the GetBlobInfo method is:\n%\n% void GetBlobInfo(BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: Specifies a pointer to a BlobInfo structure.\n%\n*/\nMagickExport void GetBlobInfo(BlobInfo *blob_info)\n{\n assert(blob_info != (BlobInfo *) NULL);\n (void) memset(blob_info,0,sizeof(*blob_info));\n blob_info->type=UndefinedStream;\n blob_info->quantum=(size_t) MagickMaxBlobExtent;\n blob_info->properties.st_mtime=GetMagickTime();\n blob_info->properties.st_ctime=blob_info->properties.st_mtime;\n blob_info->debug=IsEventLogging();\n blob_info->reference_count=1;\n blob_info->semaphore=AcquireSemaphoreInfo();\n blob_info->signature=MagickCoreSignature;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% G e t B l o b P r o p e r t i e s %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobProperties() returns information about an image blob.\n%\n% The format of the GetBlobProperties method is:\n%\n% const struct stat *GetBlobProperties(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport const struct stat *GetBlobProperties(const Image *image)\n{\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(&image->blob->properties);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b S i z e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobSize() returns the current length of the image file or blob; zero is\n% returned if the size cannot be determined.\n%\n% The format of the GetBlobSize method is:\n%\n% MagickSizeType GetBlobSize(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickSizeType GetBlobSize(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickSizeType\n extent;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n blob_info=image->blob;\n extent=0;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n {\n extent=blob_info->size;\n break;\n }\n case FileStream:\n {\n int\n file_descriptor;",
" extent=(MagickSizeType) blob_info->properties.st_size;\n if (extent == 0)\n extent=blob_info->size;\n file_descriptor=fileno(blob_info->file_info.file);\n if (file_descriptor == -1)\n break;\n if (fstat(file_descriptor,&blob_info->properties) == 0)\n extent=(MagickSizeType) blob_info->properties.st_size;\n break;\n }\n case PipeStream:\n {\n extent=blob_info->size;\n break;\n }\n case ZipStream:\n case BZipStream:\n {\n MagickBooleanType\n status;",
" status=GetPathAttributes(image->filename,&blob_info->properties);\n if (status != MagickFalse)\n extent=(MagickSizeType) blob_info->properties.st_size;\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n extent=(MagickSizeType) blob_info->length;\n break;\n }\n case CustomStream:\n {\n if ((blob_info->custom_stream->teller != (CustomStreamTeller) NULL) &&\n (blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL))\n {\n MagickOffsetType\n offset;",
" offset=blob_info->custom_stream->teller(\n blob_info->custom_stream->data);\n extent=(MagickSizeType) blob_info->custom_stream->seeker(0,SEEK_END,\n blob_info->custom_stream->data);\n (void) blob_info->custom_stream->seeker(offset,SEEK_SET,\n blob_info->custom_stream->data);\n }\n break;\n }\n }\n return(extent);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b S t r e a m D a t a %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobStreamData() returns the stream data for the image.\n%\n% The format of the GetBlobStreamData method is:\n%\n% void *GetBlobStreamData(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport void *GetBlobStreamData(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n return(image->blob->data);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ G e t B l o b S t r e a m H a n d l e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% GetBlobStreamHandler() returns the stream handler for the image.\n%\n% The format of the GetBlobStreamHandler method is:\n%\n% StreamHandler GetBlobStreamHandler(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport StreamHandler GetBlobStreamHandler(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->stream);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I m a g e T o B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImageToBlob() implements direct to memory image formats. It returns the\n% image as a formatted blob and its length. The magick member of the Image\n% structure determines the format of the returned blob (GIF, JPEG, PNG,\n% etc.). This method is the equivalent of WriteImage(), but writes the\n% formatted \"file\" to a memory buffer rather than to an actual file.\n%\n% The format of the ImageToBlob method is:\n%\n% void *ImageToBlob(const ImageInfo *image_info,Image *image,\n% size_t *length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the image.\n%\n% o length: return the actual length of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void *ImageToBlob(const ImageInfo *image_info,\n Image *image,size_t *length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *blob_info;",
" MagickBooleanType\n status;",
" void\n *blob;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n *length=0;\n blob=(unsigned char *) NULL;\n blob_info=CloneImageInfo(image_info);\n blob_info->adjoin=MagickFalse;\n (void) SetImageInfo(blob_info,1,exception);\n if (*blob_info->magick != '\\0')\n (void) CopyMagickString(image->magick,blob_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(image->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n image->magick);\n blob_info=DestroyImageInfo(blob_info);\n return(blob);\n }\n (void) CopyMagickString(blob_info->magick,image->magick,MagickPathExtent);\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n /*\n Native blob support for this image format.\n */\n blob_info->length=0;\n blob_info->blob=AcquireQuantumMemory(MagickMaxBlobExtent,\n sizeof(unsigned char));\n if (blob_info->blob == NULL)\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n else\n {\n (void) CloseBlob(image);\n image->blob->exempt=MagickTrue;\n *image->filename='\\0';\n status=WriteImage(blob_info,image,exception);\n *length=image->blob->length;\n blob=DetachBlob(image->blob);\n if (blob == (void *) NULL)\n blob_info->blob=RelinquishMagickMemory(blob_info->blob);\n else if (status == MagickFalse)\n blob=RelinquishMagickMemory(blob);\n else\n blob=ResizeQuantumMemory(blob,*length+1,sizeof(unsigned char));\n }\n }\n else\n {\n char\n unique[MagickPathExtent];",
" int\n file;",
" /*\n Write file to disk in blob image format.\n */\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n }\n else\n {\n blob_info->file=fdopen(file,\"wb\");\n if (blob_info->file != (FILE *) NULL)\n {\n (void) FormatLocaleString(image->filename,MagickPathExtent,\n \"%s:%s\",image->magick,unique);\n status=WriteImage(blob_info,image,exception);\n (void) CloseBlob(image);\n (void) fclose(blob_info->file);\n if (status != MagickFalse)\n blob=FileToBlob(unique,~0UL,length,exception);\n }\n (void) RelinquishUniqueFileResource(unique);\n }\n }\n blob_info=DestroyImageInfo(blob_info);\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ I m a g e T o C u s t o m S t r e a m %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImageToCustomStream() is the equivalent of WriteImage(), but writes the\n% formatted \"file\" to the custom stream rather than to an actual file.\n%\n% The format of the ImageToCustomStream method is:\n%\n% void ImageToCustomStream(const ImageInfo *image_info,Image *image,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the image.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void ImageToCustomStream(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *clone_info;",
" MagickBooleanType\n blob_support,\n status;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image_info->custom_stream != (CustomStreamInfo *) NULL);\n assert(image_info->custom_stream->signature == MagickCoreSignature);\n assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n clone_info=CloneImageInfo(image_info);\n clone_info->adjoin=MagickFalse;\n (void) SetImageInfo(clone_info,1,exception);\n if (*clone_info->magick != '\\0')\n (void) CopyMagickString(image->magick,clone_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(image->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoEncodeDelegateForThisImageFormat\",\"`%s'\",\n image->magick);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n (void) CopyMagickString(clone_info->magick,image->magick,MagickPathExtent);\n blob_support=GetMagickBlobSupport(magick_info);\n if ((blob_support != MagickFalse) &&\n (GetMagickEncoderSeekableStream(magick_info) != MagickFalse))\n {\n if ((clone_info->custom_stream->seeker == (CustomStreamSeeker) NULL) ||\n (clone_info->custom_stream->teller == (CustomStreamTeller) NULL))\n blob_support=MagickFalse;\n }\n if (blob_support != MagickFalse)\n {\n /*\n Native blob support for this image format.\n */\n (void) CloseBlob(image);\n *image->filename='\\0';\n (void) WriteImage(clone_info,image,exception);\n (void) CloseBlob(image);\n }\n else\n {\n char\n unique[MagickPathExtent];",
" int\n file;",
" unsigned char\n *blob;",
" /*\n Write file to disk in blob image format.\n */\n clone_info->custom_stream=(CustomStreamInfo *) NULL;\n blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n clone_info->file=fdopen(file,\"wb+\");\n if (clone_info->file != (FILE *) NULL)\n {\n ssize_t\n count;",
" (void) FormatLocaleString(image->filename,MagickPathExtent,\n \"%s:%s\",image->magick,unique);\n status=WriteImage(clone_info,image,exception);\n (void) CloseBlob(image);\n if (status != MagickFalse)\n {\n (void) fseek(clone_info->file,0,SEEK_SET);\n count=(ssize_t) MagickMaxBufferExtent;\n while (count == (ssize_t) MagickMaxBufferExtent)\n {\n count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent,\n clone_info->file);\n (void) image_info->custom_stream->writer(blob,(size_t) count,\n image_info->custom_stream->data);\n }\n }\n (void) fclose(clone_info->file);\n }\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n (void) RelinquishUniqueFileResource(unique);\n }\n clone_info=DestroyImageInfo(clone_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I m a g e T o F i l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImageToFile() writes an image to a file. It returns MagickFalse if an error\n% occurs otherwise MagickTrue.\n%\n% The format of the ImageToFile method is:\n%\n% MagickBooleanType ImageToFile(Image *image,char *filename,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o filename: Write the image to this file.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport MagickBooleanType ImageToFile(Image *image,char *filename,\n ExceptionInfo *exception)\n{\n int\n file;",
" register const unsigned char\n *p;",
" register size_t\n i;",
" size_t\n length,\n quantum;",
" ssize_t\n count;",
" struct stat\n file_stats;",
" unsigned char\n *buffer;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",filename);\n assert(filename != (const char *) NULL);\n if (*filename == '\\0')\n file=AcquireUniqueFileResource(filename);\n else\n if (LocaleCompare(filename,\"-\") == 0)\n file=fileno(stdout);\n else\n file=open_utf8(filename,O_RDWR | O_CREAT | O_EXCL | O_BINARY,S_MODE);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer));\n if (buffer == (unsigned char *) NULL)\n {\n file=close(file)-1;\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationError\",\"`%s'\",filename);\n return(MagickFalse);\n }\n length=0;\n p=(const unsigned char *) ReadBlobStream(image,quantum,buffer,&count);\n for (i=0; count > 0; )\n {\n length=(size_t) count;\n for (i=0; i < length; i+=count)\n {\n count=write(file,p+i,(size_t) (length-i));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n if (i < length)\n break;\n p=(const unsigned char *) ReadBlobStream(image,quantum,buffer,&count);\n }\n if (LocaleCompare(filename,\"-\") != 0)\n file=close(file);\n buffer=(unsigned char *) RelinquishMagickMemory(buffer);\n if ((file == -1) || (i < length))\n {\n if (file != -1)\n file=close(file);\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",filename);\n return(MagickFalse);\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I m a g e s T o B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImagesToBlob() implements direct to memory image formats. It returns the\n% image sequence as a blob and its length. The magick member of the ImageInfo\n% structure determines the format of the returned blob (GIF, JPEG, PNG, etc.)\n%\n% Note, some image formats do not permit multiple images to the same image\n% stream (e.g. JPEG). in this instance, just the first image of the\n% sequence is returned as a blob.\n%\n% The format of the ImagesToBlob method is:\n%\n% void *ImagesToBlob(const ImageInfo *image_info,Image *images,\n% size_t *length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o images: the image list.\n%\n% o length: return the actual length of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void *ImagesToBlob(const ImageInfo *image_info,Image *images,\n size_t *length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *clone_info;",
" MagickBooleanType\n status;",
" void\n *blob;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n *length=0;\n blob=(unsigned char *) NULL;\n clone_info=CloneImageInfo(image_info);\n (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images),\n exception);\n if (*clone_info->magick != '\\0')\n (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(images->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n images->magick);\n clone_info=DestroyImageInfo(clone_info);\n return(blob);\n }\n if (GetMagickAdjoin(magick_info) == MagickFalse)\n {\n clone_info=DestroyImageInfo(clone_info);\n return(ImageToBlob(image_info,images,length,exception));\n }\n (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent);\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n /*\n Native blob support for this images format.\n */\n clone_info->length=0;\n clone_info->blob=(void *) AcquireQuantumMemory(MagickMaxBlobExtent,\n sizeof(unsigned char));\n if (clone_info->blob == (void *) NULL)\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",images->filename);\n else\n {\n (void) CloseBlob(images);\n images->blob->exempt=MagickTrue;\n *images->filename='\\0';\n status=WriteImages(clone_info,images,images->filename,exception);\n *length=images->blob->length;\n blob=DetachBlob(images->blob);\n if (blob == (void *) NULL)\n clone_info->blob=RelinquishMagickMemory(clone_info->blob);\n else if (status == MagickFalse)\n blob=RelinquishMagickMemory(blob);\n else\n blob=ResizeQuantumMemory(blob,*length+1,sizeof(unsigned char));\n }\n }\n else\n {\n char\n filename[MagickPathExtent],\n unique[MagickPathExtent];",
" int\n file;",
" /*\n Write file to disk in blob images format.\n */\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,FileOpenError,\"UnableToWriteBlob\",\n image_info->filename);\n }\n else\n {\n clone_info->file=fdopen(file,\"wb\");\n if (clone_info->file != (FILE *) NULL)\n {\n (void) FormatLocaleString(filename,MagickPathExtent,\"%s:%s\",\n images->magick,unique);\n status=WriteImages(clone_info,images,filename,exception);\n (void) CloseBlob(images);\n (void) fclose(clone_info->file);\n if (status != MagickFalse)\n blob=FileToBlob(unique,~0UL,length,exception);\n }\n (void) RelinquishUniqueFileResource(unique);\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ I m a g e s T o C u s t o m B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ImagesToCustomStream() is the equivalent of WriteImages(), but writes the\n% formatted \"file\" to the custom stream rather than to an actual file.\n%\n% The format of the ImageToCustomStream method is:\n%\n% void ImagesToCustomStream(const ImageInfo *image_info,Image *images,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o images: the image list.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport void ImagesToCustomStream(const ImageInfo *image_info,\n Image *images,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" ImageInfo\n *clone_info;",
" MagickBooleanType\n blob_support,\n status;",
" assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n assert(image_info->custom_stream != (CustomStreamInfo *) NULL);\n assert(image_info->custom_stream->signature == MagickCoreSignature);\n assert(image_info->custom_stream->reader != (CustomStreamHandler) NULL);\n assert(image_info->custom_stream->writer != (CustomStreamHandler) NULL);\n assert(exception != (ExceptionInfo *) NULL);\n clone_info=CloneImageInfo(image_info);\n (void) SetImageInfo(clone_info,(unsigned int) GetImageListLength(images),\n exception);\n if (*clone_info->magick != '\\0')\n (void) CopyMagickString(images->magick,clone_info->magick,MagickPathExtent);\n magick_info=GetMagickInfo(images->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoEncodeDelegateForThisImageFormat\",\"`%s'\",\n images->magick);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n (void) CopyMagickString(clone_info->magick,images->magick,MagickPathExtent);\n blob_support=GetMagickBlobSupport(magick_info);\n if ((blob_support != MagickFalse) &&\n (GetMagickEncoderSeekableStream(magick_info) != MagickFalse))\n {\n if ((clone_info->custom_stream->seeker == (CustomStreamSeeker) NULL) ||\n (clone_info->custom_stream->teller == (CustomStreamTeller) NULL))\n blob_support=MagickFalse;\n }\n if (blob_support != MagickFalse)\n {\n /*\n Native blob support for this image format.\n */\n (void) CloseBlob(images);\n *images->filename='\\0';\n (void) WriteImages(clone_info,images,images->filename,exception);\n (void) CloseBlob(images);\n }\n else\n {\n char\n filename[MagickPathExtent],\n unique[MagickPathExtent];",
" int\n file;",
" unsigned char\n *blob;",
" /*\n Write file to disk in blob image format.\n */\n clone_info->custom_stream=(CustomStreamInfo *) NULL;\n blob=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,\n sizeof(*blob));\n if (blob == (unsigned char *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n file=AcquireUniqueFileResource(unique);\n if (file == -1)\n {\n ThrowFileException(exception,BlobError,\"UnableToWriteBlob\",\n image_info->filename);\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n clone_info=DestroyImageInfo(clone_info);\n return;\n }\n clone_info->file=fdopen(file,\"wb+\");\n if (clone_info->file != (FILE *) NULL)\n {\n ssize_t\n count;",
" (void) FormatLocaleString(filename,MagickPathExtent,\"%s:%s\",\n images->magick,unique);\n status=WriteImages(clone_info,images,filename,exception);\n (void) CloseBlob(images);\n if (status != MagickFalse)\n {\n (void) fseek(clone_info->file,0,SEEK_SET);\n count=(ssize_t) MagickMaxBufferExtent;\n while (count == (ssize_t) MagickMaxBufferExtent)\n {\n count=(ssize_t) fread(blob,sizeof(*blob),MagickMaxBufferExtent,\n clone_info->file);\n (void) image_info->custom_stream->writer(blob,(size_t) count,\n image_info->custom_stream->data);\n }\n }\n (void) fclose(clone_info->file);\n }\n blob=(unsigned char *) RelinquishMagickMemory(blob);\n (void) RelinquishUniqueFileResource(unique);\n }\n clone_info=DestroyImageInfo(clone_info);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I n j e c t I m a g e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% InjectImageBlob() injects the image with a copy of itself in the specified\n% format (e.g. inject JPEG into a PDF image).\n%\n% The format of the InjectImageBlob method is:\n%\n% MagickBooleanType InjectImageBlob(const ImageInfo *image_info,\n% Image *image,Image *inject_image,const char *format,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info..\n%\n% o image: the image.\n%\n% o inject_image: inject into the image stream.\n%\n% o format: the image format.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport MagickBooleanType InjectImageBlob(const ImageInfo *image_info,\n Image *image,Image *inject_image,const char *format,ExceptionInfo *exception)\n{\n char\n filename[MagickPathExtent];",
" FILE\n *unique_file;",
" Image\n *byte_image;",
" ImageInfo\n *write_info;",
" int\n file;",
" MagickBooleanType\n status;",
" register ssize_t\n i;",
" size_t\n quantum;",
" ssize_t\n count;",
" struct stat\n file_stats;",
" unsigned char\n *buffer;",
" /*\n Write inject image to a temporary file.\n */\n assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(inject_image != (Image *) NULL);\n assert(inject_image->signature == MagickCoreSignature);\n assert(exception != (ExceptionInfo *) NULL);\n unique_file=(FILE *) NULL;\n file=AcquireUniqueFileResource(filename);\n if (file != -1)\n unique_file=fdopen(file,\"wb\");\n if ((file == -1) || (unique_file == (FILE *) NULL))\n {\n (void) CopyMagickString(image->filename,filename,MagickPathExtent);\n ThrowFileException(exception,FileOpenError,\"UnableToCreateTemporaryFile\",\n image->filename);\n return(MagickFalse);\n }\n byte_image=CloneImage(inject_image,0,0,MagickFalse,exception);\n if (byte_image == (Image *) NULL)\n {\n (void) fclose(unique_file);\n (void) RelinquishUniqueFileResource(filename);\n return(MagickFalse);\n }\n (void) FormatLocaleString(byte_image->filename,MagickPathExtent,\"%s:%s\",\n format,filename);\n DestroyBlob(byte_image);\n byte_image->blob=CloneBlobInfo((BlobInfo *) NULL);\n write_info=CloneImageInfo(image_info);\n SetImageInfoFile(write_info,unique_file);\n status=WriteImage(write_info,byte_image,exception);\n write_info=DestroyImageInfo(write_info);\n byte_image=DestroyImage(byte_image);\n (void) fclose(unique_file);\n if (status == MagickFalse)\n {\n (void) RelinquishUniqueFileResource(filename);\n return(MagickFalse);\n }\n /*\n Inject into image stream.\n */\n file=open_utf8(filename,O_RDONLY | O_BINARY,0);\n if (file == -1)\n {\n (void) RelinquishUniqueFileResource(filename);\n ThrowFileException(exception,FileOpenError,\"UnableToOpenFile\",\n image_info->filename);\n return(MagickFalse);\n }\n quantum=(size_t) MagickMaxBufferExtent;\n if ((fstat(file,&file_stats) == 0) && (file_stats.st_size > 0))\n quantum=(size_t) MagickMin(file_stats.st_size,MagickMaxBufferExtent);\n buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer));\n if (buffer == (unsigned char *) NULL)\n {\n (void) RelinquishUniqueFileResource(filename);\n file=close(file);\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n }\n for (i=0; ; i+=count)\n {\n count=read(file,buffer,quantum);\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n status=WriteBlobStream(image,(size_t) count,buffer) == count ? MagickTrue :\n MagickFalse;\n }\n file=close(file);\n if (file == -1)\n ThrowFileException(exception,FileOpenError,\"UnableToWriteBlob\",filename);\n (void) RelinquishUniqueFileResource(filename);\n buffer=(unsigned char *) RelinquishMagickMemory(buffer);\n return(status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s B l o b E x e m p t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsBlobExempt() returns true if the blob is exempt.\n%\n% The format of the IsBlobExempt method is:\n%\n% MagickBooleanType IsBlobExempt(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType IsBlobExempt(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->exempt);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s B l o b S e e k a b l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsBlobSeekable() returns true if the blob is seekable.\n%\n% The format of the IsBlobSeekable method is:\n%\n% MagickBooleanType IsBlobSeekable(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType IsBlobSeekable(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case BlobStream:\n return(MagickTrue);\n case FileStream:\n {\n int\n status;",
" if (blob_info->file_info.file == (FILE *) NULL)\n return(MagickFalse);\n status=fseek(blob_info->file_info.file,0,SEEK_CUR);\n return(status == -1 ? MagickFalse : MagickTrue);\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n MagickOffsetType\n offset;",
" if (blob_info->file_info.gzfile == (gzFile) NULL)\n return(MagickFalse);\n offset=gzseek(blob_info->file_info.gzfile,0,SEEK_CUR);\n return(offset < 0 ? MagickFalse : MagickTrue);\n#else\n break;\n#endif\n }\n case UndefinedStream:\n case BZipStream:\n case FifoStream:\n case PipeStream:\n case StandardStream:\n break;\n case CustomStream:\n {\n if ((blob_info->custom_stream->seeker != (CustomStreamSeeker) NULL) &&\n (blob_info->custom_stream->teller != (CustomStreamTeller) NULL))\n return(MagickTrue);\n break;\n }\n default:\n break;\n }\n return(MagickFalse);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s B l o b T e m p o r a r y %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsBlobTemporary() returns true if the blob is temporary.\n%\n% The format of the IsBlobTemporary method is:\n%\n% MagickBooleanType IsBlobTemporary(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickBooleanType IsBlobTemporary(const Image *image)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n return(image->blob->temporary);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ M a p B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% MapBlob() creates a mapping from a file to a binary large object.\n%\n% The format of the MapBlob method is:\n%\n% void *MapBlob(int file,const MapMode mode,const MagickOffsetType offset,\n% const size_t length)\n%\n% A description of each parameter follows:\n%\n% o file: map this file descriptor.\n%\n% o mode: ReadMode, WriteMode, or IOMode.\n%\n% o offset: starting at this offset within the file.\n%\n% o length: the length of the mapping is returned in this pointer.\n%\n*/\nMagickExport void *MapBlob(int file,const MapMode mode,\n const MagickOffsetType offset,const size_t length)\n{\n#if defined(MAGICKCORE_HAVE_MMAP)\n int\n flags,\n protection;",
" void\n *map;",
" /*\n Map file.\n */\n flags=0;\n if (file == -1)\n#if defined(MAP_ANONYMOUS)\n flags|=MAP_ANONYMOUS;\n#else\n return(NULL);\n#endif\n switch (mode)\n {\n case ReadMode:\n default:\n {\n protection=PROT_READ;\n flags|=MAP_PRIVATE;\n break;\n }\n case WriteMode:\n {\n protection=PROT_WRITE;\n flags|=MAP_SHARED;\n break;\n }\n case IOMode:\n {\n protection=PROT_READ | PROT_WRITE;\n flags|=MAP_SHARED;\n break;\n }\n }\n#if !defined(MAGICKCORE_HAVE_HUGEPAGES) || !defined(MAP_HUGETLB)\n map=mmap((char *) NULL,length,protection,flags,file,offset);\n#else\n map=mmap((char *) NULL,length,protection,flags | MAP_HUGETLB,file,offset);\n if (map == MAP_FAILED)\n map=mmap((char *) NULL,length,protection,flags,file,offset);\n#endif\n if (map == MAP_FAILED)\n return(NULL);\n return(map);\n#else\n (void) file;\n (void) mode;\n (void) offset;\n (void) length;\n return(NULL);\n#endif\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ M S B O r d e r L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% MSBOrderLong() converts a least-significant byte first buffer of integers to\n% most-significant byte first.\n%\n% The format of the MSBOrderLong method is:\n%\n% void MSBOrderLong(unsigned char *buffer,const size_t length)\n%\n% A description of each parameter follows.\n%\n% o buffer: Specifies a pointer to a buffer of integers.\n%\n% o length: Specifies the length of the buffer.\n%\n*/\nMagickExport void MSBOrderLong(unsigned char *buffer,const size_t length)\n{\n int\n c;",
" register unsigned char\n *p,\n *q;",
" assert(buffer != (unsigned char *) NULL);\n q=buffer+length;\n while (buffer < q)\n {\n p=buffer+3;\n c=(int) (*p);\n *p=(*buffer);\n *buffer++=(unsigned char) c;\n p=buffer+1;\n c=(int) (*p);\n *p=(*buffer);\n *buffer++=(unsigned char) c;\n buffer+=2;\n }\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ M S B O r d e r S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% MSBOrderShort() converts a least-significant byte first buffer of integers\n% to most-significant byte first.\n%\n% The format of the MSBOrderShort method is:\n%\n% void MSBOrderShort(unsigned char *p,const size_t length)\n%\n% A description of each parameter follows.\n%\n% o p: Specifies a pointer to a buffer of integers.\n%\n% o length: Specifies the length of the buffer.\n%\n*/\nMagickExport void MSBOrderShort(unsigned char *p,const size_t length)\n{\n int\n c;",
" register unsigned char\n *q;",
" assert(p != (unsigned char *) NULL);\n q=p+length;\n while (p < q)\n {\n c=(int) (*p);\n *p=(*(p+1));\n p++;\n *p++=(unsigned char) c;\n }\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ O p e n B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% OpenBlob() opens a file associated with the image. A file name of '-' sets\n% the file to stdin for type 'r' and stdout for type 'w'. If the filename\n% suffix is '.gz' or '.Z', the image is decompressed for type 'r' and\n% compressed for type 'w'. If the filename prefix is '|', it is piped to or\n% from a system command.\n%\n% The format of the OpenBlob method is:\n%\n% MagickBooleanType OpenBlob(const ImageInfo *image_info,Image *image,\n% const BlobMode mode,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the image.\n%\n% o mode: the mode for opening the file.\n%\n*/",
"static inline MagickBooleanType SetStreamBuffering(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *option;",
" int\n status;",
" size_t\n size;",
" size=16384;\n option=GetImageOption(image_info,\"stream:buffer-size\");\n if (option != (const char *) NULL)\n size=StringToUnsignedLong(option);\n status=setvbuf(image->blob->file_info.file,(char *) NULL,size == 0 ?\n _IONBF : _IOFBF,size);\n return(status == 0 ? MagickTrue : MagickFalse);\n}",
"MagickExport MagickBooleanType OpenBlob(const ImageInfo *image_info,\n Image *image,const BlobMode mode,ExceptionInfo *exception)\n{\n BlobInfo\n *magick_restrict blob_info;",
" char\n extension[MagickPathExtent],\n filename[MagickPathExtent];",
" const char\n *type;",
" MagickBooleanType\n status;",
" PolicyRights\n rights;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n blob_info=image->blob;\n if (image_info->blob != (void *) NULL)\n {\n if (image_info->stream != (StreamHandler) NULL)\n blob_info->stream=(StreamHandler) image_info->stream;\n AttachBlob(blob_info,image_info->blob,image_info->length);\n return(MagickTrue);\n }\n if ((image_info->custom_stream != (CustomStreamInfo *) NULL) &&\n (*image->filename == '\\0'))\n {\n blob_info->type=CustomStream;\n blob_info->custom_stream=image_info->custom_stream;\n return(MagickTrue);\n }\n (void) DetachBlob(blob_info);\n blob_info->mode=mode;\n switch (mode)\n {\n default: type=\"r\"; break;\n case ReadBlobMode: type=\"r\"; break;\n case ReadBinaryBlobMode: type=\"rb\"; break;\n case WriteBlobMode: type=\"w\"; break;\n case WriteBinaryBlobMode: type=\"w+b\"; break;\n case AppendBlobMode: type=\"a\"; break;\n case AppendBinaryBlobMode: type=\"a+b\"; break;\n }\n if (*type != 'r')\n blob_info->synchronize=image_info->synchronize;\n if (image_info->stream != (StreamHandler) NULL)\n {\n blob_info->stream=image_info->stream;\n if (*type == 'w')\n {\n blob_info->type=FifoStream;\n return(MagickTrue);\n }\n }\n /*\n Open image file.\n */\n *filename='\\0';\n (void) CopyMagickString(filename,image->filename,MagickPathExtent);\n rights=ReadPolicyRights;\n if (*type == 'w')\n rights=WritePolicyRights;\n if (IsRightsAuthorized(PathPolicyDomain,rights,filename) == MagickFalse)\n {\n errno=EPERM;\n (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,\n \"NotAuthorized\",\"`%s'\",filename);\n return(MagickFalse);\n }\n if ((LocaleCompare(filename,\"-\") == 0) ||\n ((*filename == '\\0') && (image_info->file == (FILE *) NULL)))\n {\n blob_info->file_info.file=(*type == 'r') ? stdin : stdout;\n#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)\n if (strchr(type,'b') != (char *) NULL)\n setmode(fileno(blob_info->file_info.file),_O_BINARY);\n#endif\n blob_info->type=StandardStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n if ((LocaleNCompare(filename,\"fd:\",3) == 0) &&\n (IsGeometry(filename+3) != MagickFalse))\n {\n char\n fileMode[MagickPathExtent];",
" *fileMode =(*type);\n fileMode[1]='\\0';\n blob_info->file_info.file=fdopen(StringToLong(filename+3),fileMode);\n if (blob_info->file_info.file == (FILE *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)\n if (strchr(type,'b') != (char *) NULL)\n setmode(fileno(blob_info->file_info.file),_O_BINARY);\n#endif\n blob_info->type=FileStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n#if defined(MAGICKCORE_HAVE_POPEN) && defined(MAGICKCORE_PIPES_SUPPORT)\n if (*filename == '|')\n {\n char\n fileMode[MagickPathExtent],\n *sanitize_command;",
" /*\n Pipe image to or from a system command.\n */\n#if defined(SIGPIPE)\n if (*type == 'w')\n (void) signal(SIGPIPE,SIG_IGN);\n#endif\n *fileMode =(*type);\n fileMode[1]='\\0';\n sanitize_command=SanitizeString(filename+1);\n blob_info->file_info.file=(FILE *) popen_utf8(sanitize_command,fileMode);\n sanitize_command=DestroyString(sanitize_command);\n if (blob_info->file_info.file == (FILE *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n blob_info->type=PipeStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n#endif\n status=GetPathAttributes(filename,&blob_info->properties);\n#if defined(S_ISFIFO)\n if ((status != MagickFalse) && S_ISFIFO(blob_info->properties.st_mode))\n {\n blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);\n if (blob_info->file_info.file == (FILE *) NULL)\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n blob_info->type=FileStream;\n blob_info->exempt=MagickTrue;\n return(SetStreamBuffering(image_info,image));\n }\n#endif\n GetPathComponent(image->filename,ExtensionPath,extension);\n if (*type == 'w')\n {\n (void) CopyMagickString(filename,image->filename,MagickPathExtent);\n if ((image_info->adjoin == MagickFalse) ||\n (strchr(filename,'%') != (char *) NULL))\n {\n /*\n Form filename for multi-part images.\n */\n (void) InterpretImageFilename(image_info,image,image->filename,(int)\n image->scene,filename,exception);\n if ((LocaleCompare(filename,image->filename) == 0) &&\n ((GetPreviousImageInList(image) != (Image *) NULL) ||\n (GetNextImageInList(image) != (Image *) NULL)))\n {\n char\n path[MagickPathExtent];",
" GetPathComponent(image->filename,RootPath,path);\n if (*extension == '\\0')\n (void) FormatLocaleString(filename,MagickPathExtent,\"%s-%.20g\",\n path,(double) image->scene);\n else\n (void) FormatLocaleString(filename,MagickPathExtent,\n \"%s-%.20g.%s\",path,(double) image->scene,extension);\n }\n (void) CopyMagickString(image->filename,filename,MagickPathExtent);\n#if defined(macintosh)\n SetApplicationType(filename,image_info->magick,'8BIM');\n#endif\n }\n }\n if (image_info->file != (FILE *) NULL)\n {\n blob_info->file_info.file=image_info->file;\n blob_info->type=FileStream;\n blob_info->exempt=MagickTrue;\n }\n else\n if (*type == 'r')\n {\n blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);\n if (blob_info->file_info.file != (FILE *) NULL)\n {\n size_t\n count;",
" unsigned char\n magick[3];",
" blob_info->type=FileStream;\n (void) SetStreamBuffering(image_info,image);\n (void) memset(magick,0,sizeof(magick));\n count=fread(magick,1,sizeof(magick),blob_info->file_info.file);\n (void) fseek(blob_info->file_info.file,-((off_t) count),SEEK_CUR);\n#if defined(MAGICKCORE_POSIX_SUPPORT)\n (void) fflush(blob_info->file_info.file);\n#endif\n (void) LogMagickEvent(BlobEvent,GetMagickModule(),\n \" read %.20g magic header bytes\",(double) count);\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if (((int) magick[0] == 0x1F) && ((int) magick[1] == 0x8B) &&\n ((int) magick[2] == 0x08))\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n (void) fclose(blob_info->file_info.file);\n blob_info->file_info.file=(FILE *) NULL;\n blob_info->file_info.gzfile=gzopen(filename,\"rb\");\n if (blob_info->file_info.gzfile != (gzFile) NULL)\n blob_info->type=ZipStream;\n }\n#endif\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n if (strncmp((char *) magick,\"BZh\",3) == 0)\n {\n if (blob_info->file_info.file != (FILE *) NULL)\n (void) fclose(blob_info->file_info.file);\n blob_info->file_info.file=(FILE *) NULL;\n blob_info->file_info.bzfile=BZ2_bzopen(filename,\"r\");\n if (blob_info->file_info.bzfile != (BZFILE *) NULL)\n blob_info->type=BZipStream;\n }\n#endif\n if (blob_info->type == FileStream)\n {\n const MagickInfo\n *magick_info;",
" ExceptionInfo\n *sans_exception;",
" size_t\n length;",
" sans_exception=AcquireExceptionInfo();\n magick_info=GetMagickInfo(image_info->magick,sans_exception);\n sans_exception=DestroyExceptionInfo(sans_exception);\n length=(size_t) blob_info->properties.st_size;\n if ((magick_info != (const MagickInfo *) NULL) &&\n (GetMagickBlobSupport(magick_info) != MagickFalse) &&\n (length > MagickMaxBufferExtent) &&\n (AcquireMagickResource(MapResource,length) != MagickFalse))\n {\n void\n *blob;",
" blob=MapBlob(fileno(blob_info->file_info.file),ReadMode,0,\n length);\n if (blob == (void *) NULL)\n RelinquishMagickResource(MapResource,length);\n else\n {\n /*\n Format supports blobs-- use memory-mapped I/O.\n */\n if (image_info->file != (FILE *) NULL)\n blob_info->exempt=MagickFalse;\n else\n {\n (void) fclose(blob_info->file_info.file);\n blob_info->file_info.file=(FILE *) NULL;\n }\n AttachBlob(blob_info,blob,length);\n blob_info->mapped=MagickTrue;\n }\n }\n }\n }\n }\n else\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if ((LocaleCompare(extension,\"Z\") == 0) ||\n (LocaleCompare(extension,\"gz\") == 0) ||\n (LocaleCompare(extension,\"wmz\") == 0) ||\n (LocaleCompare(extension,\"svgz\") == 0))\n {\n blob_info->file_info.gzfile=gzopen(filename,\"wb\");\n if (blob_info->file_info.gzfile != (gzFile) NULL)\n blob_info->type=ZipStream;\n }\n else\n#endif\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n if (LocaleCompare(extension,\"bz2\") == 0)\n {\n blob_info->file_info.bzfile=BZ2_bzopen(filename,\"w\");\n if (blob_info->file_info.bzfile != (BZFILE *) NULL)\n blob_info->type=BZipStream;\n }\n else\n#endif\n {\n blob_info->file_info.file=(FILE *) fopen_utf8(filename,type);\n if (blob_info->file_info.file != (FILE *) NULL)\n {\n blob_info->type=FileStream;\n (void) SetStreamBuffering(image_info,image);\n }\n }\n blob_info->status=MagickFalse;\n if (blob_info->type != UndefinedStream)\n blob_info->size=GetBlobSize(image);\n else\n {\n ThrowFileException(exception,BlobError,\"UnableToOpenBlob\",filename);\n return(MagickFalse);\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ P i n g B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% PingBlob() returns all the attributes of an image or image sequence except\n% for the pixels. It is much faster and consumes far less memory than\n% BlobToImage(). On failure, a NULL image is returned and exception\n% describes the reason for the failure.\n%\n% The format of the PingBlob method is:\n%\n% Image *PingBlob(const ImageInfo *image_info,const void *blob,\n% const size_t length,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o blob: the address of a character stream in one of the image formats\n% understood by ImageMagick.\n%\n% o length: This size_t integer reflects the length in bytes of the blob.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"#if defined(__cplusplus) || defined(c_plusplus)\nextern \"C\" {\n#endif",
"static size_t PingStream(const Image *magick_unused(image),\n const void *magick_unused(pixels),const size_t columns)\n{\n magick_unreferenced(image);\n magick_unreferenced(pixels);\n return(columns);\n}",
"#if defined(__cplusplus) || defined(c_plusplus)\n}\n#endif",
"MagickExport Image *PingBlob(const ImageInfo *image_info,const void *blob,\n const size_t length,ExceptionInfo *exception)\n{\n const MagickInfo\n *magick_info;",
" Image\n *image;",
" ImageInfo\n *clone_info,\n *ping_info;",
" MagickBooleanType\n status;",
" assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n if ((blob == (const void *) NULL) || (length == 0))\n {\n (void) ThrowMagickException(exception,GetMagickModule(),BlobError,\n \"ZeroLengthBlobNotPermitted\",\"`%s'\",image_info->filename);\n return((Image *) NULL);\n }\n ping_info=CloneImageInfo(image_info);\n ping_info->blob=(void *) blob;\n ping_info->length=length;\n ping_info->ping=MagickTrue;\n if (*ping_info->magick == '\\0')\n (void) SetImageInfo(ping_info,0,exception);\n magick_info=GetMagickInfo(ping_info->magick,exception);\n if (magick_info == (const MagickInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"NoDecodeDelegateForThisImageFormat\",\"`%s'\",\n ping_info->magick);\n ping_info=DestroyImageInfo(ping_info);\n return((Image *) NULL);\n }\n if (GetMagickBlobSupport(magick_info) != MagickFalse)\n {\n char\n filename[MagickPathExtent];",
" /*\n Native blob support for this image format.\n */\n (void) CopyMagickString(filename,ping_info->filename,MagickPathExtent);\n (void) FormatLocaleString(ping_info->filename,MagickPathExtent,\"%s:%s\",\n ping_info->magick,filename);\n image=ReadStream(ping_info,&PingStream,exception);\n if (image != (Image *) NULL)\n (void) DetachBlob(image->blob);\n ping_info=DestroyImageInfo(ping_info);\n return(image);\n }\n /*\n Write blob to a temporary file on disk.\n */\n ping_info->blob=(void *) NULL;\n ping_info->length=0;\n *ping_info->filename='\\0';\n status=BlobToFile(ping_info->filename,blob,length,exception);\n if (status == MagickFalse)\n {\n (void) RelinquishUniqueFileResource(ping_info->filename);\n ping_info=DestroyImageInfo(ping_info);\n return((Image *) NULL);\n }\n clone_info=CloneImageInfo(ping_info);\n (void) FormatLocaleString(clone_info->filename,MagickPathExtent,\"%s:%s\",\n ping_info->magick,ping_info->filename);\n image=ReadStream(clone_info,&PingStream,exception);\n if (image != (Image *) NULL)\n {\n Image\n *images;",
" /*\n Restore original filenames and image format.\n */\n for (images=GetFirstImageInList(image); images != (Image *) NULL; )\n {\n (void) CopyMagickString(images->filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick_filename,image_info->filename,\n MagickPathExtent);\n (void) CopyMagickString(images->magick,magick_info->name,\n MagickPathExtent);\n images=GetNextImageInList(images);\n }\n }\n clone_info=DestroyImageInfo(clone_info);\n (void) RelinquishUniqueFileResource(ping_info->filename);\n ping_info=DestroyImageInfo(ping_info);\n return(image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlob() reads data from the blob or image file and returns it. It\n% returns the number of bytes read. If length is zero, ReadBlob() returns\n% zero and has no other results. If length is greater than SSIZE_MAX, the\n% result is unspecified.\n%\n% The format of the ReadBlob method is:\n%\n% ssize_t ReadBlob(Image *image,const size_t length,void *data)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o length: Specifies an integer representing the number of bytes to read\n% from the file.\n%\n% o data: Specifies an area to place the information requested from the\n% file.\n%\n*/\nMagickExport ssize_t ReadBlob(Image *image,const size_t length,void *data)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n c;",
" register unsigned char\n *q;",
" ssize_t\n count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n if (length == 0)\n return(0);\n assert(data != (void *) NULL);\n blob_info=image->blob;\n count=0;\n q=(unsigned char *) data;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n switch (length)\n {\n default:\n {\n count=(ssize_t) fread(q,1,length,blob_info->file_info.file);\n break;\n }\n case 4:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 3:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 2:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 1:\n {\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 0:\n break;\n }\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n switch (length)\n {\n default:\n {\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) gzread(blob_info->file_info.gzfile,q+i,\n (unsigned int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n break;\n }\n case 4:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 3:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 2:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 1:\n {\n c=gzgetc(blob_info->file_info.gzfile);\n if (c == EOF)\n break;\n *q++=(unsigned char) c;\n count++;\n }\n case 0:\n break;\n }\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) BZ2_bzread(blob_info->file_info.bzfile,q+i,\n (unsigned int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n {\n register const unsigned char\n *p;",
" if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n {\n blob_info->eof=MagickTrue;\n break;\n }\n p=blob_info->data+blob_info->offset;\n count=(ssize_t) MagickMin((MagickOffsetType) length,(MagickOffsetType)\n blob_info->length-blob_info->offset);\n blob_info->offset+=count;\n if (count != (ssize_t) length)\n blob_info->eof=MagickTrue;\n (void) memcpy(q,p,(size_t) count);\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->reader != (CustomStreamHandler) NULL)\n count=blob_info->custom_stream->reader(q,length,\n blob_info->custom_stream->data);\n break;\n }\n }\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b B y t e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobByte() reads a single byte from the image file and returns it.\n%\n% The format of the ReadBlobByte method is:\n%\n% int ReadBlobByte(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport int ReadBlobByte(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" register const unsigned char\n *p;",
" unsigned char\n buffer[1];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n int\n c;",
" p=(const unsigned char *) buffer;\n c=getc(blob_info->file_info.file);\n if (c == EOF)\n return(EOF);\n *buffer=(unsigned char) c;\n break;\n }\n default:\n {\n ssize_t\n count;",
" p=(const unsigned char *) ReadBlobStream(image,1,buffer,&count);\n if (count != 1)\n return(EOF);\n break;\n }\n }\n return((int) (*p));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b D o u b l e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobDouble() reads a double value as a 64-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the ReadBlobDouble method is:\n%\n% double ReadBlobDouble(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport double ReadBlobDouble(Image *image)\n{\n union\n {\n MagickSizeType\n unsigned_value;",
" double\n double_value;\n } quantum;",
" quantum.double_value=0.0;\n quantum.unsigned_value=ReadBlobLongLong(image);\n return(quantum.double_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b F l o a t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobFloat() reads a float value as a 32-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the ReadBlobFloat method is:\n%\n% float ReadBlobFloat(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport float ReadBlobFloat(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" float\n float_value;\n } quantum;",
" quantum.float_value=0.0;\n quantum.unsigned_value=ReadBlobLong(image);\n return(quantum.float_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLong() reads a unsigned int value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobLong method is:\n%\n% unsigned int ReadBlobLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned int ReadBlobLong(Image *image)\n{\n register const unsigned char\n *p;",
" ssize_t\n count;",
" unsigned char\n buffer[4];",
" unsigned int\n value;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,4,buffer,&count);\n if (count != 4)\n return(0UL);\n if (image->endian == LSBEndian)\n {\n value=(unsigned int) (*p++);\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 24;\n return(value);\n }\n value=(unsigned int) (*p++) << 24;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L o n g L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLongLong() reads a long long value as a 64-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobLongLong method is:\n%\n% MagickSizeType ReadBlobLongLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport MagickSizeType ReadBlobLongLong(Image *image)\n{\n MagickSizeType\n value;",
" register const unsigned char\n *p;",
" ssize_t\n count;",
" unsigned char\n buffer[8];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,8,buffer,&count);\n if (count != 8)\n return(MagickULLConstant(0));\n if (image->endian == LSBEndian)\n {\n value=(MagickSizeType) (*p++);\n value|=(MagickSizeType) (*p++) << 8;\n value|=(MagickSizeType) (*p++) << 16;\n value|=(MagickSizeType) (*p++) << 24;\n value|=(MagickSizeType) (*p++) << 32;\n value|=(MagickSizeType) (*p++) << 40;\n value|=(MagickSizeType) (*p++) << 48;\n value|=(MagickSizeType) (*p++) << 56;\n return(value);\n }\n value=(MagickSizeType) (*p++) << 56;\n value|=(MagickSizeType) (*p++) << 48;\n value|=(MagickSizeType) (*p++) << 40;\n value|=(MagickSizeType) (*p++) << 32;\n value|=(MagickSizeType) (*p++) << 24;\n value|=(MagickSizeType) (*p++) << 16;\n value|=(MagickSizeType) (*p++) << 8;\n value|=(MagickSizeType) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobShort() reads a short value as a 16-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the ReadBlobShort method is:\n%\n% unsigned short ReadBlobShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned short ReadBlobShort(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned short\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,2,buffer,&count);\n if (count != 2)\n return((unsigned short) 0U);\n if (image->endian == LSBEndian)\n {\n value=(unsigned short) (*p++);\n value|=(unsigned short) (*p++) << 8;\n return(value);\n }\n value=(unsigned short) ((unsigned short) (*p++) << 8);\n value|=(unsigned short) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBLong() reads a unsigned int value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the ReadBlobLSBLong method is:\n%\n% unsigned int ReadBlobLSBLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned int ReadBlobLSBLong(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned int\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,4,buffer,&count);\n if (count != 4)\n return(0U);\n value=(unsigned int) (*p++);\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 24;\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBSignedLong() reads a signed int value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the ReadBlobLSBSignedLong method is:\n%\n% signed int ReadBlobLSBSignedLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed int ReadBlobLSBSignedLong(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobLSBLong(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBShort() reads a short value as a 16-bit quantity in\n% least-significant byte first order.\n%\n% The format of the ReadBlobLSBShort method is:\n%\n% unsigned short ReadBlobLSBShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned short ReadBlobLSBShort(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned short\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,2,buffer,&count);\n if (count != 2)\n return((unsigned short) 0U);\n value=(unsigned short) (*p++);\n value|=(unsigned short) (*p++) << 8;\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b L S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobLSBSignedShort() reads a signed short value as a 16-bit quantity in\n% least-significant byte-order.\n%\n% The format of the ReadBlobLSBSignedShort method is:\n%\n% signed short ReadBlobLSBSignedShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed short ReadBlobLSBSignedShort(Image *image)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobLSBShort(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBLong() reads a unsigned int value as a 32-bit quantity in\n% most-significant byte first order.\n%\n% The format of the ReadBlobMSBLong method is:\n%\n% unsigned int ReadBlobMSBLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned int ReadBlobMSBLong(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned int\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,4,buffer,&count);\n if (count != 4)\n return(0UL);\n value=(unsigned int) (*p++) << 24;\n value|=(unsigned int) (*p++) << 16;\n value|=(unsigned int) (*p++) << 8;\n value|=(unsigned int) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B L o n g L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBLongLong() reads a unsigned long long value as a 64-bit quantity\n% in most-significant byte first order.\n%\n% The format of the ReadBlobMSBLongLong method is:\n%\n% unsigned int ReadBlobMSBLongLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport MagickSizeType ReadBlobMSBLongLong(Image *image)\n{\n register const unsigned char\n *p;",
" register MagickSizeType\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[8];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,8,buffer,&count);\n if (count != 8)\n return(MagickULLConstant(0));\n value=(MagickSizeType) (*p++) << 56;\n value|=(MagickSizeType) (*p++) << 48;\n value|=(MagickSizeType) (*p++) << 40;\n value|=(MagickSizeType) (*p++) << 32;\n value|=(MagickSizeType) (*p++) << 24;\n value|=(MagickSizeType) (*p++) << 16;\n value|=(MagickSizeType) (*p++) << 8;\n value|=(MagickSizeType) (*p++);\n return(value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBShort() reads a short value as a 16-bit quantity in\n% most-significant byte first order.\n%\n% The format of the ReadBlobMSBShort method is:\n%\n% unsigned short ReadBlobMSBShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport unsigned short ReadBlobMSBShort(Image *image)\n{\n register const unsigned char\n *p;",
" register unsigned short\n value;",
" ssize_t\n count;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n *buffer='\\0';\n p=(const unsigned char *) ReadBlobStream(image,2,buffer,&count);\n if (count != 2)\n return((unsigned short) 0U);\n value=(unsigned short) ((*p++) << 8);\n value|=(unsigned short) (*p++);\n return((unsigned short) (value & 0xffff));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBSignedLong() reads a signed int value as a 32-bit quantity in\n% most-significant byte-order.\n%\n% The format of the ReadBlobMSBSignedLong method is:\n%\n% signed int ReadBlobMSBSignedLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed int ReadBlobMSBSignedLong(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobMSBLong(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b M S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobMSBSignedShort() reads a signed short value as a 16-bit quantity in\n% most-significant byte-order.\n%\n% The format of the ReadBlobMSBSignedShort method is:\n%\n% signed short ReadBlobMSBSignedShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed short ReadBlobMSBSignedShort(Image *image)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobMSBShort(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobSignedLong() reads a signed int value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobSignedLong method is:\n%\n% signed int ReadBlobSignedLong(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed int ReadBlobSignedLong(Image *image)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobLong(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobSignedShort() reads a signed short value as a 16-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the ReadBlobSignedShort method is:\n%\n% signed short ReadBlobSignedShort(Image *image)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n*/\nMagickExport signed short ReadBlobSignedShort(Image *image)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" quantum.unsigned_value=ReadBlobShort(image);\n return(quantum.signed_value);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S t r e a m %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobStream() reads data from the blob or image file and returns it. It\n% returns a pointer to the data buffer you supply or to the image memory\n% buffer if its supported (zero-copy). If length is zero, ReadBlobStream()\n% returns a count of zero and has no other results. If length is greater than\n% SSIZE_MAX, the result is unspecified.\n%\n% The format of the ReadBlobStream method is:\n%\n% const void *ReadBlobStream(Image *image,const size_t length,void *data,\n% ssize_t *count)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o length: Specifies an integer representing the number of bytes to read\n% from the file.\n%\n% o count: returns the number of bytes read.\n%\n% o data: Specifies an area to place the information requested from the\n% file.\n%\n*/\nMagickExport const void *ReadBlobStream(Image *image,const size_t length,\n void *data,ssize_t *count)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n assert(count != (ssize_t *) NULL);\n blob_info=image->blob;\n if (blob_info->type != BlobStream)\n {\n assert(data != NULL);\n *count=ReadBlob(image,length,(unsigned char *) data);\n return(data);\n }\n if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n {\n *count=0;\n blob_info->eof=MagickTrue;\n return(data);\n }\n data=blob_info->data+blob_info->offset;\n *count=(ssize_t) MagickMin((MagickOffsetType) length,(MagickOffsetType)\n blob_info->length-blob_info->offset);\n blob_info->offset+=(*count);\n if (*count != (ssize_t) length)\n blob_info->eof=MagickTrue;\n return(data);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b S t r i n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobString() reads characters from a blob or file until a newline\n% character is read or an end-of-file condition is encountered.\n%\n% The format of the ReadBlobString method is:\n%\n% char *ReadBlobString(Image *image,char *string)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o string: the address of a character buffer.\n%\n*/\nMagickExport char *ReadBlobString(Image *image,char *string)\n{\n int\n c;",
" register ssize_t\n i;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n for (i=0; i < (MagickPathExtent-1L); i++)\n {\n c=ReadBlobByte(image);\n if (c == EOF)\n {\n if (i == 0)\n return((char *) NULL);\n break;\n }\n string[i]=c;\n if (c == '\\n')\n {\n if ((i > 0) && (string[i-1] == '\\r'))\n i--;\n break;\n }\n }\n string[i]='\\0';\n return(string);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e f e r e n c e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReferenceBlob() increments the reference count associated with the pixel\n% blob returning a pointer to the blob.\n%\n% The format of the ReferenceBlob method is:\n%\n% BlobInfo ReferenceBlob(BlobInfo *blob_info)\n%\n% A description of each parameter follows:\n%\n% o blob_info: the blob_info.\n%\n*/\nMagickExport BlobInfo *ReferenceBlob(BlobInfo *blob)\n{\n assert(blob != (BlobInfo *) NULL);\n assert(blob->signature == MagickCoreSignature);\n if (blob->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"...\");\n LockSemaphoreInfo(blob->semaphore);\n blob->reference_count++;\n UnlockSemaphoreInfo(blob->semaphore);\n return(blob);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e e k B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SeekBlob() sets the offset in bytes from the beginning of a blob or file\n% and returns the resulting offset.\n%\n% The format of the SeekBlob method is:\n%\n% MagickOffsetType SeekBlob(Image *image,const MagickOffsetType offset,\n% const int whence)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o offset: Specifies an integer representing the offset in bytes.\n%\n% o whence: Specifies an integer representing how the offset is\n% treated relative to the beginning of the blob as follows:\n%\n% SEEK_SET Set position equal to offset bytes.\n% SEEK_CUR Set position to current location plus offset.\n% SEEK_END Set position to EOF plus offset.\n%\n*/\nMagickExport MagickOffsetType SeekBlob(Image *image,\n const MagickOffsetType offset,const int whence)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n case PipeStream:\n return(-1);\n case FileStream:\n {\n if ((offset < 0) && (whence == SEEK_SET))\n return(-1);\n if (fseek(blob_info->file_info.file,offset,whence) < 0)\n return(-1);\n blob_info->offset=TellBlob(image);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n if (gzseek(blob_info->file_info.gzfile,offset,whence) < 0)\n return(-1);\n#endif\n blob_info->offset=TellBlob(image);\n break;\n }\n case BZipStream:\n return(-1);\n case FifoStream:\n return(-1);\n case BlobStream:\n {\n switch (whence)\n {\n case SEEK_SET:\n default:\n {\n if (offset < 0)\n return(-1);\n blob_info->offset=offset;\n break;\n }\n case SEEK_CUR:\n {\n if (((offset > 0) && (blob_info->offset > (SSIZE_MAX-offset))) ||\n ((offset < 0) && (blob_info->offset < (-SSIZE_MAX-offset))))\n {\n errno=EOVERFLOW;\n return(-1);\n }\n if ((blob_info->offset+offset) < 0)\n return(-1);\n blob_info->offset+=offset;\n break;\n }\n case SEEK_END:\n {\n if (((MagickOffsetType) blob_info->length+offset) < 0)\n return(-1);\n blob_info->offset=blob_info->length+offset;\n break;\n }\n }\n if (blob_info->offset < (MagickOffsetType) ((off_t) blob_info->length))\n {\n blob_info->eof=MagickFalse;\n break;\n }\n if (blob_info->offset >= (MagickOffsetType) ((off_t) blob_info->extent))\n return(-1);\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->seeker == (CustomStreamSeeker) NULL)\n return(-1);\n blob_info->offset=blob_info->custom_stream->seeker(offset,whence,\n blob_info->custom_stream->data);\n break;\n }\n }\n return(blob_info->offset);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t B l o b E x e m p t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetBlobExempt() sets the blob exempt status.\n%\n% The format of the SetBlobExempt method is:\n%\n% MagickBooleanType SetBlobExempt(const Image *image,\n% const MagickBooleanType exempt)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o exempt: Set to true if this blob is exempt from being closed.\n%\n*/\nMagickExport void SetBlobExempt(Image *image,const MagickBooleanType exempt)\n{\n assert(image != (const Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n image->blob->exempt=exempt;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t B l o b E x t e n t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetBlobExtent() ensures enough space is allocated for the blob. If the\n% method is successful, subsequent writes to bytes in the specified range are\n% guaranteed not to fail.\n%\n% The format of the SetBlobExtent method is:\n%\n% MagickBooleanType SetBlobExtent(Image *image,const MagickSizeType extent)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o extent: the blob maximum extent.\n%\n*/\nMagickExport MagickBooleanType SetBlobExtent(Image *image,\n const MagickSizeType extent)\n{\n BlobInfo\n *magick_restrict blob_info;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n return(MagickFalse);\n case FileStream:\n {\n MagickOffsetType\n offset;",
" ssize_t\n count;",
" if (extent != (MagickSizeType) ((off_t) extent))\n return(MagickFalse);\n offset=SeekBlob(image,0,SEEK_END);\n if (offset < 0)\n return(MagickFalse);\n if ((MagickSizeType) offset >= extent)\n break;\n offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);\n if (offset < 0)\n break;\n count=(ssize_t) fwrite((const unsigned char *) \"\",1,1,\n blob_info->file_info.file);\n#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)\n if (blob_info->synchronize != MagickFalse)\n {\n int\n file;",
" file=fileno(blob_info->file_info.file);\n if ((file == -1) || (offset < 0))\n return(MagickFalse);\n (void) posix_fallocate(file,offset,extent-offset);\n }\n#endif\n offset=SeekBlob(image,offset,SEEK_SET);\n if (count != 1)\n return(MagickFalse);\n break;\n }\n case PipeStream:\n case ZipStream:\n return(MagickFalse);\n case BZipStream:\n return(MagickFalse);\n case FifoStream:\n return(MagickFalse);\n case BlobStream:\n {\n if (extent != (MagickSizeType) ((size_t) extent))\n return(MagickFalse);\n if (blob_info->mapped != MagickFalse)\n {\n MagickOffsetType\n offset;",
" ssize_t\n count;",
" (void) UnmapBlob(blob_info->data,blob_info->length);\n RelinquishMagickResource(MapResource,blob_info->length);\n if (extent != (MagickSizeType) ((off_t) extent))\n return(MagickFalse);\n offset=SeekBlob(image,0,SEEK_END);\n if (offset < 0)\n return(MagickFalse);\n if ((MagickSizeType) offset >= extent)\n break;\n offset=SeekBlob(image,(MagickOffsetType) extent-1,SEEK_SET);\n count=(ssize_t) fwrite((const unsigned char *) \"\",1,1,\n blob_info->file_info.file);\n#if defined(MAGICKCORE_HAVE_POSIX_FALLOCATE)\n if (blob_info->synchronize != MagickFalse)\n {\n int\n file;",
" file=fileno(blob_info->file_info.file);\n if ((file == -1) || (offset < 0))\n return(MagickFalse);\n (void) posix_fallocate(file,offset,extent-offset);\n }\n#endif\n offset=SeekBlob(image,offset,SEEK_SET);\n if (count != 1)\n return(MagickFalse);\n (void) AcquireMagickResource(MapResource,extent);\n blob_info->data=(unsigned char*) MapBlob(fileno(\n blob_info->file_info.file),WriteMode,0,(size_t) extent);\n blob_info->extent=(size_t) extent;\n blob_info->length=(size_t) extent;\n (void) SyncBlob(image);\n break;\n }\n blob_info->extent=(size_t) extent;\n blob_info->data=(unsigned char *) ResizeQuantumMemory(blob_info->data,\n blob_info->extent+1,sizeof(*blob_info->data));\n (void) SyncBlob(image);\n if (blob_info->data == (unsigned char *) NULL)\n {\n (void) DetachBlob(blob_info);\n return(MagickFalse);\n }\n break;\n }\n case CustomStream:\n break;\n }\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m D a t a %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamData() sets the stream info data member.\n%\n% The format of the SetCustomStreamData method is:\n%\n% void SetCustomStreamData(CustomStreamInfo *custom_stream,void *)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o data: an object containing information about the custom stream.\n%\n*/\nMagickExport void SetCustomStreamData(CustomStreamInfo *custom_stream,\n void *data)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->data=data;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m R e a d e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamReader() sets the stream info reader member.\n%\n% The format of the SetCustomStreamReader method is:\n%\n% void SetCustomStreamReader(CustomStreamInfo *custom_stream,\n% CustomStreamHandler reader)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o reader: a function to read from the stream.\n%\n*/\nMagickExport void SetCustomStreamReader(CustomStreamInfo *custom_stream,\n CustomStreamHandler reader)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->reader=reader;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m S e e k e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamSeeker() sets the stream info seeker member.\n%\n% The format of the SetCustomStreamReader method is:\n%\n% void SetCustomStreamSeeker(CustomStreamInfo *custom_stream,\n% CustomStreamSeeker seeker)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o seeker: a function to seek in the custom stream.\n%\n*/\nMagickExport void SetCustomStreamSeeker(CustomStreamInfo *custom_stream,\n CustomStreamSeeker seeker)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->seeker=seeker;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m T e l l e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamTeller() sets the stream info teller member.\n%\n% The format of the SetCustomStreamTeller method is:\n%\n% void SetCustomStreamTeller(CustomStreamInfo *custom_stream,\n% CustomStreamTeller *teller)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o teller: a function to set the position in the stream.\n%\n*/\nMagickExport void SetCustomStreamTeller(CustomStreamInfo *custom_stream,\n CustomStreamTeller teller)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->teller=teller;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S e t C u s t o m S t r e a m W r i t e r %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SetCustomStreamWriter() sets the stream info writer member.\n%\n% The format of the SetCustomStreamWriter method is:\n%\n% void SetCustomStreamWriter(CustomStreamInfo *custom_stream,\n% CustomStreamHandler *writer)\n%\n% A description of each parameter follows:\n%\n% o custom_stream: the custom stream info.\n%\n% o writer: a function to write to the custom stream.\n%\n*/\nMagickExport void SetCustomStreamWriter(CustomStreamInfo *custom_stream,\n CustomStreamHandler writer)\n{\n assert(custom_stream != (CustomStreamInfo *) NULL);\n assert(custom_stream->signature == MagickCoreSignature);\n custom_stream->writer=writer;\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ S y n c B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% SyncBlob() flushes the datastream if it is a file or synchronizes the data\n% attributes if it is an blob.\n%\n% The format of the SyncBlob method is:\n%\n% int SyncBlob(Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nstatic int SyncBlob(Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n status;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n status=0;\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n case PipeStream:\n {\n status=fflush(blob_info->file_info.file);\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n status=gzflush(blob_info->file_info.gzfile,Z_SYNC_FLUSH);\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n status=BZ2_bzflush(blob_info->file_info.bzfile);\n#endif\n break;\n }\n case FifoStream:\n break;\n case BlobStream:\n break;\n case CustomStream:\n break;\n }\n return(status);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ T e l l B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% TellBlob() obtains the current value of the blob or file position.\n%\n% The format of the TellBlob method is:\n%\n% MagickOffsetType TellBlob(const Image *image)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n*/\nMagickExport MagickOffsetType TellBlob(const Image *image)\n{\n BlobInfo\n *magick_restrict blob_info;",
" MagickOffsetType\n offset;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n offset=(-1);\n switch (blob_info->type)\n {\n case UndefinedStream:\n case StandardStream:\n break;\n case FileStream:\n {\n offset=ftell(blob_info->file_info.file);\n break;\n }\n case PipeStream:\n break;\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n offset=(MagickOffsetType) gztell(blob_info->file_info.gzfile);\n#endif\n break;\n }\n case BZipStream:\n break;\n case FifoStream:\n break;\n case BlobStream:\n {\n offset=blob_info->offset;\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->teller != (CustomStreamTeller) NULL)\n offset=blob_info->custom_stream->teller(blob_info->custom_stream->data);\n break;\n }\n }\n return(offset);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ U n m a p B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% UnmapBlob() deallocates the binary large object previously allocated with\n% the MapBlob method.\n%\n% The format of the UnmapBlob method is:\n%\n% MagickBooleanType UnmapBlob(void *map,const size_t length)\n%\n% A description of each parameter follows:\n%\n% o map: the address of the binary large object.\n%\n% o length: the length of the binary large object.\n%\n*/\nMagickExport MagickBooleanType UnmapBlob(void *map,const size_t length)\n{\n#if defined(MAGICKCORE_HAVE_MMAP)\n int\n status;",
" status=munmap(map,length);\n return(status == -1 ? MagickFalse : MagickTrue);\n#else\n (void) map;\n (void) length;\n return(MagickFalse);\n#endif\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlob() writes data to a blob or image file. It returns the number of\n% bytes written.\n%\n% The format of the WriteBlob method is:\n%\n% ssize_t WriteBlob(Image *image,const size_t length,const void *data)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o length: Specifies an integer representing the number of bytes to\n% write to the file.\n%\n% o data: The address of the data to write to the blob or file.\n%\n*/\nMagickExport ssize_t WriteBlob(Image *image,const size_t length,\n const void *data)\n{\n BlobInfo\n *magick_restrict blob_info;",
" int\n c;",
" register const unsigned char\n *p;",
" register unsigned char\n *q;",
" ssize_t\n count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n if (length == 0)\n return(0);\n assert(data != (const void *) NULL);\n blob_info=image->blob;\n count=0;\n p=(const unsigned char *) data;\n q=(unsigned char *) data;\n switch (blob_info->type)\n {\n case UndefinedStream:\n break;\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n switch (length)\n {\n default:\n {\n count=(ssize_t) fwrite((const char *) data,1,length,\n blob_info->file_info.file);\n break;\n }\n case 4:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 3:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 2:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 1:\n {\n c=putc((int) *p++,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n }\n case 0:\n break;\n }\n break;\n }\n case ZipStream:\n {\n#if defined(MAGICKCORE_ZLIB_DELEGATE)\n switch (length)\n {\n default:\n {\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) gzwrite(blob_info->file_info.gzfile,q+i,\n (unsigned int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n break;\n }\n case 4:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 3:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 2:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 1:\n {\n c=gzputc(blob_info->file_info.gzfile,(int) *p++);\n if (c == EOF)\n break;\n count++;\n }\n case 0:\n break;\n }\n#endif\n break;\n }\n case BZipStream:\n {\n#if defined(MAGICKCORE_BZLIB_DELEGATE)\n register ssize_t\n i;",
" for (i=0; i < (ssize_t) length; i+=count)\n {\n count=(ssize_t) BZ2_bzwrite(blob_info->file_info.bzfile,q+i,\n (int) MagickMin(length-i,MagickMaxBufferExtent));\n if (count <= 0)\n {\n count=0;\n if (errno != EINTR)\n break;\n }\n }\n count=i;\n#endif\n break;\n }\n case FifoStream:\n {\n count=(ssize_t) blob_info->stream(image,data,length);\n break;\n }\n case BlobStream:\n {\n if ((blob_info->offset+(MagickOffsetType) length) >=\n (MagickOffsetType) blob_info->extent)\n {\n if (blob_info->mapped != MagickFalse)\n return(0);\n blob_info->extent+=length+blob_info->quantum;\n blob_info->quantum<<=1;\n blob_info->data=(unsigned char *) ResizeQuantumMemory(\n blob_info->data,blob_info->extent+1,sizeof(*blob_info->data));\n (void) SyncBlob(image);\n if (blob_info->data == (unsigned char *) NULL)\n {\n (void) DetachBlob(blob_info);\n return(0);\n }\n }\n q=blob_info->data+blob_info->offset;\n (void) memcpy(q,p,length);\n blob_info->offset+=length;\n if (blob_info->offset >= (MagickOffsetType) blob_info->length)\n blob_info->length=(size_t) blob_info->offset;\n count=(ssize_t) length;\n break;\n }\n case CustomStream:\n {\n if (blob_info->custom_stream->writer != (CustomStreamHandler) NULL)\n count=blob_info->custom_stream->writer((unsigned char *) data,\n length,blob_info->custom_stream->data);\n break;\n }\n }\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b B y t e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobByte() write an integer to a blob. It returns the number of bytes\n% written (either 0 or 1);\n%\n% The format of the WriteBlobByte method is:\n%\n% ssize_t WriteBlobByte(Image *image,const unsigned char value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobByte(Image *image,const unsigned char value)\n{\n BlobInfo\n *magick_restrict blob_info;",
" ssize_t\n count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(image->blob != (BlobInfo *) NULL);\n assert(image->blob->type != UndefinedStream);\n blob_info=image->blob;\n count=0;\n switch (blob_info->type)\n {\n case StandardStream:\n case FileStream:\n case PipeStream:\n {\n int\n c;",
" c=putc((int) value,blob_info->file_info.file);\n if (c == EOF)\n break;\n count++;\n break;\n }\n default:\n {\n count=WriteBlobStream(image,1,&value);\n break;\n }\n }\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b F l o a t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobFloat() writes a float value as a 32-bit quantity in the byte-order\n% specified by the endian member of the image structure.\n%\n% The format of the WriteBlobFloat method is:\n%\n% ssize_t WriteBlobFloat(Image *image,const float value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobFloat(Image *image,const float value)\n{\n union\n {\n unsigned int\n unsigned_value;",
" float\n float_value;\n } quantum;",
" quantum.unsigned_value=0U;\n quantum.float_value=value;\n return(WriteBlobLong(image,quantum.unsigned_value));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLong() writes a unsigned int value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobLong method is:\n%\n% ssize_t WriteBlobLong(Image *image,const unsigned int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLong(Image *image,const unsigned int value)\n{\n unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n buffer[2]=(unsigned char) (value >> 16);\n buffer[3]=(unsigned char) (value >> 24);\n return(WriteBlobStream(image,4,buffer));\n }\n buffer[0]=(unsigned char) (value >> 24);\n buffer[1]=(unsigned char) (value >> 16);\n buffer[2]=(unsigned char) (value >> 8);\n buffer[3]=(unsigned char) value;\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L o n g L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBLongLong() writes a long long value as a 64-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobLongLong method is:\n%\n% ssize_t WriteBlobLongLong(Image *image,const MagickSizeType value)\n%\n% A description of each parameter follows.\n%\n% o value: Specifies the value to write.\n%\n% o image: the image.\n%\n*/\nMagickExport ssize_t WriteBlobLongLong(Image *image,const MagickSizeType value)\n{\n unsigned char\n buffer[8];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n buffer[2]=(unsigned char) (value >> 16);\n buffer[3]=(unsigned char) (value >> 24);\n buffer[4]=(unsigned char) (value >> 32);\n buffer[5]=(unsigned char) (value >> 40);\n buffer[6]=(unsigned char) (value >> 48);\n buffer[7]=(unsigned char) (value >> 56);\n return(WriteBlobStream(image,8,buffer));\n }\n buffer[0]=(unsigned char) (value >> 56);\n buffer[1]=(unsigned char) (value >> 48);\n buffer[2]=(unsigned char) (value >> 40);\n buffer[3]=(unsigned char) (value >> 32);\n buffer[4]=(unsigned char) (value >> 24);\n buffer[5]=(unsigned char) (value >> 16);\n buffer[6]=(unsigned char) (value >> 8);\n buffer[7]=(unsigned char) value;\n return(WriteBlobStream(image,8,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobShort() writes a short value as a 16-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobShort method is:\n%\n% ssize_t WriteBlobShort(Image *image,const unsigned short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobShort(Image *image,const unsigned short value)\n{\n unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n return(WriteBlobStream(image,2,buffer));\n }\n buffer[0]=(unsigned char) (value >> 8);\n buffer[1]=(unsigned char) value;\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobSignedLong() writes a signed value as a 32-bit quantity in the\n% byte-order specified by the endian member of the image structure.\n%\n% The format of the WriteBlobSignedLong method is:\n%\n% ssize_t WriteBlobSignedLong(Image *image,const signed int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobSignedLong(Image *image,const signed int value)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n if (image->endian == LSBEndian)\n {\n buffer[0]=(unsigned char) quantum.unsigned_value;\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[2]=(unsigned char) (quantum.unsigned_value >> 16);\n buffer[3]=(unsigned char) (quantum.unsigned_value >> 24);\n return(WriteBlobStream(image,4,buffer));\n }\n buffer[0]=(unsigned char) (quantum.unsigned_value >> 24);\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 16);\n buffer[2]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[3]=(unsigned char) quantum.unsigned_value;\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBLong() writes a unsigned int value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the WriteBlobLSBLong method is:\n%\n% ssize_t WriteBlobLSBLong(Image *image,const unsigned int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBLong(Image *image,const unsigned int value)\n{\n unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n buffer[2]=(unsigned char) (value >> 16);\n buffer[3]=(unsigned char) (value >> 24);\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBShort() writes a unsigned short value as a 16-bit quantity in\n% least-significant byte first order.\n%\n% The format of the WriteBlobLSBShort method is:\n%\n% ssize_t WriteBlobLSBShort(Image *image,const unsigned short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBShort(Image *image,const unsigned short value)\n{\n unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) value;\n buffer[1]=(unsigned char) (value >> 8);\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B S i g n e d L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBSignedLong() writes a signed value as a 32-bit quantity in\n% least-significant byte first order.\n%\n% The format of the WriteBlobLSBSignedLong method is:\n%\n% ssize_t WriteBlobLSBSignedLong(Image *image,const signed int value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBSignedLong(Image *image,const signed int value)\n{\n union\n {\n unsigned int\n unsigned_value;",
" signed int\n signed_value;\n } quantum;",
" unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n buffer[0]=(unsigned char) quantum.unsigned_value;\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[2]=(unsigned char) (quantum.unsigned_value >> 16);\n buffer[3]=(unsigned char) (quantum.unsigned_value >> 24);\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b L S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobLSBSignedShort() writes a signed short value as a 16-bit quantity\n% in least-significant byte first order.\n%\n% The format of the WriteBlobLSBSignedShort method is:\n%\n% ssize_t WriteBlobLSBSignedShort(Image *image,const signed short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobLSBSignedShort(Image *image,\n const signed short value)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n buffer[0]=(unsigned char) quantum.unsigned_value;\n buffer[1]=(unsigned char) (quantum.unsigned_value >> 8);\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b M S B L o n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBLong() writes a unsigned int value as a 32-bit quantity in\n% most-significant byte first order.\n%\n% The format of the WriteBlobMSBLong method is:\n%\n% ssize_t WriteBlobMSBLong(Image *image,const unsigned int value)\n%\n% A description of each parameter follows.\n%\n% o value: Specifies the value to write.\n%\n% o image: the image.\n%\n*/\nMagickExport ssize_t WriteBlobMSBLong(Image *image,const unsigned int value)\n{\n unsigned char\n buffer[4];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) (value >> 24);\n buffer[1]=(unsigned char) (value >> 16);\n buffer[2]=(unsigned char) (value >> 8);\n buffer[3]=(unsigned char) value;\n return(WriteBlobStream(image,4,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b M S B S i g n e d S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBSignedShort() writes a signed short value as a 16-bit quantity\n% in most-significant byte first order.\n%\n% The format of the WriteBlobMSBSignedShort method is:\n%\n% ssize_t WriteBlobMSBSignedShort(Image *image,const signed short value)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o value: Specifies the value to write.\n%\n*/\nMagickExport ssize_t WriteBlobMSBSignedShort(Image *image,\n const signed short value)\n{\n union\n {\n unsigned short\n unsigned_value;",
" signed short\n signed_value;\n } quantum;",
" unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n quantum.signed_value=value;\n buffer[0]=(unsigned char) (quantum.unsigned_value >> 8);\n buffer[1]=(unsigned char) quantum.unsigned_value;\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b M S B S h o r t %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobMSBShort() writes a unsigned short value as a 16-bit quantity in\n% most-significant byte first order.\n%\n% The format of the WriteBlobMSBShort method is:\n%\n% ssize_t WriteBlobMSBShort(Image *image,const unsigned short value)\n%\n% A description of each parameter follows.\n%\n% o value: Specifies the value to write.\n%\n% o file: Specifies the file to write the data to.\n%\n*/\nMagickExport ssize_t WriteBlobMSBShort(Image *image,const unsigned short value)\n{\n unsigned char\n buffer[2];",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n buffer[0]=(unsigned char) (value >> 8);\n buffer[1]=(unsigned char) value;\n return(WriteBlobStream(image,2,buffer));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ W r i t e B l o b S t r i n g %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteBlobString() write a string to a blob. It returns the number of\n% characters written.\n%\n% The format of the WriteBlobString method is:\n%\n% ssize_t WriteBlobString(Image *image,const char *string)\n%\n% A description of each parameter follows.\n%\n% o image: the image.\n%\n% o string: Specifies the string to write.\n%\n*/\nMagickExport ssize_t WriteBlobString(Image *image,const char *string)\n{\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(string != (const char *) NULL);\n return(WriteBlobStream(image,strlen(string),(const unsigned char *) string));\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [1013], "buggy_code_start_loc": [1013], "filenames": ["MagickCore/blob.c"], "fixing_code_end_loc": [1015], "fixing_code_start_loc": [1014], "message": "In ImageMagick 7.x before 7.0.8-42 and 6.x before 6.9.10-42, there is a use after free vulnerability in the UnmapBlob function that allows an attacker to cause a denial of service by sending a crafted file.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:*", "matchCriteriaId": "20ADD76D-50E8-4DCE-8572-28070BFE3835", "versionEndExcluding": "6.9.10-42", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "6.0", "vulnerable": true}, {"criteria": "cpe:2.3:a:imagemagick:imagemagick:*:*:*:*:*:*:*:*", "matchCriteriaId": "5F512348-96B1-4F5F-94A2-3112BD1FEA9A", "versionEndExcluding": "7.0.8-42", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": "7.0.0-0", "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "F1E78106-58E6-4D59-990F-75DA575BFAD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "In ImageMagick 7.x before 7.0.8-42 and 6.x before 6.9.10-42, there is a use after free vulnerability in the UnmapBlob function that allows an attacker to cause a denial of service by sending a crafted file."}, {"lang": "es", "value": "En ImageMagick versiones 7.x anteriores a 7.0.8-42 y versiones 6.x anteriores a 6.9.10-42, hay una vulnerabilidad de uso de la memoria previamente liberada en la funci\u00f3n UnmapBlob que permite a un atacante causar una denegaci\u00f3n de servicio mediante el env\u00edo de un archivo especialmente dise\u00f1ado."}], "evaluatorComment": null, "id": "CVE-2019-14980", "lastModified": "2023-03-02T18:00:56.910", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 4.3, "confidentialityImpact": "NONE", "integrityImpact": "NONE", "vectorString": "AV:N/AC:M/Au:N/C:N/I:N/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 2.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 6.5, "baseSeverity": "MEDIUM", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 3.6, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-08-12T23:15:11.493", "references": [{"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-11/msg00040.html"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-11/msg00042.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/commit/c5d012a46ae22be9444326aa37969a3f75daa3ba"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/compare/7.0.8-41...7.0.8-42"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick6/commit/614a257295bdcdeda347086761062ac7658b6830"}, {"source": "cve@mitre.org", "tags": ["Issue Tracking", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick6/issues/43"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/c5d012a46ae22be9444326aa37969a3f75daa3ba"}, "type": "CWE-416"}
| 99
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# Changelog\nAll notable changes to this project will be documented in this file.",
"## v2.6-dev - Unreleased",
"### Improvements\n- Improve layout in \"My Checks\" for checks with long ping URLs (#745)\n- Add support for communicating with signal-cli over TCP (#732)\n- Add /api/v2/ (changes the status reporting of checks in started state) (#633)\n- Update settings.py to read the ADMINS setting from an environment variable\n- Add \"Start Keyword\" filtering for inbound emails (#716)",
"### Bug Fixes\n- Fix the Signal integration to handle unexpected RPC messages better (#763)\n- Fix special character encoding in Signal notifications (#767)\n- Fix project sort order to be case-insensitive everywhere in the UI (#768)\n- Fix special character encoding in project invite emails\n- Fix check transfer between same account's projects when at check limit\n- Fix wording in the invite email when inviting read-only users",
"",
"\n## v2.5 - 2022-12-14",
"### Improvements\n- Upgrade to fido2 1.1.0 and simplify hc.lib.webauthn\n- Add handling for ipv4address:port values in the X-Forwarded-For header (#714)\n- Add a form for submitting Signal CAPTCHA solutions\n- Add Duration field in the Ping Details dialog (#720)\n- Update Mattermost setup instructions\n- Add support for specifying a run ID via a \"rid\" query parameter (#722)\n- Add last ping body in Slack notifications (#735)\n- Add ntfy integration (#728)\n- Add \".txt\" suffix to the filename when downloading ping body (#738)\n- Add API support for fetching ping bodies (#737)\n- Change \"Settings - Email Reports\" page to allow manual timezone selection",
"### Bug Fixes\n- Fix the most recent ping lookup in the \"Ping Details\" dialog\n- Fix binary data handling in the hc.front.views.ping_body view\n- Fix downtime summaries in weekly reports (#736)\n- Fix week, month boundary calculation to use user's timezone",
"## v2.4.1 - 2022-10-18",
"### Bug Fixes\n- Fix the GHA workflow for building arm/v7 docker image",
"## v2.4 - 2022-10-18",
"### Improvements\n- Add support for EMAIL_USE_SSL environment variable (#685)\n- Switch from requests to pycurl\n- Implement documentation search\n- Add date filters in the Log page\n- Upgrade to cronsim 2.3\n- Add support for the $BODY placeholder in webhook payloads (#708)\n- Implement the \"Clear Events\" function\n- Add support for custom topics in Zulip notifications (#583)",
"### Bug Fixes\n- Fix the handling of TooManyRedirects exceptions\n- Fix MySQL 8 support in the Docker image (upgrade from buster to bullseye) (#717)",
"## v2.3 - 2022-08-05",
"### Improvements\n- Update Dockerfile to start SMTP listener (#668)\n- Implement the \"Add Check\" dialog\n- Include last ping type in Slack, Mattermost, Discord notifications\n- Upgrade to cron-descriptor 1.2.30\n- Add \"Filter by keywords in the message body\" feature (#653)\n- Upgrade to HiDPI screenshots in the documentation\n- Add support for the $JSON placeholder in webhook payloads\n- Add ping endpoints for \"log\" events\n- Add the \"Badges\" page in docs\n- Add support for multiple recipients in incoming email (#669)\n- Upgrade to fido2 1.0.0, requests 2.28.1, segno 1.5.2\n- Implement auto-refresh and running indicator in the My Projects page (#681)\n- Upgrade to Django 4.1 and django-compressor 4.1\n- Add API support for resuming paused checks (#687)",
"### Bug Fixes\n- Fix the display of ignored pings with non-zero exit status\n- Fix a race condition in the \"Change Email\" flow\n- Fix grouping and sorting in the text version of the report/nag emails (#679)\n- Fix the update_timeout and pause views to create flips (for downtime bookkeeping)\n- Fix the checks list to preserve selected filters when adding/updating checks (#684)\n- Fix duration calculation to skip \"log\" and \"ign\" events",
"## v2.2.1 - 2022-06-13",
"### Improvements\n- Improve the text version of the alert email template",
"### Bug Fixes\n- Fix the version number displayed in the footer",
"## v2.2 - 2022-06-13",
"### Improvements\n- Add address verification step in the \"Change Email\" flow\n- Reduce logging output from sendalerts and sendreports management commands (#656)\n- Add Ctrl+C handler in sendalerts and sendreports management commands\n- Add notes in docs about configuring uWSGI via UWSGI_ env vars (#656)\n- Implement login link expiration (login links will now expire in 1 hour)\n- Add Gotify integration (#270)\n- Add API support for reading/writing the subject and subject_fail fields (#659)\n- Add \"Disabled\" priority for Pushover notifications (#663)",
"### Bug Fixes\n- Update hc.front.views.channels to handle empty strings in settings (#635)\n- Add logic to handle ContentDecodingError exceptions",
"## v2.1 - 2022-05-10",
"### Improvements\n- Add logic to alert ADMINS when Signal transport hits a CAPTCHA challenge\n- Implement the \"started\" progress spinner in the details pages\n- Add \"hc_check_started\" metric in the Prometheus metrics endpoint (#630)\n- Add a management command for submitting Signal rate limit challenges\n- Upgrade to django-compressor 4.0\n- Update the C# snippet\n- Increase max displayed duration from 24h to 72h (#644)\n- Add \"Ping-Body-Limit\" response header in ping API responses",
"### Bug Fixes\n- Fix unwanted localization in badge SVG generation (#629)\n- Update email template to handle not yet uploaded ping bodies\n- Add small delay in transports.Email.notify to allow ping body to upload\n- Fix prunenotifications to handle checks with missing pings (#636)\n- Fix \"Send Test Notification\" for integrations that only send \"up\" notifications",
"## v2.0.1 - 2022-03-18",
"### Bug Fixes\n- Fix the GHA workflow for building arm/v7 docker image",
"## v2.0 - 2022-03-18",
"This release contains a backwards-incompatible change to the Signal integration\n(hence the major version number bump). Healthchecks uses signal-cli to deliver\nSignal notifications. In the past versions, Healthchecks interfaced with\nsignal-cli over DBus. Starting from this version, Healthchecks interfaces\nwith signal-cli using JSON RPC. Please see README for details on how to set\nthis up.",
"### Improvements\n- Update Telegram integration to treat \"group chat was deleted\" as permanent error\n- Update email bounce handler to mark email channels as disabled (#446)\n- Update Signal integration to use JSON RPC over UNIX socket\n- Update the \"Add TOTP\" form to display plaintext TOTP secret (#602)\n- Improve PagerDuty notifications\n- Add Ping.body_raw field for storing body as bytes\n- Add support for storing ping bodies in S3-compatible object storage (#609)\n- Add a \"Download Original\" link in the \"Ping Details\" dialog",
"### Bug Fixes\n- Fix unwanted special character escaping in notification messages (#606)\n- Fix JS error after copying a code snippet\n- Make email non-editable in the \"Invite Member\" dialog when team limit reached\n- Fix Telegram bot to handle TransportError exceptions\n- Fix Signal integration to handle UNREGISTERED_FAILURE errors\n- Fix unwanted localization of period and grace values in data- attributes (#617)\n- Fix Mattermost integration to treat 404 as a transient error (#613)",
"## v1.25.0 - 2022-01-07",
"### Improvements\n- Implement Pushover emergency alert cancellation when check goes up\n- Add \"The following checks are also down\" section in Telegram notifications\n- Add \"The following checks are also down\" section in Signal notifications\n- Upgrade to django-compressor 3.0\n- Add support for Telegram channels (#592)\n- Implement Telegram group to supergroup migration (#132)\n- Update the Slack integration to not retry when Slack returns 404\n- Refactor transport classes to raise exceptions on delivery problems\n- Add Channel.disabled field, for disabling integrations on permanent errors\n- Upgrade to Django 4\n- Bump the min. Python version from 3.6 to 3.8 (as required by Django 4)",
"### Bug Fixes\n- Fix report templates to not show the \"started\" status (show UP or DOWN instead)\n- Update Dockerfile to avoid running \"pip wheel\" more than once (#594)",
"## v1.24.1 - 2021-11-10",
"### Bug Fixes\n- Fix Dockerfile for arm/v7 - install all dependencies from piwheels",
"## v1.24.0 - 2021-11-10",
"### Improvements\n- Switch from croniter to cronsim\n- Change outgoing webhook timeout to 10s, but cap the total time to 20s\n- Implement automatic `api_ping` and `api_notification` pruning (#556)\n- Update Dockerfile to install apprise (#581)\n- Improve period and grace controls, allow up to 365 day periods (#281)\n- Add SIGTERM handling in sendalerts and sendreports\n- Remove the \"welcome\" landing page, direct users to the sign in form instead",
"### Bug Fixes\n- Fix hc.api.views.ping to handle non-utf8 data in request body (#574)\n- Fix a crash when hc.api.views.pause receives a single integer in request body",
"## v1.23.1 - 2021-10-13",
"### Bug Fixes\n- Fix missing uwsgi dependencies in arm/v7 Docker image",
"## v1.23.0 - 2021-10-13",
"### Improvements\n- Add /api/v1/badges/ endpoint (#552)\n- Add ability to edit existing email, Signal, SMS, WhatsApp integrations\n- Add new ping URL format: /{ping_key}/{slug} (#491)\n- Reduce Docker image size by using slim base image and multi-stage Dockerfile\n- Upgrade to Bootstrap 3.4.1\n- Upgrade to jQuery 3.6.0",
"### Bug Fixes\n- Add handling for non-latin-1 characters in webhook headers\n- Fix dark mode bug in selectpicker widgets\n- Fix a crash during login when user's profile does not exist (#77)\n- Drop API support for GET, DELETE requests with a request body\n- Add missing @csrf_exempt annotations in API views\n- Fix the ping handler to reject status codes > 255\n- Add 'schemaVersion' field in the shields.io endpoint (#566)",
"## v1.22.0 - 2021-08-06",
"### Improvements\n- Use multicolor channel icons for better appearance in the dark mode\n- Add SITE_LOGO_URL setting (#323)\n- Add admin action to log in as any user\n- Add a \"Manager\" role (#484)\n- Add support for 2FA using TOTP (#354)\n- Add Whitenoise (#548)",
"### Bug Fixes\n- Fix dark mode styling issues in Cron Syntax Cheatsheet\n- Fix a 403 when transferring a project to a read-only team member\n- Security: fix allow_redirect function to reject absolute URLs",
"## v1.21.0 - 2021-07-02",
"### Improvements\n- Increase \"Success / Failure Keywords\" field lengths to 200\n- Django 3.2.4\n- Improve the handling of unknown email addresses in the Sign In form\n- Add support for \"... is UP\" SMS notifications\n- Add an option for weekly reports (in addition to monthly)\n- Implement PagerDuty Simple Install Flow, remove PD Connect\n- Implement dark mode",
"### Bug Fixes\n- Fix off-by-one-month error in monthly reports, downtime columns (#539)",
"## v1.20.0 - 2021-04-22",
"### Improvements\n- Django 3.2\n- Rename VictorOps -> Splunk On-Call\n- Implement email body decoding in the \"Ping Details\" dialog\n- Add a \"Subject\" field in the \"Ping Details\" dialog\n- Improve HTML email display in the \"Ping Details\" dialog\n- Add a link to check's details page in Slack notifications\n- Replace details_url with cloaked_url in email and chat notifications\n- In the \"My Projects\" page, show projects with failing checks first",
"### Bug Fixes\n- Fix downtime summary to handle months when the check didn't exist yet (#472)\n- Relax cron expression validation: accept all expressions that croniter accepts\n- Fix sendalerts to clear Profile.next_nag_date if all checks up\n- Fix the pause action to clear Profile.next_nag_date if all checks up\n- Fix the \"Email Reports\" screen to clear Profile.next_nag_date if all checks up\n- Fix the month boundary calculation in monthly reports (#497)",
"## v1.19.0 - 2021-02-03",
"### Improvements\n- Add tighter parameter checks in hc.front.views.serve_doc\n- Update OpsGenie instructions (#450)\n- Update the email notification template to include more check and last ping details\n- Improve the crontab snippet in the \"Check Details\" page (#465)\n- Add Signal integration (#428)\n- Change Zulip onboarding, ask for the zuliprc file (#202)\n- Add a section in Docs about running self-hosted instances\n- Add experimental Dockerfile and docker-compose.yml\n- Add rate limiting for Pushover notifications (6 notifications / user / minute)\n- Add support for disabling specific integration types (#471)",
"### Bug Fixes\n- Fix unwanted HTML escaping in SMS and WhatsApp notifications\n- Fix a crash when adding an integration for an empty Trello account\n- Change icon CSS class prefix to 'ic-' to work around Fanboy's filter list",
"## v1.18.0 - 2020-12-09",
"### Improvements\n- Add a tooltip to the 'confirmation link' label (#436)\n- Update API to allow specifying channels by names (#440)\n- When saving a phone number, remove any invisible unicode characers\n- Update the read-only dashboard's CSS for better mobile support (#442)\n- Reduce the number of SQL queries used in the \"Get Checks\" API call\n- Add support for script's exit status in ping URLs (#429)\n- Improve phone number sanitization: remove spaces and hyphens\n- Change the \"Test Integration\" behavior for webhooks: don't retry failed requests\n- Add retries to the the email sending logic\n- Require confirmation codes (sent to email) before sensitive actions\n- Implement WebAuthn two-factor authentication\n- Implement badge mode (up/down vs up/late/down) selector (#282)\n- Add Ping.exitstatus field, store client's reported exit status values (#455)\n- Implement header-based authentication (#457)\n- Add a \"Lost password?\" link with instructions in the Sign In page",
"### Bug Fixes\n- Fix db field overflow when copying a check with a long name",
"## v1.17.0 - 2020-10-14",
"### Improvements\n- Django 3.1\n- Handle status callbacks from Twilio, show delivery failures in Integrations\n- Removing unused /api/v1/notifications/{uuid}/bounce endpoint\n- Less verbose output in the `senddeletionnotices` command\n- Host a read-only dashboard (from github.com/healthchecks/dashboard/)\n- LINE Notify integration (#412)\n- Read-only team members\n- API support for setting the allowed HTTP methods for making ping requests",
"### Bug Fixes\n- Handle excessively long email addresses in the signup form\n- Handle excessively long email addresses in the team member invite form\n- Don't allow duplicate team memberships\n- When copying a check, copy all fields from the \"Filtering Rules\" dialog (#417)\n- Fix missing Resume button (#421)\n- When decoding inbound emails, decode encoded headers (#420)\n- Escape markdown in MS Teams notifications (#426)\n- Set the \"title\" and \"summary\" fields in MS Teams notifications (#435)",
"## v1.16.0 - 2020-08-04",
"### Improvements\n- Paused ping handling can be controlled via API (#376)\n- Add \"Get a list of checks's logged pings\" API call (#371)\n- The /api/v1/checks/ endpoint now accepts either UUID or `unique_key` (#370)\n- Added /api/v1/checks/uuid/flips/ endpoint (#349)\n- In the cron expression dialog, show a human-friendly version of the expression\n- Indicate a started check with a progress spinner under status icon (#338)\n- Added \"Docs > Reliability Tips\" page\n- Spike.sh integration (#402)\n- Updated Discord integration to use discord.com instead of discordapp.com\n- Add \"Failure Keyword\" filtering for inbound emails (#396)\n- Add support for multiple, comma-separated keywords (#396)\n- New integration: phone calls (#403)",
"### Bug Fixes\n- Removing Pager Team integration, project appears to be discontinued\n- Sending a test notification updates Channel.last_error (#391)\n- Handle HTTP 429 responses from Matrix server when joining a Matrix room",
"## v1.15.0 - 2020-06-04",
"### Improvements\n- Rate limiting for Telegram notifications (10 notifications per chat per minute)\n- Use Slack V2 OAuth flow\n- Users can edit their existing webhook integrations (#176)\n- Add a \"Transfer Ownership\" feature in Project Settings\n- In checks list, the pause button asks for confirmation (#356)\n- Added /api/v1/metrics/ endpoint, useful for monitoring the service itself\n- Added \"When paused, ignore pings\" option in the Filtering Rules dialog (#369)",
"### Bug Fixes\n- \"Get a single check\" API call now supports read-only API keys (#346)\n- Don't escape HTML in the subject line of notification emails\n- Don't let users clone checks if the account is at check limit",
"## v1.14.0 - 2020-03-23",
"### Improvements\n- Improved UI to invite users from account's other projects (#258)\n- Experimental Prometheus metrics endpoint (#300)\n- Don't store user's current project in DB, put it explicitly in page URLs (#336)\n- API reference in Markdown\n- Use Selectize.js for entering tags (#324)\n- Zulip integration (#202)\n- OpsGenie integration returns more detailed error messages\n- Telegram integration returns more detailed error messages\n- Added the \"Get a single check\" API call (#337)\n- Display project name in Slack notifications (#342)",
"### Bug Fixes\n- The \"render_docs\" command checks if markdown and pygments is installed (#329)\n- The team size limit is applied to the n. of distinct users across all projects (#332)\n- API: don't let SuspiciousOperation bubble up when validating channel ids\n- API security: check channel ownership when setting check's channels\n- API: update check's \"alert_after\" field when changing schedule\n- API: validate channel identifiers before creating/updating a check (#335)\n- Fix redirect after login when adding Telegram integration",
"## v1.13.0 - 2020-02-13",
"### Improvements\n- Show a red \"!\" in project's top navigation if any integration is not working\n- createsuperuser management command requires an unique email address (#318)\n- For superusers, show \"Site Administration\" in top navigation, note in README (#317)\n- Make Ping.body size limit configurable (#301)\n- Show sub-second durations with higher precision, 2 digits after decimal point (#321)\n- Replace the gear icon with three horizontal dots icon (#322)\n- Add a Pause button in the checks list (#312)\n- Documentation in Markdown\n- Added an example of capturing and submitting log output (#315)\n- The sendalerts commands measures dwell time and reports it over statsd protocol\n- Django 3.0.3\n- Show a warning in top navigation if the project has no integrations (#327)",
"### Bug Fixes\n- Increase the allowable length of Matrix room alias to 100 (#320)\n- Make sure Check.last_ping and Ping.created timestamps match exactly\n- Don't trigger \"down\" notifications when changing schedule interactively in web UI\n- Fix sendalerts crash loop when encountering a bad cron schedule\n- Stricter cron validation, reject schedules like \"At midnight of February 31\"\n- In hc.front.views.ping_details, if a ping does not exist, return a friendly message",
"## v1.12.0 - 2020-01-02",
"### Improvements\n- Django 3.0\n- \"Filtering Rules\" dialog, an option to require HTTP POST (#297)\n- Show Healthchecks version in Django admin header (#306)\n- Added JSON endpoint for Shields.io (#304)\n- `senddeletionnotices` command skips profiles with recent last_active_date\n- The \"Update Check\" API call can update check's description (#311)",
"### Bug Fixes\n- Don't set CSRF cookie on first visit. Signup is exempt from CSRF protection\n- Fix List-Unsubscribe email header value: add angle brackets\n- Unsubscribe links serve a form, and require HTTP POST to actually unsubscribe\n- For webhook integration, validate each header line separately\n- Fix \"Send Test Notification\" for webhooks that only fire on checks going up\n- Don't allow adding webhook integrations with both URLs blank\n- Don't allow adding email integrations with both \"up\" and \"down\" unchecked",
"\n## v1.11.0 - 2019-11-22",
"### Improvements\n- In monthly reports, no downtime stats for the current month (month has just started)\n- Add Microsoft Teams integration (#135)\n- Add Profile.last_active_date field for more accurate inactive user detection\n- Add \"Shell Commands\" integration (#302)\n- PagerDuty integration works with or without PD_VENDOR_KEY (#303)",
"### Bug Fixes\n - On mobile, \"My Checks\" page, always show the gear (Details) button (#286)\n - Make log events fit better on mobile screens",
"\n## v1.10.0 - 2019-10-21",
"### Improvements\n- Add the \"Last Duration\" field in the \"My Checks\" page (#257)\n- Add \"last_duration\" attribute to the Check API resource (#257)\n- Upgrade to psycopg2 2.8.3\n- Add Go usage example\n- Send monthly reports on 1st of every month, not randomly during the month\n- Signup form sets the \"auto-login\" cookie to avoid an extra click during first login\n- Autofocus the email field in the signup form, and submit on enter key\n- Add support for OpsGenie EU region (#294)\n- Update OpsGenie logo and setup illustrations\n- Add a \"Create a Copy\" function for cloning checks (#288)\n- Send email notification when monthly SMS sending limit is reached (#292)",
"### Bug Fixes\n- Prevent double-clicking the submit button in signup form\n- Upgrade to Django 2.2.6 – fixes sqlite migrations (#284)",
"\n## v1.9.0 - 2019-09-03",
"### Improvements\n- Show the number of downtimes and total downtime minutes in monthly reports (#104)\n- Show the number of downtimes and total downtime minutes in \"Check Details\" page\n- Add the `pruneflips` management command\n- Add Mattermost integration (#276)\n- Three choices in timezone switcher (UTC / check's timezone / browser's timezone) (#278)\n- After adding a new check redirect to the \"Check Details\" page",
"### Bug Fixes\n- Fix javascript code to construct correct URLs when running from a subdirectory (#273)\n- Don't show the \"Sign Up\" link in the login page if registration is closed (#280)",
"## v1.8.0 - 2019-07-08",
"### Improvements\n- Add the `prunetokenbucket` management command\n- Show check counts in JSON \"badges\" (#251)\n- Webhooks support HTTP PUT (#249)\n- Webhooks can use different req. bodies and headers for \"up\" and \"down\" events (#249)\n- Show check's code instead of full URL on 992px - 1200px wide screens (#253)\n- Add WhatsApp integration (uses Twilio same as the SMS integration)\n- Webhooks support the $TAGS placeholder\n- Don't include ping URLs in API responses when the read-only key is used",
"### Bug Fixes\n- Fix badges for tags containing special characters (#240, #237)\n- Fix the \"Integrations\" page for when the user has no active project\n- Prevent email clients from opening the one-time login links (#255)\n- Fix `prunepings` and `prunepingsslow`, they got broken when adding Projects (#264)",
"\n## v1.7.0 - 2019-05-02",
"### Improvements\n- Add the EMAIL_USE_VERIFICATION configuration setting (#232)\n- Show \"Badges\" and \"Settings\" in top navigation (#234)\n- Upgrade to Django 2.2\n- Can configure the email integration to only report the \"down\" events (#231)\n- Add \"Test!\" function in the Integrations page (#207)\n- Rate limiting for the log in attempts\n- Password strength meter and length check in the \"Set Password\" form\n- Show the Description section even if the description is missing. (#246)\n- Include the description in email alerts. (#247)",
"\n## v1.6.0 - 2019-04-01",
"### Improvements\n- Add the \"desc\" field (check's description) to API responses\n- Add maxlength attribute to HTML input=text elements\n- Improved logic for displaying job execution times in log (#219)\n- Add Matrix integration\n- Add Pager Team integration\n- Add a management command for sending inactive account notifications",
"### Bug Fixes\n- Fix refreshing of the checks page filtered by tags (#221)\n- Escape asterisks in Slack messages (#223)\n- Fix a \"invalid time format\" in front.views.status_single on Windows hosts",
"\n## v1.5.0 - 2019-02-04",
"### Improvements\n- Database schema: add uniqueness constraint to Check.code\n- Database schema: add Ping.kind field. Remove \"start\" and \"fail\" fields\n- Add \"Email Settings...\" dialog and \"Subject Must Contain\" setting\n- Database schema: add the Project model\n- Move project-specific settings to a new \"Project Settings\" page\n- Add a \"Transfer to Another Project...\" dialog\n- Add the \"My Projects\" page",
"\n## v1.4.0 - 2018-12-25",
"### Improvements\n- Set Pushover alert priorities for \"down\" and \"up\" events separately\n- Additional python usage examples\n- Allow simultaneous access to checks from different teams\n- Add CORS support to API endpoints\n- Flip model, for tracking status changes of the Check objects\n- Add `/ping/<code>/start` API endpoint\n- When using the `/start` endpoint, show elapsed times in ping log",
"### Bug Fixes\n- Fix after-login redirects (the \"?next=\" query parameter)\n- Update Check.status field when user edits timeout & grace settings\n- Use timezone-aware datetimes with croniter, avoid ambiguities around DST\n- Validate and reject cron schedules with six components",
"\n## v1.3.0 - 2018-11-21",
"### Improvements\n- Load settings from environment variables\n- Add \"List-Unsubscribe\" header to alert and report emails\n- Don't send monthly reports to inactive accounts (no pings in 6 months)\n- Add search box in the \"My Checks\" page\n- Add read-only API key support\n- Remove Profile.bill_to field (obsolete)\n- Show a warning when running with DEBUG=True\n- Add \"channels\" attribute to the Check API resource\n- Can specify channel codes when updating a check via API\n- Add a workaround for email agents automatically opening \"Unsubscribe\" links\n- Add Channel.name field, users can now name integrations\n- Add \"Get a List of Existing Integrations\" API call",
"### Bug Fixes\n- During DST transition, handle ambiguous dates as pre-transition",
"\n## v1.2.0 - 2018-10-20",
"### Improvements\n- Content updates in the \"Welcome\" page.\n- Added \"Docs > Third-Party Resources\" page.\n- Improved layout and styling in \"Login\" page.\n- Separate \"Sign Up\" and \"Log In\" forms.\n- \"My Checks\" page: support filtering checks by query string parameters.\n- Added Trello integration",
"### Bug Fixes\n- Timezones were missing in the \"Change Schedule\" dialog, fixed.\n- Fix hamburger menu button in \"Login\" page.",
"\n## v1.1.0 - 2018-08-20",
"### Improvements\n- A new \"Check Details\" page.\n- Updated django-compressor, psycopg2, pytz, requests package versions.\n- C# usage example.\n- Checks have a \"Description\" field."
] |
[
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"# Changelog\nAll notable changes to this project will be documented in this file.",
"## v2.6-dev - Unreleased",
"### Improvements\n- Improve layout in \"My Checks\" for checks with long ping URLs (#745)\n- Add support for communicating with signal-cli over TCP (#732)\n- Add /api/v2/ (changes the status reporting of checks in started state) (#633)\n- Update settings.py to read the ADMINS setting from an environment variable\n- Add \"Start Keyword\" filtering for inbound emails (#716)",
"### Bug Fixes\n- Fix the Signal integration to handle unexpected RPC messages better (#763)\n- Fix special character encoding in Signal notifications (#767)\n- Fix project sort order to be case-insensitive everywhere in the UI (#768)\n- Fix special character encoding in project invite emails\n- Fix check transfer between same account's projects when at check limit\n- Fix wording in the invite email when inviting read-only users",
"- Fix login and signup views to make email enumeration harder",
"\n## v2.5 - 2022-12-14",
"### Improvements\n- Upgrade to fido2 1.1.0 and simplify hc.lib.webauthn\n- Add handling for ipv4address:port values in the X-Forwarded-For header (#714)\n- Add a form for submitting Signal CAPTCHA solutions\n- Add Duration field in the Ping Details dialog (#720)\n- Update Mattermost setup instructions\n- Add support for specifying a run ID via a \"rid\" query parameter (#722)\n- Add last ping body in Slack notifications (#735)\n- Add ntfy integration (#728)\n- Add \".txt\" suffix to the filename when downloading ping body (#738)\n- Add API support for fetching ping bodies (#737)\n- Change \"Settings - Email Reports\" page to allow manual timezone selection",
"### Bug Fixes\n- Fix the most recent ping lookup in the \"Ping Details\" dialog\n- Fix binary data handling in the hc.front.views.ping_body view\n- Fix downtime summaries in weekly reports (#736)\n- Fix week, month boundary calculation to use user's timezone",
"## v2.4.1 - 2022-10-18",
"### Bug Fixes\n- Fix the GHA workflow for building arm/v7 docker image",
"## v2.4 - 2022-10-18",
"### Improvements\n- Add support for EMAIL_USE_SSL environment variable (#685)\n- Switch from requests to pycurl\n- Implement documentation search\n- Add date filters in the Log page\n- Upgrade to cronsim 2.3\n- Add support for the $BODY placeholder in webhook payloads (#708)\n- Implement the \"Clear Events\" function\n- Add support for custom topics in Zulip notifications (#583)",
"### Bug Fixes\n- Fix the handling of TooManyRedirects exceptions\n- Fix MySQL 8 support in the Docker image (upgrade from buster to bullseye) (#717)",
"## v2.3 - 2022-08-05",
"### Improvements\n- Update Dockerfile to start SMTP listener (#668)\n- Implement the \"Add Check\" dialog\n- Include last ping type in Slack, Mattermost, Discord notifications\n- Upgrade to cron-descriptor 1.2.30\n- Add \"Filter by keywords in the message body\" feature (#653)\n- Upgrade to HiDPI screenshots in the documentation\n- Add support for the $JSON placeholder in webhook payloads\n- Add ping endpoints for \"log\" events\n- Add the \"Badges\" page in docs\n- Add support for multiple recipients in incoming email (#669)\n- Upgrade to fido2 1.0.0, requests 2.28.1, segno 1.5.2\n- Implement auto-refresh and running indicator in the My Projects page (#681)\n- Upgrade to Django 4.1 and django-compressor 4.1\n- Add API support for resuming paused checks (#687)",
"### Bug Fixes\n- Fix the display of ignored pings with non-zero exit status\n- Fix a race condition in the \"Change Email\" flow\n- Fix grouping and sorting in the text version of the report/nag emails (#679)\n- Fix the update_timeout and pause views to create flips (for downtime bookkeeping)\n- Fix the checks list to preserve selected filters when adding/updating checks (#684)\n- Fix duration calculation to skip \"log\" and \"ign\" events",
"## v2.2.1 - 2022-06-13",
"### Improvements\n- Improve the text version of the alert email template",
"### Bug Fixes\n- Fix the version number displayed in the footer",
"## v2.2 - 2022-06-13",
"### Improvements\n- Add address verification step in the \"Change Email\" flow\n- Reduce logging output from sendalerts and sendreports management commands (#656)\n- Add Ctrl+C handler in sendalerts and sendreports management commands\n- Add notes in docs about configuring uWSGI via UWSGI_ env vars (#656)\n- Implement login link expiration (login links will now expire in 1 hour)\n- Add Gotify integration (#270)\n- Add API support for reading/writing the subject and subject_fail fields (#659)\n- Add \"Disabled\" priority for Pushover notifications (#663)",
"### Bug Fixes\n- Update hc.front.views.channels to handle empty strings in settings (#635)\n- Add logic to handle ContentDecodingError exceptions",
"## v2.1 - 2022-05-10",
"### Improvements\n- Add logic to alert ADMINS when Signal transport hits a CAPTCHA challenge\n- Implement the \"started\" progress spinner in the details pages\n- Add \"hc_check_started\" metric in the Prometheus metrics endpoint (#630)\n- Add a management command for submitting Signal rate limit challenges\n- Upgrade to django-compressor 4.0\n- Update the C# snippet\n- Increase max displayed duration from 24h to 72h (#644)\n- Add \"Ping-Body-Limit\" response header in ping API responses",
"### Bug Fixes\n- Fix unwanted localization in badge SVG generation (#629)\n- Update email template to handle not yet uploaded ping bodies\n- Add small delay in transports.Email.notify to allow ping body to upload\n- Fix prunenotifications to handle checks with missing pings (#636)\n- Fix \"Send Test Notification\" for integrations that only send \"up\" notifications",
"## v2.0.1 - 2022-03-18",
"### Bug Fixes\n- Fix the GHA workflow for building arm/v7 docker image",
"## v2.0 - 2022-03-18",
"This release contains a backwards-incompatible change to the Signal integration\n(hence the major version number bump). Healthchecks uses signal-cli to deliver\nSignal notifications. In the past versions, Healthchecks interfaced with\nsignal-cli over DBus. Starting from this version, Healthchecks interfaces\nwith signal-cli using JSON RPC. Please see README for details on how to set\nthis up.",
"### Improvements\n- Update Telegram integration to treat \"group chat was deleted\" as permanent error\n- Update email bounce handler to mark email channels as disabled (#446)\n- Update Signal integration to use JSON RPC over UNIX socket\n- Update the \"Add TOTP\" form to display plaintext TOTP secret (#602)\n- Improve PagerDuty notifications\n- Add Ping.body_raw field for storing body as bytes\n- Add support for storing ping bodies in S3-compatible object storage (#609)\n- Add a \"Download Original\" link in the \"Ping Details\" dialog",
"### Bug Fixes\n- Fix unwanted special character escaping in notification messages (#606)\n- Fix JS error after copying a code snippet\n- Make email non-editable in the \"Invite Member\" dialog when team limit reached\n- Fix Telegram bot to handle TransportError exceptions\n- Fix Signal integration to handle UNREGISTERED_FAILURE errors\n- Fix unwanted localization of period and grace values in data- attributes (#617)\n- Fix Mattermost integration to treat 404 as a transient error (#613)",
"## v1.25.0 - 2022-01-07",
"### Improvements\n- Implement Pushover emergency alert cancellation when check goes up\n- Add \"The following checks are also down\" section in Telegram notifications\n- Add \"The following checks are also down\" section in Signal notifications\n- Upgrade to django-compressor 3.0\n- Add support for Telegram channels (#592)\n- Implement Telegram group to supergroup migration (#132)\n- Update the Slack integration to not retry when Slack returns 404\n- Refactor transport classes to raise exceptions on delivery problems\n- Add Channel.disabled field, for disabling integrations on permanent errors\n- Upgrade to Django 4\n- Bump the min. Python version from 3.6 to 3.8 (as required by Django 4)",
"### Bug Fixes\n- Fix report templates to not show the \"started\" status (show UP or DOWN instead)\n- Update Dockerfile to avoid running \"pip wheel\" more than once (#594)",
"## v1.24.1 - 2021-11-10",
"### Bug Fixes\n- Fix Dockerfile for arm/v7 - install all dependencies from piwheels",
"## v1.24.0 - 2021-11-10",
"### Improvements\n- Switch from croniter to cronsim\n- Change outgoing webhook timeout to 10s, but cap the total time to 20s\n- Implement automatic `api_ping` and `api_notification` pruning (#556)\n- Update Dockerfile to install apprise (#581)\n- Improve period and grace controls, allow up to 365 day periods (#281)\n- Add SIGTERM handling in sendalerts and sendreports\n- Remove the \"welcome\" landing page, direct users to the sign in form instead",
"### Bug Fixes\n- Fix hc.api.views.ping to handle non-utf8 data in request body (#574)\n- Fix a crash when hc.api.views.pause receives a single integer in request body",
"## v1.23.1 - 2021-10-13",
"### Bug Fixes\n- Fix missing uwsgi dependencies in arm/v7 Docker image",
"## v1.23.0 - 2021-10-13",
"### Improvements\n- Add /api/v1/badges/ endpoint (#552)\n- Add ability to edit existing email, Signal, SMS, WhatsApp integrations\n- Add new ping URL format: /{ping_key}/{slug} (#491)\n- Reduce Docker image size by using slim base image and multi-stage Dockerfile\n- Upgrade to Bootstrap 3.4.1\n- Upgrade to jQuery 3.6.0",
"### Bug Fixes\n- Add handling for non-latin-1 characters in webhook headers\n- Fix dark mode bug in selectpicker widgets\n- Fix a crash during login when user's profile does not exist (#77)\n- Drop API support for GET, DELETE requests with a request body\n- Add missing @csrf_exempt annotations in API views\n- Fix the ping handler to reject status codes > 255\n- Add 'schemaVersion' field in the shields.io endpoint (#566)",
"## v1.22.0 - 2021-08-06",
"### Improvements\n- Use multicolor channel icons for better appearance in the dark mode\n- Add SITE_LOGO_URL setting (#323)\n- Add admin action to log in as any user\n- Add a \"Manager\" role (#484)\n- Add support for 2FA using TOTP (#354)\n- Add Whitenoise (#548)",
"### Bug Fixes\n- Fix dark mode styling issues in Cron Syntax Cheatsheet\n- Fix a 403 when transferring a project to a read-only team member\n- Security: fix allow_redirect function to reject absolute URLs",
"## v1.21.0 - 2021-07-02",
"### Improvements\n- Increase \"Success / Failure Keywords\" field lengths to 200\n- Django 3.2.4\n- Improve the handling of unknown email addresses in the Sign In form\n- Add support for \"... is UP\" SMS notifications\n- Add an option for weekly reports (in addition to monthly)\n- Implement PagerDuty Simple Install Flow, remove PD Connect\n- Implement dark mode",
"### Bug Fixes\n- Fix off-by-one-month error in monthly reports, downtime columns (#539)",
"## v1.20.0 - 2021-04-22",
"### Improvements\n- Django 3.2\n- Rename VictorOps -> Splunk On-Call\n- Implement email body decoding in the \"Ping Details\" dialog\n- Add a \"Subject\" field in the \"Ping Details\" dialog\n- Improve HTML email display in the \"Ping Details\" dialog\n- Add a link to check's details page in Slack notifications\n- Replace details_url with cloaked_url in email and chat notifications\n- In the \"My Projects\" page, show projects with failing checks first",
"### Bug Fixes\n- Fix downtime summary to handle months when the check didn't exist yet (#472)\n- Relax cron expression validation: accept all expressions that croniter accepts\n- Fix sendalerts to clear Profile.next_nag_date if all checks up\n- Fix the pause action to clear Profile.next_nag_date if all checks up\n- Fix the \"Email Reports\" screen to clear Profile.next_nag_date if all checks up\n- Fix the month boundary calculation in monthly reports (#497)",
"## v1.19.0 - 2021-02-03",
"### Improvements\n- Add tighter parameter checks in hc.front.views.serve_doc\n- Update OpsGenie instructions (#450)\n- Update the email notification template to include more check and last ping details\n- Improve the crontab snippet in the \"Check Details\" page (#465)\n- Add Signal integration (#428)\n- Change Zulip onboarding, ask for the zuliprc file (#202)\n- Add a section in Docs about running self-hosted instances\n- Add experimental Dockerfile and docker-compose.yml\n- Add rate limiting for Pushover notifications (6 notifications / user / minute)\n- Add support for disabling specific integration types (#471)",
"### Bug Fixes\n- Fix unwanted HTML escaping in SMS and WhatsApp notifications\n- Fix a crash when adding an integration for an empty Trello account\n- Change icon CSS class prefix to 'ic-' to work around Fanboy's filter list",
"## v1.18.0 - 2020-12-09",
"### Improvements\n- Add a tooltip to the 'confirmation link' label (#436)\n- Update API to allow specifying channels by names (#440)\n- When saving a phone number, remove any invisible unicode characers\n- Update the read-only dashboard's CSS for better mobile support (#442)\n- Reduce the number of SQL queries used in the \"Get Checks\" API call\n- Add support for script's exit status in ping URLs (#429)\n- Improve phone number sanitization: remove spaces and hyphens\n- Change the \"Test Integration\" behavior for webhooks: don't retry failed requests\n- Add retries to the the email sending logic\n- Require confirmation codes (sent to email) before sensitive actions\n- Implement WebAuthn two-factor authentication\n- Implement badge mode (up/down vs up/late/down) selector (#282)\n- Add Ping.exitstatus field, store client's reported exit status values (#455)\n- Implement header-based authentication (#457)\n- Add a \"Lost password?\" link with instructions in the Sign In page",
"### Bug Fixes\n- Fix db field overflow when copying a check with a long name",
"## v1.17.0 - 2020-10-14",
"### Improvements\n- Django 3.1\n- Handle status callbacks from Twilio, show delivery failures in Integrations\n- Removing unused /api/v1/notifications/{uuid}/bounce endpoint\n- Less verbose output in the `senddeletionnotices` command\n- Host a read-only dashboard (from github.com/healthchecks/dashboard/)\n- LINE Notify integration (#412)\n- Read-only team members\n- API support for setting the allowed HTTP methods for making ping requests",
"### Bug Fixes\n- Handle excessively long email addresses in the signup form\n- Handle excessively long email addresses in the team member invite form\n- Don't allow duplicate team memberships\n- When copying a check, copy all fields from the \"Filtering Rules\" dialog (#417)\n- Fix missing Resume button (#421)\n- When decoding inbound emails, decode encoded headers (#420)\n- Escape markdown in MS Teams notifications (#426)\n- Set the \"title\" and \"summary\" fields in MS Teams notifications (#435)",
"## v1.16.0 - 2020-08-04",
"### Improvements\n- Paused ping handling can be controlled via API (#376)\n- Add \"Get a list of checks's logged pings\" API call (#371)\n- The /api/v1/checks/ endpoint now accepts either UUID or `unique_key` (#370)\n- Added /api/v1/checks/uuid/flips/ endpoint (#349)\n- In the cron expression dialog, show a human-friendly version of the expression\n- Indicate a started check with a progress spinner under status icon (#338)\n- Added \"Docs > Reliability Tips\" page\n- Spike.sh integration (#402)\n- Updated Discord integration to use discord.com instead of discordapp.com\n- Add \"Failure Keyword\" filtering for inbound emails (#396)\n- Add support for multiple, comma-separated keywords (#396)\n- New integration: phone calls (#403)",
"### Bug Fixes\n- Removing Pager Team integration, project appears to be discontinued\n- Sending a test notification updates Channel.last_error (#391)\n- Handle HTTP 429 responses from Matrix server when joining a Matrix room",
"## v1.15.0 - 2020-06-04",
"### Improvements\n- Rate limiting for Telegram notifications (10 notifications per chat per minute)\n- Use Slack V2 OAuth flow\n- Users can edit their existing webhook integrations (#176)\n- Add a \"Transfer Ownership\" feature in Project Settings\n- In checks list, the pause button asks for confirmation (#356)\n- Added /api/v1/metrics/ endpoint, useful for monitoring the service itself\n- Added \"When paused, ignore pings\" option in the Filtering Rules dialog (#369)",
"### Bug Fixes\n- \"Get a single check\" API call now supports read-only API keys (#346)\n- Don't escape HTML in the subject line of notification emails\n- Don't let users clone checks if the account is at check limit",
"## v1.14.0 - 2020-03-23",
"### Improvements\n- Improved UI to invite users from account's other projects (#258)\n- Experimental Prometheus metrics endpoint (#300)\n- Don't store user's current project in DB, put it explicitly in page URLs (#336)\n- API reference in Markdown\n- Use Selectize.js for entering tags (#324)\n- Zulip integration (#202)\n- OpsGenie integration returns more detailed error messages\n- Telegram integration returns more detailed error messages\n- Added the \"Get a single check\" API call (#337)\n- Display project name in Slack notifications (#342)",
"### Bug Fixes\n- The \"render_docs\" command checks if markdown and pygments is installed (#329)\n- The team size limit is applied to the n. of distinct users across all projects (#332)\n- API: don't let SuspiciousOperation bubble up when validating channel ids\n- API security: check channel ownership when setting check's channels\n- API: update check's \"alert_after\" field when changing schedule\n- API: validate channel identifiers before creating/updating a check (#335)\n- Fix redirect after login when adding Telegram integration",
"## v1.13.0 - 2020-02-13",
"### Improvements\n- Show a red \"!\" in project's top navigation if any integration is not working\n- createsuperuser management command requires an unique email address (#318)\n- For superusers, show \"Site Administration\" in top navigation, note in README (#317)\n- Make Ping.body size limit configurable (#301)\n- Show sub-second durations with higher precision, 2 digits after decimal point (#321)\n- Replace the gear icon with three horizontal dots icon (#322)\n- Add a Pause button in the checks list (#312)\n- Documentation in Markdown\n- Added an example of capturing and submitting log output (#315)\n- The sendalerts commands measures dwell time and reports it over statsd protocol\n- Django 3.0.3\n- Show a warning in top navigation if the project has no integrations (#327)",
"### Bug Fixes\n- Increase the allowable length of Matrix room alias to 100 (#320)\n- Make sure Check.last_ping and Ping.created timestamps match exactly\n- Don't trigger \"down\" notifications when changing schedule interactively in web UI\n- Fix sendalerts crash loop when encountering a bad cron schedule\n- Stricter cron validation, reject schedules like \"At midnight of February 31\"\n- In hc.front.views.ping_details, if a ping does not exist, return a friendly message",
"## v1.12.0 - 2020-01-02",
"### Improvements\n- Django 3.0\n- \"Filtering Rules\" dialog, an option to require HTTP POST (#297)\n- Show Healthchecks version in Django admin header (#306)\n- Added JSON endpoint for Shields.io (#304)\n- `senddeletionnotices` command skips profiles with recent last_active_date\n- The \"Update Check\" API call can update check's description (#311)",
"### Bug Fixes\n- Don't set CSRF cookie on first visit. Signup is exempt from CSRF protection\n- Fix List-Unsubscribe email header value: add angle brackets\n- Unsubscribe links serve a form, and require HTTP POST to actually unsubscribe\n- For webhook integration, validate each header line separately\n- Fix \"Send Test Notification\" for webhooks that only fire on checks going up\n- Don't allow adding webhook integrations with both URLs blank\n- Don't allow adding email integrations with both \"up\" and \"down\" unchecked",
"\n## v1.11.0 - 2019-11-22",
"### Improvements\n- In monthly reports, no downtime stats for the current month (month has just started)\n- Add Microsoft Teams integration (#135)\n- Add Profile.last_active_date field for more accurate inactive user detection\n- Add \"Shell Commands\" integration (#302)\n- PagerDuty integration works with or without PD_VENDOR_KEY (#303)",
"### Bug Fixes\n - On mobile, \"My Checks\" page, always show the gear (Details) button (#286)\n - Make log events fit better on mobile screens",
"\n## v1.10.0 - 2019-10-21",
"### Improvements\n- Add the \"Last Duration\" field in the \"My Checks\" page (#257)\n- Add \"last_duration\" attribute to the Check API resource (#257)\n- Upgrade to psycopg2 2.8.3\n- Add Go usage example\n- Send monthly reports on 1st of every month, not randomly during the month\n- Signup form sets the \"auto-login\" cookie to avoid an extra click during first login\n- Autofocus the email field in the signup form, and submit on enter key\n- Add support for OpsGenie EU region (#294)\n- Update OpsGenie logo and setup illustrations\n- Add a \"Create a Copy\" function for cloning checks (#288)\n- Send email notification when monthly SMS sending limit is reached (#292)",
"### Bug Fixes\n- Prevent double-clicking the submit button in signup form\n- Upgrade to Django 2.2.6 – fixes sqlite migrations (#284)",
"\n## v1.9.0 - 2019-09-03",
"### Improvements\n- Show the number of downtimes and total downtime minutes in monthly reports (#104)\n- Show the number of downtimes and total downtime minutes in \"Check Details\" page\n- Add the `pruneflips` management command\n- Add Mattermost integration (#276)\n- Three choices in timezone switcher (UTC / check's timezone / browser's timezone) (#278)\n- After adding a new check redirect to the \"Check Details\" page",
"### Bug Fixes\n- Fix javascript code to construct correct URLs when running from a subdirectory (#273)\n- Don't show the \"Sign Up\" link in the login page if registration is closed (#280)",
"## v1.8.0 - 2019-07-08",
"### Improvements\n- Add the `prunetokenbucket` management command\n- Show check counts in JSON \"badges\" (#251)\n- Webhooks support HTTP PUT (#249)\n- Webhooks can use different req. bodies and headers for \"up\" and \"down\" events (#249)\n- Show check's code instead of full URL on 992px - 1200px wide screens (#253)\n- Add WhatsApp integration (uses Twilio same as the SMS integration)\n- Webhooks support the $TAGS placeholder\n- Don't include ping URLs in API responses when the read-only key is used",
"### Bug Fixes\n- Fix badges for tags containing special characters (#240, #237)\n- Fix the \"Integrations\" page for when the user has no active project\n- Prevent email clients from opening the one-time login links (#255)\n- Fix `prunepings` and `prunepingsslow`, they got broken when adding Projects (#264)",
"\n## v1.7.0 - 2019-05-02",
"### Improvements\n- Add the EMAIL_USE_VERIFICATION configuration setting (#232)\n- Show \"Badges\" and \"Settings\" in top navigation (#234)\n- Upgrade to Django 2.2\n- Can configure the email integration to only report the \"down\" events (#231)\n- Add \"Test!\" function in the Integrations page (#207)\n- Rate limiting for the log in attempts\n- Password strength meter and length check in the \"Set Password\" form\n- Show the Description section even if the description is missing. (#246)\n- Include the description in email alerts. (#247)",
"\n## v1.6.0 - 2019-04-01",
"### Improvements\n- Add the \"desc\" field (check's description) to API responses\n- Add maxlength attribute to HTML input=text elements\n- Improved logic for displaying job execution times in log (#219)\n- Add Matrix integration\n- Add Pager Team integration\n- Add a management command for sending inactive account notifications",
"### Bug Fixes\n- Fix refreshing of the checks page filtered by tags (#221)\n- Escape asterisks in Slack messages (#223)\n- Fix a \"invalid time format\" in front.views.status_single on Windows hosts",
"\n## v1.5.0 - 2019-02-04",
"### Improvements\n- Database schema: add uniqueness constraint to Check.code\n- Database schema: add Ping.kind field. Remove \"start\" and \"fail\" fields\n- Add \"Email Settings...\" dialog and \"Subject Must Contain\" setting\n- Database schema: add the Project model\n- Move project-specific settings to a new \"Project Settings\" page\n- Add a \"Transfer to Another Project...\" dialog\n- Add the \"My Projects\" page",
"\n## v1.4.0 - 2018-12-25",
"### Improvements\n- Set Pushover alert priorities for \"down\" and \"up\" events separately\n- Additional python usage examples\n- Allow simultaneous access to checks from different teams\n- Add CORS support to API endpoints\n- Flip model, for tracking status changes of the Check objects\n- Add `/ping/<code>/start` API endpoint\n- When using the `/start` endpoint, show elapsed times in ping log",
"### Bug Fixes\n- Fix after-login redirects (the \"?next=\" query parameter)\n- Update Check.status field when user edits timeout & grace settings\n- Use timezone-aware datetimes with croniter, avoid ambiguities around DST\n- Validate and reject cron schedules with six components",
"\n## v1.3.0 - 2018-11-21",
"### Improvements\n- Load settings from environment variables\n- Add \"List-Unsubscribe\" header to alert and report emails\n- Don't send monthly reports to inactive accounts (no pings in 6 months)\n- Add search box in the \"My Checks\" page\n- Add read-only API key support\n- Remove Profile.bill_to field (obsolete)\n- Show a warning when running with DEBUG=True\n- Add \"channels\" attribute to the Check API resource\n- Can specify channel codes when updating a check via API\n- Add a workaround for email agents automatically opening \"Unsubscribe\" links\n- Add Channel.name field, users can now name integrations\n- Add \"Get a List of Existing Integrations\" API call",
"### Bug Fixes\n- During DST transition, handle ambiguous dates as pre-transition",
"\n## v1.2.0 - 2018-10-20",
"### Improvements\n- Content updates in the \"Welcome\" page.\n- Added \"Docs > Third-Party Resources\" page.\n- Improved layout and styling in \"Login\" page.\n- Separate \"Sign Up\" and \"Log In\" forms.\n- \"My Checks\" page: support filtering checks by query string parameters.\n- Added Trello integration",
"### Bug Fixes\n- Timezones were missing in the \"Change Schedule\" dialog, fixed.\n- Fix hamburger menu button in \"Login\" page.",
"\n## v1.1.0 - 2018-08-20",
"### Improvements\n- A new \"Check Details\" page.\n- Updated django-compressor, psycopg2, pytz, requests package versions.\n- C# usage example.\n- Checks have a \"Description\" field."
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"from datetime import timedelta as td",
"from django import forms\nfrom django.contrib.auth import authenticate\nfrom django.contrib.auth.models import User",
"from hc.accounts.models import REPORT_CHOICES, Member\nfrom hc.api.models import TokenBucket\nfrom hc.lib.tz import all_timezones",
"\nclass LowercaseEmailField(forms.EmailField):\n def clean(self, value):\n value = super(LowercaseEmailField, self).clean(value)\n return value.lower()",
"\nclass SignupForm(forms.Form):\n # Call it \"identity\" instead of \"email\"\n # to avoid some of the dumber bots\n identity = LowercaseEmailField(\n error_messages={\"required\": \"Please enter your email address.\"}\n )\n tz = forms.CharField(required=False)",
" def clean_identity(self):\n v = self.cleaned_data[\"identity\"]\n if len(v) > 254:\n raise forms.ValidationError(\"Address is too long.\")\n",
" if User.objects.filter(email=v).exists():\n raise forms.ValidationError(\n \"An account with this email address already exists.\"\n )\n",
" return v",
" def clean_tz(self):\n # Declare tz as \"clean\" only if we can find it in hc.lib.tz.all_timezones\n if self.cleaned_data[\"tz\"] in all_timezones:\n return self.cleaned_data[\"tz\"]",
" # Otherwise, return None, and *don't* throw a validation exception:\n # If user's browser reports a timezone we don't recognize, we\n # should ignore the timezone but still save the rest of the form.",
"\nclass EmailLoginForm(forms.Form):\n # Call it \"identity\" instead of \"email\"\n # to avoid some of the dumber bots\n identity = LowercaseEmailField()",
" def clean_identity(self):\n v = self.cleaned_data[\"identity\"]\n if not TokenBucket.authorize_login_email(v):\n raise forms.ValidationError(\"Too many attempts, please try later.\")",
" try:\n self.user = User.objects.get(email=v)\n except User.DoesNotExist:",
" raise forms.ValidationError(\"Unknown email address.\")",
"\n return v",
"\nclass PasswordLoginForm(forms.Form):\n email = LowercaseEmailField()\n password = forms.CharField()",
" def clean(self):\n username = self.cleaned_data.get(\"email\")\n password = self.cleaned_data.get(\"password\")",
" if username and password:\n if not TokenBucket.authorize_login_password(username):\n raise forms.ValidationError(\"Too many attempts, please try later.\")",
" self.user = authenticate(username=username, password=password)\n if self.user is None or not self.user.is_active:\n raise forms.ValidationError(\"Incorrect email or password.\")",
" return self.cleaned_data",
"\nclass ReportSettingsForm(forms.Form):\n reports = forms.ChoiceField(choices=REPORT_CHOICES)\n nag_period = forms.IntegerField(min_value=0, max_value=86400)\n tz = forms.CharField()",
" def clean_nag_period(self):\n seconds = self.cleaned_data[\"nag_period\"]",
" if seconds not in (0, 3600, 86400):\n raise forms.ValidationError(\"Bad nag_period: %d\" % seconds)",
" return td(seconds=seconds)",
" def clean_tz(self):\n # Declare tz as \"clean\" only if we can find it in hc.lib.tz.all_timezones\n if self.cleaned_data[\"tz\"] in all_timezones:\n return self.cleaned_data[\"tz\"]",
" # Otherwise, return None, and *don't* throw a validation exception:\n # If user's browser reports a timezone we don't recognize, we\n # should ignore the timezone but still save the rest of the form.",
"\nclass SetPasswordForm(forms.Form):\n password = forms.CharField(min_length=8)",
"\nclass ChangeEmailForm(forms.Form):\n error_css_class = \"has-error\"\n email = LowercaseEmailField()",
" def clean_email(self):\n v = self.cleaned_data[\"email\"]\n if User.objects.filter(email=v).exists():\n raise forms.ValidationError(\"%s is already registered\" % v)",
" return v",
"\nclass InviteTeamMemberForm(forms.Form):\n email = LowercaseEmailField(max_length=254)\n role = forms.ChoiceField(choices=Member.Role.choices)",
"\nclass RemoveTeamMemberForm(forms.Form):\n email = LowercaseEmailField()",
"\nclass ProjectNameForm(forms.Form):\n name = forms.CharField(max_length=60)",
"\nclass TransferForm(forms.Form):\n email = LowercaseEmailField()",
"\nclass AddWebAuthnForm(forms.Form):\n name = forms.CharField(max_length=100)\n response = forms.CharField()",
"\nclass WebAuthnForm(forms.Form):\n response = forms.CharField()",
"\nclass TotpForm(forms.Form):\n error_css_class = \"has-error\"\n code = forms.RegexField(regex=r\"^\\d{6}$\")",
" def __init__(self, totp, post=None, files=None):\n self.totp = totp\n super(TotpForm, self).__init__(post, files)",
" def clean_code(self):\n if not self.totp.verify(self.cleaned_data[\"code\"], valid_window=1):\n raise forms.ValidationError(\"The code you entered was incorrect.\")",
" return self.cleaned_data[\"code\"]"
] |
[
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"from datetime import timedelta as td",
"from django import forms\nfrom django.contrib.auth import authenticate\nfrom django.contrib.auth.models import User",
"from hc.accounts.models import REPORT_CHOICES, Member\nfrom hc.api.models import TokenBucket\nfrom hc.lib.tz import all_timezones",
"\nclass LowercaseEmailField(forms.EmailField):\n def clean(self, value):\n value = super(LowercaseEmailField, self).clean(value)\n return value.lower()",
"\nclass SignupForm(forms.Form):\n # Call it \"identity\" instead of \"email\"\n # to avoid some of the dumber bots\n identity = LowercaseEmailField(\n error_messages={\"required\": \"Please enter your email address.\"}\n )\n tz = forms.CharField(required=False)",
" def clean_identity(self):\n v = self.cleaned_data[\"identity\"]\n if len(v) > 254:\n raise forms.ValidationError(\"Address is too long.\")\n",
"",
" return v",
" def clean_tz(self):\n # Declare tz as \"clean\" only if we can find it in hc.lib.tz.all_timezones\n if self.cleaned_data[\"tz\"] in all_timezones:\n return self.cleaned_data[\"tz\"]",
" # Otherwise, return None, and *don't* throw a validation exception:\n # If user's browser reports a timezone we don't recognize, we\n # should ignore the timezone but still save the rest of the form.",
"\nclass EmailLoginForm(forms.Form):\n # Call it \"identity\" instead of \"email\"\n # to avoid some of the dumber bots\n identity = LowercaseEmailField()",
" def clean_identity(self):\n v = self.cleaned_data[\"identity\"]\n if not TokenBucket.authorize_login_email(v):\n raise forms.ValidationError(\"Too many attempts, please try later.\")",
" try:\n self.user = User.objects.get(email=v)\n except User.DoesNotExist:",
" self.user = None",
"\n return v",
"\nclass PasswordLoginForm(forms.Form):\n email = LowercaseEmailField()\n password = forms.CharField()",
" def clean(self):\n username = self.cleaned_data.get(\"email\")\n password = self.cleaned_data.get(\"password\")",
" if username and password:\n if not TokenBucket.authorize_login_password(username):\n raise forms.ValidationError(\"Too many attempts, please try later.\")",
" self.user = authenticate(username=username, password=password)\n if self.user is None or not self.user.is_active:\n raise forms.ValidationError(\"Incorrect email or password.\")",
" return self.cleaned_data",
"\nclass ReportSettingsForm(forms.Form):\n reports = forms.ChoiceField(choices=REPORT_CHOICES)\n nag_period = forms.IntegerField(min_value=0, max_value=86400)\n tz = forms.CharField()",
" def clean_nag_period(self):\n seconds = self.cleaned_data[\"nag_period\"]",
" if seconds not in (0, 3600, 86400):\n raise forms.ValidationError(\"Bad nag_period: %d\" % seconds)",
" return td(seconds=seconds)",
" def clean_tz(self):\n # Declare tz as \"clean\" only if we can find it in hc.lib.tz.all_timezones\n if self.cleaned_data[\"tz\"] in all_timezones:\n return self.cleaned_data[\"tz\"]",
" # Otherwise, return None, and *don't* throw a validation exception:\n # If user's browser reports a timezone we don't recognize, we\n # should ignore the timezone but still save the rest of the form.",
"\nclass SetPasswordForm(forms.Form):\n password = forms.CharField(min_length=8)",
"\nclass ChangeEmailForm(forms.Form):\n error_css_class = \"has-error\"\n email = LowercaseEmailField()",
" def clean_email(self):\n v = self.cleaned_data[\"email\"]\n if User.objects.filter(email=v).exists():\n raise forms.ValidationError(\"%s is already registered\" % v)",
" return v",
"\nclass InviteTeamMemberForm(forms.Form):\n email = LowercaseEmailField(max_length=254)\n role = forms.ChoiceField(choices=Member.Role.choices)",
"\nclass RemoveTeamMemberForm(forms.Form):\n email = LowercaseEmailField()",
"\nclass ProjectNameForm(forms.Form):\n name = forms.CharField(max_length=60)",
"\nclass TransferForm(forms.Form):\n email = LowercaseEmailField()",
"\nclass AddWebAuthnForm(forms.Form):\n name = forms.CharField(max_length=100)\n response = forms.CharField()",
"\nclass WebAuthnForm(forms.Form):\n response = forms.CharField()",
"\nclass TotpForm(forms.Form):\n error_css_class = \"has-error\"\n code = forms.RegexField(regex=r\"^\\d{6}$\")",
" def __init__(self, totp, post=None, files=None):\n self.totp = totp\n super(TotpForm, self).__init__(post, files)",
" def clean_code(self):\n if not self.totp.verify(self.cleaned_data[\"code\"], valid_window=1):\n raise forms.ValidationError(\"The code you entered was incorrect.\")",
" return self.cleaned_data[\"code\"]"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"from django.conf import settings\nfrom django.core import mail\nfrom django.test.utils import override_settings",
"from hc.accounts.models import Credential\nfrom hc.api.models import Check, TokenBucket\nfrom hc.test import BaseTestCase",
"\nclass LoginTestCase(BaseTestCase):\n def setUp(self):\n super().setUp()\n self.checks_url = f\"/projects/{self.project.code}/checks/\"",
" def test_it_shows_form(self):\n r = self.client.get(\"/accounts/login/\")\n self.assertContains(r, \"Email Me a Link\")",
" def test_it_redirects_authenticated_get(self):\n self.client.login(username=\"alice@example.org\", password=\"password\")",
" r = self.client.get(\"/accounts/login/\")\n self.assertRedirects(r, self.checks_url)",
" @override_settings(SITE_ROOT=\"http://testserver\", SITE_LOGO_URL=None)\n def test_it_sends_link(self):\n form = {\"identity\": \"alice@example.org\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")",
" # And email should have been sent\n self.assertEqual(len(mail.outbox), 1)\n message = mail.outbox[0]\n self.assertEqual(message.subject, f\"Log in to {settings.SITE_NAME}\")\n html = message.alternatives[0][0]\n self.assertIn(\"http://testserver/static/img/logo.png\", html)\n self.assertIn(\"http://testserver/docs/\", html)",
" @override_settings(SITE_LOGO_URL=\"https://example.org/logo.svg\")\n def test_it_uses_custom_logo(self):\n self.client.post(\"/accounts/login/\", {\"identity\": \"alice@example.org\"})\n html = mail.outbox[0].alternatives[0][0]\n self.assertIn(\"https://example.org/logo.svg\", html)",
" def test_it_sends_link_with_next(self):\n form = {\"identity\": \"alice@example.org\"}",
" r = self.client.post(\"/accounts/login/?next=\" + self.channels_url, form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")\n self.assertIn(\"auto-login\", r.cookies)",
" # The check_token link should have a ?next= query parameter:\n self.assertEqual(len(mail.outbox), 1)\n body = mail.outbox[0].body\n self.assertTrue(\"/?next=\" + self.channels_url in body)",
"",
"\n @override_settings(SECRET_KEY=\"test-secret\")\n def test_it_rate_limits_emails(self):\n # \"d60d...\" is sha1(\"alice@example.orgtest-secret\")\n obj = TokenBucket(value=\"em-d60db3b2343e713a4de3e92d4eb417e4f05f06ab\")\n obj.tokens = 0\n obj.save()",
" form = {\"identity\": \"alice@example.org\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertContains(r, \"Too many attempts\")",
" # No email should have been sent\n self.assertEqual(len(mail.outbox), 0)",
" def test_it_pops_bad_link_from_session(self):\n self.client.session[\"bad_link\"] = True\n self.client.get(\"/accounts/login/\")\n assert \"bad_link\" not in self.client.session",
" def test_it_ignores_case(self):\n form = {\"identity\": \"ALICE@EXAMPLE.ORG\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")",
" self.profile.refresh_from_db()\n self.assertTrue(self.profile.token)",
" def test_it_handles_password(self):\n form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, self.checks_url)",
" @override_settings(SECRET_KEY=\"test-secret\")\n def test_it_rate_limits_password_attempts(self):\n # \"d60d...\" is sha1(\"alice@example.orgtest-secret\")\n obj = TokenBucket(value=\"pw-d60db3b2343e713a4de3e92d4eb417e4f05f06ab\")\n obj.tokens = 0\n obj.save()",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertContains(r, \"Too many attempts\")",
" def test_it_handles_password_login_with_redirect(self):\n check = Check.objects.create(project=self.project)",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" samples = [self.channels_url, \"/checks/%s/details/\" % check.code]",
" for s in samples:\n r = self.client.post(\"/accounts/login/?next=%s\" % s, form)\n self.assertRedirects(r, s)",
" def test_it_handles_bad_next_parameter(self):\n form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" samples = [\n \"/evil/\",\n f\"https://example.org/projects/{self.project.code}/checks/\",\n ]",
" for sample in samples:\n r = self.client.post(\"/accounts/login/?next=\" + sample, form)\n self.assertRedirects(r, self.checks_url)",
" def test_it_handles_wrong_password(self):\n form = {\n \"action\": \"login\",\n \"email\": \"alice@example.org\",\n \"password\": \"wrong password\",\n }",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertContains(r, \"Incorrect email or password\")",
" @override_settings(REGISTRATION_OPEN=False)\n def test_it_obeys_registration_open(self):\n r = self.client.get(\"/accounts/login/\")\n self.assertNotContains(r, \"Create Your Account\")",
" def test_it_redirects_to_webauthn_form(self):\n Credential.objects.create(user=self.alice, name=\"Alices Key\")",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}\n r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(\n r, \"/accounts/login/two_factor/\", fetch_redirect_response=False\n )",
" # It should not log the user in yet\n self.assertNotIn(\"_auth_user_id\", self.client.session)",
" # Instead, it should set 2fa_user_id in the session\n user_id, email, valid_until = self.client.session[\"2fa_user\"]\n self.assertEqual(user_id, self.alice.id)",
" def test_it_redirects_to_totp_form(self):\n self.profile.totp = \"0\" * 32\n self.profile.save()",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}\n r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(\n r, \"/accounts/login/two_factor/totp/\", fetch_redirect_response=False\n )",
" # It should not log the user in yet\n self.assertNotIn(\"_auth_user_id\", self.client.session)",
" # Instead, it should set 2fa_user_id in the session\n user_id, email, valid_until = self.client.session[\"2fa_user\"]\n self.assertEqual(user_id, self.alice.id)",
" def test_it_handles_missing_profile(self):\n self.profile.delete()",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, self.checks_url)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"from django.conf import settings\nfrom django.core import mail\nfrom django.test.utils import override_settings",
"from hc.accounts.models import Credential\nfrom hc.api.models import Check, TokenBucket\nfrom hc.test import BaseTestCase",
"\nclass LoginTestCase(BaseTestCase):\n def setUp(self):\n super().setUp()\n self.checks_url = f\"/projects/{self.project.code}/checks/\"",
" def test_it_shows_form(self):\n r = self.client.get(\"/accounts/login/\")\n self.assertContains(r, \"Email Me a Link\")",
" def test_it_redirects_authenticated_get(self):\n self.client.login(username=\"alice@example.org\", password=\"password\")",
" r = self.client.get(\"/accounts/login/\")\n self.assertRedirects(r, self.checks_url)",
" @override_settings(SITE_ROOT=\"http://testserver\", SITE_LOGO_URL=None)\n def test_it_sends_link(self):\n form = {\"identity\": \"alice@example.org\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")",
" # And email should have been sent\n self.assertEqual(len(mail.outbox), 1)\n message = mail.outbox[0]\n self.assertEqual(message.subject, f\"Log in to {settings.SITE_NAME}\")\n html = message.alternatives[0][0]\n self.assertIn(\"http://testserver/static/img/logo.png\", html)\n self.assertIn(\"http://testserver/docs/\", html)",
" @override_settings(SITE_LOGO_URL=\"https://example.org/logo.svg\")\n def test_it_uses_custom_logo(self):\n self.client.post(\"/accounts/login/\", {\"identity\": \"alice@example.org\"})\n html = mail.outbox[0].alternatives[0][0]\n self.assertIn(\"https://example.org/logo.svg\", html)",
" def test_it_sends_link_with_next(self):\n form = {\"identity\": \"alice@example.org\"}",
" r = self.client.post(\"/accounts/login/?next=\" + self.channels_url, form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")\n self.assertIn(\"auto-login\", r.cookies)",
" # The check_token link should have a ?next= query parameter:\n self.assertEqual(len(mail.outbox), 1)\n body = mail.outbox[0].body\n self.assertTrue(\"/?next=\" + self.channels_url in body)",
"\n def test_it_handles_unknown_email(self):\n form = {\"identity\": \"surprise@example.org\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")\n self.assertIn(\"auto-login\", r.cookies)",
" # There should be no sent emails.\n self.assertEqual(len(mail.outbox), 0)",
"\n @override_settings(SECRET_KEY=\"test-secret\")\n def test_it_rate_limits_emails(self):\n # \"d60d...\" is sha1(\"alice@example.orgtest-secret\")\n obj = TokenBucket(value=\"em-d60db3b2343e713a4de3e92d4eb417e4f05f06ab\")\n obj.tokens = 0\n obj.save()",
" form = {\"identity\": \"alice@example.org\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertContains(r, \"Too many attempts\")",
" # No email should have been sent\n self.assertEqual(len(mail.outbox), 0)",
" def test_it_pops_bad_link_from_session(self):\n self.client.session[\"bad_link\"] = True\n self.client.get(\"/accounts/login/\")\n assert \"bad_link\" not in self.client.session",
" def test_it_ignores_case(self):\n form = {\"identity\": \"ALICE@EXAMPLE.ORG\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, \"/accounts/login_link_sent/\")",
" self.profile.refresh_from_db()\n self.assertTrue(self.profile.token)",
" def test_it_handles_password(self):\n form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, self.checks_url)",
" @override_settings(SECRET_KEY=\"test-secret\")\n def test_it_rate_limits_password_attempts(self):\n # \"d60d...\" is sha1(\"alice@example.orgtest-secret\")\n obj = TokenBucket(value=\"pw-d60db3b2343e713a4de3e92d4eb417e4f05f06ab\")\n obj.tokens = 0\n obj.save()",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertContains(r, \"Too many attempts\")",
" def test_it_handles_password_login_with_redirect(self):\n check = Check.objects.create(project=self.project)",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" samples = [self.channels_url, \"/checks/%s/details/\" % check.code]",
" for s in samples:\n r = self.client.post(\"/accounts/login/?next=%s\" % s, form)\n self.assertRedirects(r, s)",
" def test_it_handles_bad_next_parameter(self):\n form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" samples = [\n \"/evil/\",\n f\"https://example.org/projects/{self.project.code}/checks/\",\n ]",
" for sample in samples:\n r = self.client.post(\"/accounts/login/?next=\" + sample, form)\n self.assertRedirects(r, self.checks_url)",
" def test_it_handles_wrong_password(self):\n form = {\n \"action\": \"login\",\n \"email\": \"alice@example.org\",\n \"password\": \"wrong password\",\n }",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertContains(r, \"Incorrect email or password\")",
" @override_settings(REGISTRATION_OPEN=False)\n def test_it_obeys_registration_open(self):\n r = self.client.get(\"/accounts/login/\")\n self.assertNotContains(r, \"Create Your Account\")",
" def test_it_redirects_to_webauthn_form(self):\n Credential.objects.create(user=self.alice, name=\"Alices Key\")",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}\n r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(\n r, \"/accounts/login/two_factor/\", fetch_redirect_response=False\n )",
" # It should not log the user in yet\n self.assertNotIn(\"_auth_user_id\", self.client.session)",
" # Instead, it should set 2fa_user_id in the session\n user_id, email, valid_until = self.client.session[\"2fa_user\"]\n self.assertEqual(user_id, self.alice.id)",
" def test_it_redirects_to_totp_form(self):\n self.profile.totp = \"0\" * 32\n self.profile.save()",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}\n r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(\n r, \"/accounts/login/two_factor/totp/\", fetch_redirect_response=False\n )",
" # It should not log the user in yet\n self.assertNotIn(\"_auth_user_id\", self.client.session)",
" # Instead, it should set 2fa_user_id in the session\n user_id, email, valid_until = self.client.session[\"2fa_user\"]\n self.assertEqual(user_id, self.alice.id)",
" def test_it_handles_missing_profile(self):\n self.profile.delete()",
" form = {\"action\": \"login\", \"email\": \"alice@example.org\", \"password\": \"password\"}",
" r = self.client.post(\"/accounts/login/\", form)\n self.assertRedirects(r, self.checks_url)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"from django.conf import settings\nfrom django.contrib.auth.models import User\nfrom django.core import mail\nfrom django.test import TestCase\nfrom django.test.utils import override_settings",
"from hc.accounts.models import Profile, Project\nfrom hc.api.models import Channel, Check",
"\nclass SignupTestCase(TestCase):\n @override_settings(USE_PAYMENTS=False)\n def test_it_works(self):\n form = {\"identity\": \"alice@example.org\", \"tz\": \"Europe/Riga\"}",
" r = self.client.post(\"/accounts/signup/\", form)",
" self.assertContains(r, \"Account created\")",
" self.assertIn(\"auto-login\", r.cookies)",
" # An user should have been created\n user = User.objects.get()",
" # A profile should have been created\n profile = Profile.objects.get()\n self.assertEqual(profile.check_limit, 10000)\n self.assertEqual(profile.sms_limit, 10000)\n self.assertEqual(profile.call_limit, 10000)\n self.assertEqual(profile.tz, \"Europe/Riga\")",
" # And email sent\n self.assertEqual(len(mail.outbox), 1)\n subject = \"Log in to %s\" % settings.SITE_NAME\n self.assertEqual(mail.outbox[0].subject, subject)",
" # A project should have been created\n project = Project.objects.get()\n self.assertEqual(project.owner, user)\n self.assertEqual(project.badge_key, user.username)",
" # And check should be associated with the new user\n check = Check.objects.get()\n self.assertEqual(check.name, \"My First Check\")\n self.assertEqual(check.slug, \"my-first-check\")\n self.assertEqual(check.project, project)",
" # A channel should have been created\n channel = Channel.objects.get()\n self.assertEqual(channel.project, project)",
" @override_settings(USE_PAYMENTS=True)\n def test_it_sets_limits(self):\n form = {\"identity\": \"alice@example.org\", \"tz\": \"\"}",
" self.client.post(\"/accounts/signup/\", form)",
" profile = Profile.objects.get()\n self.assertEqual(profile.check_limit, 20)\n self.assertEqual(profile.sms_limit, 5)\n self.assertEqual(profile.call_limit, 0)",
" @override_settings(REGISTRATION_OPEN=False)\n def test_it_obeys_registration_open(self):\n form = {\"identity\": \"dan@example.org\", \"tz\": \"\"}",
" r = self.client.post(\"/accounts/signup/\", form)\n self.assertEqual(r.status_code, 403)",
" def test_it_ignores_case(self):\n form = {\"identity\": \"ALICE@EXAMPLE.ORG\", \"tz\": \"\"}\n self.client.post(\"/accounts/signup/\", form)",
" # There should be exactly one user:\n q = User.objects.filter(email=\"alice@example.org\")\n self.assertTrue(q.exists)\n",
" def test_it_checks_for_existing_users(self):",
" alice = User(username=\"alice\", email=\"alice@example.org\")\n alice.save()",
" form = {\"identity\": \"alice@example.org\", \"tz\": \"\"}\n r = self.client.post(\"/accounts/signup/\", form)",
" self.assertContains(r, \"already exists\")",
"\n def test_it_checks_syntax(self):\n form = {\"identity\": \"alice at example org\", \"tz\": \"\"}\n r = self.client.post(\"/accounts/signup/\", form)\n self.assertContains(r, \"Enter a valid email address\")",
" def test_it_checks_length(self):\n aaa = \"a\" * 300\n form = {\"identity\": f\"alice+{aaa}@example.org\", \"tz\": \"\"}\n r = self.client.post(\"/accounts/signup/\", form)\n self.assertContains(r, \"Address is too long.\")",
" self.assertFalse(User.objects.exists())",
" @override_settings(USE_PAYMENTS=False)\n def test_it_ignores_bad_tz(self):\n form = {\"identity\": \"alice@example.org\", \"tz\": \"Foo/Bar\"}",
" r = self.client.post(\"/accounts/signup/\", form)",
" self.assertContains(r, \"Account created\")",
" self.assertIn(\"auto-login\", r.cookies)",
" profile = Profile.objects.get()\n self.assertEqual(profile.tz, \"UTC\")"
] |
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"from django.conf import settings\nfrom django.contrib.auth.models import User\nfrom django.core import mail\nfrom django.test import TestCase\nfrom django.test.utils import override_settings",
"from hc.accounts.models import Profile, Project\nfrom hc.api.models import Channel, Check",
"\nclass SignupTestCase(TestCase):\n @override_settings(USE_PAYMENTS=False)\n def test_it_works(self):\n form = {\"identity\": \"alice@example.org\", \"tz\": \"Europe/Riga\"}",
" r = self.client.post(\"/accounts/signup/\", form)",
" self.assertContains(r, \"check your email\")",
" self.assertIn(\"auto-login\", r.cookies)",
" # An user should have been created\n user = User.objects.get()",
" # A profile should have been created\n profile = Profile.objects.get()\n self.assertEqual(profile.check_limit, 10000)\n self.assertEqual(profile.sms_limit, 10000)\n self.assertEqual(profile.call_limit, 10000)\n self.assertEqual(profile.tz, \"Europe/Riga\")",
" # And email sent\n self.assertEqual(len(mail.outbox), 1)\n subject = \"Log in to %s\" % settings.SITE_NAME\n self.assertEqual(mail.outbox[0].subject, subject)",
" # A project should have been created\n project = Project.objects.get()\n self.assertEqual(project.owner, user)\n self.assertEqual(project.badge_key, user.username)",
" # And check should be associated with the new user\n check = Check.objects.get()\n self.assertEqual(check.name, \"My First Check\")\n self.assertEqual(check.slug, \"my-first-check\")\n self.assertEqual(check.project, project)",
" # A channel should have been created\n channel = Channel.objects.get()\n self.assertEqual(channel.project, project)",
" @override_settings(USE_PAYMENTS=True)\n def test_it_sets_limits(self):\n form = {\"identity\": \"alice@example.org\", \"tz\": \"\"}",
" self.client.post(\"/accounts/signup/\", form)",
" profile = Profile.objects.get()\n self.assertEqual(profile.check_limit, 20)\n self.assertEqual(profile.sms_limit, 5)\n self.assertEqual(profile.call_limit, 0)",
" @override_settings(REGISTRATION_OPEN=False)\n def test_it_obeys_registration_open(self):\n form = {\"identity\": \"dan@example.org\", \"tz\": \"\"}",
" r = self.client.post(\"/accounts/signup/\", form)\n self.assertEqual(r.status_code, 403)",
" def test_it_ignores_case(self):\n form = {\"identity\": \"ALICE@EXAMPLE.ORG\", \"tz\": \"\"}\n self.client.post(\"/accounts/signup/\", form)",
" # There should be exactly one user:\n q = User.objects.filter(email=\"alice@example.org\")\n self.assertTrue(q.exists)\n",
" def test_it_handles_existing_users(self):",
" alice = User(username=\"alice\", email=\"alice@example.org\")\n alice.save()",
" form = {\"identity\": \"alice@example.org\", \"tz\": \"\"}\n r = self.client.post(\"/accounts/signup/\", form)",
" self.assertContains(r, \"check your email\")\n self.assertIn(\"auto-login\", r.cookies)",
" # It should not send an email\n self.assertEqual(len(mail.outbox), 0)",
"\n def test_it_checks_syntax(self):\n form = {\"identity\": \"alice at example org\", \"tz\": \"\"}\n r = self.client.post(\"/accounts/signup/\", form)\n self.assertContains(r, \"Enter a valid email address\")",
" def test_it_checks_length(self):\n aaa = \"a\" * 300\n form = {\"identity\": f\"alice+{aaa}@example.org\", \"tz\": \"\"}\n r = self.client.post(\"/accounts/signup/\", form)\n self.assertContains(r, \"Address is too long.\")",
" self.assertFalse(User.objects.exists())",
" @override_settings(USE_PAYMENTS=False)\n def test_it_ignores_bad_tz(self):\n form = {\"identity\": \"alice@example.org\", \"tz\": \"Foo/Bar\"}",
" r = self.client.post(\"/accounts/signup/\", form)",
" self.assertContains(r, \"check your email\")",
" self.assertIn(\"auto-login\", r.cookies)",
" profile = Profile.objects.get()\n self.assertEqual(profile.tz, \"UTC\")"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"import time\nimport uuid\nfrom datetime import timedelta as td\nfrom secrets import token_urlsafe\nfrom urllib.parse import urlparse",
"import pyotp\nimport segno\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.contrib.auth import authenticate\nfrom django.contrib.auth import login as auth_login\nfrom django.contrib.auth import logout as auth_logout\nfrom django.contrib.auth import update_session_auth_hash\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth.models import User\nfrom django.core.signing import BadSignature, SignatureExpired, TimestampSigner\nfrom django.db import transaction\nfrom django.db.models.functions import Lower\nfrom django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\nfrom django.shortcuts import get_object_or_404, redirect, render\nfrom django.urls import Resolver404, resolve, reverse\nfrom django.utils.timezone import now\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.decorators.http import require_POST",
"from hc.accounts import forms\nfrom hc.accounts.decorators import require_sudo_mode\nfrom hc.accounts.models import Credential, Member, Profile, Project\nfrom hc.api.models import Channel, Check, TokenBucket\nfrom hc.lib.tz import all_timezones\nfrom hc.lib.webauthn import CreateHelper, GetHelper\nfrom hc.payments.models import Subscription",
"POST_LOGIN_ROUTES = (\n \"hc-checks\",\n \"hc-details\",\n \"hc-log\",\n \"hc-channels\",\n \"hc-add-slack\",\n \"hc-add-pushover\",\n \"hc-add-telegram\",\n \"hc-project-settings\",\n \"hc-uncloak\",\n)",
"\ndef _allow_redirect(redirect_url):\n if not redirect_url:\n return False",
" parsed = urlparse(redirect_url)\n if parsed.netloc:\n # Allow redirects only to relative URLs\n return False",
" try:\n match = resolve(parsed.path)\n except Resolver404:\n return False",
" return match.url_name in POST_LOGIN_ROUTES",
"\ndef _make_user(email, tz=None, with_project=True):\n username = str(uuid.uuid4())[:30]\n user = User(username=username, email=email)\n user.set_unusable_password()\n user.save()",
" project = None\n if with_project:\n project = Project(owner=user)\n project.badge_key = user.username\n project.save()",
" check = Check(project=project)\n check.set_name_slug(\"My First Check\")\n check.save()",
" channel = Channel(project=project)\n channel.kind = \"email\"\n channel.value = email\n channel.email_verified = True\n channel.save()",
" channel.checks.add(check)",
" # Ensure a profile gets created\n profile = Profile.objects.for_user(user)\n if tz:\n profile.tz = tz\n profile.save()",
" return user",
"\ndef _redirect_after_login(request):\n \"\"\"Redirect to the URL indicated in ?next= query parameter.\"\"\"",
" redirect_url = request.GET.get(\"next\")\n if _allow_redirect(redirect_url):\n return redirect(redirect_url)",
" if request.user.project_set.count() == 1:\n project = request.user.project_set.first()\n return redirect(\"hc-checks\", project.code)",
" return redirect(\"hc-index\")",
"\ndef _check_2fa(request, user):\n have_keys = user.credentials.exists()\n profile = Profile.objects.for_user(user)\n if have_keys or profile.totp:\n # We have verified user's password or token, and now must\n # verify their security key. We store the following in user's session:\n # - user.id, to look up the user in the login_webauthn view\n # - user.email, to make sure email was not changed between the auth steps\n # - timestamp, to limit the max time between the auth steps\n request.session[\"2fa_user\"] = [user.id, user.email, int(time.time())]",
" if have_keys:\n path = reverse(\"hc-login-webauthn\")\n else:\n path = reverse(\"hc-login-totp\")",
" redirect_url = request.GET.get(\"next\")\n if _allow_redirect(redirect_url):\n path += \"?next=%s\" % redirect_url",
" return redirect(path)",
" auth_login(request, user)\n return _redirect_after_login(request)",
"\ndef _new_key(nbytes=24):\n while True:\n candidate = token_urlsafe(nbytes)\n if candidate[0] not in \"-_\" and candidate[-1] not in \"-_\":\n return candidate",
"\ndef login(request):\n form = forms.PasswordLoginForm()\n magic_form = forms.EmailLoginForm()",
" if request.method == \"POST\":\n if request.POST.get(\"action\") == \"login\":\n form = forms.PasswordLoginForm(request.POST)\n if form.is_valid():\n return _check_2fa(request, form.user)",
" else:\n magic_form = forms.EmailLoginForm(request.POST)\n if magic_form.is_valid():\n redirect_url = request.GET.get(\"next\")\n if not _allow_redirect(redirect_url):\n redirect_url = None\n",
" profile = Profile.objects.for_user(magic_form.user)\n profile.send_instant_login_link(redirect_url=redirect_url)",
" response = redirect(\"hc-login-link-sent\")",
"",
" # check_token looks for this cookie to decide if\n # it needs to do the extra POST step.\n response.set_cookie(\"auto-login\", \"1\", max_age=300, httponly=True)\n return response",
" if request.user.is_authenticated:\n return _redirect_after_login(request)",
" bad_link = request.session.pop(\"bad_link\", None)\n ctx = {\n \"page\": \"login\",\n \"form\": form,\n \"magic_form\": magic_form,\n \"bad_link\": bad_link,\n \"registration_open\": settings.REGISTRATION_OPEN,\n \"support_email\": settings.SUPPORT_EMAIL,\n }\n return render(request, \"accounts/login.html\", ctx)",
"\n@require_POST\ndef logout(request):\n auth_logout(request)\n return redirect(\"hc-index\")",
"\n@require_POST\n@csrf_exempt\ndef signup(request):\n if not settings.REGISTRATION_OPEN:\n return HttpResponseForbidden()",
" ctx = {}\n form = forms.SignupForm(request.POST)\n if form.is_valid():\n email = form.cleaned_data[\"identity\"]",
" tz = form.cleaned_data[\"tz\"]\n user = _make_user(email, tz)\n profile = Profile.objects.for_user(user)\n profile.send_instant_login_link()\n ctx[\"created\"] = True",
" else:\n ctx = {\"form\": form}",
" response = render(request, \"accounts/signup_result.html\", ctx)",
" if ctx.get(\"created\"):",
" response.set_cookie(\"auto-login\", \"1\", max_age=300, httponly=True)",
" return response",
"\ndef login_link_sent(request):\n return render(request, \"accounts/login_link_sent.html\")",
"\ndef check_token(request, username, token, new_email=None):\n if request.user.is_authenticated:\n auth_logout(request)",
" # Some email servers open links in emails to check for malicious content.\n # To work around this, we sign user in if the method is POST\n # *or* if the browser presents a cookie we had set when sending the login link.\n #\n # If the method is GET and the auto-login cookie isn't present, we serve\n # a HTML form with a submit button.\n if request.method != \"POST\" and \"auto-login\" not in request.COOKIES:\n return render(request, \"accounts/check_token_submit.html\")",
" user = authenticate(username=username, token=token)\n if user is not None and user.is_active:\n if new_email:\n if User.objects.filter(email=new_email).exists():\n request.session[\"bad_link\"] = True\n return redirect(\"hc-login\")",
" user.email = new_email\n user.set_unusable_password()\n user.save()",
" user.profile.token = \"\"\n user.profile.save()\n return _check_2fa(request, user)",
" request.session[\"bad_link\"] = True\n return redirect(\"hc-login\")",
"\n@login_required\ndef profile(request):\n profile = request.profile",
" ctx = {\n \"page\": \"profile\",\n \"profile\": profile,\n \"my_projects_status\": \"default\",\n \"2fa_status\": \"default\",\n \"added_credential_name\": request.session.pop(\"added_credential_name\", \"\"),\n \"removed_credential_name\": request.session.pop(\"removed_credential_name\", \"\"),\n \"enabled_totp\": request.session.pop(\"enabled_totp\", False),\n \"disabled_totp\": request.session.pop(\"disabled_totp\", False),\n \"credentials\": list(request.user.credentials.order_by(\"id\")),\n \"use_webauthn\": settings.RP_ID,\n }",
" if ctx[\"added_credential_name\"] or ctx[\"enabled_totp\"]:\n ctx[\"2fa_status\"] = \"success\"",
" if ctx[\"removed_credential_name\"] or ctx[\"disabled_totp\"]:\n ctx[\"2fa_status\"] = \"info\"",
" if request.session.pop(\"changed_password\", False):\n ctx[\"changed_password\"] = True\n ctx[\"email_password_status\"] = \"success\"",
" if request.method == \"POST\" and \"leave_project\" in request.POST:\n code = request.POST[\"code\"]\n try:\n project = Project.objects.get(code=code, member__user=request.user)\n except Project.DoesNotExist:\n return HttpResponseBadRequest()",
" Member.objects.filter(project=project, user=request.user).delete()",
" ctx[\"left_project\"] = project\n ctx[\"my_projects_status\"] = \"info\"",
" ctx[\"ownerships\"] = request.user.project_set.order_by(Lower(\"name\"))\n ctx[\"memberships\"] = request.user.memberships.order_by(Lower(\"project__name\"))\n return render(request, \"accounts/profile.html\", ctx)",
"\n@login_required\n@require_POST\ndef add_project(request):\n form = forms.ProjectNameForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest()",
" project = Project(owner=request.user)\n project.code = project.badge_key = str(uuid.uuid4())\n project.name = form.cleaned_data[\"name\"]\n project.save()",
" return redirect(\"hc-checks\", project.code)",
"\n@login_required\ndef project(request, code):\n project = get_object_or_404(Project, code=code)\n is_owner = project.owner_id == request.user.id",
" if request.user.is_superuser or is_owner:\n is_manager = True\n rw = True\n else:\n membership = get_object_or_404(Member, project=project, user=request.user)\n is_manager = membership.role == Member.Role.MANAGER\n rw = membership.is_rw",
" ctx = {\n \"page\": \"project\",\n \"rw\": rw,\n \"project\": project,\n \"is_owner\": is_owner,\n \"is_manager\": is_manager,\n \"show_api_keys\": \"show_api_keys\" in request.GET,\n \"enable_prometheus\": settings.PROMETHEUS_ENABLED is True,\n }",
" if request.method == \"POST\":\n if \"create_key\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" if request.POST[\"create_key\"] == \"api_key\":\n project.api_key = _new_key(24)\n elif request.POST[\"create_key\"] == \"api_key_readonly\":\n project.api_key_readonly = _new_key(24)\n elif request.POST[\"create_key\"] == \"ping_key\":\n project.ping_key = _new_key(16)\n project.save()",
" ctx[\"key_created\"] = True\n ctx[\"api_status\"] = \"success\"\n ctx[\"show_keys\"] = True\n elif \"revoke_key\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" if request.POST[\"revoke_key\"] == \"api_key\":\n project.api_key = \"\"\n elif request.POST[\"revoke_key\"] == \"api_key_readonly\":\n project.api_key_readonly = \"\"\n elif request.POST[\"revoke_key\"] == \"ping_key\":\n project.ping_key = None\n project.save()",
" ctx[\"key_revoked\"] = True\n ctx[\"api_status\"] = \"info\"\n elif \"show_keys\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" ctx[\"show_keys\"] = True\n elif \"invite_team_member\" in request.POST:\n if not is_manager:\n return HttpResponseForbidden()",
" form = forms.InviteTeamMemberForm(request.POST)\n if form.is_valid():\n email = form.cleaned_data[\"email\"]",
" invite_suggestions = project.invite_suggestions()\n if not invite_suggestions.filter(email=email).exists():\n # We're inviting a new user. Are we within team size limit?\n if not project.can_invite_new_users():\n return HttpResponseForbidden()",
" # And are we not hitting a rate limit?\n if not TokenBucket.authorize_invite(request.user):\n return render(request, \"try_later.html\")",
" try:\n user = User.objects.get(email=email)\n except User.DoesNotExist:\n user = _make_user(email, with_project=False)",
" if project.invite(user, role=form.cleaned_data[\"role\"]):\n ctx[\"team_member_invited\"] = email\n ctx[\"team_status\"] = \"success\"\n else:\n ctx[\"team_member_duplicate\"] = email\n ctx[\"team_status\"] = \"info\"",
" elif \"remove_team_member\" in request.POST:\n if not is_manager:\n return HttpResponseForbidden()",
" form = forms.RemoveTeamMemberForm(request.POST)\n if form.is_valid():\n q = User.objects\n q = q.filter(email=form.cleaned_data[\"email\"])\n q = q.filter(memberships__project=project)\n farewell_user = q.first()\n if farewell_user is None:\n return HttpResponseBadRequest()",
" if farewell_user == request.user:\n return HttpResponseBadRequest()",
" Member.objects.filter(project=project, user=farewell_user).delete()",
" ctx[\"team_member_removed\"] = form.cleaned_data[\"email\"]\n ctx[\"team_status\"] = \"info\"\n elif \"set_project_name\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" form = forms.ProjectNameForm(request.POST)\n if form.is_valid():\n project.name = form.cleaned_data[\"name\"]\n project.save()",
" ctx[\"project_name_updated\"] = True\n ctx[\"project_name_status\"] = \"success\"",
" elif \"transfer_project\" in request.POST:\n if not is_owner:\n return HttpResponseForbidden()",
" form = forms.TransferForm(request.POST)\n if form.is_valid():\n # Look up the proposed new owner\n email = form.cleaned_data[\"email\"]\n try:\n membership = project.member_set.filter(user__email=email).get()\n except Member.DoesNotExist:\n return HttpResponseBadRequest()",
" # Revoke any previous transfer requests\n project.member_set.update(transfer_request_date=None)",
" # Initiate the new request\n membership.transfer_request_date = now()\n membership.save()",
" # Send an email notification\n profile = Profile.objects.for_user(membership.user)\n profile.send_transfer_request(project)",
" ctx[\"transfer_initiated\"] = True\n ctx[\"transfer_status\"] = \"success\"",
" elif \"cancel_transfer\" in request.POST:\n if not is_owner:\n return HttpResponseForbidden()",
" project.member_set.update(transfer_request_date=None)\n ctx[\"transfer_cancelled\"] = True\n ctx[\"transfer_status\"] = \"success\"",
" elif \"accept_transfer\" in request.POST:\n tr = project.transfer_request()\n if not tr or tr.user != request.user:\n return HttpResponseForbidden()",
" if not tr.can_accept():\n return HttpResponseBadRequest()",
" with transaction.atomic():\n # 1. Reuse the existing membership, and change its user\n tr.user = project.owner\n tr.transfer_request_date = None\n # The previous owner becomes a regular member\n # (not readonly, not manager):\n tr.role = Member.Role.REGULAR\n tr.save()",
" # 2. Change project's owner\n project.owner = request.user\n project.save()",
" ctx[\"is_owner\"] = True\n ctx[\"is_manager\"] = True\n messages.success(request, \"You are now the owner of this project!\")",
" elif \"reject_transfer\" in request.POST:\n tr = project.transfer_request()\n if not tr or tr.user != request.user:\n return HttpResponseForbidden()",
" tr.transfer_request_date = None\n tr.save()",
" q = project.member_set.select_related(\"user\").order_by(\"user__email\")\n ctx[\"memberships\"] = list(q)\n ctx[\"can_invite_new_users\"] = project.can_invite_new_users()\n return render(request, \"accounts/project.html\", ctx)",
"\n@login_required\ndef notifications(request):\n profile = request.profile",
" ctx = {\n \"status\": \"default\",\n \"page\": \"profile\",\n \"profile\": profile,\n \"timezones\": all_timezones,\n }",
" if request.method == \"POST\":\n form = forms.ReportSettingsForm(request.POST)\n if form.is_valid():\n if form.cleaned_data[\"tz\"]:\n profile.tz = form.cleaned_data[\"tz\"]\n profile.reports = form.cleaned_data[\"reports\"]\n profile.next_report_date = profile.choose_next_report_date()",
" if profile.nag_period != form.cleaned_data[\"nag_period\"]:\n # Set the new nag period\n profile.nag_period = form.cleaned_data[\"nag_period\"]\n # and update next_nag_date:\n if profile.nag_period:\n profile.update_next_nag_date()\n else:\n profile.next_nag_date = None",
" profile.save()\n ctx[\"status\"] = \"info\"",
" return render(request, \"accounts/notifications.html\", ctx)",
"\n@login_required\n@require_sudo_mode\ndef set_password(request):\n if request.method == \"POST\":\n form = forms.SetPasswordForm(request.POST)\n if form.is_valid():\n password = form.cleaned_data[\"password\"]\n request.user.set_password(password)\n request.user.save()",
" request.profile.token = \"\"\n request.profile.save()",
" # update the session with the new password hash so that\n # the user doesn't get logged out\n update_session_auth_hash(request, request.user)",
" request.session[\"changed_password\"] = True\n return redirect(\"hc-profile\")",
" return render(request, \"accounts/set_password.html\", {})",
"\n@login_required\n@require_sudo_mode\ndef change_email(request):\n if \"sent\" in request.session:\n ctx = {\"email\": request.session.pop(\"sent\")}\n return render(request, \"accounts/change_email_instructions.html\", ctx)",
" if request.method == \"POST\":\n form = forms.ChangeEmailForm(request.POST)\n if form.is_valid():\n # The user has entered a valid-looking new email address.\n # Send a special login link to the new address. When the user\n # clicks the special login link, hc.accounts.views.change_email_verify\n # unpacks the payload, and passes it to hc.accounts.views.check_token,\n # which finally updates user's email address.\n email = form.cleaned_data[\"email\"]\n request.profile.send_change_email_link(email)\n request.session[\"sent\"] = email",
" response = redirect(reverse(\"hc-change-email\"))\n # check_token looks for this cookie to decide if\n # it needs to do the extra POST step.\n response.set_cookie(\"auto-login\", \"1\", max_age=900, httponly=True)\n return response\n else:\n form = forms.ChangeEmailForm()",
" return render(request, \"accounts/change_email.html\", {\"form\": form})",
"\ndef change_email_verify(request, signed_payload):\n try:\n payload = TimestampSigner().unsign_object(signed_payload, max_age=900)\n except BadSignature:\n return render(request, \"bad_link.html\")",
" return check_token(request, payload[\"u\"], payload[\"t\"], payload[\"e\"])",
"\n@csrf_exempt\ndef unsubscribe_reports(request, signed_username):\n # Some email servers open links in emails to check for malicious content.\n # To work around this, for GET requests we serve a confirmation form.\n # If the signature is more than 5 minutes old, we also include JS code to\n # auto-submit the form.",
" signer = TimestampSigner(salt=\"reports\")\n # First, check the signature without looking at the timestamp:\n try:\n username = signer.unsign(signed_username)\n except BadSignature:\n return render(request, \"bad_link.html\")",
" try:\n user = User.objects.get(username=username)\n except User.DoesNotExist:\n # This is likely an old unsubscribe link, and the user account has already\n # been deleted. Show the \"Unsubscribed!\" page nevertheless.\n return render(request, \"accounts/unsubscribed.html\")",
" if request.method != \"POST\":\n # Unsign again, now with max_age set,\n # to see if the timestamp is older than 5 minutes\n try:\n autosubmit = False\n username = signer.unsign(signed_username, max_age=300)\n except SignatureExpired:\n autosubmit = True",
" ctx = {\"autosubmit\": autosubmit}\n return render(request, \"accounts/unsubscribe_submit.html\", ctx)",
" profile = Profile.objects.for_user(user)\n profile.reports = \"off\"\n profile.next_report_date = None\n profile.nag_period = td()\n profile.next_nag_date = None\n profile.save()",
" return render(request, \"accounts/unsubscribed.html\")",
"\n@login_required\n@require_sudo_mode\ndef close(request):\n user = request.user",
" if request.method == \"POST\":\n if request.POST.get(\"confirmation\") == request.user.email:\n # Cancel their subscription:\n if sub := Subscription.objects.filter(user=user).first():\n sub.cancel()",
" # Deleting user also deletes its profile, checks, channels etc.\n user.delete()",
" request.session.flush()\n return redirect(\"hc-login\")",
" ctx = {}\n if \"confirmation\" in request.POST:\n ctx[\"wrong_confirmation\"] = True",
" return render(request, \"accounts/close_account.html\", ctx)",
"\n@require_POST\n@login_required\ndef remove_project(request, code):\n project = get_object_or_404(Project, code=code, owner=request.user)\n project.delete()\n return redirect(\"hc-index\")",
"\n@login_required\n@require_sudo_mode\ndef add_webauthn(request):\n if not settings.RP_ID:\n return HttpResponse(status=404)",
" credentials = request.user.credentials.values_list(\"data\", flat=True)\n helper = CreateHelper(settings.RP_ID, credentials)",
" if request.method == \"POST\":\n form = forms.AddWebAuthnForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest()",
" state = request.session[\"state\"]\n credential_bytes = helper.verify(state, form.cleaned_data[\"response\"])\n if credential_bytes is None:\n return HttpResponseBadRequest()",
" c = Credential(user=request.user)\n c.name = form.cleaned_data[\"name\"]\n c.data = credential_bytes\n c.save()",
" request.session.pop(\"state\")\n request.session[\"added_credential_name\"] = c.name\n return redirect(\"hc-profile\")",
" options, request.session[\"state\"] = helper.prepare(request.user.email)\n return render(request, \"accounts/add_credential.html\", {\"options\": options})",
"\n@login_required\n@require_sudo_mode\ndef add_totp(request):\n if request.profile.totp:\n # TOTP is already configured, refuse to continue\n return HttpResponseBadRequest()",
" if \"totp_secret\" not in request.session:\n request.session[\"totp_secret\"] = pyotp.random_base32()",
" totp = pyotp.totp.TOTP(request.session[\"totp_secret\"])",
" if request.method == \"POST\":\n form = forms.TotpForm(totp, request.POST)\n if form.is_valid():\n request.profile.totp = request.session[\"totp_secret\"]\n request.profile.totp_created = now()\n request.profile.save()",
" request.session[\"enabled_totp\"] = True\n request.session.pop(\"totp_secret\")\n return redirect(\"hc-profile\")\n else:\n form = forms.TotpForm(totp)",
" uri = totp.provisioning_uri(name=request.user.email, issuer_name=settings.SITE_NAME)\n qr_data_uri = segno.make(uri).png_data_uri(scale=8)\n ctx = {\n \"form\": form,\n \"qr_data_uri\": qr_data_uri,\n \"secret\": request.session[\"totp_secret\"],\n }\n return render(request, \"accounts/add_totp.html\", ctx)",
"\n@login_required\n@require_sudo_mode\ndef remove_totp(request):\n if request.method == \"POST\" and \"disable_totp\" in request.POST:\n request.profile.totp = None\n request.profile.totp_created = None\n request.profile.save()\n request.session[\"disabled_totp\"] = True\n return redirect(\"hc-profile\")",
" ctx = {\"is_last\": not request.user.credentials.exists()}\n return render(request, \"accounts/remove_totp.html\", ctx)",
"\n@login_required\n@require_sudo_mode\ndef remove_credential(request, code):\n if not settings.RP_ID:\n return HttpResponse(status=404)",
" try:\n credential = Credential.objects.get(user=request.user, code=code)\n except Credential.DoesNotExist:\n return HttpResponseBadRequest()",
" if request.method == \"POST\" and \"remove_credential\" in request.POST:\n request.session[\"removed_credential_name\"] = credential.name\n credential.delete()\n return redirect(\"hc-profile\")",
" if request.profile.totp:\n is_last = False\n else:\n is_last = request.user.credentials.count() == 1",
" ctx = {\"credential\": credential, \"is_last\": is_last}\n return render(request, \"accounts/remove_credential.html\", ctx)",
"\ndef login_webauthn(request):\n # We require RP_ID. Fail predicably if it is not set:\n if not settings.RP_ID:\n return HttpResponse(status=500)",
" # Expect an unauthenticated user\n if request.user.is_authenticated:\n return HttpResponseBadRequest()",
" if \"2fa_user\" not in request.session:\n return HttpResponseBadRequest()",
" user_id, email, timestamp = request.session[\"2fa_user\"]\n if timestamp + 300 < time.time():\n return redirect(\"hc-login\")",
" try:\n user = User.objects.get(id=user_id, email=email)\n except User.DoesNotExist:\n return HttpResponseBadRequest()",
" credentials = user.credentials.values_list(\"data\", flat=True)\n helper = GetHelper(settings.RP_ID, credentials)",
" if request.method == \"POST\":\n form = forms.WebAuthnForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest()",
" if not helper.verify(request.session[\"state\"], form.cleaned_data[\"response\"]):\n return HttpResponseBadRequest()",
" request.session.pop(\"state\")\n request.session.pop(\"2fa_user\")\n auth_login(request, user, \"hc.accounts.backends.EmailBackend\")\n return _redirect_after_login(request)",
" options, request.session[\"state\"] = helper.prepare()",
" totp_url = None\n if user.profile.totp:\n totp_url = reverse(\"hc-login-totp\")\n redirect_url = request.GET.get(\"next\")\n if _allow_redirect(redirect_url):\n totp_url += \"?next=%s\" % redirect_url",
" ctx = {\n \"options\": options,\n \"totp_url\": totp_url,\n }\n return render(request, \"accounts/login_webauthn.html\", ctx)",
"\ndef login_totp(request):\n # Expect an unauthenticated user\n if request.user.is_authenticated:\n return HttpResponseBadRequest()",
" if \"2fa_user\" not in request.session:\n return HttpResponseBadRequest()",
" user_id, email, timestamp = request.session[\"2fa_user\"]\n if timestamp + 300 < time.time():\n return redirect(\"hc-login\")",
" try:\n user = User.objects.get(id=user_id, email=email)\n except User.DoesNotExist:\n return HttpResponseBadRequest()",
" if not user.profile.totp:\n return HttpResponseBadRequest()",
" totp = pyotp.totp.TOTP(user.profile.totp)\n if request.method == \"POST\":\n # To guard against brute-forcing TOTP codes, we allow\n # 96 attempts per user per 24h.\n if not TokenBucket.authorize_totp_attempt(user):\n return render(request, \"try_later.html\")",
" form = forms.TotpForm(totp, request.POST)\n if form.is_valid():\n # We blacklist an used TOTP code for 90 seconds,\n # so an attacker cannot reuse a stolen code.\n if not TokenBucket.authorize_totp_code(user, form.cleaned_data[\"code\"]):\n return render(request, \"try_later.html\")",
" request.session.pop(\"2fa_user\")\n auth_login(request, user, \"hc.accounts.backends.EmailBackend\")\n return _redirect_after_login(request)\n else:\n form = forms.TotpForm(totp)",
" return render(request, \"accounts/login_totp.html\", {\"form\": form})",
"\n@login_required\ndef appearance(request):\n profile = request.profile",
" ctx = {\n \"page\": \"appearance\",\n \"profile\": profile,\n \"status\": \"default\",\n }",
" if request.method == \"POST\":\n theme = request.POST.get(\"theme\", \"\")\n if theme in (\"\", \"dark\"):\n profile.theme = theme\n profile.save()\n ctx[\"status\"] = \"info\"",
" return render(request, \"accounts/appearance.html\", ctx)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"from __future__ import annotations",
"import time\nimport uuid\nfrom datetime import timedelta as td\nfrom secrets import token_urlsafe\nfrom urllib.parse import urlparse",
"import pyotp\nimport segno\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.contrib.auth import authenticate\nfrom django.contrib.auth import login as auth_login\nfrom django.contrib.auth import logout as auth_logout\nfrom django.contrib.auth import update_session_auth_hash\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth.models import User\nfrom django.core.signing import BadSignature, SignatureExpired, TimestampSigner\nfrom django.db import transaction\nfrom django.db.models.functions import Lower\nfrom django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden\nfrom django.shortcuts import get_object_or_404, redirect, render\nfrom django.urls import Resolver404, resolve, reverse\nfrom django.utils.timezone import now\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.views.decorators.http import require_POST",
"from hc.accounts import forms\nfrom hc.accounts.decorators import require_sudo_mode\nfrom hc.accounts.models import Credential, Member, Profile, Project\nfrom hc.api.models import Channel, Check, TokenBucket\nfrom hc.lib.tz import all_timezones\nfrom hc.lib.webauthn import CreateHelper, GetHelper\nfrom hc.payments.models import Subscription",
"POST_LOGIN_ROUTES = (\n \"hc-checks\",\n \"hc-details\",\n \"hc-log\",\n \"hc-channels\",\n \"hc-add-slack\",\n \"hc-add-pushover\",\n \"hc-add-telegram\",\n \"hc-project-settings\",\n \"hc-uncloak\",\n)",
"\ndef _allow_redirect(redirect_url):\n if not redirect_url:\n return False",
" parsed = urlparse(redirect_url)\n if parsed.netloc:\n # Allow redirects only to relative URLs\n return False",
" try:\n match = resolve(parsed.path)\n except Resolver404:\n return False",
" return match.url_name in POST_LOGIN_ROUTES",
"\ndef _make_user(email, tz=None, with_project=True):\n username = str(uuid.uuid4())[:30]\n user = User(username=username, email=email)\n user.set_unusable_password()\n user.save()",
" project = None\n if with_project:\n project = Project(owner=user)\n project.badge_key = user.username\n project.save()",
" check = Check(project=project)\n check.set_name_slug(\"My First Check\")\n check.save()",
" channel = Channel(project=project)\n channel.kind = \"email\"\n channel.value = email\n channel.email_verified = True\n channel.save()",
" channel.checks.add(check)",
" # Ensure a profile gets created\n profile = Profile.objects.for_user(user)\n if tz:\n profile.tz = tz\n profile.save()",
" return user",
"\ndef _redirect_after_login(request):\n \"\"\"Redirect to the URL indicated in ?next= query parameter.\"\"\"",
" redirect_url = request.GET.get(\"next\")\n if _allow_redirect(redirect_url):\n return redirect(redirect_url)",
" if request.user.project_set.count() == 1:\n project = request.user.project_set.first()\n return redirect(\"hc-checks\", project.code)",
" return redirect(\"hc-index\")",
"\ndef _check_2fa(request, user):\n have_keys = user.credentials.exists()\n profile = Profile.objects.for_user(user)\n if have_keys or profile.totp:\n # We have verified user's password or token, and now must\n # verify their security key. We store the following in user's session:\n # - user.id, to look up the user in the login_webauthn view\n # - user.email, to make sure email was not changed between the auth steps\n # - timestamp, to limit the max time between the auth steps\n request.session[\"2fa_user\"] = [user.id, user.email, int(time.time())]",
" if have_keys:\n path = reverse(\"hc-login-webauthn\")\n else:\n path = reverse(\"hc-login-totp\")",
" redirect_url = request.GET.get(\"next\")\n if _allow_redirect(redirect_url):\n path += \"?next=%s\" % redirect_url",
" return redirect(path)",
" auth_login(request, user)\n return _redirect_after_login(request)",
"\ndef _new_key(nbytes=24):\n while True:\n candidate = token_urlsafe(nbytes)\n if candidate[0] not in \"-_\" and candidate[-1] not in \"-_\":\n return candidate",
"\ndef login(request):\n form = forms.PasswordLoginForm()\n magic_form = forms.EmailLoginForm()",
" if request.method == \"POST\":\n if request.POST.get(\"action\") == \"login\":\n form = forms.PasswordLoginForm(request.POST)\n if form.is_valid():\n return _check_2fa(request, form.user)",
" else:\n magic_form = forms.EmailLoginForm(request.POST)\n if magic_form.is_valid():\n redirect_url = request.GET.get(\"next\")\n if not _allow_redirect(redirect_url):\n redirect_url = None\n",
" if magic_form.user:\n profile = Profile.objects.for_user(magic_form.user)\n profile.send_instant_login_link(redirect_url=redirect_url)\n",
" response = redirect(\"hc-login-link-sent\")",
"",
" # check_token looks for this cookie to decide if\n # it needs to do the extra POST step.\n response.set_cookie(\"auto-login\", \"1\", max_age=300, httponly=True)\n return response",
" if request.user.is_authenticated:\n return _redirect_after_login(request)",
" bad_link = request.session.pop(\"bad_link\", None)\n ctx = {\n \"page\": \"login\",\n \"form\": form,\n \"magic_form\": magic_form,\n \"bad_link\": bad_link,\n \"registration_open\": settings.REGISTRATION_OPEN,\n \"support_email\": settings.SUPPORT_EMAIL,\n }\n return render(request, \"accounts/login.html\", ctx)",
"\n@require_POST\ndef logout(request):\n auth_logout(request)\n return redirect(\"hc-index\")",
"\n@require_POST\n@csrf_exempt\ndef signup(request):\n if not settings.REGISTRATION_OPEN:\n return HttpResponseForbidden()",
" ctx = {}\n form = forms.SignupForm(request.POST)\n if form.is_valid():\n email = form.cleaned_data[\"identity\"]",
" if not User.objects.filter(email=email).exists():\n tz = form.cleaned_data[\"tz\"]\n user = _make_user(email, tz)\n profile = Profile.objects.for_user(user)\n profile.send_instant_login_link()",
" else:\n ctx = {\"form\": form}",
" response = render(request, \"accounts/signup_result.html\", ctx)",
" if \"form\" not in ctx:",
" response.set_cookie(\"auto-login\", \"1\", max_age=300, httponly=True)",
" return response",
"\ndef login_link_sent(request):\n return render(request, \"accounts/login_link_sent.html\")",
"\ndef check_token(request, username, token, new_email=None):\n if request.user.is_authenticated:\n auth_logout(request)",
" # Some email servers open links in emails to check for malicious content.\n # To work around this, we sign user in if the method is POST\n # *or* if the browser presents a cookie we had set when sending the login link.\n #\n # If the method is GET and the auto-login cookie isn't present, we serve\n # a HTML form with a submit button.\n if request.method != \"POST\" and \"auto-login\" not in request.COOKIES:\n return render(request, \"accounts/check_token_submit.html\")",
" user = authenticate(username=username, token=token)\n if user is not None and user.is_active:\n if new_email:\n if User.objects.filter(email=new_email).exists():\n request.session[\"bad_link\"] = True\n return redirect(\"hc-login\")",
" user.email = new_email\n user.set_unusable_password()\n user.save()",
" user.profile.token = \"\"\n user.profile.save()\n return _check_2fa(request, user)",
" request.session[\"bad_link\"] = True\n return redirect(\"hc-login\")",
"\n@login_required\ndef profile(request):\n profile = request.profile",
" ctx = {\n \"page\": \"profile\",\n \"profile\": profile,\n \"my_projects_status\": \"default\",\n \"2fa_status\": \"default\",\n \"added_credential_name\": request.session.pop(\"added_credential_name\", \"\"),\n \"removed_credential_name\": request.session.pop(\"removed_credential_name\", \"\"),\n \"enabled_totp\": request.session.pop(\"enabled_totp\", False),\n \"disabled_totp\": request.session.pop(\"disabled_totp\", False),\n \"credentials\": list(request.user.credentials.order_by(\"id\")),\n \"use_webauthn\": settings.RP_ID,\n }",
" if ctx[\"added_credential_name\"] or ctx[\"enabled_totp\"]:\n ctx[\"2fa_status\"] = \"success\"",
" if ctx[\"removed_credential_name\"] or ctx[\"disabled_totp\"]:\n ctx[\"2fa_status\"] = \"info\"",
" if request.session.pop(\"changed_password\", False):\n ctx[\"changed_password\"] = True\n ctx[\"email_password_status\"] = \"success\"",
" if request.method == \"POST\" and \"leave_project\" in request.POST:\n code = request.POST[\"code\"]\n try:\n project = Project.objects.get(code=code, member__user=request.user)\n except Project.DoesNotExist:\n return HttpResponseBadRequest()",
" Member.objects.filter(project=project, user=request.user).delete()",
" ctx[\"left_project\"] = project\n ctx[\"my_projects_status\"] = \"info\"",
" ctx[\"ownerships\"] = request.user.project_set.order_by(Lower(\"name\"))\n ctx[\"memberships\"] = request.user.memberships.order_by(Lower(\"project__name\"))\n return render(request, \"accounts/profile.html\", ctx)",
"\n@login_required\n@require_POST\ndef add_project(request):\n form = forms.ProjectNameForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest()",
" project = Project(owner=request.user)\n project.code = project.badge_key = str(uuid.uuid4())\n project.name = form.cleaned_data[\"name\"]\n project.save()",
" return redirect(\"hc-checks\", project.code)",
"\n@login_required\ndef project(request, code):\n project = get_object_or_404(Project, code=code)\n is_owner = project.owner_id == request.user.id",
" if request.user.is_superuser or is_owner:\n is_manager = True\n rw = True\n else:\n membership = get_object_or_404(Member, project=project, user=request.user)\n is_manager = membership.role == Member.Role.MANAGER\n rw = membership.is_rw",
" ctx = {\n \"page\": \"project\",\n \"rw\": rw,\n \"project\": project,\n \"is_owner\": is_owner,\n \"is_manager\": is_manager,\n \"show_api_keys\": \"show_api_keys\" in request.GET,\n \"enable_prometheus\": settings.PROMETHEUS_ENABLED is True,\n }",
" if request.method == \"POST\":\n if \"create_key\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" if request.POST[\"create_key\"] == \"api_key\":\n project.api_key = _new_key(24)\n elif request.POST[\"create_key\"] == \"api_key_readonly\":\n project.api_key_readonly = _new_key(24)\n elif request.POST[\"create_key\"] == \"ping_key\":\n project.ping_key = _new_key(16)\n project.save()",
" ctx[\"key_created\"] = True\n ctx[\"api_status\"] = \"success\"\n ctx[\"show_keys\"] = True\n elif \"revoke_key\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" if request.POST[\"revoke_key\"] == \"api_key\":\n project.api_key = \"\"\n elif request.POST[\"revoke_key\"] == \"api_key_readonly\":\n project.api_key_readonly = \"\"\n elif request.POST[\"revoke_key\"] == \"ping_key\":\n project.ping_key = None\n project.save()",
" ctx[\"key_revoked\"] = True\n ctx[\"api_status\"] = \"info\"\n elif \"show_keys\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" ctx[\"show_keys\"] = True\n elif \"invite_team_member\" in request.POST:\n if not is_manager:\n return HttpResponseForbidden()",
" form = forms.InviteTeamMemberForm(request.POST)\n if form.is_valid():\n email = form.cleaned_data[\"email\"]",
" invite_suggestions = project.invite_suggestions()\n if not invite_suggestions.filter(email=email).exists():\n # We're inviting a new user. Are we within team size limit?\n if not project.can_invite_new_users():\n return HttpResponseForbidden()",
" # And are we not hitting a rate limit?\n if not TokenBucket.authorize_invite(request.user):\n return render(request, \"try_later.html\")",
" try:\n user = User.objects.get(email=email)\n except User.DoesNotExist:\n user = _make_user(email, with_project=False)",
" if project.invite(user, role=form.cleaned_data[\"role\"]):\n ctx[\"team_member_invited\"] = email\n ctx[\"team_status\"] = \"success\"\n else:\n ctx[\"team_member_duplicate\"] = email\n ctx[\"team_status\"] = \"info\"",
" elif \"remove_team_member\" in request.POST:\n if not is_manager:\n return HttpResponseForbidden()",
" form = forms.RemoveTeamMemberForm(request.POST)\n if form.is_valid():\n q = User.objects\n q = q.filter(email=form.cleaned_data[\"email\"])\n q = q.filter(memberships__project=project)\n farewell_user = q.first()\n if farewell_user is None:\n return HttpResponseBadRequest()",
" if farewell_user == request.user:\n return HttpResponseBadRequest()",
" Member.objects.filter(project=project, user=farewell_user).delete()",
" ctx[\"team_member_removed\"] = form.cleaned_data[\"email\"]\n ctx[\"team_status\"] = \"info\"\n elif \"set_project_name\" in request.POST:\n if not rw:\n return HttpResponseForbidden()",
" form = forms.ProjectNameForm(request.POST)\n if form.is_valid():\n project.name = form.cleaned_data[\"name\"]\n project.save()",
" ctx[\"project_name_updated\"] = True\n ctx[\"project_name_status\"] = \"success\"",
" elif \"transfer_project\" in request.POST:\n if not is_owner:\n return HttpResponseForbidden()",
" form = forms.TransferForm(request.POST)\n if form.is_valid():\n # Look up the proposed new owner\n email = form.cleaned_data[\"email\"]\n try:\n membership = project.member_set.filter(user__email=email).get()\n except Member.DoesNotExist:\n return HttpResponseBadRequest()",
" # Revoke any previous transfer requests\n project.member_set.update(transfer_request_date=None)",
" # Initiate the new request\n membership.transfer_request_date = now()\n membership.save()",
" # Send an email notification\n profile = Profile.objects.for_user(membership.user)\n profile.send_transfer_request(project)",
" ctx[\"transfer_initiated\"] = True\n ctx[\"transfer_status\"] = \"success\"",
" elif \"cancel_transfer\" in request.POST:\n if not is_owner:\n return HttpResponseForbidden()",
" project.member_set.update(transfer_request_date=None)\n ctx[\"transfer_cancelled\"] = True\n ctx[\"transfer_status\"] = \"success\"",
" elif \"accept_transfer\" in request.POST:\n tr = project.transfer_request()\n if not tr or tr.user != request.user:\n return HttpResponseForbidden()",
" if not tr.can_accept():\n return HttpResponseBadRequest()",
" with transaction.atomic():\n # 1. Reuse the existing membership, and change its user\n tr.user = project.owner\n tr.transfer_request_date = None\n # The previous owner becomes a regular member\n # (not readonly, not manager):\n tr.role = Member.Role.REGULAR\n tr.save()",
" # 2. Change project's owner\n project.owner = request.user\n project.save()",
" ctx[\"is_owner\"] = True\n ctx[\"is_manager\"] = True\n messages.success(request, \"You are now the owner of this project!\")",
" elif \"reject_transfer\" in request.POST:\n tr = project.transfer_request()\n if not tr or tr.user != request.user:\n return HttpResponseForbidden()",
" tr.transfer_request_date = None\n tr.save()",
" q = project.member_set.select_related(\"user\").order_by(\"user__email\")\n ctx[\"memberships\"] = list(q)\n ctx[\"can_invite_new_users\"] = project.can_invite_new_users()\n return render(request, \"accounts/project.html\", ctx)",
"\n@login_required\ndef notifications(request):\n profile = request.profile",
" ctx = {\n \"status\": \"default\",\n \"page\": \"profile\",\n \"profile\": profile,\n \"timezones\": all_timezones,\n }",
" if request.method == \"POST\":\n form = forms.ReportSettingsForm(request.POST)\n if form.is_valid():\n if form.cleaned_data[\"tz\"]:\n profile.tz = form.cleaned_data[\"tz\"]\n profile.reports = form.cleaned_data[\"reports\"]\n profile.next_report_date = profile.choose_next_report_date()",
" if profile.nag_period != form.cleaned_data[\"nag_period\"]:\n # Set the new nag period\n profile.nag_period = form.cleaned_data[\"nag_period\"]\n # and update next_nag_date:\n if profile.nag_period:\n profile.update_next_nag_date()\n else:\n profile.next_nag_date = None",
" profile.save()\n ctx[\"status\"] = \"info\"",
" return render(request, \"accounts/notifications.html\", ctx)",
"\n@login_required\n@require_sudo_mode\ndef set_password(request):\n if request.method == \"POST\":\n form = forms.SetPasswordForm(request.POST)\n if form.is_valid():\n password = form.cleaned_data[\"password\"]\n request.user.set_password(password)\n request.user.save()",
" request.profile.token = \"\"\n request.profile.save()",
" # update the session with the new password hash so that\n # the user doesn't get logged out\n update_session_auth_hash(request, request.user)",
" request.session[\"changed_password\"] = True\n return redirect(\"hc-profile\")",
" return render(request, \"accounts/set_password.html\", {})",
"\n@login_required\n@require_sudo_mode\ndef change_email(request):\n if \"sent\" in request.session:\n ctx = {\"email\": request.session.pop(\"sent\")}\n return render(request, \"accounts/change_email_instructions.html\", ctx)",
" if request.method == \"POST\":\n form = forms.ChangeEmailForm(request.POST)\n if form.is_valid():\n # The user has entered a valid-looking new email address.\n # Send a special login link to the new address. When the user\n # clicks the special login link, hc.accounts.views.change_email_verify\n # unpacks the payload, and passes it to hc.accounts.views.check_token,\n # which finally updates user's email address.\n email = form.cleaned_data[\"email\"]\n request.profile.send_change_email_link(email)\n request.session[\"sent\"] = email",
" response = redirect(reverse(\"hc-change-email\"))\n # check_token looks for this cookie to decide if\n # it needs to do the extra POST step.\n response.set_cookie(\"auto-login\", \"1\", max_age=900, httponly=True)\n return response\n else:\n form = forms.ChangeEmailForm()",
" return render(request, \"accounts/change_email.html\", {\"form\": form})",
"\ndef change_email_verify(request, signed_payload):\n try:\n payload = TimestampSigner().unsign_object(signed_payload, max_age=900)\n except BadSignature:\n return render(request, \"bad_link.html\")",
" return check_token(request, payload[\"u\"], payload[\"t\"], payload[\"e\"])",
"\n@csrf_exempt\ndef unsubscribe_reports(request, signed_username):\n # Some email servers open links in emails to check for malicious content.\n # To work around this, for GET requests we serve a confirmation form.\n # If the signature is more than 5 minutes old, we also include JS code to\n # auto-submit the form.",
" signer = TimestampSigner(salt=\"reports\")\n # First, check the signature without looking at the timestamp:\n try:\n username = signer.unsign(signed_username)\n except BadSignature:\n return render(request, \"bad_link.html\")",
" try:\n user = User.objects.get(username=username)\n except User.DoesNotExist:\n # This is likely an old unsubscribe link, and the user account has already\n # been deleted. Show the \"Unsubscribed!\" page nevertheless.\n return render(request, \"accounts/unsubscribed.html\")",
" if request.method != \"POST\":\n # Unsign again, now with max_age set,\n # to see if the timestamp is older than 5 minutes\n try:\n autosubmit = False\n username = signer.unsign(signed_username, max_age=300)\n except SignatureExpired:\n autosubmit = True",
" ctx = {\"autosubmit\": autosubmit}\n return render(request, \"accounts/unsubscribe_submit.html\", ctx)",
" profile = Profile.objects.for_user(user)\n profile.reports = \"off\"\n profile.next_report_date = None\n profile.nag_period = td()\n profile.next_nag_date = None\n profile.save()",
" return render(request, \"accounts/unsubscribed.html\")",
"\n@login_required\n@require_sudo_mode\ndef close(request):\n user = request.user",
" if request.method == \"POST\":\n if request.POST.get(\"confirmation\") == request.user.email:\n # Cancel their subscription:\n if sub := Subscription.objects.filter(user=user).first():\n sub.cancel()",
" # Deleting user also deletes its profile, checks, channels etc.\n user.delete()",
" request.session.flush()\n return redirect(\"hc-login\")",
" ctx = {}\n if \"confirmation\" in request.POST:\n ctx[\"wrong_confirmation\"] = True",
" return render(request, \"accounts/close_account.html\", ctx)",
"\n@require_POST\n@login_required\ndef remove_project(request, code):\n project = get_object_or_404(Project, code=code, owner=request.user)\n project.delete()\n return redirect(\"hc-index\")",
"\n@login_required\n@require_sudo_mode\ndef add_webauthn(request):\n if not settings.RP_ID:\n return HttpResponse(status=404)",
" credentials = request.user.credentials.values_list(\"data\", flat=True)\n helper = CreateHelper(settings.RP_ID, credentials)",
" if request.method == \"POST\":\n form = forms.AddWebAuthnForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest()",
" state = request.session[\"state\"]\n credential_bytes = helper.verify(state, form.cleaned_data[\"response\"])\n if credential_bytes is None:\n return HttpResponseBadRequest()",
" c = Credential(user=request.user)\n c.name = form.cleaned_data[\"name\"]\n c.data = credential_bytes\n c.save()",
" request.session.pop(\"state\")\n request.session[\"added_credential_name\"] = c.name\n return redirect(\"hc-profile\")",
" options, request.session[\"state\"] = helper.prepare(request.user.email)\n return render(request, \"accounts/add_credential.html\", {\"options\": options})",
"\n@login_required\n@require_sudo_mode\ndef add_totp(request):\n if request.profile.totp:\n # TOTP is already configured, refuse to continue\n return HttpResponseBadRequest()",
" if \"totp_secret\" not in request.session:\n request.session[\"totp_secret\"] = pyotp.random_base32()",
" totp = pyotp.totp.TOTP(request.session[\"totp_secret\"])",
" if request.method == \"POST\":\n form = forms.TotpForm(totp, request.POST)\n if form.is_valid():\n request.profile.totp = request.session[\"totp_secret\"]\n request.profile.totp_created = now()\n request.profile.save()",
" request.session[\"enabled_totp\"] = True\n request.session.pop(\"totp_secret\")\n return redirect(\"hc-profile\")\n else:\n form = forms.TotpForm(totp)",
" uri = totp.provisioning_uri(name=request.user.email, issuer_name=settings.SITE_NAME)\n qr_data_uri = segno.make(uri).png_data_uri(scale=8)\n ctx = {\n \"form\": form,\n \"qr_data_uri\": qr_data_uri,\n \"secret\": request.session[\"totp_secret\"],\n }\n return render(request, \"accounts/add_totp.html\", ctx)",
"\n@login_required\n@require_sudo_mode\ndef remove_totp(request):\n if request.method == \"POST\" and \"disable_totp\" in request.POST:\n request.profile.totp = None\n request.profile.totp_created = None\n request.profile.save()\n request.session[\"disabled_totp\"] = True\n return redirect(\"hc-profile\")",
" ctx = {\"is_last\": not request.user.credentials.exists()}\n return render(request, \"accounts/remove_totp.html\", ctx)",
"\n@login_required\n@require_sudo_mode\ndef remove_credential(request, code):\n if not settings.RP_ID:\n return HttpResponse(status=404)",
" try:\n credential = Credential.objects.get(user=request.user, code=code)\n except Credential.DoesNotExist:\n return HttpResponseBadRequest()",
" if request.method == \"POST\" and \"remove_credential\" in request.POST:\n request.session[\"removed_credential_name\"] = credential.name\n credential.delete()\n return redirect(\"hc-profile\")",
" if request.profile.totp:\n is_last = False\n else:\n is_last = request.user.credentials.count() == 1",
" ctx = {\"credential\": credential, \"is_last\": is_last}\n return render(request, \"accounts/remove_credential.html\", ctx)",
"\ndef login_webauthn(request):\n # We require RP_ID. Fail predicably if it is not set:\n if not settings.RP_ID:\n return HttpResponse(status=500)",
" # Expect an unauthenticated user\n if request.user.is_authenticated:\n return HttpResponseBadRequest()",
" if \"2fa_user\" not in request.session:\n return HttpResponseBadRequest()",
" user_id, email, timestamp = request.session[\"2fa_user\"]\n if timestamp + 300 < time.time():\n return redirect(\"hc-login\")",
" try:\n user = User.objects.get(id=user_id, email=email)\n except User.DoesNotExist:\n return HttpResponseBadRequest()",
" credentials = user.credentials.values_list(\"data\", flat=True)\n helper = GetHelper(settings.RP_ID, credentials)",
" if request.method == \"POST\":\n form = forms.WebAuthnForm(request.POST)\n if not form.is_valid():\n return HttpResponseBadRequest()",
" if not helper.verify(request.session[\"state\"], form.cleaned_data[\"response\"]):\n return HttpResponseBadRequest()",
" request.session.pop(\"state\")\n request.session.pop(\"2fa_user\")\n auth_login(request, user, \"hc.accounts.backends.EmailBackend\")\n return _redirect_after_login(request)",
" options, request.session[\"state\"] = helper.prepare()",
" totp_url = None\n if user.profile.totp:\n totp_url = reverse(\"hc-login-totp\")\n redirect_url = request.GET.get(\"next\")\n if _allow_redirect(redirect_url):\n totp_url += \"?next=%s\" % redirect_url",
" ctx = {\n \"options\": options,\n \"totp_url\": totp_url,\n }\n return render(request, \"accounts/login_webauthn.html\", ctx)",
"\ndef login_totp(request):\n # Expect an unauthenticated user\n if request.user.is_authenticated:\n return HttpResponseBadRequest()",
" if \"2fa_user\" not in request.session:\n return HttpResponseBadRequest()",
" user_id, email, timestamp = request.session[\"2fa_user\"]\n if timestamp + 300 < time.time():\n return redirect(\"hc-login\")",
" try:\n user = User.objects.get(id=user_id, email=email)\n except User.DoesNotExist:\n return HttpResponseBadRequest()",
" if not user.profile.totp:\n return HttpResponseBadRequest()",
" totp = pyotp.totp.TOTP(user.profile.totp)\n if request.method == \"POST\":\n # To guard against brute-forcing TOTP codes, we allow\n # 96 attempts per user per 24h.\n if not TokenBucket.authorize_totp_attempt(user):\n return render(request, \"try_later.html\")",
" form = forms.TotpForm(totp, request.POST)\n if form.is_valid():\n # We blacklist an used TOTP code for 90 seconds,\n # so an attacker cannot reuse a stolen code.\n if not TokenBucket.authorize_totp_code(user, form.cleaned_data[\"code\"]):\n return render(request, \"try_later.html\")",
" request.session.pop(\"2fa_user\")\n auth_login(request, user, \"hc.accounts.backends.EmailBackend\")\n return _redirect_after_login(request)\n else:\n form = forms.TotpForm(totp)",
" return render(request, \"accounts/login_totp.html\", {\"form\": form})",
"\n@login_required\ndef appearance(request):\n profile = request.profile",
" ctx = {\n \"page\": \"appearance\",\n \"profile\": profile,\n \"status\": \"default\",\n }",
" if request.method == \"POST\":\n theme = request.POST.get(\"theme\", \"\")\n if theme in (\"\", \"dark\"):\n profile.theme = theme\n profile.save()\n ctx[\"status\"] = \"info\"",
" return render(request, \"accounts/appearance.html\", ctx)"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"{% extends \"base.html\" %}",
"",
"\n{% block content %}\n<div class=\"row\">\n <div class=\"col-sm-6 col-sm-offset-3\">\n <div class=\"hc-dialog\">",
" <h1>Login Link Sent!</h1>",
" <br />\n <p>",
" We've sent you an email with login instructions.\n Please check your inbox!",
" </p>",
"",
" </div>\n </div>\n</div>",
"{% endblock %}"
] |
[
1,
0,
1,
0,
1,
0,
1,
0,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"{% extends \"base.html\" %}",
"{% load hc_extras %}",
"\n{% block content %}\n<div class=\"row\">\n <div class=\"col-sm-6 col-sm-offset-3\">\n <div class=\"hc-dialog\">",
" <h1>Check Your Email!</h1>",
" <br />\n <p>",
" If a {% site_name %} account exists for this email address,\n you will receive a login link in your email shortly.",
" </p>",
"",
" </div>\n </div>\n</div>",
"{% endblock %}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"{% for error in form.identity.errors %}\n<p class=\"text-danger\">{{ error }}</p>",
"",
"{% endfor %}",
"\n{% if created %}\n<p class=\"text-success\">Account created, please check your email!</p>\n{% endif %}"
] |
[
1,
0,
1,
0
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"{% for error in form.identity.errors %}\n<p class=\"text-danger\">{{ error }}</p>",
"{% empty %}\n<p class=\"text-success\">Please check your email!</p>",
"{% endfor %}",
""
] |
[
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [19, 64, 58, 105, 214, 14, 8], "buggy_code_start_loc": [19, 33, 58, 19, 164, 1, 3], "filenames": ["CHANGELOG.md", "hc/accounts/forms.py", "hc/accounts/tests/test_login.py", "hc/accounts/tests/test_signup.py", "hc/accounts/views.py", "templates/accounts/login_link_sent.html", "templates/accounts/signup_result.html"], "fixing_code_end_loc": [21, 59, 69, 109, 215, 13, 6], "fixing_code_start_loc": [20, 32, 59, 19, 164, 2, 3], "message": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:healthchecks:healthchecks:*:*:*:*:*:*:*:*", "matchCriteriaId": "67ABA56D-6361-4668-A210-5DC5EDF49E0A", "versionEndExcluding": "2.6", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Observable Discrepancy in GitHub repository healthchecks/healthchecks prior to v2.6."}], "evaluatorComment": null, "id": "CVE-2023-0440", "lastModified": "2023-03-02T02:15:41.507", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.0"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.3, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 1.4, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-01-23T14:15:11.720", "references": [{"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/208a096f-7986-4eed-8629-b7285348a686"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-203"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-203"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/healthchecks/healthchecks/commit/359edbd2709e27b60687061a32e19322bc971c1f"}, "type": "CWE-203"}
| 100
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"/**\n * The main stop words configuration frontend.\n *\n * This Source Code Form is subject to the terms of the Mozilla Public License,\n * v. 2.0. If a copy of the MPL was not distributed with this file, You can\n * obtain one at http://mozilla.org/MPL/2.0/.\n *\n * @package phpMyFAQ\n * @author Anatoliy Belsky <ab@php.net>\n * @copyright 2009-2022 phpMyFAQ Team\n * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0\n * @link https://www.phpmyfaq.de\n * @since 2009-04-01\n */",
"if (!defined('IS_VALID_PHPMYFAQ')) {\n http_response_code(400);\n exit();\n}\n?>",
" <div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\">\n <h1 class=\"h2\">\n <i aria-hidden=\"true\" class=\"fa fa-wrench\"></i>\n <?= $PMF_LANG['ad_menu_stopwordsconfig'] ?>\n </h1>\n </div>",
"<?php\nif ($user->perm->hasPermission($user->getUserId(), 'editconfig')) {\n $sortedLanguageCodes = $languageCodes;\n asort($sortedLanguageCodes);\n reset($sortedLanguageCodes);\n ?>\n <div class=\"row\">\n <div class=\"col-lg-12\">",
" <p>\n <?= $PMF_LANG['ad_stopwords_desc'] ?>\n </p>\n <p>\n <label for=\"stopwords_lang_selector\"><?= $PMF_LANG['ad_entry_locale'] ?>:</label>\n <select onchange=\"loadStopWordsByLang(this.options[this.selectedIndex].value)\"\n id=\"stopwords_lang_selector\">\n <option value=\"none\">---</option>\n <?php foreach ($sortedLanguageCodes as $key => $value) { ?>\n <option value=\"<?= strtolower($key) ?>\"><?= $value ?></option>\n <?php } ?>\n </select>\n <span id=\"stopwords_loading_indicator\"></span>\n </p>",
" <div class=\"mb-3\" id=\"stopwords_content\"></div>",
" <script>",
" /**\n * column count in the stop words table\n */\n const maxCols = 4;",
" /**\n * Load stop words by language, build html and put\n * it into stop words_content container\n *\n * @param lang language to retrieve the stop words by\n * @return void\n */\n function loadStopWordsByLang(lang) {\n if ('none' === lang) {\n return;\n }",
" $('#stopwords_loading_indicator').html('<i class=\"fa fa-cog fa-spin fa-fw\"></i><span class=\"sr-only\">Loading...</span>');",
" $.get('index.php',\n { action: 'ajax', ajax: 'config', ajaxaction: 'load_stop_words_by_lang', stopwords_lang: lang },\n (data) => {\n $('#stopwords_content').html(buildStopWordsHTML(data));\n $('#stopwords_loading_indicator').html('<i class=\"fa fa-spell-check\" aria-hidden=\"true\"></i>');\n },\n 'json',\n );\n }",
" /**\n * Build complete html contents to view and edit stop words\n *\n * @param data Supposed is stop words json data\n *\n * @return string\n */\n function buildStopWordsHTML(data) {\n if ('object' != typeof (data)) {\n return '';\n }",
" let html = '<table class=\"table table-hover\">';\n let elem_id;\n for (let i = 0; i < data.length; i++) {",
" if (i % maxCols === 0) {\n html += '<tr id=\"stopwords_group_' + i + '\">';\n }",
" // id attribute is of the format stopword_<id>_<lang>",
" elem_id = buildStopWordInputElemId(data[i].id, data[i].lang);",
"\n html += '<td>';",
" html += buildStopWordInputElement(elem_id, data[i].stopword);",
" html += '</td>';",
" if (i % maxCols === maxCols - 1) {\n html += '</tr>';\n }\n }",
" html += '</table>';\n html += '<a class=\"btn btn-primary\" href=\"javascript: addStopWordInputElem();\"><i aria-hidden=\"true\" class=\"fa fa-plus\"></i> <?= $PMF_LANG['ad_config_stopword_input'] ?></a>';",
" return html;\n }",
"\n /**\n * Build an input element to view and edit stop word\n *\n * @param elementId id of the html element\n * @param stopword\n *\n * @return string\n */\n function buildStopWordInputElement(elementId, stopword) {\n elementId = elementId || buildStopWordInputElemId();\n stopword = stopword || '';\n const attrs = 'onblur=\"saveStopWord(this.id)\" onkeydown=\"saveStopWordHandleEnter(this.id, event)\" onfocus=\"saveOldValue(this.id)\"';",
" return '<input class=\"form-control form-control-sm\" id=\"' + elementId + '\" value=\"' + stopword + '\" ' + attrs + '>';",
" }",
" /**\n * Id attribute is of the format stopword_<id>_<lang>\n *\n * @param id database id of the word\n * @param lang\n *\n * @return string\n */\n function buildStopWordInputElemId(id, lang) {\n id = id || -1;\n lang = lang || $('#stopwords_lang_selector').val();",
" return 'stopword_' + id + '_' + lang;\n }",
" /**\n * Parse the stopword element id and return a clean object\n *\n * @param elem_id input element id\n *\n * @return object\n */\n function parseStopWordInputElemId(elem_id) {\n const info = elem_id.split('_');",
" return { id: info[1], lang: info[2] };\n }",
" /**\n * Handle enter press on a stop word input element\n *\n * @param elem_id input element id\n * @param event\n *\n * @return void\n */\n function saveStopWordHandleEnter(elem_id, event) {\n const element = $('#' + elem_id);\n event = event || window.event || undefined;",
" if (undefined !== event) {\n const key = event.charCode || event.keyCode || 0;\n if (13 === key) {\n if ('' === element.val()) {\n deleteStopWord(elem_id);\n } else {\n // this blur action will cause saveStopWord() call\n element.blur();\n }\n }\n }\n }",
" /**\n * Save stopword doing an ajax call\n *\n * @param elem_id input element id\n * @return void\n */\n function saveStopWord(elem_id) {\n const info = parseStopWordInputElemId(elem_id);\n const element = $('#' + elem_id);",
" if (element.attr('old_value') !== element.val()) {\n $.get('index.php', {\n action: 'ajax',\n ajax: 'config',\n ajaxaction: 'save_stop_word',\n stopword_id: info.id,\n stopword: element.val(),\n stopwords_lang: info.lang,\n csrf: '<?= $user->getCsrfTokenFromSession();\n ?>',\n },\n );\n } else {\n if (0 > info.id && '' === element.val()) {\n element.remove();\n }\n }\n }",
" /**\n * Save the value of the stop word input element.\n * This is bound on onfocus.\n *\n * @param elem_id input element id\n *\n * @return void\n */\n function saveOldValue(elem_id) {\n const element = $('#' + elem_id);\n element.attr('old_value', element.val());\n }",
"\n /**\n * Handle stop word delete doing an ajax request.\n *\n * @param elem_id input element id\n *\n * @return void\n */\n function deleteStopWord(elem_id) {\n const info = parseStopWordInputElemId(elem_id);\n const element = $('#' + elem_id);",
" element.fadeOut('slow');",
" $.get('index.php', {\n action: 'ajax',\n ajax: 'config',\n ajaxaction: 'delete_stop_word',\n stopword_id: info.id,\n stopwords_lang: info.lang,\n csrf: '<?= $user->getCsrfTokenFromSession() ?>',\n },\n function() {\n loadStopWordsByLang(info.lang);\n },\n );\n }",
" /**\n * Handle stop word add prompting for a new word and doing an ajax request.\n *\n * @return void\n */\n function addStopWordInputElem() {\n const word = prompt('<?= $PMF_LANG['ad_config_stopword_input']?>', '');\n const lang = $('#stopwords_lang_selector').val();",
" if (!!word) {\n $.get('index.php', {\n action: 'ajax',\n ajax: 'config',\n ajaxaction: 'save_stop_word',\n stopword: word,\n stopwords_lang: lang,\n csrf: '<?= $user->getCsrfTokenFromSession() ?>',\n },\n function() {\n loadStopWordsByLang(lang);\n },\n );\n }\n }",
"",
" </script>\n </div>\n </div>\n <?php\n} else {\n echo $PMF_LANG['err_NotAuth'];\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [288, 196], "buggy_code_start_loc": [109, 195], "filenames": ["phpmyfaq/admin/stopwords.php", "phpmyfaq/src/phpMyFAQ/Stopwords.php"], "fixing_code_end_loc": [304, 196], "fixing_code_start_loc": [109, 195], "message": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:phpmyfaq:phpmyfaq:*:*:*:*:*:*:*:*", "matchCriteriaId": "653EC167-06FC-4D30-AAF8-B75F596519AE", "versionEndExcluding": "3.1.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12."}], "evaluatorComment": null, "id": "CVE-2023-1884", "lastModified": "2023-04-11T16:39:18.543", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 4.7, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 1.2, "impactScore": 3.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-04-05T17:15:07.323", "references": [{"source": "security@huntr.dev", "tags": ["Patch"], "url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/dda73cb6-9344-4822-97a1-2e31efb6a73e"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Primary"}]}, "github_commit_url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, "type": "CWE-79"}
| 101
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"/**\n * The main stop words configuration frontend.\n *\n * This Source Code Form is subject to the terms of the Mozilla Public License,\n * v. 2.0. If a copy of the MPL was not distributed with this file, You can\n * obtain one at http://mozilla.org/MPL/2.0/.\n *\n * @package phpMyFAQ\n * @author Anatoliy Belsky <ab@php.net>\n * @copyright 2009-2022 phpMyFAQ Team\n * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0\n * @link https://www.phpmyfaq.de\n * @since 2009-04-01\n */",
"if (!defined('IS_VALID_PHPMYFAQ')) {\n http_response_code(400);\n exit();\n}\n?>",
" <div class=\"d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom\">\n <h1 class=\"h2\">\n <i aria-hidden=\"true\" class=\"fa fa-wrench\"></i>\n <?= $PMF_LANG['ad_menu_stopwordsconfig'] ?>\n </h1>\n </div>",
"<?php\nif ($user->perm->hasPermission($user->getUserId(), 'editconfig')) {\n $sortedLanguageCodes = $languageCodes;\n asort($sortedLanguageCodes);\n reset($sortedLanguageCodes);\n ?>\n <div class=\"row\">\n <div class=\"col-lg-12\">",
" <p>\n <?= $PMF_LANG['ad_stopwords_desc'] ?>\n </p>\n <p>\n <label for=\"stopwords_lang_selector\"><?= $PMF_LANG['ad_entry_locale'] ?>:</label>\n <select onchange=\"loadStopWordsByLang(this.options[this.selectedIndex].value)\"\n id=\"stopwords_lang_selector\">\n <option value=\"none\">---</option>\n <?php foreach ($sortedLanguageCodes as $key => $value) { ?>\n <option value=\"<?= strtolower($key) ?>\"><?= $value ?></option>\n <?php } ?>\n </select>\n <span id=\"stopwords_loading_indicator\"></span>\n </p>",
" <div class=\"mb-3\" id=\"stopwords_content\"></div>",
" <script>",
" /**\n * column count in the stop words table\n */\n const maxCols = 4;",
" /**\n * Load stop words by language, build html and put\n * it into stop words_content container\n *\n * @param lang language to retrieve the stop words by\n * @return void\n */\n function loadStopWordsByLang(lang) {\n if ('none' === lang) {\n return;\n }",
" $('#stopwords_loading_indicator').html('<i class=\"fa fa-cog fa-spin fa-fw\"></i><span class=\"sr-only\">Loading...</span>');",
" $.get('index.php',\n { action: 'ajax', ajax: 'config', ajaxaction: 'load_stop_words_by_lang', stopwords_lang: lang },\n (data) => {\n $('#stopwords_content').html(buildStopWordsHTML(data));\n $('#stopwords_loading_indicator').html('<i class=\"fa fa-spell-check\" aria-hidden=\"true\"></i>');\n },\n 'json',\n );\n }",
" /**\n * Build complete html contents to view and edit stop words\n *\n * @param data Supposed is stop words json data\n *\n * @return string\n */\n function buildStopWordsHTML(data) {\n if ('object' != typeof (data)) {\n return '';\n }",
" let html = '<table class=\"table table-hover\">';\n let elem_id;\n for (let i = 0; i < data.length; i++) {",
" if (i % maxCols === 0) {\n html += '<tr id=\"stopwords_group_' + i + '\">';\n }",
" // id attribute is of the format stopword_<id>_<lang>",
" elem_id = buildStopWordInputElemId(data[i].id, escape(data[i].lang));",
"\n html += '<td>';",
" html += buildStopWordInputElement(elem_id, escape(data[i].stopword));",
" html += '</td>';",
" if (i % maxCols === maxCols - 1) {\n html += '</tr>';\n }\n }",
" html += '</table>';\n html += '<a class=\"btn btn-primary\" href=\"javascript: addStopWordInputElem();\"><i aria-hidden=\"true\" class=\"fa fa-plus\"></i> <?= $PMF_LANG['ad_config_stopword_input'] ?></a>';",
" return html;\n }",
"\n /**\n * Build an input element to view and edit stop word\n *\n * @param elementId id of the html element\n * @param stopword\n *\n * @return string\n */\n function buildStopWordInputElement(elementId, stopword) {\n elementId = elementId || buildStopWordInputElemId();\n stopword = stopword || '';\n const attrs = 'onblur=\"saveStopWord(this.id)\" onkeydown=\"saveStopWordHandleEnter(this.id, event)\" onfocus=\"saveOldValue(this.id)\"';",
" return '<input class=\"form-control form-control-sm\" id=\"' + elementId + '\" value=\"' + escape(stopword) + '\" ' + attrs + '>';",
" }",
" /**\n * Id attribute is of the format stopword_<id>_<lang>\n *\n * @param id database id of the word\n * @param lang\n *\n * @return string\n */\n function buildStopWordInputElemId(id, lang) {\n id = id || -1;\n lang = lang || $('#stopwords_lang_selector').val();",
" return 'stopword_' + id + '_' + lang;\n }",
" /**\n * Parse the stopword element id and return a clean object\n *\n * @param elem_id input element id\n *\n * @return object\n */\n function parseStopWordInputElemId(elem_id) {\n const info = elem_id.split('_');",
" return { id: info[1], lang: info[2] };\n }",
" /**\n * Handle enter press on a stop word input element\n *\n * @param elem_id input element id\n * @param event\n *\n * @return void\n */\n function saveStopWordHandleEnter(elem_id, event) {\n const element = $('#' + elem_id);\n event = event || window.event || undefined;",
" if (undefined !== event) {\n const key = event.charCode || event.keyCode || 0;\n if (13 === key) {\n if ('' === element.val()) {\n deleteStopWord(elem_id);\n } else {\n // this blur action will cause saveStopWord() call\n element.blur();\n }\n }\n }\n }",
" /**\n * Save stopword doing an ajax call\n *\n * @param elem_id input element id\n * @return void\n */\n function saveStopWord(elem_id) {\n const info = parseStopWordInputElemId(elem_id);\n const element = $('#' + elem_id);",
" if (element.attr('old_value') !== element.val()) {\n $.get('index.php', {\n action: 'ajax',\n ajax: 'config',\n ajaxaction: 'save_stop_word',\n stopword_id: info.id,\n stopword: element.val(),\n stopwords_lang: info.lang,\n csrf: '<?= $user->getCsrfTokenFromSession();\n ?>',\n },\n );\n } else {\n if (0 > info.id && '' === element.val()) {\n element.remove();\n }\n }\n }",
" /**\n * Save the value of the stop word input element.\n * This is bound on onfocus.\n *\n * @param elem_id input element id\n *\n * @return void\n */\n function saveOldValue(elem_id) {\n const element = $('#' + elem_id);\n element.attr('old_value', element.val());\n }",
"\n /**\n * Handle stop word delete doing an ajax request.\n *\n * @param elem_id input element id\n *\n * @return void\n */\n function deleteStopWord(elem_id) {\n const info = parseStopWordInputElemId(elem_id);\n const element = $('#' + elem_id);",
" element.fadeOut('slow');",
" $.get('index.php', {\n action: 'ajax',\n ajax: 'config',\n ajaxaction: 'delete_stop_word',\n stopword_id: info.id,\n stopwords_lang: info.lang,\n csrf: '<?= $user->getCsrfTokenFromSession() ?>',\n },\n function() {\n loadStopWordsByLang(info.lang);\n },\n );\n }",
" /**\n * Handle stop word add prompting for a new word and doing an ajax request.\n *\n * @return void\n */\n function addStopWordInputElem() {\n const word = prompt('<?= $PMF_LANG['ad_config_stopword_input']?>', '');\n const lang = $('#stopwords_lang_selector').val();",
" if (!!word) {\n $.get('index.php', {\n action: 'ajax',\n ajax: 'config',\n ajaxaction: 'save_stop_word',\n stopword: word,\n stopwords_lang: lang,\n csrf: '<?= $user->getCsrfTokenFromSession() ?>',\n },\n function() {\n loadStopWordsByLang(lang);\n },\n );\n }\n }",
"\n const escape = (text) => {\n const map = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n };",
" return text.replace(/[&<>\"']/g, (mapped) => {\n return map[mapped];\n });\n };\n",
" </script>\n </div>\n </div>\n <?php\n} else {\n echo $PMF_LANG['err_NotAuth'];\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [288, 196], "buggy_code_start_loc": [109, 195], "filenames": ["phpmyfaq/admin/stopwords.php", "phpmyfaq/src/phpMyFAQ/Stopwords.php"], "fixing_code_end_loc": [304, 196], "fixing_code_start_loc": [109, 195], "message": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:phpmyfaq:phpmyfaq:*:*:*:*:*:*:*:*", "matchCriteriaId": "653EC167-06FC-4D30-AAF8-B75F596519AE", "versionEndExcluding": "3.1.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12."}], "evaluatorComment": null, "id": "CVE-2023-1884", "lastModified": "2023-04-11T16:39:18.543", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 4.7, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 1.2, "impactScore": 3.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-04-05T17:15:07.323", "references": [{"source": "security@huntr.dev", "tags": ["Patch"], "url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/dda73cb6-9344-4822-97a1-2e31efb6a73e"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Primary"}]}, "github_commit_url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, "type": "CWE-79"}
| 101
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"/**\n * The main Stopwords class.\n *\n * This Source Code Form is subject to the terms of the Mozilla Public License,\n * v. 2.0. If a copy of the MPL was not distributed with this file, You can\n * obtain one at http://mozilla.org/MPL/2.0/.\n *\n * @package phpMyFAQ\n * @author Anatoliy Belsky\n * @author Matteo Scaramuccia <matteo@phpmyfaq.de>\n * @copyright 2009-2022 phpMyFAQ Team\n * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0\n * @link https://www.phpmyfaq.de\n * @since 2009-04-01\n */",
"namespace phpMyFAQ;",
"/**\n * Class Stopwords\n *\n * @package phpMyFAQ\n */\nclass Stopwords\n{\n /**\n * @var Configuration\n */\n private $config;",
" /**\n * @var string\n */\n private $language;",
" /**\n * Table name.\n *\n * @var string\n */\n private $tableName;",
" /**\n * Constructor.\n *\n * @param Configuration $config\n */\n public function __construct(Configuration $config)\n {\n $this->config = $config;\n $this->tableName = Database::getTablePrefix() . 'faqstopwords';\n }",
" /**\n * @return string\n */\n public function getLanguage(): string\n {\n return $this->language;\n }",
" /**\n * @return string\n */\n public function getTableName(): string\n {\n return $this->tableName;\n }",
" /**\n * @param string $language\n */\n public function setLanguage(string $language): void\n {\n $this->language = $language;\n }",
" /**\n * @param string $tableName\n */\n public function setTableName(string $tableName): void\n {\n $this->tableName = $tableName;\n }",
" /**\n * Add a word to the stop words dictionary.\n * If the given word already exists, false is returned.\n *\n * @param string $word\n * @return bool\n */\n public function add(string $word): bool\n {\n if (!$this->match($word)) {\n $sql = sprintf(\n \"INSERT INTO %s VALUES(%d, '%s', '%s')\",\n $this->tableName,\n $this->config->getDb()->nextId($this->tableName, 'id'),\n $this->language,\n $word\n );\n $this->config->getDb()->query($sql);",
" return true;\n }",
" return false;\n }",
" /**\n * Update a word in the stop words dictionary.\n *\n * @param int $id\n * @param string $word\n * @return bool\n */\n public function update(int $id, string $word): bool\n {\n $sql = \"UPDATE %s SET stopword = '%s' WHERE id = %d AND lang = '%s'\";\n $sql = sprintf(\n $sql,\n $this->tableName,\n $word,\n $id,\n $this->language\n );",
" return (bool) $this->config->getDb()->query($sql);\n }",
" /**\n * Remove a word from the stop word dictionary.\n *\n * @param int $id\n * @return bool\n */\n public function remove(int $id): bool\n {\n $sql = sprintf(\n \"DELETE FROM %s WHERE id = %d AND lang = '%s'\",\n $this->tableName,\n $id,\n $this->language\n );",
" return (bool) $this->config->getDb()->query($sql);\n }",
" /**\n * Match a word against the stop words dictionary.\n *\n * @param string $word\n * @return bool\n */\n public function match(string $word): bool\n {\n $sql = sprintf(\n \"SELECT id FROM %s WHERE LOWER(stopword) = LOWER('%s') AND lang = '%s'\",\n $this->tableName,\n $word,\n $this->language\n );",
" $result = $this->config->getDb()->query($sql);",
" return $this->config->getDb()->numRows($result) > 0;\n }",
" /**\n * Retrieve all the stop words by a certain language.\n *\n * @param string $lang Language to retrieve stop words by\n * @param bool $wordsOnly\n *\n * @return string[]\n */\n public function getByLang($lang = null, $wordsOnly = false): array\n {\n $lang = is_null($lang) ? $this->config->getLanguage()->getLanguage() : $lang;\n $sql = sprintf(\n \"SELECT id, lang, LOWER(stopword) AS stopword FROM %s WHERE lang = '%s'\",\n $this->tableName,\n $lang\n );",
" $result = $this->config->getDb()->query($sql);",
" $stopWords = [];",
" if ($wordsOnly) {\n while (($row = $this->config->getDb()->fetchObject($result)) == true) {",
" $stopWords[] = $row->stopword;",
" }\n } else {\n return $this->config->getDb()->fetchAll($result);\n }",
" return $stopWords;\n }",
" /**\n * Filter some text cutting out all non words and stop words.\n *\n * @param string $input text to filter\n * @return string[]\n */\n public function clean(string $input): array\n {\n $words = explode(' ', $input);\n $stop_words = $this->getByLang(null, true);\n $retval = [];",
" foreach ($words as $word) {\n $word = Strings::strtolower($word);\n if (\n !is_numeric($word) && 1 < Strings::strlen($word)\n && !in_array($word, $stop_words) && !in_array($word, $retval)\n ) {\n $retval[] = $word;\n }\n }",
" return $retval;\n }",
" /**\n * This function checks the content against a bad word list if the banned\n * word spam protection has been activated from the general phpMyFAQ\n * configuration.\n *\n * @param string $content\n * @return bool\n */\n public function checkBannedWord(string $content): bool\n {\n // Sanity checks\n $content = Strings::strtolower(trim($content));\n if (('' === $content) || (!$this->config->get('spam.checkBannedWords'))) {\n return true;\n }",
" // Check if we check more than one word\n $checkWords = explode(' ', $content);\n if (1 === count($checkWords)) {\n $checkWords = [$content];\n }",
" $bannedWords = $this->getBannedWords();\n // We just search a match of, at least, one banned word into $content\n if (is_array($bannedWords)) {\n foreach ($bannedWords as $bannedWord) {\n foreach ($checkWords as $word) {\n if (Strings::strtolower($word) === Strings::strtolower($bannedWord)) {\n return false;\n }\n }\n }\n }",
" return true;\n }",
" /**\n * This function returns the banned words dictionary as an array.\n *\n * @return string[]\n */\n private function getBannedWords(): array\n {\n $bannedTrimmedWords = [];\n $bannedWordsFile = PMF_SRC_DIR . '/blockedwords.txt';\n $bannedWords = [];",
" // Read the dictionary\n if (file_exists($bannedWordsFile) && is_readable($bannedWordsFile)) {\n $bannedWords = file_get_contents($bannedWordsFile);\n }",
" // Trim it\n foreach (explode(\"\\n\", $bannedWords) as $word) {\n $bannedTrimmedWords[] = trim($word);\n }",
" return $bannedTrimmedWords;\n }\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [288, 196], "buggy_code_start_loc": [109, 195], "filenames": ["phpmyfaq/admin/stopwords.php", "phpmyfaq/src/phpMyFAQ/Stopwords.php"], "fixing_code_end_loc": [304, 196], "fixing_code_start_loc": [109, 195], "message": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:phpmyfaq:phpmyfaq:*:*:*:*:*:*:*:*", "matchCriteriaId": "653EC167-06FC-4D30-AAF8-B75F596519AE", "versionEndExcluding": "3.1.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12."}], "evaluatorComment": null, "id": "CVE-2023-1884", "lastModified": "2023-04-11T16:39:18.543", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 4.7, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 1.2, "impactScore": 3.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-04-05T17:15:07.323", "references": [{"source": "security@huntr.dev", "tags": ["Patch"], "url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/dda73cb6-9344-4822-97a1-2e31efb6a73e"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Primary"}]}, "github_commit_url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, "type": "CWE-79"}
| 101
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"/**\n * The main Stopwords class.\n *\n * This Source Code Form is subject to the terms of the Mozilla Public License,\n * v. 2.0. If a copy of the MPL was not distributed with this file, You can\n * obtain one at http://mozilla.org/MPL/2.0/.\n *\n * @package phpMyFAQ\n * @author Anatoliy Belsky\n * @author Matteo Scaramuccia <matteo@phpmyfaq.de>\n * @copyright 2009-2022 phpMyFAQ Team\n * @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0\n * @link https://www.phpmyfaq.de\n * @since 2009-04-01\n */",
"namespace phpMyFAQ;",
"/**\n * Class Stopwords\n *\n * @package phpMyFAQ\n */\nclass Stopwords\n{\n /**\n * @var Configuration\n */\n private $config;",
" /**\n * @var string\n */\n private $language;",
" /**\n * Table name.\n *\n * @var string\n */\n private $tableName;",
" /**\n * Constructor.\n *\n * @param Configuration $config\n */\n public function __construct(Configuration $config)\n {\n $this->config = $config;\n $this->tableName = Database::getTablePrefix() . 'faqstopwords';\n }",
" /**\n * @return string\n */\n public function getLanguage(): string\n {\n return $this->language;\n }",
" /**\n * @return string\n */\n public function getTableName(): string\n {\n return $this->tableName;\n }",
" /**\n * @param string $language\n */\n public function setLanguage(string $language): void\n {\n $this->language = $language;\n }",
" /**\n * @param string $tableName\n */\n public function setTableName(string $tableName): void\n {\n $this->tableName = $tableName;\n }",
" /**\n * Add a word to the stop words dictionary.\n * If the given word already exists, false is returned.\n *\n * @param string $word\n * @return bool\n */\n public function add(string $word): bool\n {\n if (!$this->match($word)) {\n $sql = sprintf(\n \"INSERT INTO %s VALUES(%d, '%s', '%s')\",\n $this->tableName,\n $this->config->getDb()->nextId($this->tableName, 'id'),\n $this->language,\n $word\n );\n $this->config->getDb()->query($sql);",
" return true;\n }",
" return false;\n }",
" /**\n * Update a word in the stop words dictionary.\n *\n * @param int $id\n * @param string $word\n * @return bool\n */\n public function update(int $id, string $word): bool\n {\n $sql = \"UPDATE %s SET stopword = '%s' WHERE id = %d AND lang = '%s'\";\n $sql = sprintf(\n $sql,\n $this->tableName,\n $word,\n $id,\n $this->language\n );",
" return (bool) $this->config->getDb()->query($sql);\n }",
" /**\n * Remove a word from the stop word dictionary.\n *\n * @param int $id\n * @return bool\n */\n public function remove(int $id): bool\n {\n $sql = sprintf(\n \"DELETE FROM %s WHERE id = %d AND lang = '%s'\",\n $this->tableName,\n $id,\n $this->language\n );",
" return (bool) $this->config->getDb()->query($sql);\n }",
" /**\n * Match a word against the stop words dictionary.\n *\n * @param string $word\n * @return bool\n */\n public function match(string $word): bool\n {\n $sql = sprintf(\n \"SELECT id FROM %s WHERE LOWER(stopword) = LOWER('%s') AND lang = '%s'\",\n $this->tableName,\n $word,\n $this->language\n );",
" $result = $this->config->getDb()->query($sql);",
" return $this->config->getDb()->numRows($result) > 0;\n }",
" /**\n * Retrieve all the stop words by a certain language.\n *\n * @param string $lang Language to retrieve stop words by\n * @param bool $wordsOnly\n *\n * @return string[]\n */\n public function getByLang($lang = null, $wordsOnly = false): array\n {\n $lang = is_null($lang) ? $this->config->getLanguage()->getLanguage() : $lang;\n $sql = sprintf(\n \"SELECT id, lang, LOWER(stopword) AS stopword FROM %s WHERE lang = '%s'\",\n $this->tableName,\n $lang\n );",
" $result = $this->config->getDb()->query($sql);",
" $stopWords = [];",
" if ($wordsOnly) {\n while (($row = $this->config->getDb()->fetchObject($result)) == true) {",
" $stopWords[] = Strings::htmlentities($row->stopword);",
" }\n } else {\n return $this->config->getDb()->fetchAll($result);\n }",
" return $stopWords;\n }",
" /**\n * Filter some text cutting out all non words and stop words.\n *\n * @param string $input text to filter\n * @return string[]\n */\n public function clean(string $input): array\n {\n $words = explode(' ', $input);\n $stop_words = $this->getByLang(null, true);\n $retval = [];",
" foreach ($words as $word) {\n $word = Strings::strtolower($word);\n if (\n !is_numeric($word) && 1 < Strings::strlen($word)\n && !in_array($word, $stop_words) && !in_array($word, $retval)\n ) {\n $retval[] = $word;\n }\n }",
" return $retval;\n }",
" /**\n * This function checks the content against a bad word list if the banned\n * word spam protection has been activated from the general phpMyFAQ\n * configuration.\n *\n * @param string $content\n * @return bool\n */\n public function checkBannedWord(string $content): bool\n {\n // Sanity checks\n $content = Strings::strtolower(trim($content));\n if (('' === $content) || (!$this->config->get('spam.checkBannedWords'))) {\n return true;\n }",
" // Check if we check more than one word\n $checkWords = explode(' ', $content);\n if (1 === count($checkWords)) {\n $checkWords = [$content];\n }",
" $bannedWords = $this->getBannedWords();\n // We just search a match of, at least, one banned word into $content\n if (is_array($bannedWords)) {\n foreach ($bannedWords as $bannedWord) {\n foreach ($checkWords as $word) {\n if (Strings::strtolower($word) === Strings::strtolower($bannedWord)) {\n return false;\n }\n }\n }\n }",
" return true;\n }",
" /**\n * This function returns the banned words dictionary as an array.\n *\n * @return string[]\n */\n private function getBannedWords(): array\n {\n $bannedTrimmedWords = [];\n $bannedWordsFile = PMF_SRC_DIR . '/blockedwords.txt';\n $bannedWords = [];",
" // Read the dictionary\n if (file_exists($bannedWordsFile) && is_readable($bannedWordsFile)) {\n $bannedWords = file_get_contents($bannedWordsFile);\n }",
" // Trim it\n foreach (explode(\"\\n\", $bannedWords) as $word) {\n $bannedTrimmedWords[] = trim($word);\n }",
" return $bannedTrimmedWords;\n }\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [288, 196], "buggy_code_start_loc": [109, 195], "filenames": ["phpmyfaq/admin/stopwords.php", "phpmyfaq/src/phpMyFAQ/Stopwords.php"], "fixing_code_end_loc": [304, 196], "fixing_code_start_loc": [109, 195], "message": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:phpmyfaq:phpmyfaq:*:*:*:*:*:*:*:*", "matchCriteriaId": "653EC167-06FC-4D30-AAF8-B75F596519AE", "versionEndExcluding": "3.1.12", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Generic in GitHub repository thorsten/phpmyfaq prior to 3.1.12."}], "evaluatorComment": null, "id": "CVE-2023-1884", "lastModified": "2023-04-11T16:39:18.543", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "LOW", "baseScore": 4.7, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "HIGH", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:L", "version": "3.0"}, "exploitabilityScore": 1.2, "impactScore": 3.4, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 6.1, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-04-05T17:15:07.323", "references": [{"source": "security@huntr.dev", "tags": ["Patch"], "url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/dda73cb6-9344-4822-97a1-2e31efb6a73e"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Primary"}]}, "github_commit_url": "https://github.com/thorsten/phpmyfaq/commit/7f0f921de74c88038826c46bbd2a123518d9d611"}, "type": "CWE-79"}
| 101
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% FFFFF OOO U U RRRR IIIII EEEEE RRRR %\n% F O O U U R R I E R R %\n% FFF O O U U RRRR I EEE RRRR %\n% F O O U U R R I E R R %\n% F OOO UUU R R IIIII EEEEE R R %\n% %\n% %\n% MagickCore Discrete Fourier Transform Methods %\n% %\n% Software Design %\n% Sean Burke %\n% Fred Weinhaus %\n% Cristy %\n% July 2009 %\n% %\n% %\n% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/artifact.h\"\n#include \"MagickCore/attribute.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/image.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/fourier.h\"\n#include \"MagickCore/log.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/monitor.h\"\n#include \"MagickCore/monitor-private.h\"\n#include \"MagickCore/pixel-accessor.h\"\n#include \"MagickCore/pixel-private.h\"\n#include \"MagickCore/property.h\"\n#include \"MagickCore/quantum-private.h\"\n#include \"MagickCore/resource_.h\"\n#include \"MagickCore/string-private.h\"\n#include \"MagickCore/thread-private.h\"\n#if defined(MAGICKCORE_FFTW_DELEGATE)\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n#include <complex.h>\n#endif\n#include <fftw3.h>\n#if !defined(MAGICKCORE_HAVE_CABS)\n#define cabs(z) (sqrt(z[0]*z[0]+z[1]*z[1]))\n#endif\n#if !defined(MAGICKCORE_HAVE_CARG)\n#define carg(z) (atan2(cimag(z),creal(z)))\n#endif\n#if !defined(MAGICKCORE_HAVE_CIMAG)\n#define cimag(z) (z[1])\n#endif\n#if !defined(MAGICKCORE_HAVE_CREAL)\n#define creal(z) (z[0])\n#endif\n#endif\n\f\n/*\n Typedef declarations.\n*/\ntypedef struct _FourierInfo\n{\n PixelChannel\n channel;",
" MagickBooleanType\n modulus;",
" size_t\n width,\n height;",
" ssize_t\n center;\n} FourierInfo;\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% C o m p l e x I m a g e s %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ComplexImages() performs complex mathematics on an image sequence.\n%\n% The format of the ComplexImages method is:\n%\n% MagickBooleanType ComplexImages(Image *images,const ComplexOperator op,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o op: A complex operator.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,\n ExceptionInfo *exception)\n{\n#define ComplexImageTag \"Complex/Image\"",
" CacheView\n *Ai_view,\n *Ar_view,\n *Bi_view,\n *Br_view,\n *Ci_view,\n *Cr_view;",
" const char\n *artifact;",
" const Image\n *Ai_image,\n *Ar_image,\n *Bi_image,\n *Br_image;",
" double\n snr;",
" Image\n *Ci_image,\n *complex_images,\n *Cr_image,\n *image;",
" MagickBooleanType\n status;",
" MagickOffsetType\n progress;",
" ssize_t\n y;",
" assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n if (images->next == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",images->filename);\n return((Image *) NULL);\n }\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return(image);\n }\n image->depth=32UL;\n complex_images=NewImageList();\n AppendImageToList(&complex_images,image);\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n {\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n }\n AppendImageToList(&complex_images,image);\n /*\n Apply complex mathematics to image pixels.\n */\n artifact=GetImageArtifact(image,\"complex:snr\");\n snr=0.0;\n if (artifact != (const char *) NULL)\n snr=StringToDouble(artifact,(char **) NULL);\n Ar_image=images;\n Ai_image=images->next;\n Br_image=images;\n Bi_image=images->next;\n if ((images->next->next != (Image *) NULL) &&\n (images->next->next->next != (Image *) NULL))\n {\n Br_image=images->next->next;\n Bi_image=images->next->next->next;\n }\n Cr_image=complex_images;\n Ci_image=complex_images->next;\n Ar_view=AcquireVirtualCacheView(Ar_image,exception);\n Ai_view=AcquireVirtualCacheView(Ai_image,exception);\n Br_view=AcquireVirtualCacheView(Br_image,exception);\n Bi_view=AcquireVirtualCacheView(Bi_image,exception);\n Cr_view=AcquireAuthenticCacheView(Cr_image,exception);\n Ci_view=AcquireAuthenticCacheView(Ci_image,exception);\n status=MagickTrue;\n progress=0;\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\",
" magick_number_threads(images,complex_images,images->rows,1L)\n#endif\n for (y=0; y < (ssize_t) images->rows; y++)",
" {\n register const Quantum\n *magick_restrict Ai,\n *magick_restrict Ar,\n *magick_restrict Bi,\n *magick_restrict Br;",
" register Quantum\n *magick_restrict Ci,\n *magick_restrict Cr;",
" register ssize_t\n x;",
" if (status == MagickFalse)\n continue;",
" Ar=GetCacheViewVirtualPixels(Ar_view,0,y,\n MagickMax(Ar_image->columns,Cr_image->columns),1,exception);\n Ai=GetCacheViewVirtualPixels(Ai_view,0,y,\n MagickMax(Ai_image->columns,Ci_image->columns),1,exception);\n Br=GetCacheViewVirtualPixels(Br_view,0,y,\n MagickMax(Br_image->columns,Cr_image->columns),1,exception);\n Bi=GetCacheViewVirtualPixels(Bi_view,0,y,\n MagickMax(Bi_image->columns,Ci_image->columns),1,exception);",
" Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);\n Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);\n if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || \n (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||\n (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }",
" for (x=0; x < (ssize_t) images->columns; x++)",
" {\n register ssize_t\n i;\n",
" for (i=0; i < (ssize_t) GetPixelChannels(images); i++)",
" {\n switch (op)\n {\n case AddComplexOperator:\n {\n Cr[i]=Ar[i]+Br[i];\n Ci[i]=Ai[i]+Bi[i];\n break;\n }\n case ConjugateComplexOperator:\n default:\n {\n Cr[i]=Ar[i];\n Ci[i]=(-Bi[i]);\n break;\n }\n case DivideComplexOperator:\n {\n double\n gamma;\n",
" gamma=PerceptibleReciprocal(Br[i]*Br[i]+Bi[i]*Bi[i]+snr);\n Cr[i]=gamma*(Ar[i]*Br[i]+Ai[i]*Bi[i]);\n Ci[i]=gamma*(Ai[i]*Br[i]-Ar[i]*Bi[i]);",
" break;\n }\n case MagnitudePhaseComplexOperator:\n {",
" Cr[i]=sqrt(Ar[i]*Ar[i]+Ai[i]*Ai[i]);\n Ci[i]=atan2(Ai[i],Ar[i])/(2.0*MagickPI)+0.5;",
" break;\n }\n case MultiplyComplexOperator:\n {",
" Cr[i]=QuantumScale*(Ar[i]*Br[i]-Ai[i]*Bi[i]);\n Ci[i]=QuantumScale*(Ai[i]*Br[i]+Ar[i]*Bi[i]);",
" break;\n }\n case RealImaginaryComplexOperator:\n {\n Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));\n Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));\n break;\n }\n case SubtractComplexOperator:\n {\n Cr[i]=Ar[i]-Br[i];\n Ci[i]=Ai[i]-Bi[i];\n break;\n }\n }\n }\n Ar+=GetPixelChannels(Ar_image);\n Ai+=GetPixelChannels(Ai_image);\n Br+=GetPixelChannels(Br_image);\n Bi+=GetPixelChannels(Bi_image);\n Cr+=GetPixelChannels(Cr_image);\n Ci+=GetPixelChannels(Ci_image);\n }\n if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)\n status=MagickFalse;\n if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)\n status=MagickFalse;\n if (images->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;",
"#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n Cr_view=DestroyCacheView(Cr_view);\n Ci_view=DestroyCacheView(Ci_view);\n Br_view=DestroyCacheView(Br_view);\n Bi_view=DestroyCacheView(Bi_view);\n Ar_view=DestroyCacheView(Ar_view);\n Ai_view=DestroyCacheView(Ai_view);\n if (status == MagickFalse)\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% F o r w a r d F o u r i e r T r a n s f o r m I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ForwardFourierTransformImage() implements the discrete Fourier transform\n% (DFT) of the image either as a magnitude / phase or real / imaginary image\n% pair.\n%\n% The format of the ForwadFourierTransformImage method is:\n%\n% Image *ForwardFourierTransformImage(const Image *image,\n% const MagickBooleanType modulus,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o modulus: if true, return as transform as a magnitude / phase pair\n% otherwise a real / imaginary image pair.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"#if defined(MAGICKCORE_FFTW_DELEGATE)",
"static MagickBooleanType RollFourier(const size_t width,const size_t height,\n const ssize_t x_offset,const ssize_t y_offset,double *roll_pixels)\n{\n double\n *source_pixels;",
" MemoryInfo\n *source_info;",
" register ssize_t\n i,\n x;",
" ssize_t\n u,\n v,\n y;",
" /*\n Move zero frequency (DC, average color) from (0,0) to (width/2,height/2).\n */\n source_info=AcquireVirtualMemory(width,height*sizeof(*source_pixels));\n if (source_info == (MemoryInfo *) NULL)\n return(MagickFalse);\n source_pixels=(double *) GetVirtualMemoryBlob(source_info);\n i=0L;\n for (y=0L; y < (ssize_t) height; y++)\n {\n if (y_offset < 0L)\n v=((y+y_offset) < 0L) ? y+y_offset+(ssize_t) height : y+y_offset;\n else\n v=((y+y_offset) > ((ssize_t) height-1L)) ? y+y_offset-(ssize_t) height :\n y+y_offset;\n for (x=0L; x < (ssize_t) width; x++)\n {\n if (x_offset < 0L)\n u=((x+x_offset) < 0L) ? x+x_offset+(ssize_t) width : x+x_offset;\n else\n u=((x+x_offset) > ((ssize_t) width-1L)) ? x+x_offset-(ssize_t) width :\n x+x_offset;\n source_pixels[v*width+u]=roll_pixels[i++];\n }\n }\n (void) memcpy(roll_pixels,source_pixels,height*width*\n sizeof(*source_pixels));\n source_info=RelinquishVirtualMemory(source_info);\n return(MagickTrue);\n}",
"static MagickBooleanType ForwardQuadrantSwap(const size_t width,\n const size_t height,double *source_pixels,double *forward_pixels)\n{\n MagickBooleanType\n status;",
" register ssize_t\n x;",
" ssize_t\n center,\n y;",
" /*\n Swap quadrants.\n */\n center=(ssize_t) (width/2L)+1L;\n status=RollFourier((size_t) center,height,0L,(ssize_t) height/2L,\n source_pixels);\n if (status == MagickFalse)\n return(MagickFalse);\n for (y=0L; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L); x++)\n forward_pixels[y*width+x+width/2L]=source_pixels[y*center+x];\n for (y=1; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L); x++)\n forward_pixels[(height-y)*width+width/2L-x-1L]=\n source_pixels[y*center+x+1L];\n for (x=0L; x < (ssize_t) (width/2L); x++)\n forward_pixels[width/2L-x-1L]=source_pixels[x+1L];\n return(MagickTrue);\n}",
"static void CorrectPhaseLHS(const size_t width,const size_t height,\n double *fourier_pixels)\n{\n register ssize_t\n x;",
" ssize_t\n y;",
" for (y=0L; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L); x++)\n fourier_pixels[y*width+x]*=(-1.0);\n}",
"static MagickBooleanType ForwardFourier(const FourierInfo *fourier_info,\n Image *image,double *magnitude,double *phase,ExceptionInfo *exception)\n{\n CacheView\n *magnitude_view,\n *phase_view;",
" double\n *magnitude_pixels,\n *phase_pixels;",
" Image\n *magnitude_image,\n *phase_image;",
" MagickBooleanType\n status;",
" MemoryInfo\n *magnitude_info,\n *phase_info;",
" register Quantum\n *q;",
" register ssize_t\n x;",
" ssize_t\n i,\n y;",
" magnitude_image=GetFirstImageInList(image);\n phase_image=GetNextImageInList(image);\n if (phase_image == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n /*\n Create \"Fourier Transform\" image from constituent arrays.\n */\n magnitude_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*magnitude_pixels));\n phase_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*phase_pixels));\n if ((magnitude_info == (MemoryInfo *) NULL) ||\n (phase_info == (MemoryInfo *) NULL))\n {\n if (phase_info != (MemoryInfo *) NULL)\n phase_info=RelinquishVirtualMemory(phase_info);\n if (magnitude_info != (MemoryInfo *) NULL)\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n magnitude_pixels=(double *) GetVirtualMemoryBlob(magnitude_info);\n (void) memset(magnitude_pixels,0,fourier_info->width*\n fourier_info->height*sizeof(*magnitude_pixels));\n phase_pixels=(double *) GetVirtualMemoryBlob(phase_info);\n (void) memset(phase_pixels,0,fourier_info->width*\n fourier_info->height*sizeof(*phase_pixels));\n status=ForwardQuadrantSwap(fourier_info->width,fourier_info->height,\n magnitude,magnitude_pixels);\n if (status != MagickFalse)\n status=ForwardQuadrantSwap(fourier_info->width,fourier_info->height,phase,\n phase_pixels);\n CorrectPhaseLHS(fourier_info->width,fourier_info->height,phase_pixels);\n if (fourier_info->modulus != MagickFalse)\n {\n i=0L;\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n phase_pixels[i]/=(2.0*MagickPI);\n phase_pixels[i]+=0.5;\n i++;\n }\n }\n magnitude_view=AcquireAuthenticCacheView(magnitude_image,exception);\n i=0L;\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n q=GetCacheViewAuthenticPixels(magnitude_view,0L,y,fourier_info->width,1UL,\n exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n SetPixelRed(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case GreenPixelChannel:\n {\n SetPixelGreen(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case BluePixelChannel:\n {\n SetPixelBlue(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case BlackPixelChannel:\n {\n SetPixelBlack(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case AlphaPixelChannel:\n {\n SetPixelAlpha(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n }\n i++;\n q+=GetPixelChannels(magnitude_image);\n }\n status=SyncCacheViewAuthenticPixels(magnitude_view,exception);\n if (status == MagickFalse)\n break;\n }\n magnitude_view=DestroyCacheView(magnitude_view);\n i=0L;\n phase_view=AcquireAuthenticCacheView(phase_image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n q=GetCacheViewAuthenticPixels(phase_view,0L,y,fourier_info->width,1UL,\n exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n SetPixelRed(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case GreenPixelChannel:\n {\n SetPixelGreen(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case BluePixelChannel:\n {\n SetPixelBlue(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case BlackPixelChannel:\n {\n SetPixelBlack(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case AlphaPixelChannel:\n {\n SetPixelAlpha(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n }\n i++;\n q+=GetPixelChannels(phase_image);\n }\n status=SyncCacheViewAuthenticPixels(phase_view,exception);\n if (status == MagickFalse)\n break;\n }\n phase_view=DestroyCacheView(phase_view);\n phase_info=RelinquishVirtualMemory(phase_info);\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n return(status);\n}",
"static MagickBooleanType ForwardFourierTransform(FourierInfo *fourier_info,\n const Image *image,double *magnitude_pixels,double *phase_pixels,\n ExceptionInfo *exception)\n{\n CacheView\n *image_view;",
" const char\n *value;",
" double\n *source_pixels;",
" fftw_complex\n *forward_pixels;",
" fftw_plan\n fftw_r2c_plan;",
" MemoryInfo\n *forward_info,\n *source_info;",
" register const Quantum\n *p;",
" register ssize_t\n i,\n x;",
" ssize_t\n y;",
" /*\n Generate the forward Fourier transform.\n */\n source_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*source_pixels));\n if (source_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n source_pixels=(double *) GetVirtualMemoryBlob(source_info);\n memset(source_pixels,0,fourier_info->width*fourier_info->height*\n sizeof(*source_pixels));\n i=0L;\n image_view=AcquireVirtualCacheView(image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n p=GetCacheViewVirtualPixels(image_view,0L,y,fourier_info->width,1UL,\n exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n source_pixels[i]=QuantumScale*GetPixelRed(image,p);\n break;\n }\n case GreenPixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelGreen(image,p);\n break;\n }\n case BluePixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelBlue(image,p);\n break;\n }\n case BlackPixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelBlack(image,p);\n break;\n }\n case AlphaPixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelAlpha(image,p);\n break;\n }\n }\n i++;\n p+=GetPixelChannels(image);\n }\n }\n image_view=DestroyCacheView(image_view);\n forward_info=AcquireVirtualMemory((size_t) fourier_info->width,\n (fourier_info->height/2+1)*sizeof(*forward_pixels));\n if (forward_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n source_info=(MemoryInfo *) RelinquishVirtualMemory(source_info);\n return(MagickFalse);\n }\n forward_pixels=(fftw_complex *) GetVirtualMemoryBlob(forward_info);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_ForwardFourierTransform)\n#endif\n fftw_r2c_plan=fftw_plan_dft_r2c_2d(fourier_info->width,fourier_info->height,\n source_pixels,forward_pixels,FFTW_ESTIMATE);\n fftw_execute_dft_r2c(fftw_r2c_plan,source_pixels,forward_pixels);\n fftw_destroy_plan(fftw_r2c_plan);\n source_info=(MemoryInfo *) RelinquishVirtualMemory(source_info);\n value=GetImageArtifact(image,\"fourier:normalize\");\n if ((value == (const char *) NULL) || (LocaleCompare(value,\"forward\") == 0))\n {\n double\n gamma;",
" /*\n Normalize fourier transform.\n */\n i=0L;\n gamma=PerceptibleReciprocal((double) fourier_info->width*\n fourier_info->height);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n forward_pixels[i]*=gamma;\n#else\n forward_pixels[i][0]*=gamma;\n forward_pixels[i][1]*=gamma;\n#endif\n i++;\n }\n }\n /*\n Generate magnitude and phase (or real and imaginary).\n */\n i=0L;\n if (fourier_info->modulus != MagickFalse)\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n magnitude_pixels[i]=cabs(forward_pixels[i]);\n phase_pixels[i]=carg(forward_pixels[i]);\n i++;\n }\n else\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n magnitude_pixels[i]=creal(forward_pixels[i]);\n phase_pixels[i]=cimag(forward_pixels[i]);\n i++;\n }\n forward_info=(MemoryInfo *) RelinquishVirtualMemory(forward_info);\n return(MagickTrue);\n}",
"static MagickBooleanType ForwardFourierTransformChannel(const Image *image,\n const PixelChannel channel,const MagickBooleanType modulus,\n Image *fourier_image,ExceptionInfo *exception)\n{\n double\n *magnitude_pixels,\n *phase_pixels;",
" FourierInfo\n fourier_info;",
" MagickBooleanType\n status;",
" MemoryInfo\n *magnitude_info,\n *phase_info;",
" fourier_info.width=image->columns;\n fourier_info.height=image->rows;\n if ((image->columns != image->rows) || ((image->columns % 2) != 0) ||\n ((image->rows % 2) != 0))\n {\n size_t extent=image->columns < image->rows ? image->rows : image->columns;\n fourier_info.width=(extent & 0x01) == 1 ? extent+1UL : extent;\n }\n fourier_info.height=fourier_info.width;\n fourier_info.center=(ssize_t) (fourier_info.width/2L)+1L;\n fourier_info.channel=channel;\n fourier_info.modulus=modulus;\n magnitude_info=AcquireVirtualMemory((size_t) fourier_info.width,\n (fourier_info.height/2+1)*sizeof(*magnitude_pixels));\n phase_info=AcquireVirtualMemory((size_t) fourier_info.width,\n (fourier_info.height/2+1)*sizeof(*phase_pixels));\n if ((magnitude_info == (MemoryInfo *) NULL) ||\n (phase_info == (MemoryInfo *) NULL))\n {\n if (phase_info != (MemoryInfo *) NULL)\n phase_info=RelinquishVirtualMemory(phase_info);\n if (magnitude_info == (MemoryInfo *) NULL)\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n magnitude_pixels=(double *) GetVirtualMemoryBlob(magnitude_info);\n phase_pixels=(double *) GetVirtualMemoryBlob(phase_info);\n status=ForwardFourierTransform(&fourier_info,image,magnitude_pixels,\n phase_pixels,exception);\n if (status != MagickFalse)\n status=ForwardFourier(&fourier_info,fourier_image,magnitude_pixels,\n phase_pixels,exception);\n phase_info=RelinquishVirtualMemory(phase_info);\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n return(status);\n}\n#endif",
"MagickExport Image *ForwardFourierTransformImage(const Image *image,\n const MagickBooleanType modulus,ExceptionInfo *exception)\n{\n Image\n *fourier_image;",
" fourier_image=NewImageList();\n#if !defined(MAGICKCORE_FFTW_DELEGATE)\n (void) modulus;\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\"`%s' (FFTW)\",\n image->filename);\n#else\n {\n Image\n *magnitude_image;",
" size_t\n height,\n width;",
" width=image->columns;\n height=image->rows;\n if ((image->columns != image->rows) || ((image->columns % 2) != 0) ||\n ((image->rows % 2) != 0))\n {\n size_t extent=image->columns < image->rows ? image->rows :\n image->columns;\n width=(extent & 0x01) == 1 ? extent+1UL : extent;\n }\n height=width;\n magnitude_image=CloneImage(image,width,height,MagickTrue,exception);\n if (magnitude_image != (Image *) NULL)\n {\n Image\n *phase_image;",
" magnitude_image->storage_class=DirectClass;\n magnitude_image->depth=32UL;\n phase_image=CloneImage(image,width,height,MagickTrue,exception);\n if (phase_image == (Image *) NULL)\n magnitude_image=DestroyImage(magnitude_image);\n else\n {\n MagickBooleanType\n is_gray,\n status;",
" phase_image->storage_class=DirectClass;\n phase_image->depth=32UL;\n AppendImageToList(&fourier_image,magnitude_image);\n AppendImageToList(&fourier_image,phase_image);\n status=MagickTrue;\n is_gray=IsImageGray(image);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel sections\n#endif\n {\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" if (is_gray != MagickFalse)\n thread_status=ForwardFourierTransformChannel(image,\n GrayPixelChannel,modulus,fourier_image,exception);\n else\n thread_status=ForwardFourierTransformChannel(image,\n RedPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=ForwardFourierTransformChannel(image,\n GreenPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=ForwardFourierTransformChannel(image,\n BluePixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (image->colorspace == CMYKColorspace)\n thread_status=ForwardFourierTransformChannel(image,\n BlackPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (image->alpha_trait != UndefinedPixelTrait)\n thread_status=ForwardFourierTransformChannel(image,\n AlphaPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n }\n if (status == MagickFalse)\n fourier_image=DestroyImageList(fourier_image);\n fftw_cleanup();\n }\n }\n }\n#endif\n return(fourier_image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I n v e r s e F o u r i e r T r a n s f o r m I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% InverseFourierTransformImage() implements the inverse discrete Fourier\n% transform (DFT) of the image either as a magnitude / phase or real /\n% imaginary image pair.\n%\n% The format of the InverseFourierTransformImage method is:\n%\n% Image *InverseFourierTransformImage(const Image *magnitude_image,\n% const Image *phase_image,const MagickBooleanType modulus,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o magnitude_image: the magnitude or real image.\n%\n% o phase_image: the phase or imaginary image.\n%\n% o modulus: if true, return transform as a magnitude / phase pair\n% otherwise a real / imaginary image pair.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"#if defined(MAGICKCORE_FFTW_DELEGATE)\nstatic MagickBooleanType InverseQuadrantSwap(const size_t width,\n const size_t height,const double *source,double *destination)\n{\n register ssize_t\n x;",
" ssize_t\n center,\n y;",
" /*\n Swap quadrants.\n */\n center=(ssize_t) (width/2L)+1L;\n for (y=1L; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L+1L); x++)\n destination[(height-y)*center-x+width/2L]=source[y*width+x];\n for (y=0L; y < (ssize_t) height; y++)\n destination[y*center]=source[y*width+width/2L];\n for (x=0L; x < center; x++)\n destination[x]=source[center-x-1L];\n return(RollFourier(center,height,0L,(ssize_t) height/-2L,destination));\n}",
"static MagickBooleanType InverseFourier(FourierInfo *fourier_info,\n const Image *magnitude_image,const Image *phase_image,\n fftw_complex *fourier_pixels,ExceptionInfo *exception)\n{\n CacheView\n *magnitude_view,\n *phase_view;",
" double\n *inverse_pixels,\n *magnitude_pixels,\n *phase_pixels;",
" MagickBooleanType\n status;",
" MemoryInfo\n *inverse_info,\n *magnitude_info,\n *phase_info;",
" register const Quantum\n *p;",
" register ssize_t\n i,\n x;",
" ssize_t\n y;",
" /*\n Inverse fourier - read image and break down into a double array.\n */\n magnitude_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*magnitude_pixels));\n phase_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*phase_pixels));\n inverse_info=AcquireVirtualMemory((size_t) fourier_info->width,\n (fourier_info->height/2+1)*sizeof(*inverse_pixels));\n if ((magnitude_info == (MemoryInfo *) NULL) ||\n (phase_info == (MemoryInfo *) NULL) ||\n (inverse_info == (MemoryInfo *) NULL))\n {\n if (magnitude_info != (MemoryInfo *) NULL)\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n if (phase_info != (MemoryInfo *) NULL)\n phase_info=RelinquishVirtualMemory(phase_info);\n if (inverse_info != (MemoryInfo *) NULL)\n inverse_info=RelinquishVirtualMemory(inverse_info);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\n magnitude_image->filename);\n return(MagickFalse);\n }\n magnitude_pixels=(double *) GetVirtualMemoryBlob(magnitude_info);\n phase_pixels=(double *) GetVirtualMemoryBlob(phase_info);\n inverse_pixels=(double *) GetVirtualMemoryBlob(inverse_info);\n i=0L;\n magnitude_view=AcquireVirtualCacheView(magnitude_image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n p=GetCacheViewVirtualPixels(magnitude_view,0L,y,fourier_info->width,1UL,\n exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelRed(magnitude_image,p);\n break;\n }\n case GreenPixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelGreen(magnitude_image,p);\n break;\n }\n case BluePixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelBlue(magnitude_image,p);\n break;\n }\n case BlackPixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelBlack(magnitude_image,p);\n break;\n }\n case AlphaPixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelAlpha(magnitude_image,p);\n break;\n }\n }\n i++;\n p+=GetPixelChannels(magnitude_image);\n }\n }\n magnitude_view=DestroyCacheView(magnitude_view);\n status=InverseQuadrantSwap(fourier_info->width,fourier_info->height,\n magnitude_pixels,inverse_pixels);\n (void) memcpy(magnitude_pixels,inverse_pixels,fourier_info->height*\n fourier_info->center*sizeof(*magnitude_pixels));\n i=0L;\n phase_view=AcquireVirtualCacheView(phase_image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n p=GetCacheViewVirtualPixels(phase_view,0,y,fourier_info->width,1,\n exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n phase_pixels[i]=QuantumScale*GetPixelRed(phase_image,p);\n break;\n }\n case GreenPixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelGreen(phase_image,p);\n break;\n }\n case BluePixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelBlue(phase_image,p);\n break;\n }\n case BlackPixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelBlack(phase_image,p);\n break;\n }\n case AlphaPixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelAlpha(phase_image,p);\n break;\n }\n }\n i++;\n p+=GetPixelChannels(phase_image);\n }\n }\n if (fourier_info->modulus != MagickFalse)\n {\n i=0L;\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n phase_pixels[i]-=0.5;\n phase_pixels[i]*=(2.0*MagickPI);\n i++;\n }\n }\n phase_view=DestroyCacheView(phase_view);\n CorrectPhaseLHS(fourier_info->width,fourier_info->height,phase_pixels);\n if (status != MagickFalse)\n status=InverseQuadrantSwap(fourier_info->width,fourier_info->height,\n phase_pixels,inverse_pixels);\n (void) memcpy(phase_pixels,inverse_pixels,fourier_info->height*\n fourier_info->center*sizeof(*phase_pixels));\n inverse_info=RelinquishVirtualMemory(inverse_info);\n /*\n Merge two sets.\n */\n i=0L;\n if (fourier_info->modulus != MagickFalse)\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n fourier_pixels[i]=magnitude_pixels[i]*cos(phase_pixels[i])+I*\n magnitude_pixels[i]*sin(phase_pixels[i]);\n#else\n fourier_pixels[i][0]=magnitude_pixels[i]*cos(phase_pixels[i]);\n fourier_pixels[i][1]=magnitude_pixels[i]*sin(phase_pixels[i]);\n#endif\n i++;\n }\n else\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n fourier_pixels[i]=magnitude_pixels[i]+I*phase_pixels[i];\n#else\n fourier_pixels[i][0]=magnitude_pixels[i];\n fourier_pixels[i][1]=phase_pixels[i];\n#endif\n i++;\n }\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n phase_info=RelinquishVirtualMemory(phase_info);\n return(status);\n}",
"static MagickBooleanType InverseFourierTransform(FourierInfo *fourier_info,\n fftw_complex *fourier_pixels,Image *image,ExceptionInfo *exception)\n{\n CacheView\n *image_view;",
" const char\n *value;",
" double\n *source_pixels;",
" fftw_plan\n fftw_c2r_plan;",
" MemoryInfo\n *source_info;",
" register Quantum\n *q;",
" register ssize_t\n i,\n x;",
" ssize_t\n y;",
" source_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*source_pixels));\n if (source_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n source_pixels=(double *) GetVirtualMemoryBlob(source_info);\n value=GetImageArtifact(image,\"fourier:normalize\");\n if (LocaleCompare(value,\"inverse\") == 0)\n {\n double\n gamma;",
" /*\n Normalize inverse transform.\n */\n i=0L;\n gamma=PerceptibleReciprocal((double) fourier_info->width*\n fourier_info->height);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n fourier_pixels[i]*=gamma;\n#else\n fourier_pixels[i][0]*=gamma;\n fourier_pixels[i][1]*=gamma;\n#endif\n i++;\n }\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_InverseFourierTransform)\n#endif\n fftw_c2r_plan=fftw_plan_dft_c2r_2d(fourier_info->width,fourier_info->height,\n fourier_pixels,source_pixels,FFTW_ESTIMATE);\n fftw_execute_dft_c2r(fftw_c2r_plan,fourier_pixels,source_pixels);\n fftw_destroy_plan(fftw_c2r_plan);\n i=0L;\n image_view=AcquireAuthenticCacheView(image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n if (y >= (ssize_t) image->rows)\n break;\n q=GetCacheViewAuthenticPixels(image_view,0L,y,fourier_info->width >\n image->columns ? image->columns : fourier_info->width,1UL,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n if (x < (ssize_t) image->columns)\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n SetPixelRed(image,ClampToQuantum(QuantumRange*source_pixels[i]),q);\n break;\n }\n case GreenPixelChannel:\n {\n SetPixelGreen(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n case BluePixelChannel:\n {\n SetPixelBlue(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n case BlackPixelChannel:\n {\n SetPixelBlack(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n case AlphaPixelChannel:\n {\n SetPixelAlpha(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n }\n i++;\n q+=GetPixelChannels(image);\n }\n if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)\n break;\n }\n image_view=DestroyCacheView(image_view);\n source_info=RelinquishVirtualMemory(source_info);\n return(MagickTrue);\n}",
"static MagickBooleanType InverseFourierTransformChannel(\n const Image *magnitude_image,const Image *phase_image,\n const PixelChannel channel,const MagickBooleanType modulus,\n Image *fourier_image,ExceptionInfo *exception)\n{\n fftw_complex\n *inverse_pixels;",
" FourierInfo\n fourier_info;",
" MagickBooleanType\n status;",
" MemoryInfo\n *inverse_info;",
" fourier_info.width=magnitude_image->columns;\n fourier_info.height=magnitude_image->rows;\n if ((magnitude_image->columns != magnitude_image->rows) ||\n ((magnitude_image->columns % 2) != 0) ||\n ((magnitude_image->rows % 2) != 0))\n {\n size_t extent=magnitude_image->columns < magnitude_image->rows ?\n magnitude_image->rows : magnitude_image->columns;\n fourier_info.width=(extent & 0x01) == 1 ? extent+1UL : extent;\n }\n fourier_info.height=fourier_info.width;\n fourier_info.center=(ssize_t) (fourier_info.width/2L)+1L;\n fourier_info.channel=channel;\n fourier_info.modulus=modulus;\n inverse_info=AcquireVirtualMemory((size_t) fourier_info.width,\n (fourier_info.height/2+1)*sizeof(*inverse_pixels));\n if (inverse_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\n magnitude_image->filename);\n return(MagickFalse);\n }\n inverse_pixels=(fftw_complex *) GetVirtualMemoryBlob(inverse_info);\n status=InverseFourier(&fourier_info,magnitude_image,phase_image,\n inverse_pixels,exception);\n if (status != MagickFalse)\n status=InverseFourierTransform(&fourier_info,inverse_pixels,fourier_image,\n exception);\n inverse_info=RelinquishVirtualMemory(inverse_info);\n return(status);\n}\n#endif",
"MagickExport Image *InverseFourierTransformImage(const Image *magnitude_image,\n const Image *phase_image,const MagickBooleanType modulus,\n ExceptionInfo *exception)\n{\n Image\n *fourier_image;",
" assert(magnitude_image != (Image *) NULL);\n assert(magnitude_image->signature == MagickCoreSignature);\n if (magnitude_image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n magnitude_image->filename);\n if (phase_image == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",magnitude_image->filename);\n return((Image *) NULL);\n }\n#if !defined(MAGICKCORE_FFTW_DELEGATE)\n fourier_image=(Image *) NULL;\n (void) modulus;\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\"`%s' (FFTW)\",\n magnitude_image->filename);\n#else\n {\n fourier_image=CloneImage(magnitude_image,magnitude_image->columns,\n magnitude_image->rows,MagickTrue,exception);\n if (fourier_image != (Image *) NULL)\n {\n MagickBooleanType\n is_gray,\n status;",
" status=MagickTrue;\n is_gray=IsImageGray(magnitude_image);\n if (is_gray != MagickFalse)\n is_gray=IsImageGray(phase_image);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel sections\n#endif\n {\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" if (is_gray != MagickFalse)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,GrayPixelChannel,modulus,fourier_image,exception);\n else\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,RedPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,GreenPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,BluePixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (magnitude_image->colorspace == CMYKColorspace)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,BlackPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (magnitude_image->alpha_trait != UndefinedPixelTrait)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,AlphaPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n }\n if (status == MagickFalse)\n fourier_image=DestroyImage(fourier_image);\n }\n fftw_cleanup();\n }\n#endif\n return(fourier_image);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [310, 689], "buggy_code_start_loc": [232, 681], "filenames": ["MagickCore/fourier.c", "coders/gif.c"], "fixing_code_end_loc": [306, 691], "fixing_code_start_loc": [232, 682], "message": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:7.0.8-50:q16:*:*:*:*:*:*", "matchCriteriaId": "25CCEA99-8329-46C6-9625-4FE15F24CF69", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.04:*:*:*:*:*:*:*", "matchCriteriaId": "CD783B0C-9246-47D9-A937-6144FE8BFF0F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "F1E78106-58E6-4D59-990F-75DA575BFAD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage."}, {"lang": "es", "value": "ImageMagick versi\u00f3n 7.0.8-50 Q16 presenta una vulnerabilidad de desbordamiento de b\u00fafer basado en memoria din\u00e1mica (heap) en MagickCore/fourier.c en ComplexImage."}], "evaluatorComment": null, "id": "CVE-2019-13308", "lastModified": "2023-03-02T15:56:47.600", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-07-05T01:15:10.750", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00069.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/issues/1595"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick6/commit/19651f3db63fa1511ed83a348c4c82fa553f8d01"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/09/msg00007.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4192-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4712"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, "type": "CWE-787"}
| 102
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% FFFFF OOO U U RRRR IIIII EEEEE RRRR %\n% F O O U U R R I E R R %\n% FFF O O U U RRRR I EEE RRRR %\n% F O O U U R R I E R R %\n% F OOO UUU R R IIIII EEEEE R R %\n% %\n% %\n% MagickCore Discrete Fourier Transform Methods %\n% %\n% Software Design %\n% Sean Burke %\n% Fred Weinhaus %\n% Cristy %\n% July 2009 %\n% %\n% %\n% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/artifact.h\"\n#include \"MagickCore/attribute.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/image.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/fourier.h\"\n#include \"MagickCore/log.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/monitor.h\"\n#include \"MagickCore/monitor-private.h\"\n#include \"MagickCore/pixel-accessor.h\"\n#include \"MagickCore/pixel-private.h\"\n#include \"MagickCore/property.h\"\n#include \"MagickCore/quantum-private.h\"\n#include \"MagickCore/resource_.h\"\n#include \"MagickCore/string-private.h\"\n#include \"MagickCore/thread-private.h\"\n#if defined(MAGICKCORE_FFTW_DELEGATE)\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n#include <complex.h>\n#endif\n#include <fftw3.h>\n#if !defined(MAGICKCORE_HAVE_CABS)\n#define cabs(z) (sqrt(z[0]*z[0]+z[1]*z[1]))\n#endif\n#if !defined(MAGICKCORE_HAVE_CARG)\n#define carg(z) (atan2(cimag(z),creal(z)))\n#endif\n#if !defined(MAGICKCORE_HAVE_CIMAG)\n#define cimag(z) (z[1])\n#endif\n#if !defined(MAGICKCORE_HAVE_CREAL)\n#define creal(z) (z[0])\n#endif\n#endif\n\f\n/*\n Typedef declarations.\n*/\ntypedef struct _FourierInfo\n{\n PixelChannel\n channel;",
" MagickBooleanType\n modulus;",
" size_t\n width,\n height;",
" ssize_t\n center;\n} FourierInfo;\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% C o m p l e x I m a g e s %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ComplexImages() performs complex mathematics on an image sequence.\n%\n% The format of the ComplexImages method is:\n%\n% MagickBooleanType ComplexImages(Image *images,const ComplexOperator op,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o op: A complex operator.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nMagickExport Image *ComplexImages(const Image *images,const ComplexOperator op,\n ExceptionInfo *exception)\n{\n#define ComplexImageTag \"Complex/Image\"",
" CacheView\n *Ai_view,\n *Ar_view,\n *Bi_view,\n *Br_view,\n *Ci_view,\n *Cr_view;",
" const char\n *artifact;",
" const Image\n *Ai_image,\n *Ar_image,\n *Bi_image,\n *Br_image;",
" double\n snr;",
" Image\n *Ci_image,\n *complex_images,\n *Cr_image,\n *image;",
" MagickBooleanType\n status;",
" MagickOffsetType\n progress;",
" ssize_t\n y;",
" assert(images != (Image *) NULL);\n assert(images->signature == MagickCoreSignature);\n if (images->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",images->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n if (images->next == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",images->filename);\n return((Image *) NULL);\n }\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n return((Image *) NULL);\n if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)\n {\n image=DestroyImageList(image);\n return(image);\n }\n image->depth=32UL;\n complex_images=NewImageList();\n AppendImageToList(&complex_images,image);\n image=CloneImage(images,0,0,MagickTrue,exception);\n if (image == (Image *) NULL)\n {\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n }\n AppendImageToList(&complex_images,image);\n /*\n Apply complex mathematics to image pixels.\n */\n artifact=GetImageArtifact(image,\"complex:snr\");\n snr=0.0;\n if (artifact != (const char *) NULL)\n snr=StringToDouble(artifact,(char **) NULL);\n Ar_image=images;\n Ai_image=images->next;\n Br_image=images;\n Bi_image=images->next;\n if ((images->next->next != (Image *) NULL) &&\n (images->next->next->next != (Image *) NULL))\n {\n Br_image=images->next->next;\n Bi_image=images->next->next->next;\n }\n Cr_image=complex_images;\n Ci_image=complex_images->next;\n Ar_view=AcquireVirtualCacheView(Ar_image,exception);\n Ai_view=AcquireVirtualCacheView(Ai_image,exception);\n Br_view=AcquireVirtualCacheView(Br_image,exception);\n Bi_view=AcquireVirtualCacheView(Bi_image,exception);\n Cr_view=AcquireAuthenticCacheView(Cr_image,exception);\n Ci_view=AcquireAuthenticCacheView(Ci_image,exception);\n status=MagickTrue;\n progress=0;\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel for schedule(static) shared(progress,status) \\",
" magick_number_threads(Cr_image,complex_images,Cr_image->rows,1L)\n#endif\n for (y=0; y < (ssize_t) Cr_image->rows; y++)",
" {\n register const Quantum\n *magick_restrict Ai,\n *magick_restrict Ar,\n *magick_restrict Bi,\n *magick_restrict Br;",
" register Quantum\n *magick_restrict Ci,\n *magick_restrict Cr;",
" register ssize_t\n x;",
" if (status == MagickFalse)\n continue;",
" Ar=GetCacheViewVirtualPixels(Ar_view,0,y,Cr_image->columns,1,exception);\n Ai=GetCacheViewVirtualPixels(Ai_view,0,y,Cr_image->columns,1,exception);\n Br=GetCacheViewVirtualPixels(Br_view,0,y,Cr_image->columns,1,exception);\n Bi=GetCacheViewVirtualPixels(Bi_view,0,y,Cr_image->columns,1,exception);",
" Cr=QueueCacheViewAuthenticPixels(Cr_view,0,y,Cr_image->columns,1,exception);\n Ci=QueueCacheViewAuthenticPixels(Ci_view,0,y,Ci_image->columns,1,exception);\n if ((Ar == (const Quantum *) NULL) || (Ai == (const Quantum *) NULL) || \n (Br == (const Quantum *) NULL) || (Bi == (const Quantum *) NULL) ||\n (Cr == (Quantum *) NULL) || (Ci == (Quantum *) NULL))\n {\n status=MagickFalse;\n continue;\n }",
" for (x=0; x < (ssize_t) Cr_image->columns; x++)",
" {\n register ssize_t\n i;\n",
" for (i=0; i < (ssize_t) GetPixelChannels(Cr_image); i++)",
" {\n switch (op)\n {\n case AddComplexOperator:\n {\n Cr[i]=Ar[i]+Br[i];\n Ci[i]=Ai[i]+Bi[i];\n break;\n }\n case ConjugateComplexOperator:\n default:\n {\n Cr[i]=Ar[i];\n Ci[i]=(-Bi[i]);\n break;\n }\n case DivideComplexOperator:\n {\n double\n gamma;\n",
" gamma=PerceptibleReciprocal((double) Br[i]*Br[i]+Bi[i]*Bi[i]+snr);\n Cr[i]=gamma*((double) Ar[i]*Br[i]+(double) Ai[i]*Bi[i]);\n Ci[i]=gamma*((double) Ai[i]*Br[i]-(double) Ar[i]*Bi[i]);",
" break;\n }\n case MagnitudePhaseComplexOperator:\n {",
" Cr[i]=sqrt((double) Ar[i]*Ar[i]+(double) Ai[i]*Ai[i]);\n Ci[i]=atan2((double) Ai[i],(double) Ar[i])/(2.0*MagickPI)+0.5;",
" break;\n }\n case MultiplyComplexOperator:\n {",
" Cr[i]=QuantumScale*((double) Ar[i]*Br[i]-(double) Ai[i]*Bi[i]);\n Ci[i]=QuantumScale*((double) Ai[i]*Br[i]+(double) Ar[i]*Bi[i]);",
" break;\n }\n case RealImaginaryComplexOperator:\n {\n Cr[i]=Ar[i]*cos(2.0*MagickPI*(Ai[i]-0.5));\n Ci[i]=Ar[i]*sin(2.0*MagickPI*(Ai[i]-0.5));\n break;\n }\n case SubtractComplexOperator:\n {\n Cr[i]=Ar[i]-Br[i];\n Ci[i]=Ai[i]-Bi[i];\n break;\n }\n }\n }\n Ar+=GetPixelChannels(Ar_image);\n Ai+=GetPixelChannels(Ai_image);\n Br+=GetPixelChannels(Br_image);\n Bi+=GetPixelChannels(Bi_image);\n Cr+=GetPixelChannels(Cr_image);\n Ci+=GetPixelChannels(Ci_image);\n }\n if (SyncCacheViewAuthenticPixels(Ci_view,exception) == MagickFalse)\n status=MagickFalse;\n if (SyncCacheViewAuthenticPixels(Cr_view,exception) == MagickFalse)\n status=MagickFalse;\n if (images->progress_monitor != (MagickProgressMonitor) NULL)\n {\n MagickBooleanType\n proceed;",
"#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp atomic\n#endif\n progress++;\n proceed=SetImageProgress(images,ComplexImageTag,progress,images->rows);\n if (proceed == MagickFalse)\n status=MagickFalse;\n }\n }\n Cr_view=DestroyCacheView(Cr_view);\n Ci_view=DestroyCacheView(Ci_view);\n Br_view=DestroyCacheView(Br_view);\n Bi_view=DestroyCacheView(Bi_view);\n Ar_view=DestroyCacheView(Ar_view);\n Ai_view=DestroyCacheView(Ai_view);\n if (status == MagickFalse)\n complex_images=DestroyImageList(complex_images);\n return(complex_images);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% F o r w a r d F o u r i e r T r a n s f o r m I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ForwardFourierTransformImage() implements the discrete Fourier transform\n% (DFT) of the image either as a magnitude / phase or real / imaginary image\n% pair.\n%\n% The format of the ForwadFourierTransformImage method is:\n%\n% Image *ForwardFourierTransformImage(const Image *image,\n% const MagickBooleanType modulus,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o modulus: if true, return as transform as a magnitude / phase pair\n% otherwise a real / imaginary image pair.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"#if defined(MAGICKCORE_FFTW_DELEGATE)",
"static MagickBooleanType RollFourier(const size_t width,const size_t height,\n const ssize_t x_offset,const ssize_t y_offset,double *roll_pixels)\n{\n double\n *source_pixels;",
" MemoryInfo\n *source_info;",
" register ssize_t\n i,\n x;",
" ssize_t\n u,\n v,\n y;",
" /*\n Move zero frequency (DC, average color) from (0,0) to (width/2,height/2).\n */\n source_info=AcquireVirtualMemory(width,height*sizeof(*source_pixels));\n if (source_info == (MemoryInfo *) NULL)\n return(MagickFalse);\n source_pixels=(double *) GetVirtualMemoryBlob(source_info);\n i=0L;\n for (y=0L; y < (ssize_t) height; y++)\n {\n if (y_offset < 0L)\n v=((y+y_offset) < 0L) ? y+y_offset+(ssize_t) height : y+y_offset;\n else\n v=((y+y_offset) > ((ssize_t) height-1L)) ? y+y_offset-(ssize_t) height :\n y+y_offset;\n for (x=0L; x < (ssize_t) width; x++)\n {\n if (x_offset < 0L)\n u=((x+x_offset) < 0L) ? x+x_offset+(ssize_t) width : x+x_offset;\n else\n u=((x+x_offset) > ((ssize_t) width-1L)) ? x+x_offset-(ssize_t) width :\n x+x_offset;\n source_pixels[v*width+u]=roll_pixels[i++];\n }\n }\n (void) memcpy(roll_pixels,source_pixels,height*width*\n sizeof(*source_pixels));\n source_info=RelinquishVirtualMemory(source_info);\n return(MagickTrue);\n}",
"static MagickBooleanType ForwardQuadrantSwap(const size_t width,\n const size_t height,double *source_pixels,double *forward_pixels)\n{\n MagickBooleanType\n status;",
" register ssize_t\n x;",
" ssize_t\n center,\n y;",
" /*\n Swap quadrants.\n */\n center=(ssize_t) (width/2L)+1L;\n status=RollFourier((size_t) center,height,0L,(ssize_t) height/2L,\n source_pixels);\n if (status == MagickFalse)\n return(MagickFalse);\n for (y=0L; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L); x++)\n forward_pixels[y*width+x+width/2L]=source_pixels[y*center+x];\n for (y=1; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L); x++)\n forward_pixels[(height-y)*width+width/2L-x-1L]=\n source_pixels[y*center+x+1L];\n for (x=0L; x < (ssize_t) (width/2L); x++)\n forward_pixels[width/2L-x-1L]=source_pixels[x+1L];\n return(MagickTrue);\n}",
"static void CorrectPhaseLHS(const size_t width,const size_t height,\n double *fourier_pixels)\n{\n register ssize_t\n x;",
" ssize_t\n y;",
" for (y=0L; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L); x++)\n fourier_pixels[y*width+x]*=(-1.0);\n}",
"static MagickBooleanType ForwardFourier(const FourierInfo *fourier_info,\n Image *image,double *magnitude,double *phase,ExceptionInfo *exception)\n{\n CacheView\n *magnitude_view,\n *phase_view;",
" double\n *magnitude_pixels,\n *phase_pixels;",
" Image\n *magnitude_image,\n *phase_image;",
" MagickBooleanType\n status;",
" MemoryInfo\n *magnitude_info,\n *phase_info;",
" register Quantum\n *q;",
" register ssize_t\n x;",
" ssize_t\n i,\n y;",
" magnitude_image=GetFirstImageInList(image);\n phase_image=GetNextImageInList(image);\n if (phase_image == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n /*\n Create \"Fourier Transform\" image from constituent arrays.\n */\n magnitude_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*magnitude_pixels));\n phase_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*phase_pixels));\n if ((magnitude_info == (MemoryInfo *) NULL) ||\n (phase_info == (MemoryInfo *) NULL))\n {\n if (phase_info != (MemoryInfo *) NULL)\n phase_info=RelinquishVirtualMemory(phase_info);\n if (magnitude_info != (MemoryInfo *) NULL)\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n magnitude_pixels=(double *) GetVirtualMemoryBlob(magnitude_info);\n (void) memset(magnitude_pixels,0,fourier_info->width*\n fourier_info->height*sizeof(*magnitude_pixels));\n phase_pixels=(double *) GetVirtualMemoryBlob(phase_info);\n (void) memset(phase_pixels,0,fourier_info->width*\n fourier_info->height*sizeof(*phase_pixels));\n status=ForwardQuadrantSwap(fourier_info->width,fourier_info->height,\n magnitude,magnitude_pixels);\n if (status != MagickFalse)\n status=ForwardQuadrantSwap(fourier_info->width,fourier_info->height,phase,\n phase_pixels);\n CorrectPhaseLHS(fourier_info->width,fourier_info->height,phase_pixels);\n if (fourier_info->modulus != MagickFalse)\n {\n i=0L;\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n phase_pixels[i]/=(2.0*MagickPI);\n phase_pixels[i]+=0.5;\n i++;\n }\n }\n magnitude_view=AcquireAuthenticCacheView(magnitude_image,exception);\n i=0L;\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n q=GetCacheViewAuthenticPixels(magnitude_view,0L,y,fourier_info->width,1UL,\n exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n SetPixelRed(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case GreenPixelChannel:\n {\n SetPixelGreen(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case BluePixelChannel:\n {\n SetPixelBlue(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case BlackPixelChannel:\n {\n SetPixelBlack(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n case AlphaPixelChannel:\n {\n SetPixelAlpha(magnitude_image,ClampToQuantum(QuantumRange*\n magnitude_pixels[i]),q);\n break;\n }\n }\n i++;\n q+=GetPixelChannels(magnitude_image);\n }\n status=SyncCacheViewAuthenticPixels(magnitude_view,exception);\n if (status == MagickFalse)\n break;\n }\n magnitude_view=DestroyCacheView(magnitude_view);\n i=0L;\n phase_view=AcquireAuthenticCacheView(phase_image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n q=GetCacheViewAuthenticPixels(phase_view,0L,y,fourier_info->width,1UL,\n exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n SetPixelRed(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case GreenPixelChannel:\n {\n SetPixelGreen(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case BluePixelChannel:\n {\n SetPixelBlue(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case BlackPixelChannel:\n {\n SetPixelBlack(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n case AlphaPixelChannel:\n {\n SetPixelAlpha(phase_image,ClampToQuantum(QuantumRange*\n phase_pixels[i]),q);\n break;\n }\n }\n i++;\n q+=GetPixelChannels(phase_image);\n }\n status=SyncCacheViewAuthenticPixels(phase_view,exception);\n if (status == MagickFalse)\n break;\n }\n phase_view=DestroyCacheView(phase_view);\n phase_info=RelinquishVirtualMemory(phase_info);\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n return(status);\n}",
"static MagickBooleanType ForwardFourierTransform(FourierInfo *fourier_info,\n const Image *image,double *magnitude_pixels,double *phase_pixels,\n ExceptionInfo *exception)\n{\n CacheView\n *image_view;",
" const char\n *value;",
" double\n *source_pixels;",
" fftw_complex\n *forward_pixels;",
" fftw_plan\n fftw_r2c_plan;",
" MemoryInfo\n *forward_info,\n *source_info;",
" register const Quantum\n *p;",
" register ssize_t\n i,\n x;",
" ssize_t\n y;",
" /*\n Generate the forward Fourier transform.\n */\n source_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*source_pixels));\n if (source_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n source_pixels=(double *) GetVirtualMemoryBlob(source_info);\n memset(source_pixels,0,fourier_info->width*fourier_info->height*\n sizeof(*source_pixels));\n i=0L;\n image_view=AcquireVirtualCacheView(image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n p=GetCacheViewVirtualPixels(image_view,0L,y,fourier_info->width,1UL,\n exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n source_pixels[i]=QuantumScale*GetPixelRed(image,p);\n break;\n }\n case GreenPixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelGreen(image,p);\n break;\n }\n case BluePixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelBlue(image,p);\n break;\n }\n case BlackPixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelBlack(image,p);\n break;\n }\n case AlphaPixelChannel:\n {\n source_pixels[i]=QuantumScale*GetPixelAlpha(image,p);\n break;\n }\n }\n i++;\n p+=GetPixelChannels(image);\n }\n }\n image_view=DestroyCacheView(image_view);\n forward_info=AcquireVirtualMemory((size_t) fourier_info->width,\n (fourier_info->height/2+1)*sizeof(*forward_pixels));\n if (forward_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n source_info=(MemoryInfo *) RelinquishVirtualMemory(source_info);\n return(MagickFalse);\n }\n forward_pixels=(fftw_complex *) GetVirtualMemoryBlob(forward_info);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_ForwardFourierTransform)\n#endif\n fftw_r2c_plan=fftw_plan_dft_r2c_2d(fourier_info->width,fourier_info->height,\n source_pixels,forward_pixels,FFTW_ESTIMATE);\n fftw_execute_dft_r2c(fftw_r2c_plan,source_pixels,forward_pixels);\n fftw_destroy_plan(fftw_r2c_plan);\n source_info=(MemoryInfo *) RelinquishVirtualMemory(source_info);\n value=GetImageArtifact(image,\"fourier:normalize\");\n if ((value == (const char *) NULL) || (LocaleCompare(value,\"forward\") == 0))\n {\n double\n gamma;",
" /*\n Normalize fourier transform.\n */\n i=0L;\n gamma=PerceptibleReciprocal((double) fourier_info->width*\n fourier_info->height);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n forward_pixels[i]*=gamma;\n#else\n forward_pixels[i][0]*=gamma;\n forward_pixels[i][1]*=gamma;\n#endif\n i++;\n }\n }\n /*\n Generate magnitude and phase (or real and imaginary).\n */\n i=0L;\n if (fourier_info->modulus != MagickFalse)\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n magnitude_pixels[i]=cabs(forward_pixels[i]);\n phase_pixels[i]=carg(forward_pixels[i]);\n i++;\n }\n else\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n magnitude_pixels[i]=creal(forward_pixels[i]);\n phase_pixels[i]=cimag(forward_pixels[i]);\n i++;\n }\n forward_info=(MemoryInfo *) RelinquishVirtualMemory(forward_info);\n return(MagickTrue);\n}",
"static MagickBooleanType ForwardFourierTransformChannel(const Image *image,\n const PixelChannel channel,const MagickBooleanType modulus,\n Image *fourier_image,ExceptionInfo *exception)\n{\n double\n *magnitude_pixels,\n *phase_pixels;",
" FourierInfo\n fourier_info;",
" MagickBooleanType\n status;",
" MemoryInfo\n *magnitude_info,\n *phase_info;",
" fourier_info.width=image->columns;\n fourier_info.height=image->rows;\n if ((image->columns != image->rows) || ((image->columns % 2) != 0) ||\n ((image->rows % 2) != 0))\n {\n size_t extent=image->columns < image->rows ? image->rows : image->columns;\n fourier_info.width=(extent & 0x01) == 1 ? extent+1UL : extent;\n }\n fourier_info.height=fourier_info.width;\n fourier_info.center=(ssize_t) (fourier_info.width/2L)+1L;\n fourier_info.channel=channel;\n fourier_info.modulus=modulus;\n magnitude_info=AcquireVirtualMemory((size_t) fourier_info.width,\n (fourier_info.height/2+1)*sizeof(*magnitude_pixels));\n phase_info=AcquireVirtualMemory((size_t) fourier_info.width,\n (fourier_info.height/2+1)*sizeof(*phase_pixels));\n if ((magnitude_info == (MemoryInfo *) NULL) ||\n (phase_info == (MemoryInfo *) NULL))\n {\n if (phase_info != (MemoryInfo *) NULL)\n phase_info=RelinquishVirtualMemory(phase_info);\n if (magnitude_info == (MemoryInfo *) NULL)\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n magnitude_pixels=(double *) GetVirtualMemoryBlob(magnitude_info);\n phase_pixels=(double *) GetVirtualMemoryBlob(phase_info);\n status=ForwardFourierTransform(&fourier_info,image,magnitude_pixels,\n phase_pixels,exception);\n if (status != MagickFalse)\n status=ForwardFourier(&fourier_info,fourier_image,magnitude_pixels,\n phase_pixels,exception);\n phase_info=RelinquishVirtualMemory(phase_info);\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n return(status);\n}\n#endif",
"MagickExport Image *ForwardFourierTransformImage(const Image *image,\n const MagickBooleanType modulus,ExceptionInfo *exception)\n{\n Image\n *fourier_image;",
" fourier_image=NewImageList();\n#if !defined(MAGICKCORE_FFTW_DELEGATE)\n (void) modulus;\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\"`%s' (FFTW)\",\n image->filename);\n#else\n {\n Image\n *magnitude_image;",
" size_t\n height,\n width;",
" width=image->columns;\n height=image->rows;\n if ((image->columns != image->rows) || ((image->columns % 2) != 0) ||\n ((image->rows % 2) != 0))\n {\n size_t extent=image->columns < image->rows ? image->rows :\n image->columns;\n width=(extent & 0x01) == 1 ? extent+1UL : extent;\n }\n height=width;\n magnitude_image=CloneImage(image,width,height,MagickTrue,exception);\n if (magnitude_image != (Image *) NULL)\n {\n Image\n *phase_image;",
" magnitude_image->storage_class=DirectClass;\n magnitude_image->depth=32UL;\n phase_image=CloneImage(image,width,height,MagickTrue,exception);\n if (phase_image == (Image *) NULL)\n magnitude_image=DestroyImage(magnitude_image);\n else\n {\n MagickBooleanType\n is_gray,\n status;",
" phase_image->storage_class=DirectClass;\n phase_image->depth=32UL;\n AppendImageToList(&fourier_image,magnitude_image);\n AppendImageToList(&fourier_image,phase_image);\n status=MagickTrue;\n is_gray=IsImageGray(image);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel sections\n#endif\n {\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" if (is_gray != MagickFalse)\n thread_status=ForwardFourierTransformChannel(image,\n GrayPixelChannel,modulus,fourier_image,exception);\n else\n thread_status=ForwardFourierTransformChannel(image,\n RedPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=ForwardFourierTransformChannel(image,\n GreenPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=ForwardFourierTransformChannel(image,\n BluePixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (image->colorspace == CMYKColorspace)\n thread_status=ForwardFourierTransformChannel(image,\n BlackPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (image->alpha_trait != UndefinedPixelTrait)\n thread_status=ForwardFourierTransformChannel(image,\n AlphaPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n }\n if (status == MagickFalse)\n fourier_image=DestroyImageList(fourier_image);\n fftw_cleanup();\n }\n }\n }\n#endif\n return(fourier_image);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I n v e r s e F o u r i e r T r a n s f o r m I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% InverseFourierTransformImage() implements the inverse discrete Fourier\n% transform (DFT) of the image either as a magnitude / phase or real /\n% imaginary image pair.\n%\n% The format of the InverseFourierTransformImage method is:\n%\n% Image *InverseFourierTransformImage(const Image *magnitude_image,\n% const Image *phase_image,const MagickBooleanType modulus,\n% ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o magnitude_image: the magnitude or real image.\n%\n% o phase_image: the phase or imaginary image.\n%\n% o modulus: if true, return transform as a magnitude / phase pair\n% otherwise a real / imaginary image pair.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"#if defined(MAGICKCORE_FFTW_DELEGATE)\nstatic MagickBooleanType InverseQuadrantSwap(const size_t width,\n const size_t height,const double *source,double *destination)\n{\n register ssize_t\n x;",
" ssize_t\n center,\n y;",
" /*\n Swap quadrants.\n */\n center=(ssize_t) (width/2L)+1L;\n for (y=1L; y < (ssize_t) height; y++)\n for (x=0L; x < (ssize_t) (width/2L+1L); x++)\n destination[(height-y)*center-x+width/2L]=source[y*width+x];\n for (y=0L; y < (ssize_t) height; y++)\n destination[y*center]=source[y*width+width/2L];\n for (x=0L; x < center; x++)\n destination[x]=source[center-x-1L];\n return(RollFourier(center,height,0L,(ssize_t) height/-2L,destination));\n}",
"static MagickBooleanType InverseFourier(FourierInfo *fourier_info,\n const Image *magnitude_image,const Image *phase_image,\n fftw_complex *fourier_pixels,ExceptionInfo *exception)\n{\n CacheView\n *magnitude_view,\n *phase_view;",
" double\n *inverse_pixels,\n *magnitude_pixels,\n *phase_pixels;",
" MagickBooleanType\n status;",
" MemoryInfo\n *inverse_info,\n *magnitude_info,\n *phase_info;",
" register const Quantum\n *p;",
" register ssize_t\n i,\n x;",
" ssize_t\n y;",
" /*\n Inverse fourier - read image and break down into a double array.\n */\n magnitude_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*magnitude_pixels));\n phase_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*phase_pixels));\n inverse_info=AcquireVirtualMemory((size_t) fourier_info->width,\n (fourier_info->height/2+1)*sizeof(*inverse_pixels));\n if ((magnitude_info == (MemoryInfo *) NULL) ||\n (phase_info == (MemoryInfo *) NULL) ||\n (inverse_info == (MemoryInfo *) NULL))\n {\n if (magnitude_info != (MemoryInfo *) NULL)\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n if (phase_info != (MemoryInfo *) NULL)\n phase_info=RelinquishVirtualMemory(phase_info);\n if (inverse_info != (MemoryInfo *) NULL)\n inverse_info=RelinquishVirtualMemory(inverse_info);\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\n magnitude_image->filename);\n return(MagickFalse);\n }\n magnitude_pixels=(double *) GetVirtualMemoryBlob(magnitude_info);\n phase_pixels=(double *) GetVirtualMemoryBlob(phase_info);\n inverse_pixels=(double *) GetVirtualMemoryBlob(inverse_info);\n i=0L;\n magnitude_view=AcquireVirtualCacheView(magnitude_image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n p=GetCacheViewVirtualPixels(magnitude_view,0L,y,fourier_info->width,1UL,\n exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelRed(magnitude_image,p);\n break;\n }\n case GreenPixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelGreen(magnitude_image,p);\n break;\n }\n case BluePixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelBlue(magnitude_image,p);\n break;\n }\n case BlackPixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelBlack(magnitude_image,p);\n break;\n }\n case AlphaPixelChannel:\n {\n magnitude_pixels[i]=QuantumScale*GetPixelAlpha(magnitude_image,p);\n break;\n }\n }\n i++;\n p+=GetPixelChannels(magnitude_image);\n }\n }\n magnitude_view=DestroyCacheView(magnitude_view);\n status=InverseQuadrantSwap(fourier_info->width,fourier_info->height,\n magnitude_pixels,inverse_pixels);\n (void) memcpy(magnitude_pixels,inverse_pixels,fourier_info->height*\n fourier_info->center*sizeof(*magnitude_pixels));\n i=0L;\n phase_view=AcquireVirtualCacheView(phase_image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n p=GetCacheViewVirtualPixels(phase_view,0,y,fourier_info->width,1,\n exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n phase_pixels[i]=QuantumScale*GetPixelRed(phase_image,p);\n break;\n }\n case GreenPixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelGreen(phase_image,p);\n break;\n }\n case BluePixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelBlue(phase_image,p);\n break;\n }\n case BlackPixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelBlack(phase_image,p);\n break;\n }\n case AlphaPixelChannel:\n {\n phase_pixels[i]=QuantumScale*GetPixelAlpha(phase_image,p);\n break;\n }\n }\n i++;\n p+=GetPixelChannels(phase_image);\n }\n }\n if (fourier_info->modulus != MagickFalse)\n {\n i=0L;\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n phase_pixels[i]-=0.5;\n phase_pixels[i]*=(2.0*MagickPI);\n i++;\n }\n }\n phase_view=DestroyCacheView(phase_view);\n CorrectPhaseLHS(fourier_info->width,fourier_info->height,phase_pixels);\n if (status != MagickFalse)\n status=InverseQuadrantSwap(fourier_info->width,fourier_info->height,\n phase_pixels,inverse_pixels);\n (void) memcpy(phase_pixels,inverse_pixels,fourier_info->height*\n fourier_info->center*sizeof(*phase_pixels));\n inverse_info=RelinquishVirtualMemory(inverse_info);\n /*\n Merge two sets.\n */\n i=0L;\n if (fourier_info->modulus != MagickFalse)\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n fourier_pixels[i]=magnitude_pixels[i]*cos(phase_pixels[i])+I*\n magnitude_pixels[i]*sin(phase_pixels[i]);\n#else\n fourier_pixels[i][0]=magnitude_pixels[i]*cos(phase_pixels[i]);\n fourier_pixels[i][1]=magnitude_pixels[i]*sin(phase_pixels[i]);\n#endif\n i++;\n }\n else\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n fourier_pixels[i]=magnitude_pixels[i]+I*phase_pixels[i];\n#else\n fourier_pixels[i][0]=magnitude_pixels[i];\n fourier_pixels[i][1]=phase_pixels[i];\n#endif\n i++;\n }\n magnitude_info=RelinquishVirtualMemory(magnitude_info);\n phase_info=RelinquishVirtualMemory(phase_info);\n return(status);\n}",
"static MagickBooleanType InverseFourierTransform(FourierInfo *fourier_info,\n fftw_complex *fourier_pixels,Image *image,ExceptionInfo *exception)\n{\n CacheView\n *image_view;",
" const char\n *value;",
" double\n *source_pixels;",
" fftw_plan\n fftw_c2r_plan;",
" MemoryInfo\n *source_info;",
" register Quantum\n *q;",
" register ssize_t\n i,\n x;",
" ssize_t\n y;",
" source_info=AcquireVirtualMemory((size_t) fourier_info->width,\n fourier_info->height*sizeof(*source_pixels));\n if (source_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(MagickFalse);\n }\n source_pixels=(double *) GetVirtualMemoryBlob(source_info);\n value=GetImageArtifact(image,\"fourier:normalize\");\n if (LocaleCompare(value,\"inverse\") == 0)\n {\n double\n gamma;",
" /*\n Normalize inverse transform.\n */\n i=0L;\n gamma=PerceptibleReciprocal((double) fourier_info->width*\n fourier_info->height);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n for (x=0L; x < (ssize_t) fourier_info->center; x++)\n {\n#if defined(MAGICKCORE_HAVE_COMPLEX_H)\n fourier_pixels[i]*=gamma;\n#else\n fourier_pixels[i][0]*=gamma;\n fourier_pixels[i][1]*=gamma;\n#endif\n i++;\n }\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp critical (MagickCore_InverseFourierTransform)\n#endif\n fftw_c2r_plan=fftw_plan_dft_c2r_2d(fourier_info->width,fourier_info->height,\n fourier_pixels,source_pixels,FFTW_ESTIMATE);\n fftw_execute_dft_c2r(fftw_c2r_plan,fourier_pixels,source_pixels);\n fftw_destroy_plan(fftw_c2r_plan);\n i=0L;\n image_view=AcquireAuthenticCacheView(image,exception);\n for (y=0L; y < (ssize_t) fourier_info->height; y++)\n {\n if (y >= (ssize_t) image->rows)\n break;\n q=GetCacheViewAuthenticPixels(image_view,0L,y,fourier_info->width >\n image->columns ? image->columns : fourier_info->width,1UL,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0L; x < (ssize_t) fourier_info->width; x++)\n {\n if (x < (ssize_t) image->columns)\n switch (fourier_info->channel)\n {\n case RedPixelChannel:\n default:\n {\n SetPixelRed(image,ClampToQuantum(QuantumRange*source_pixels[i]),q);\n break;\n }\n case GreenPixelChannel:\n {\n SetPixelGreen(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n case BluePixelChannel:\n {\n SetPixelBlue(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n case BlackPixelChannel:\n {\n SetPixelBlack(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n case AlphaPixelChannel:\n {\n SetPixelAlpha(image,ClampToQuantum(QuantumRange*source_pixels[i]),\n q);\n break;\n }\n }\n i++;\n q+=GetPixelChannels(image);\n }\n if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)\n break;\n }\n image_view=DestroyCacheView(image_view);\n source_info=RelinquishVirtualMemory(source_info);\n return(MagickTrue);\n}",
"static MagickBooleanType InverseFourierTransformChannel(\n const Image *magnitude_image,const Image *phase_image,\n const PixelChannel channel,const MagickBooleanType modulus,\n Image *fourier_image,ExceptionInfo *exception)\n{\n fftw_complex\n *inverse_pixels;",
" FourierInfo\n fourier_info;",
" MagickBooleanType\n status;",
" MemoryInfo\n *inverse_info;",
" fourier_info.width=magnitude_image->columns;\n fourier_info.height=magnitude_image->rows;\n if ((magnitude_image->columns != magnitude_image->rows) ||\n ((magnitude_image->columns % 2) != 0) ||\n ((magnitude_image->rows % 2) != 0))\n {\n size_t extent=magnitude_image->columns < magnitude_image->rows ?\n magnitude_image->rows : magnitude_image->columns;\n fourier_info.width=(extent & 0x01) == 1 ? extent+1UL : extent;\n }\n fourier_info.height=fourier_info.width;\n fourier_info.center=(ssize_t) (fourier_info.width/2L)+1L;\n fourier_info.channel=channel;\n fourier_info.modulus=modulus;\n inverse_info=AcquireVirtualMemory((size_t) fourier_info.width,\n (fourier_info.height/2+1)*sizeof(*inverse_pixels));\n if (inverse_info == (MemoryInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\n magnitude_image->filename);\n return(MagickFalse);\n }\n inverse_pixels=(fftw_complex *) GetVirtualMemoryBlob(inverse_info);\n status=InverseFourier(&fourier_info,magnitude_image,phase_image,\n inverse_pixels,exception);\n if (status != MagickFalse)\n status=InverseFourierTransform(&fourier_info,inverse_pixels,fourier_image,\n exception);\n inverse_info=RelinquishVirtualMemory(inverse_info);\n return(status);\n}\n#endif",
"MagickExport Image *InverseFourierTransformImage(const Image *magnitude_image,\n const Image *phase_image,const MagickBooleanType modulus,\n ExceptionInfo *exception)\n{\n Image\n *fourier_image;",
" assert(magnitude_image != (Image *) NULL);\n assert(magnitude_image->signature == MagickCoreSignature);\n if (magnitude_image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n magnitude_image->filename);\n if (phase_image == (Image *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),ImageError,\n \"ImageSequenceRequired\",\"`%s'\",magnitude_image->filename);\n return((Image *) NULL);\n }\n#if !defined(MAGICKCORE_FFTW_DELEGATE)\n fourier_image=(Image *) NULL;\n (void) modulus;\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateWarning,\"DelegateLibrarySupportNotBuiltIn\",\"`%s' (FFTW)\",\n magnitude_image->filename);\n#else\n {\n fourier_image=CloneImage(magnitude_image,magnitude_image->columns,\n magnitude_image->rows,MagickTrue,exception);\n if (fourier_image != (Image *) NULL)\n {\n MagickBooleanType\n is_gray,\n status;",
" status=MagickTrue;\n is_gray=IsImageGray(magnitude_image);\n if (is_gray != MagickFalse)\n is_gray=IsImageGray(phase_image);\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp parallel sections\n#endif\n {\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" if (is_gray != MagickFalse)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,GrayPixelChannel,modulus,fourier_image,exception);\n else\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,RedPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,GreenPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (is_gray == MagickFalse)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,BluePixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (magnitude_image->colorspace == CMYKColorspace)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,BlackPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp section\n#endif\n {\n MagickBooleanType\n thread_status;",
" thread_status=MagickTrue;\n if (magnitude_image->alpha_trait != UndefinedPixelTrait)\n thread_status=InverseFourierTransformChannel(magnitude_image,\n phase_image,AlphaPixelChannel,modulus,fourier_image,exception);\n if (thread_status == MagickFalse)\n status=thread_status;\n }\n }\n if (status == MagickFalse)\n fourier_image=DestroyImage(fourier_image);\n }\n fftw_cleanup();\n }\n#endif\n return(fourier_image);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [310, 689], "buggy_code_start_loc": [232, 681], "filenames": ["MagickCore/fourier.c", "coders/gif.c"], "fixing_code_end_loc": [306, 691], "fixing_code_start_loc": [232, 682], "message": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:7.0.8-50:q16:*:*:*:*:*:*", "matchCriteriaId": "25CCEA99-8329-46C6-9625-4FE15F24CF69", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.04:*:*:*:*:*:*:*", "matchCriteriaId": "CD783B0C-9246-47D9-A937-6144FE8BFF0F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "F1E78106-58E6-4D59-990F-75DA575BFAD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage."}, {"lang": "es", "value": "ImageMagick versi\u00f3n 7.0.8-50 Q16 presenta una vulnerabilidad de desbordamiento de b\u00fafer basado en memoria din\u00e1mica (heap) en MagickCore/fourier.c en ComplexImage."}], "evaluatorComment": null, "id": "CVE-2019-13308", "lastModified": "2023-03-02T15:56:47.600", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-07-05T01:15:10.750", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00069.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/issues/1595"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick6/commit/19651f3db63fa1511ed83a348c4c82fa553f8d01"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/09/msg00007.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4192-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4712"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, "type": "CWE-787"}
| 102
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% GGGG IIIII FFFFF %\n% G I F %\n% G GG I FFF %\n% G G I F %\n% GGG IIIII F %\n% %\n% %\n% Read/Write Compuserv Graphics Interchange Format %\n% %\n% Software Design %\n% Cristy %\n% July 1992 %\n% %\n% %\n% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/attribute.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/blob-private.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/color.h\"\n#include \"MagickCore/color-private.h\"\n#include \"MagickCore/colormap.h\"\n#include \"MagickCore/colormap-private.h\"\n#include \"MagickCore/colorspace.h\"\n#include \"MagickCore/colorspace-private.h\"\n#include \"MagickCore/exception.h\"\n#include \"MagickCore/exception-private.h\"\n#include \"MagickCore/image.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/profile.h\"\n#include \"MagickCore/magick.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/monitor.h\"\n#include \"MagickCore/monitor-private.h\"\n#include \"MagickCore/option.h\"\n#include \"MagickCore/pixel.h\"\n#include \"MagickCore/pixel-accessor.h\"\n#include \"MagickCore/property.h\"\n#include \"MagickCore/quantize.h\"\n#include \"MagickCore/quantum-private.h\"\n#include \"MagickCore/resource_.h\"\n#include \"MagickCore/static.h\"\n#include \"MagickCore/string_.h\"\n#include \"MagickCore/string-private.h\"\n#include \"MagickCore/module.h\"\n\f\n/*\n Define declarations.\n*/\n#define MaximumLZWBits 12\n#define MaximumLZWCode (1UL << MaximumLZWBits)\n\f\n/*\n Typdef declarations.\n*/\ntypedef struct _LZWCodeInfo\n{\n unsigned char\n buffer[280];",
" size_t\n count,\n bit;",
" MagickBooleanType\n eof;\n} LZWCodeInfo;",
"typedef struct _LZWStack\n{\n size_t\n *codes,\n *index,\n *top;\n} LZWStack;",
"typedef struct _LZWInfo\n{\n Image\n *image;",
" LZWStack\n *stack;",
" MagickBooleanType\n genesis;",
" size_t\n data_size,\n maximum_data_value,\n clear_code,\n end_code,\n bits,\n first_code,\n last_code,\n maximum_code,\n slot,\n *table[2];",
" LZWCodeInfo\n code_info;\n} LZWInfo;\n\f\n/*\n Forward declarations.\n*/\nstatic inline int\n GetNextLZWCode(LZWInfo *,const size_t);",
"static MagickBooleanType\n WriteGIFImage(const ImageInfo *,Image *,ExceptionInfo *);",
"static ssize_t\n ReadBlobBlock(Image *,unsigned char *);\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% D e c o d e I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DecodeImage uncompresses an image via GIF-coding.\n%\n% The format of the DecodeImage method is:\n%\n% MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)\n%\n% A description of each parameter follows:\n%\n% o image: the address of a structure of type Image.\n%\n% o opacity: The colormap index associated with the transparent color.\n%\n*/",
"static LZWInfo *RelinquishLZWInfo(LZWInfo *lzw_info)\n{\n if (lzw_info->table[0] != (size_t *) NULL)\n lzw_info->table[0]=(size_t *) RelinquishMagickMemory(\n lzw_info->table[0]);\n if (lzw_info->table[1] != (size_t *) NULL)\n lzw_info->table[1]=(size_t *) RelinquishMagickMemory(\n lzw_info->table[1]);\n if (lzw_info->stack != (LZWStack *) NULL)\n {\n if (lzw_info->stack->codes != (size_t *) NULL)\n lzw_info->stack->codes=(size_t *) RelinquishMagickMemory(\n lzw_info->stack->codes);\n lzw_info->stack=(LZWStack *) RelinquishMagickMemory(lzw_info->stack);\n }\n lzw_info=(LZWInfo *) RelinquishMagickMemory(lzw_info);\n return((LZWInfo *) NULL);\n}",
"static inline void ResetLZWInfo(LZWInfo *lzw_info)\n{\n size_t\n one;",
" lzw_info->bits=lzw_info->data_size+1;\n one=1;\n lzw_info->maximum_code=one << lzw_info->bits;\n lzw_info->slot=lzw_info->maximum_data_value+3;\n lzw_info->genesis=MagickTrue;\n}",
"static LZWInfo *AcquireLZWInfo(Image *image,const size_t data_size)\n{\n LZWInfo\n *lzw_info;",
" register ssize_t\n i;",
" size_t\n one;",
" lzw_info=(LZWInfo *) AcquireMagickMemory(sizeof(*lzw_info));\n if (lzw_info == (LZWInfo *) NULL)\n return((LZWInfo *) NULL);\n (void) memset(lzw_info,0,sizeof(*lzw_info));\n lzw_info->image=image;\n lzw_info->data_size=data_size;\n one=1;\n lzw_info->maximum_data_value=(one << data_size)-1;\n lzw_info->clear_code=lzw_info->maximum_data_value+1;\n lzw_info->end_code=lzw_info->maximum_data_value+2;\n lzw_info->table[0]=(size_t *) AcquireQuantumMemory(MaximumLZWCode,\n sizeof(**lzw_info->table));\n lzw_info->table[1]=(size_t *) AcquireQuantumMemory(MaximumLZWCode,\n sizeof(**lzw_info->table));\n if ((lzw_info->table[0] == (size_t *) NULL) ||\n (lzw_info->table[1] == (size_t *) NULL))\n {\n lzw_info=RelinquishLZWInfo(lzw_info);\n return((LZWInfo *) NULL);\n }\n (void) memset(lzw_info->table[0],0,MaximumLZWCode*\n sizeof(**lzw_info->table));\n (void) memset(lzw_info->table[1],0,MaximumLZWCode*\n sizeof(**lzw_info->table));\n for (i=0; i <= (ssize_t) lzw_info->maximum_data_value; i++)\n {\n lzw_info->table[0][i]=0;\n lzw_info->table[1][i]=(size_t) i;\n }\n ResetLZWInfo(lzw_info);\n lzw_info->code_info.buffer[0]='\\0';\n lzw_info->code_info.buffer[1]='\\0';\n lzw_info->code_info.count=2;\n lzw_info->code_info.bit=8*lzw_info->code_info.count;\n lzw_info->code_info.eof=MagickFalse;\n lzw_info->genesis=MagickTrue;\n lzw_info->stack=(LZWStack *) AcquireMagickMemory(sizeof(*lzw_info->stack));\n if (lzw_info->stack == (LZWStack *) NULL)\n {\n lzw_info=RelinquishLZWInfo(lzw_info);\n return((LZWInfo *) NULL);\n }\n lzw_info->stack->codes=(size_t *) AcquireQuantumMemory(2UL*\n MaximumLZWCode,sizeof(*lzw_info->stack->codes));\n if (lzw_info->stack->codes == (size_t *) NULL)\n {\n lzw_info=RelinquishLZWInfo(lzw_info);\n return((LZWInfo *) NULL);\n }\n lzw_info->stack->index=lzw_info->stack->codes;\n lzw_info->stack->top=lzw_info->stack->codes+2*MaximumLZWCode;\n return(lzw_info);\n}",
"static inline int GetNextLZWCode(LZWInfo *lzw_info,const size_t bits)\n{\n int\n code;",
" register ssize_t\n i;",
" size_t\n one;",
" while (((lzw_info->code_info.bit+bits) > (8*lzw_info->code_info.count)) &&\n (lzw_info->code_info.eof == MagickFalse))\n {\n ssize_t\n count;",
" lzw_info->code_info.buffer[0]=lzw_info->code_info.buffer[\n lzw_info->code_info.count-2];\n lzw_info->code_info.buffer[1]=lzw_info->code_info.buffer[\n lzw_info->code_info.count-1];\n lzw_info->code_info.bit-=8*(lzw_info->code_info.count-2);\n lzw_info->code_info.count=2;\n count=ReadBlobBlock(lzw_info->image,&lzw_info->code_info.buffer[\n lzw_info->code_info.count]);\n if (count > 0)\n lzw_info->code_info.count+=count;\n else\n lzw_info->code_info.eof=MagickTrue;\n }\n if ((lzw_info->code_info.bit+bits) > (8*lzw_info->code_info.count))\n return(-1);\n code=0;\n one=1;\n for (i=0; i < (ssize_t) bits; i++)\n {\n code|=((lzw_info->code_info.buffer[lzw_info->code_info.bit/8] &\n (one << (lzw_info->code_info.bit % 8))) != 0) << i;\n lzw_info->code_info.bit++;\n }\n return(code);\n}",
"static inline int PopLZWStack(LZWStack *stack_info)\n{\n if (stack_info->index <= stack_info->codes)\n return(-1);\n stack_info->index--;\n return((int) *stack_info->index);\n}",
"static inline void PushLZWStack(LZWStack *stack_info,const size_t value)\n{\n if (stack_info->index >= stack_info->top)\n return;\n *stack_info->index=value;\n stack_info->index++;\n}",
"static int ReadBlobLZWByte(LZWInfo *lzw_info)\n{\n int\n code;",
" size_t\n one,\n value;",
" ssize_t\n count;",
" if (lzw_info->stack->index != lzw_info->stack->codes)\n return(PopLZWStack(lzw_info->stack));\n if (lzw_info->genesis != MagickFalse)\n {\n lzw_info->genesis=MagickFalse;\n do\n {\n lzw_info->first_code=(size_t) GetNextLZWCode(lzw_info,lzw_info->bits);\n lzw_info->last_code=lzw_info->first_code;\n } while (lzw_info->first_code == lzw_info->clear_code);\n return((int) lzw_info->first_code);\n }\n code=GetNextLZWCode(lzw_info,lzw_info->bits);\n if (code < 0)\n return(code);\n if ((size_t) code == lzw_info->clear_code)\n {\n ResetLZWInfo(lzw_info);\n return(ReadBlobLZWByte(lzw_info));\n }\n if ((size_t) code == lzw_info->end_code)\n return(-1);\n if ((size_t) code < lzw_info->slot)\n value=(size_t) code;\n else\n {\n PushLZWStack(lzw_info->stack,lzw_info->first_code);\n value=lzw_info->last_code;\n }\n count=0;\n while (value > lzw_info->maximum_data_value)\n {\n if ((size_t) count > MaximumLZWCode)\n return(-1);\n count++;\n if ((size_t) value > MaximumLZWCode)\n return(-1);\n PushLZWStack(lzw_info->stack,lzw_info->table[1][value]);\n value=lzw_info->table[0][value];\n }\n lzw_info->first_code=lzw_info->table[1][value];\n PushLZWStack(lzw_info->stack,lzw_info->first_code);\n one=1;\n if (lzw_info->slot < MaximumLZWCode)\n {\n lzw_info->table[0][lzw_info->slot]=lzw_info->last_code;\n lzw_info->table[1][lzw_info->slot]=lzw_info->first_code;\n lzw_info->slot++;\n if ((lzw_info->slot >= lzw_info->maximum_code) &&\n (lzw_info->bits < MaximumLZWBits))\n {\n lzw_info->bits++;\n lzw_info->maximum_code=one << lzw_info->bits;\n }\n }\n lzw_info->last_code=(size_t) code;\n return(PopLZWStack(lzw_info->stack));\n}",
"static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity,\n ExceptionInfo *exception)\n{\n int\n c;",
" LZWInfo\n *lzw_info;",
" size_t\n pass;",
" ssize_t\n index,\n offset,\n y;",
" unsigned char\n data_size;",
" /*\n Allocate decoder tables.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n data_size=(unsigned char) ReadBlobByte(image);\n if (data_size > MaximumLZWBits)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n lzw_info=AcquireLZWInfo(image,data_size);\n if (lzw_info == (LZWInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n pass=0;\n offset=0;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register ssize_t\n x;",
" register Quantum\n *magick_restrict q;",
" q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; )\n {\n c=ReadBlobLZWByte(lzw_info);\n if (c < 0)\n break;\n index=ConstrainColormapIndex(image,(ssize_t) c,exception);\n SetPixelIndex(image,(Quantum) index,q);\n SetPixelViaPixelInfo(image,image->colormap+index,q);\n SetPixelAlpha(image,index == opacity ? TransparentAlpha : OpaqueAlpha,q);\n x++;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (x < (ssize_t) image->columns)\n break;\n if (image->interlace == NoInterlace)\n offset++;\n else\n {\n switch (pass)\n {\n case 0:\n default:\n {\n offset+=8;\n break;\n }\n case 1:\n {\n offset+=8;\n break;\n }\n case 2:\n {\n offset+=4;\n break;\n }\n case 3:\n {\n offset+=2;\n break;\n }\n }\n if ((pass == 0) && (offset >= (ssize_t) image->rows))\n {\n pass++;\n offset=4;\n }\n if ((pass == 1) && (offset >= (ssize_t) image->rows))\n {\n pass++;\n offset=2;\n }\n if ((pass == 2) && (offset >= (ssize_t) image->rows))\n {\n pass++;\n offset=1;\n }\n }\n }\n lzw_info=RelinquishLZWInfo(lzw_info);\n if (y < (ssize_t) image->rows)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% E n c o d e I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% EncodeImage compresses an image via GIF-coding.\n%\n% The format of the EncodeImage method is:\n%\n% MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,\n% const size_t data_size)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the address of a structure of type Image.\n%\n% o data_size: The number of bits in the compressed packet.\n%\n*/\nstatic MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,\n const size_t data_size,ExceptionInfo *exception)\n{\n#define MaxCode(number_bits) ((one << (number_bits))-1)\n#define MaxHashTable 5003\n#define MaxGIFBits 12UL\n#define MaxGIFTable (1UL << MaxGIFBits)\n#define GIFOutputCode(code) \\\n{ \\\n /* \\\n Emit a code. \\\n */ \\\n if (bits > 0) \\\n datum|=(size_t) (code) << bits; \\\n else \\\n datum=(size_t) (code); \\\n bits+=number_bits; \\\n while (bits >= 8) \\\n { \\\n /* \\\n Add a character to current packet. \\\n */ \\\n packet[length++]=(unsigned char) (datum & 0xff); \\\n if (length >= 254) \\\n { \\\n (void) WriteBlobByte(image,(unsigned char) length); \\\n (void) WriteBlob(image,length,packet); \\\n length=0; \\\n } \\\n datum>>=8; \\\n bits-=8; \\\n } \\\n if (free_code > max_code) \\\n { \\\n number_bits++; \\\n if (number_bits == MaxGIFBits) \\\n max_code=MaxGIFTable; \\\n else \\\n max_code=MaxCode(number_bits); \\\n } \\\n}",
" Quantum\n index;",
" short\n *hash_code,\n *hash_prefix,\n waiting_code;",
" size_t\n bits,\n clear_code,\n datum,\n end_of_information_code,\n free_code,\n length,\n max_code,\n next_pixel,\n number_bits,\n one,\n pass;",
" ssize_t\n displacement,\n offset,\n k,\n y;",
" unsigned char\n *packet,\n *hash_suffix;",
" /*\n Allocate encoder tables.\n */\n assert(image != (Image *) NULL);\n one=1;\n packet=(unsigned char *) AcquireQuantumMemory(256,sizeof(*packet));\n hash_code=(short *) AcquireQuantumMemory(MaxHashTable,sizeof(*hash_code));\n hash_prefix=(short *) AcquireQuantumMemory(MaxHashTable,sizeof(*hash_prefix));\n hash_suffix=(unsigned char *) AcquireQuantumMemory(MaxHashTable,\n sizeof(*hash_suffix));\n if ((packet == (unsigned char *) NULL) || (hash_code == (short *) NULL) ||\n (hash_prefix == (short *) NULL) ||\n (hash_suffix == (unsigned char *) NULL))\n {\n if (packet != (unsigned char *) NULL)\n packet=(unsigned char *) RelinquishMagickMemory(packet);\n if (hash_code != (short *) NULL)\n hash_code=(short *) RelinquishMagickMemory(hash_code);\n if (hash_prefix != (short *) NULL)\n hash_prefix=(short *) RelinquishMagickMemory(hash_prefix);\n if (hash_suffix != (unsigned char *) NULL)\n hash_suffix=(unsigned char *) RelinquishMagickMemory(hash_suffix);\n return(MagickFalse);\n }\n /*\n Initialize GIF encoder.\n */\n (void) memset(packet,0,256*sizeof(*packet));\n (void) memset(hash_code,0,MaxHashTable*sizeof(*hash_code));\n (void) memset(hash_prefix,0,MaxHashTable*sizeof(*hash_prefix));\n (void) memset(hash_suffix,0,MaxHashTable*sizeof(*hash_suffix));\n number_bits=data_size;\n max_code=MaxCode(number_bits);\n clear_code=((short) one << (data_size-1));\n end_of_information_code=clear_code+1;\n free_code=clear_code+2;\n length=0;\n datum=0;\n bits=0;\n GIFOutputCode(clear_code);\n /*\n Encode pixels.\n */\n offset=0;\n pass=0;\n waiting_code=0;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const Quantum\n *magick_restrict p;",
" register ssize_t\n x;",
" p=GetVirtualPixels(image,0,offset,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if (y == 0)\n {\n waiting_code=(short) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n for (x=(ssize_t) (y == 0 ? 1 : 0); x < (ssize_t) image->columns; x++)\n {\n /*\n Probe hash table.\n */",
"",
" index=(Quantum) ((size_t) GetPixelIndex(image,p) & 0xff);\n p+=GetPixelChannels(image);\n k=(ssize_t) (((size_t) index << (MaxGIFBits-8))+waiting_code);\n if (k >= MaxHashTable)\n k-=MaxHashTable;",
" next_pixel=MagickFalse;\n displacement=1;",
" if (hash_code[k] > 0)\n {\n if ((hash_prefix[k] == waiting_code) &&\n (hash_suffix[k] == (unsigned char) index))\n {\n waiting_code=hash_code[k];\n continue;\n }\n if (k != 0)\n displacement=MaxHashTable-k;\n for ( ; ; )\n {\n k-=displacement;\n if (k < 0)\n k+=MaxHashTable;\n if (hash_code[k] == 0)\n break;\n if ((hash_prefix[k] == waiting_code) &&\n (hash_suffix[k] == (unsigned char) index))\n {\n waiting_code=hash_code[k];\n next_pixel=MagickTrue;\n break;\n }\n }\n if (next_pixel != MagickFalse)\n continue;\n }\n GIFOutputCode(waiting_code);\n if (free_code < MaxGIFTable)\n {\n hash_code[k]=(short) free_code++;\n hash_prefix[k]=waiting_code;\n hash_suffix[k]=(unsigned char) index;\n }\n else\n {\n /*\n Fill the hash table with empty entries.\n */\n for (k=0; k < MaxHashTable; k++)\n hash_code[k]=0;\n /*\n Reset compressor and issue a clear code.\n */\n free_code=clear_code+2;\n GIFOutputCode(clear_code);\n number_bits=data_size;\n max_code=MaxCode(number_bits);\n }\n waiting_code=(short) index;\n }\n if (image_info->interlace == NoInterlace)\n offset++;\n else\n switch (pass)\n {\n case 0:\n default:\n {\n offset+=8;\n if (offset >= (ssize_t) image->rows)\n {\n pass++;\n offset=4;\n }\n break;\n }\n case 1:\n {\n offset+=8;\n if (offset >= (ssize_t) image->rows)\n {\n pass++;\n offset=2;\n }\n break;\n }\n case 2:\n {\n offset+=4;\n if (offset >= (ssize_t) image->rows)\n {\n pass++;\n offset=1;\n }\n break;\n }\n case 3:\n {\n offset+=2;\n break;\n }\n }\n }\n /*\n Flush out the buffered code.\n */\n GIFOutputCode(waiting_code);\n GIFOutputCode(end_of_information_code);\n if (bits > 0)\n {\n /*\n Add a character to current packet.\n */\n packet[length++]=(unsigned char) (datum & 0xff);\n if (length >= 254)\n {\n (void) WriteBlobByte(image,(unsigned char) length);\n (void) WriteBlob(image,length,packet);\n length=0;\n }\n }\n /*\n Flush accumulated data.\n */\n if (length > 0)\n {\n (void) WriteBlobByte(image,(unsigned char) length);\n (void) WriteBlob(image,length,packet);\n }\n /*\n Free encoder memory.\n */\n hash_suffix=(unsigned char *) RelinquishMagickMemory(hash_suffix);\n hash_prefix=(short *) RelinquishMagickMemory(hash_prefix);\n hash_code=(short *) RelinquishMagickMemory(hash_code);\n packet=(unsigned char *) RelinquishMagickMemory(packet);\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s G I F %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsGIF() returns MagickTrue if the image format type, identified by the\n% magick string, is GIF.\n%\n% The format of the IsGIF method is:\n%\n% MagickBooleanType IsGIF(const unsigned char *magick,const size_t length)\n%\n% A description of each parameter follows:\n%\n% o magick: compare image format pattern against these bytes.\n%\n% o length: Specifies the length of the magick string.\n%\n*/\nstatic MagickBooleanType IsGIF(const unsigned char *magick,const size_t length)\n{\n if (length < 4)\n return(MagickFalse);\n if (LocaleNCompare((char *) magick,\"GIF8\",4) == 0)\n return(MagickTrue);\n return(MagickFalse);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b B l o c k %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobBlock() reads data from the image file and returns it. The\n% amount of data is determined by first reading a count byte. The number\n% of bytes read is returned.\n%\n% The format of the ReadBlobBlock method is:\n%\n% ssize_t ReadBlobBlock(Image *image,unsigned char *data)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o data: Specifies an area to place the information requested from\n% the file.\n%\n*/\nstatic ssize_t ReadBlobBlock(Image *image,unsigned char *data)\n{\n ssize_t\n count;",
" unsigned char\n block_count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(data != (unsigned char *) NULL);\n count=ReadBlob(image,1,&block_count);\n if (count != 1)\n return(0);\n count=ReadBlob(image,(size_t) block_count,data);\n if (count != (ssize_t) block_count)\n return(0);\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e a d G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadGIFImage() reads a Compuserve Graphics image file and returns it.\n% It allocates the memory necessary for the new Image structure and returns a\n% pointer to the new image.\n%\n% The format of the ReadGIFImage method is:\n%\n% Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"static void *DestroyGIFProfile(void *profile)\n{\n return((void *) DestroyStringInfo((StringInfo *) profile));\n}",
"static MagickBooleanType PingGIFImage(Image *image,ExceptionInfo *exception)\n{\n unsigned char\n buffer[256],\n length,\n data_size;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n if (ReadBlob(image,1,&data_size) != 1)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n if (data_size > MaximumLZWBits)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n if (ReadBlob(image,1,&length) != 1)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n while (length != 0)\n {\n if (ReadBlob(image,length,buffer) != (ssize_t) length)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n if (ReadBlob(image,1,&length) != 1)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n }\n return(MagickTrue);\n}",
"static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define BitSet(byte,bit) (((byte) & (bit)) == (bit))\n#define LSBFirstOrder(x,y) (((y) << 8) | (x))\n#define ThrowGIFException(exception,message) \\\n{ \\\n if (profiles != (LinkedListInfo *) NULL) \\\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile); \\\n if (global_colormap != (unsigned char *) NULL) \\\n global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap); \\\n if (meta_image != (Image *) NULL) \\\n meta_image=DestroyImage(meta_image); \\\n ThrowReaderException((exception),(message)); \\\n}",
" Image\n *image,\n *meta_image;",
" LinkedListInfo\n *profiles;",
" MagickBooleanType\n status;",
" register ssize_t\n i;",
" register unsigned char\n *p;",
" size_t\n duration,\n global_colors,\n image_count,\n local_colors,\n one;",
" ssize_t\n count,\n opacity;",
" unsigned char\n background,\n buffer[257],\n c,\n flag,\n *global_colormap;",
" /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Determine if this a GIF file.\n */\n count=ReadBlob(image,6,buffer);\n if ((count != 6) || ((LocaleNCompare((char *) buffer,\"GIF87\",5) != 0) &&\n (LocaleNCompare((char *) buffer,\"GIF89\",5) != 0)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) memset(buffer,0,sizeof(buffer));\n meta_image=AcquireImage(image_info,exception); /* metadata container */\n meta_image->page.width=ReadBlobLSBShort(image);\n meta_image->page.height=ReadBlobLSBShort(image);\n meta_image->iterations=1;\n flag=(unsigned char) ReadBlobByte(image);\n profiles=(LinkedListInfo *) NULL;\n background=(unsigned char) ReadBlobByte(image);\n c=(unsigned char) ReadBlobByte(image); /* reserved */\n one=1;\n global_colors=one << (((size_t) flag & 0x07)+1);\n global_colormap=(unsigned char *) AcquireQuantumMemory((size_t)\n MagickMax(global_colors,256),3UL*sizeof(*global_colormap));\n if (global_colormap == (unsigned char *) NULL)\n ThrowGIFException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) memset(global_colormap,0,3*MagickMax(global_colors,256)*\n sizeof(*global_colormap));\n if (BitSet((int) flag,0x80) != 0)\n {\n count=ReadBlob(image,(size_t) (3*global_colors),global_colormap);\n if (count != (ssize_t) (3*global_colors))\n ThrowGIFException(CorruptImageError,\"InsufficientImageDataInFile\");\n }\n duration=0;\n opacity=(-1);\n image_count=0;\n for ( ; ; )\n {\n count=ReadBlob(image,1,&c);\n if (count != 1)\n break;\n if (c == (unsigned char) ';')\n break; /* terminator */\n if (c == (unsigned char) '!')\n {\n /*\n GIF Extension block.\n */\n (void) memset(buffer,0,sizeof(buffer));\n count=ReadBlob(image,1,&c);\n if (count != 1)\n ThrowGIFException(CorruptImageError,\"UnableToReadExtensionBlock\");\n switch (c)\n {\n case 0xf9:\n {\n /*\n Read graphics control extension.\n */\n while (ReadBlobBlock(image,buffer) != 0) ;\n meta_image->dispose=(DisposeType) ((buffer[0] >> 2) & 0x07);\n meta_image->delay=((size_t) buffer[2] << 8) | buffer[1];\n if ((ssize_t) (buffer[0] & 0x01) == 0x01)\n opacity=(ssize_t) buffer[3];\n break;\n }\n case 0xfe:\n {\n char\n *comments;",
" size_t\n extent,\n offset;",
" comments=AcquireString((char *) NULL);\n extent=MagickPathExtent;\n for (offset=0; ; offset+=count)\n {\n count=ReadBlobBlock(image,buffer);\n if (count == 0)\n break;\n buffer[count]='\\0';\n if ((ssize_t) (count+offset+MagickPathExtent) >= (ssize_t) extent)\n {\n extent<<=1;\n comments=(char *) ResizeQuantumMemory(comments,extent+\n MagickPathExtent,sizeof(*comments));\n if (comments == (char *) NULL)\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n (void) CopyMagickString(&comments[offset],(char *) buffer,extent-\n offset);\n }\n (void) SetImageProperty(meta_image,\"comment\",comments,exception);\n comments=DestroyString(comments);\n break;\n }\n case 0xff:\n {\n MagickBooleanType\n loop;",
" /*\n Read Netscape Loop extension.\n */\n loop=MagickFalse;\n if (ReadBlobBlock(image,buffer) != 0)\n loop=LocaleNCompare((char *) buffer,\"NETSCAPE2.0\",11) == 0 ?\n MagickTrue : MagickFalse;\n if (loop != MagickFalse)\n while (ReadBlobBlock(image,buffer) != 0)\n {\n meta_image->iterations=((size_t) buffer[2] << 8) | buffer[1];\n if (meta_image->iterations != 0)\n meta_image->iterations++;\n }\n else\n {\n char\n name[MagickPathExtent];",
" int\n block_length,\n info_length,\n reserved_length;",
" MagickBooleanType\n i8bim,\n icc,\n iptc,\n magick;",
" StringInfo\n *profile;",
" unsigned char\n *info;",
" /*\n Store GIF application extension as a generic profile.\n */\n icc=LocaleNCompare((char *) buffer,\"ICCRGBG1012\",11) == 0 ?\n MagickTrue : MagickFalse;\n magick=LocaleNCompare((char *) buffer,\"ImageMagick\",11) == 0 ?\n MagickTrue : MagickFalse;\n i8bim=LocaleNCompare((char *) buffer,\"MGK8BIM0000\",11) == 0 ?\n MagickTrue : MagickFalse;\n iptc=LocaleNCompare((char *) buffer,\"MGKIPTC0000\",11) == 0 ?\n MagickTrue : MagickFalse;\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reading GIF application extension\");\n info=(unsigned char *) AcquireQuantumMemory(255UL,\n sizeof(*info));\n if (info == (unsigned char *) NULL)\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n (void) memset(info,0,255UL*sizeof(*info));\n reserved_length=255;\n for (info_length=0; ; )\n {\n block_length=(int) ReadBlobBlock(image,&info[info_length]);\n if (block_length == 0)\n break;\n info_length+=block_length;\n if (info_length > (reserved_length-255))\n {\n reserved_length+=4096;\n info=(unsigned char *) ResizeQuantumMemory(info,(size_t)\n reserved_length,sizeof(*info));\n if (info == (unsigned char *) NULL)\n {\n info=(unsigned char *) RelinquishMagickMemory(info);\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n }\n }\n profile=BlobToStringInfo(info,(size_t) info_length);\n if (profile == (StringInfo *) NULL)\n {\n info=(unsigned char *) RelinquishMagickMemory(info);\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n if (i8bim != MagickFalse)\n (void) CopyMagickString(name,\"8bim\",sizeof(name));\n else if (icc != MagickFalse)\n (void) CopyMagickString(name,\"icc\",sizeof(name));\n else if (iptc != MagickFalse)\n (void) CopyMagickString(name,\"iptc\",sizeof(name));\n else if (magick != MagickFalse)\n {\n (void) CopyMagickString(name,\"magick\",sizeof(name));\n meta_image->gamma=StringToDouble((char *) info+6,\n (char **) NULL);\n }\n else\n (void) FormatLocaleString(name,sizeof(name),\"gif:%.11s\",\n buffer);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" profile name=%s\",name);\n info=(unsigned char *) RelinquishMagickMemory(info);\n if (magick != MagickFalse)\n profile=DestroyStringInfo(profile);\n else\n {\n if (profiles == (LinkedListInfo *) NULL)\n profiles=NewLinkedList(0);\n SetStringInfoName(profile,name);\n (void) AppendValueToLinkedList(profiles,profile);\n }\n }\n break;\n }\n default:\n {\n while (ReadBlobBlock(image,buffer) != 0) ;\n break;\n }\n }\n }\n if (c != (unsigned char) ',')\n continue;\n image_count++;\n if (image_count != 1)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n status=MagickFalse;\n break;\n }\n image=SyncNextImageInList(image);\n }\n /*\n Read image attributes.\n */\n meta_image->page.x=(ssize_t) ReadBlobLSBShort(image);\n meta_image->page.y=(ssize_t) ReadBlobLSBShort(image);\n meta_image->scene=image->scene;\n (void) CloneImageProperties(image,meta_image);\n DestroyImageProperties(meta_image);\n image->storage_class=PseudoClass;\n image->compression=LZWCompression;\n image->columns=ReadBlobLSBShort(image);\n image->rows=ReadBlobLSBShort(image);\n image->depth=8;\n flag=(unsigned char) ReadBlobByte(image);\n image->interlace=BitSet((int) flag,0x40) != 0 ? GIFInterlace : NoInterlace;\n local_colors=BitSet((int) flag,0x80) == 0 ? global_colors : one <<\n ((size_t) (flag & 0x07)+1);\n image->colors=local_colors;\n if (opacity >= (ssize_t) image->colors)\n {\n image->colors++;\n opacity=(-1);\n }\n image->ticks_per_second=100;\n image->alpha_trait=opacity >= 0 ? BlendPixelTrait : UndefinedPixelTrait;\n if ((image->columns == 0) || (image->rows == 0))\n ThrowGIFException(CorruptImageError,\"NegativeOrZeroImageSize\");\n /*\n Inititialize colormap.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowGIFException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (BitSet((int) flag,0x80) == 0)\n {\n /*\n Use global colormap.\n */\n p=global_colormap;\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].green=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].blue=(double) ScaleCharToQuantum(*p++);\n if (i == opacity)\n {\n image->colormap[i].alpha=(double) TransparentAlpha;\n image->transparent_color=image->colormap[opacity];\n }\n }\n image->background_color=image->colormap[MagickMin((ssize_t) background,\n (ssize_t) image->colors-1)];\n }\n else\n {\n unsigned char\n *colormap;",
" /*\n Read local colormap.\n */\n colormap=(unsigned char *) AcquireQuantumMemory((size_t)\n MagickMax(local_colors,256),3UL*sizeof(*colormap));\n if (colormap == (unsigned char *) NULL)\n ThrowGIFException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) memset(colormap,0,3*MagickMax(local_colors,256)*\n sizeof(*colormap));\n count=ReadBlob(image,(3*local_colors)*sizeof(*colormap),colormap);\n if (count != (ssize_t) (3*local_colors))\n {\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n ThrowGIFException(CorruptImageError,\"InsufficientImageDataInFile\");\n }\n p=colormap;\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].green=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].blue=(double) ScaleCharToQuantum(*p++);\n if (i == opacity)\n image->colormap[i].alpha=(double) TransparentAlpha;\n }\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n }\n if (image->gamma == 1.0)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n if (IsPixelInfoGray(image->colormap+i) == MagickFalse)\n break;\n (void) SetImageColorspace(image,i == (ssize_t) image->colors ?\n GRAYColorspace : RGBColorspace,exception);\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n {\n if (profiles != (LinkedListInfo *) NULL)\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile);\n global_colormap=(unsigned char *) RelinquishMagickMemory(\n global_colormap);\n meta_image=DestroyImage(meta_image);\n return(DestroyImageList(image));\n }\n /*\n Decode image.\n */\n if (image_info->ping != MagickFalse)\n status=PingGIFImage(image,exception);\n else\n status=DecodeImage(image,opacity,exception);\n if ((image_info->ping == MagickFalse) && (status == MagickFalse))\n ThrowGIFException(CorruptImageError,\"CorruptImage\");\n if (profiles != (LinkedListInfo *) NULL)\n {\n StringInfo\n *profile;",
" /*\n Set image profiles.\n */\n ResetLinkedListIterator(profiles);\n profile=(StringInfo *) GetNextValueInLinkedList(profiles);\n while (profile != (StringInfo *) NULL)\n {\n (void) SetImageProfile(image,GetStringInfoName(profile),profile,\n exception);\n profile=(StringInfo *) GetNextValueInLinkedList(profiles);\n }\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile);\n }\n duration+=image->delay*image->iterations;\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n opacity=(-1);\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n image->scene-1,image->scene);\n if (status == MagickFalse)\n break;\n }\n image->duration=duration;\n if (profiles != (LinkedListInfo *) NULL)\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile);\n meta_image=DestroyImage(meta_image);\n global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap);\n if ((image->columns == 0) || (image->rows == 0))\n ThrowReaderException(CorruptImageError,\"NegativeOrZeroImageSize\");\n (void) CloseBlob(image);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n return(GetFirstImageInList(image));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e g i s t e r G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% RegisterGIFImage() adds properties for the GIF image format to\n% the list of supported formats. The properties include the image format\n% tag, a method to read and/or write the format, whether the format\n% supports the saving of more than one frame to the same file or blob,\n% whether the format supports native in-memory I/O, and a brief\n% description of the format.\n%\n% The format of the RegisterGIFImage method is:\n%\n% size_t RegisterGIFImage(void)\n%\n*/\nModuleExport size_t RegisterGIFImage(void)\n{\n MagickInfo\n *entry;",
" entry=AcquireMagickInfo(\"GIF\",\"GIF\",\n \"CompuServe graphics interchange format\");\n entry->decoder=(DecodeImageHandler *) ReadGIFImage;\n entry->encoder=(EncodeImageHandler *) WriteGIFImage;\n entry->magick=(IsImageFormatHandler *) IsGIF;\n entry->mime_type=ConstantString(\"image/gif\");\n (void) RegisterMagickInfo(entry);\n entry=AcquireMagickInfo(\"GIF\",\"GIF87\",\n \"CompuServe graphics interchange format\");\n entry->decoder=(DecodeImageHandler *) ReadGIFImage;\n entry->encoder=(EncodeImageHandler *) WriteGIFImage;\n entry->magick=(IsImageFormatHandler *) IsGIF;\n entry->flags^=CoderAdjoinFlag;\n entry->version=ConstantString(\"version 87a\");\n entry->mime_type=ConstantString(\"image/gif\");\n (void) RegisterMagickInfo(entry);\n return(MagickImageCoderSignature);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% U n r e g i s t e r G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% UnregisterGIFImage() removes format registrations made by the\n% GIF module from the list of supported formats.\n%\n% The format of the UnregisterGIFImage method is:\n%\n% UnregisterGIFImage(void)\n%\n*/\nModuleExport void UnregisterGIFImage(void)\n{\n (void) UnregisterMagickInfo(\"GIF\");\n (void) UnregisterMagickInfo(\"GIF87\");\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% W r i t e G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteGIFImage() writes an image to a file in the Compuserve Graphics\n% image format.\n%\n% The format of the WriteGIFImage method is:\n%\n% MagickBooleanType WriteGIFImage(const ImageInfo *image_info,\n% Image *image,ExceptionInfo *exception)\n%\n% A description of each parameter follows.\n%\n% o image_info: the image info.\n%\n% o image: The image.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nstatic MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n int\n c;",
" ImageInfo\n *write_info;",
" MagickBooleanType\n status;",
" MagickOffsetType\n scene;",
" RectangleInfo\n page;",
" register ssize_t\n i;",
" register unsigned char\n *q;",
" size_t\n bits_per_pixel,\n delay,\n imageListLength,\n length,\n one;",
" ssize_t\n j,\n opacity;",
" unsigned char\n *colormap,\n *global_colormap;",
" /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n /*\n Allocate colormap.\n */\n global_colormap=(unsigned char *) AcquireQuantumMemory(768UL,\n sizeof(*global_colormap));\n colormap=(unsigned char *) AcquireQuantumMemory(768UL,sizeof(*colormap));\n if ((global_colormap == (unsigned char *) NULL) ||\n (colormap == (unsigned char *) NULL))\n {\n if (global_colormap != (unsigned char *) NULL)\n global_colormap=(unsigned char *) RelinquishMagickMemory(\n global_colormap);\n if (colormap != (unsigned char *) NULL)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n for (i=0; i < 768; i++)\n colormap[i]=(unsigned char) 0;\n /*\n Write GIF header.\n */\n write_info=CloneImageInfo(image_info);\n if (LocaleCompare(write_info->magick,\"GIF87\") != 0)\n (void) WriteBlob(image,6,(unsigned char *) \"GIF89a\");\n else\n {\n (void) WriteBlob(image,6,(unsigned char *) \"GIF87a\");\n write_info->adjoin=MagickFalse;\n }\n /*\n Determine image bounding box.\n */\n page.width=image->columns;\n if (image->page.width > page.width)\n page.width=image->page.width;\n page.height=image->rows;\n if (image->page.height > page.height)\n page.height=image->page.height;\n page.x=image->page.x;\n page.y=image->page.y;\n (void) WriteBlobLSBShort(image,(unsigned short) page.width);\n (void) WriteBlobLSBShort(image,(unsigned short) page.height);\n /*\n Write images to file.\n */\n if ((write_info->adjoin != MagickFalse) &&\n (GetNextImageInList(image) != (Image *) NULL))\n write_info->interlace=NoInterlace;\n scene=0;\n one=1;\n imageListLength=GetImageListLength(image);\n do\n {\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n opacity=(-1);\n if (IsImageOpaque(image,exception) != MagickFalse)\n {\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteType,exception);\n }\n else\n {\n double\n alpha,\n beta;",
" /*\n Identify transparent colormap index.\n */\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteBilevelAlphaType,exception);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].alpha != OpaqueAlpha)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=fabs(image->colormap[i].alpha-TransparentAlpha);\n beta=fabs(image->colormap[opacity].alpha-TransparentAlpha);\n if (alpha < beta)\n opacity=i;\n }\n if (opacity == -1)\n {\n (void) SetImageType(image,PaletteBilevelAlphaType,exception);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].alpha != OpaqueAlpha)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=fabs(image->colormap[i].alpha-TransparentAlpha);\n beta=fabs(image->colormap[opacity].alpha-TransparentAlpha);\n if (alpha < beta)\n opacity=i;\n }\n }\n if (opacity >= 0)\n {\n image->colormap[opacity].red=image->transparent_color.red;\n image->colormap[opacity].green=image->transparent_color.green;\n image->colormap[opacity].blue=image->transparent_color.blue;\n }\n }\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (bits_per_pixel=1; bits_per_pixel < 8; bits_per_pixel++)\n if ((one << bits_per_pixel) >= image->colors)\n break;\n q=colormap;\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));\n }\n for ( ; i < (ssize_t) (one << bits_per_pixel); i++)\n {\n *q++=(unsigned char) 0x0;\n *q++=(unsigned char) 0x0;\n *q++=(unsigned char) 0x0;\n }\n if ((GetPreviousImageInList(image) == (Image *) NULL) ||\n (write_info->adjoin == MagickFalse))\n {\n /*\n Write global colormap.\n */\n c=0x80;\n c|=(8-1) << 4; /* color resolution */\n c|=(bits_per_pixel-1); /* size of global colormap */\n (void) WriteBlobByte(image,(unsigned char) c);\n for (j=0; j < (ssize_t) image->colors; j++)\n if (IsPixelInfoEquivalent(&image->background_color,image->colormap+j))\n break;\n (void) WriteBlobByte(image,(unsigned char)\n (j == (ssize_t) image->colors ? 0 : j)); /* background color */\n (void) WriteBlobByte(image,(unsigned char) 0x00); /* reserved */\n length=(size_t) (3*(one << bits_per_pixel));\n (void) WriteBlob(image,length,colormap);\n for (j=0; j < 768; j++)\n global_colormap[j]=colormap[j];\n }\n if (LocaleCompare(write_info->magick,\"GIF87\") != 0)\n {\n const char\n *value;",
" /*\n Write graphics control extension.\n */\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xf9);\n (void) WriteBlobByte(image,(unsigned char) 0x04);\n c=image->dispose << 2;\n if (opacity >= 0)\n c|=0x01;\n (void) WriteBlobByte(image,(unsigned char) c);\n delay=(size_t) (100*image->delay/MagickMax((size_t)\n image->ticks_per_second,1));\n (void) WriteBlobLSBShort(image,(unsigned short) delay);\n (void) WriteBlobByte(image,(unsigned char) (opacity >= 0 ? opacity :\n 0));\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n value=GetImageProperty(image,\"comment\",exception);\n if (value != (const char *) NULL)\n {\n register const char\n *p;",
" size_t\n count;",
" /*\n Write comment extension.\n */\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xfe);\n for (p=value; *p != '\\0'; )\n {\n count=MagickMin(strlen(p),255);\n (void) WriteBlobByte(image,(unsigned char) count);\n for (i=0; i < (ssize_t) count; i++)\n (void) WriteBlobByte(image,(unsigned char) *p++);\n }\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n if ((GetPreviousImageInList(image) == (Image *) NULL) &&\n (GetNextImageInList(image) != (Image *) NULL) &&\n (image->iterations != 1))\n {\n /*\n Write Netscape Loop extension.\n */\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"NETSCAPE2.0\");\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xff);\n (void) WriteBlobByte(image,(unsigned char) 0x0b);\n (void) WriteBlob(image,11,(unsigned char *) \"NETSCAPE2.0\");\n (void) WriteBlobByte(image,(unsigned char) 0x03);\n (void) WriteBlobByte(image,(unsigned char) 0x01);\n (void) WriteBlobLSBShort(image,(unsigned short) (image->iterations ?\n image->iterations-1 : 0));\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n if ((image->gamma != 1.0f/2.2f))\n {\n char\n attributes[MagickPathExtent];",
" ssize_t\n count;",
" /*\n Write ImageMagick extension.\n */\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"ImageMagick\");\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xff);\n (void) WriteBlobByte(image,(unsigned char) 0x0b);\n (void) WriteBlob(image,11,(unsigned char *) \"ImageMagick\");\n count=FormatLocaleString(attributes,MagickPathExtent,\"gamma=%g\",\n image->gamma);\n (void) WriteBlobByte(image,(unsigned char) count);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) attributes);\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n ResetImageProfileIterator(image);\n for ( ; ; )\n {\n char\n *name;",
" const StringInfo\n *profile;",
" name=GetNextImageProfile(image);\n if (name == (const char *) NULL)\n break;\n profile=GetImageProfile(image,name);\n if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0) ||\n (LocaleCompare(name,\"IPTC\") == 0) ||\n (LocaleCompare(name,\"8BIM\") == 0) ||\n (LocaleNCompare(name,\"gif:\",4) == 0))\n {\n ssize_t\n offset;",
" unsigned char\n *datum;",
" datum=GetStringInfoDatum(profile);\n length=GetStringInfoLength(profile);\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xff);\n (void) WriteBlobByte(image,(unsigned char) 0x0b);\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {\n /*\n Write ICC extension.\n */\n (void) WriteBlob(image,11,(unsigned char *) \"ICCRGBG1012\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"ICCRGBG1012\");\n }\n else\n if ((LocaleCompare(name,\"IPTC\") == 0))\n {\n /*\n Write IPTC extension.\n */\n (void) WriteBlob(image,11,(unsigned char *) \"MGKIPTC0000\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"MGKIPTC0000\");\n }\n else\n if ((LocaleCompare(name,\"8BIM\") == 0))\n {\n /*\n Write 8BIM extension.\n */\n (void) WriteBlob(image,11,(unsigned char *)\n \"MGK8BIM0000\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"MGK8BIM0000\");\n }\n else\n {\n char\n extension[MagickPathExtent];",
" /*\n Write generic extension.\n */\n (void) CopyMagickString(extension,name+4,\n sizeof(extension));\n (void) WriteBlob(image,11,(unsigned char *) extension);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",name);\n }\n offset=0;\n while ((ssize_t) length > offset)\n {\n size_t\n block_length;",
" if ((length-offset) < 255)\n block_length=length-offset;\n else\n block_length=255;\n (void) WriteBlobByte(image,(unsigned char) block_length);\n (void) WriteBlob(image,(size_t) block_length,datum+offset);\n offset+=(ssize_t) block_length;\n }\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n }\n }\n }\n (void) WriteBlobByte(image,','); /* image separator */\n /*\n Write the image header.\n */\n page.x=image->page.x;\n page.y=image->page.y;\n if ((image->page.width != 0) && (image->page.height != 0))\n page=image->page;\n (void) WriteBlobLSBShort(image,(unsigned short) (page.x < 0 ? 0 : page.x));\n (void) WriteBlobLSBShort(image,(unsigned short) (page.y < 0 ? 0 : page.y));\n (void) WriteBlobLSBShort(image,(unsigned short) image->columns);\n (void) WriteBlobLSBShort(image,(unsigned short) image->rows);\n c=0x00;\n if (write_info->interlace != NoInterlace)\n c|=0x40; /* pixel data is interlaced */\n for (j=0; j < (ssize_t) (3*image->colors); j++)\n if (colormap[j] != global_colormap[j])\n break;\n if (j == (ssize_t) (3*image->colors))\n (void) WriteBlobByte(image,(unsigned char) c);\n else\n {\n c|=0x80;\n c|=(bits_per_pixel-1); /* size of local colormap */\n (void) WriteBlobByte(image,(unsigned char) c);\n length=(size_t) (3*(one << bits_per_pixel));\n (void) WriteBlob(image,length,colormap);\n }\n /*\n Write the image data.\n */\n c=(int) MagickMax(bits_per_pixel,2);\n (void) WriteBlobByte(image,(unsigned char) c);\n status=EncodeImage(write_info,image,(size_t) MagickMax(bits_per_pixel,2)+1,\n exception);\n if (status == MagickFalse)\n {\n global_colormap=(unsigned char *) RelinquishMagickMemory(\n global_colormap);\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n write_info=DestroyImageInfo(write_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n scene++;\n status=SetImageProgress(image,SaveImagesTag,scene,imageListLength);\n if (status == MagickFalse)\n break;\n } while (write_info->adjoin != MagickFalse);\n (void) WriteBlobByte(image,';'); /* terminator */\n global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap);\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n write_info=DestroyImageInfo(write_info);\n (void) CloseBlob(image);\n return(MagickTrue);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [310, 689], "buggy_code_start_loc": [232, 681], "filenames": ["MagickCore/fourier.c", "coders/gif.c"], "fixing_code_end_loc": [306, 691], "fixing_code_start_loc": [232, 682], "message": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:7.0.8-50:q16:*:*:*:*:*:*", "matchCriteriaId": "25CCEA99-8329-46C6-9625-4FE15F24CF69", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.04:*:*:*:*:*:*:*", "matchCriteriaId": "CD783B0C-9246-47D9-A937-6144FE8BFF0F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "F1E78106-58E6-4D59-990F-75DA575BFAD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage."}, {"lang": "es", "value": "ImageMagick versi\u00f3n 7.0.8-50 Q16 presenta una vulnerabilidad de desbordamiento de b\u00fafer basado en memoria din\u00e1mica (heap) en MagickCore/fourier.c en ComplexImage."}], "evaluatorComment": null, "id": "CVE-2019-13308", "lastModified": "2023-03-02T15:56:47.600", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-07-05T01:15:10.750", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00069.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/issues/1595"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick6/commit/19651f3db63fa1511ed83a348c4c82fa553f8d01"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/09/msg00007.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4192-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4712"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, "type": "CWE-787"}
| 102
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% GGGG IIIII FFFFF %\n% G I F %\n% G GG I FFF %\n% G G I F %\n% GGG IIIII F %\n% %\n% %\n% Read/Write Compuserv Graphics Interchange Format %\n% %\n% Software Design %\n% Cristy %\n% July 1992 %\n% %\n% %\n% Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %\n% dedicated to making software imaging solutions freely available. %\n% %\n% You may not use this file except in compliance with the License. You may %\n% obtain a copy of the License at %\n% %\n% https://imagemagick.org/script/license.php %\n% %\n% Unless required by applicable law or agreed to in writing, software %\n% distributed under the License is distributed on an \"AS IS\" BASIS, %\n% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %\n% See the License for the specific language governing permissions and %\n% limitations under the License. %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n%\n*/\n\f\n/*\n Include declarations.\n*/\n#include \"MagickCore/studio.h\"\n#include \"MagickCore/attribute.h\"\n#include \"MagickCore/blob.h\"\n#include \"MagickCore/blob-private.h\"\n#include \"MagickCore/cache.h\"\n#include \"MagickCore/color.h\"\n#include \"MagickCore/color-private.h\"\n#include \"MagickCore/colormap.h\"\n#include \"MagickCore/colormap-private.h\"\n#include \"MagickCore/colorspace.h\"\n#include \"MagickCore/colorspace-private.h\"\n#include \"MagickCore/exception.h\"\n#include \"MagickCore/exception-private.h\"\n#include \"MagickCore/image.h\"\n#include \"MagickCore/image-private.h\"\n#include \"MagickCore/list.h\"\n#include \"MagickCore/profile.h\"\n#include \"MagickCore/magick.h\"\n#include \"MagickCore/memory_.h\"\n#include \"MagickCore/monitor.h\"\n#include \"MagickCore/monitor-private.h\"\n#include \"MagickCore/option.h\"\n#include \"MagickCore/pixel.h\"\n#include \"MagickCore/pixel-accessor.h\"\n#include \"MagickCore/property.h\"\n#include \"MagickCore/quantize.h\"\n#include \"MagickCore/quantum-private.h\"\n#include \"MagickCore/resource_.h\"\n#include \"MagickCore/static.h\"\n#include \"MagickCore/string_.h\"\n#include \"MagickCore/string-private.h\"\n#include \"MagickCore/module.h\"\n\f\n/*\n Define declarations.\n*/\n#define MaximumLZWBits 12\n#define MaximumLZWCode (1UL << MaximumLZWBits)\n\f\n/*\n Typdef declarations.\n*/\ntypedef struct _LZWCodeInfo\n{\n unsigned char\n buffer[280];",
" size_t\n count,\n bit;",
" MagickBooleanType\n eof;\n} LZWCodeInfo;",
"typedef struct _LZWStack\n{\n size_t\n *codes,\n *index,\n *top;\n} LZWStack;",
"typedef struct _LZWInfo\n{\n Image\n *image;",
" LZWStack\n *stack;",
" MagickBooleanType\n genesis;",
" size_t\n data_size,\n maximum_data_value,\n clear_code,\n end_code,\n bits,\n first_code,\n last_code,\n maximum_code,\n slot,\n *table[2];",
" LZWCodeInfo\n code_info;\n} LZWInfo;\n\f\n/*\n Forward declarations.\n*/\nstatic inline int\n GetNextLZWCode(LZWInfo *,const size_t);",
"static MagickBooleanType\n WriteGIFImage(const ImageInfo *,Image *,ExceptionInfo *);",
"static ssize_t\n ReadBlobBlock(Image *,unsigned char *);\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% D e c o d e I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% DecodeImage uncompresses an image via GIF-coding.\n%\n% The format of the DecodeImage method is:\n%\n% MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)\n%\n% A description of each parameter follows:\n%\n% o image: the address of a structure of type Image.\n%\n% o opacity: The colormap index associated with the transparent color.\n%\n*/",
"static LZWInfo *RelinquishLZWInfo(LZWInfo *lzw_info)\n{\n if (lzw_info->table[0] != (size_t *) NULL)\n lzw_info->table[0]=(size_t *) RelinquishMagickMemory(\n lzw_info->table[0]);\n if (lzw_info->table[1] != (size_t *) NULL)\n lzw_info->table[1]=(size_t *) RelinquishMagickMemory(\n lzw_info->table[1]);\n if (lzw_info->stack != (LZWStack *) NULL)\n {\n if (lzw_info->stack->codes != (size_t *) NULL)\n lzw_info->stack->codes=(size_t *) RelinquishMagickMemory(\n lzw_info->stack->codes);\n lzw_info->stack=(LZWStack *) RelinquishMagickMemory(lzw_info->stack);\n }\n lzw_info=(LZWInfo *) RelinquishMagickMemory(lzw_info);\n return((LZWInfo *) NULL);\n}",
"static inline void ResetLZWInfo(LZWInfo *lzw_info)\n{\n size_t\n one;",
" lzw_info->bits=lzw_info->data_size+1;\n one=1;\n lzw_info->maximum_code=one << lzw_info->bits;\n lzw_info->slot=lzw_info->maximum_data_value+3;\n lzw_info->genesis=MagickTrue;\n}",
"static LZWInfo *AcquireLZWInfo(Image *image,const size_t data_size)\n{\n LZWInfo\n *lzw_info;",
" register ssize_t\n i;",
" size_t\n one;",
" lzw_info=(LZWInfo *) AcquireMagickMemory(sizeof(*lzw_info));\n if (lzw_info == (LZWInfo *) NULL)\n return((LZWInfo *) NULL);\n (void) memset(lzw_info,0,sizeof(*lzw_info));\n lzw_info->image=image;\n lzw_info->data_size=data_size;\n one=1;\n lzw_info->maximum_data_value=(one << data_size)-1;\n lzw_info->clear_code=lzw_info->maximum_data_value+1;\n lzw_info->end_code=lzw_info->maximum_data_value+2;\n lzw_info->table[0]=(size_t *) AcquireQuantumMemory(MaximumLZWCode,\n sizeof(**lzw_info->table));\n lzw_info->table[1]=(size_t *) AcquireQuantumMemory(MaximumLZWCode,\n sizeof(**lzw_info->table));\n if ((lzw_info->table[0] == (size_t *) NULL) ||\n (lzw_info->table[1] == (size_t *) NULL))\n {\n lzw_info=RelinquishLZWInfo(lzw_info);\n return((LZWInfo *) NULL);\n }\n (void) memset(lzw_info->table[0],0,MaximumLZWCode*\n sizeof(**lzw_info->table));\n (void) memset(lzw_info->table[1],0,MaximumLZWCode*\n sizeof(**lzw_info->table));\n for (i=0; i <= (ssize_t) lzw_info->maximum_data_value; i++)\n {\n lzw_info->table[0][i]=0;\n lzw_info->table[1][i]=(size_t) i;\n }\n ResetLZWInfo(lzw_info);\n lzw_info->code_info.buffer[0]='\\0';\n lzw_info->code_info.buffer[1]='\\0';\n lzw_info->code_info.count=2;\n lzw_info->code_info.bit=8*lzw_info->code_info.count;\n lzw_info->code_info.eof=MagickFalse;\n lzw_info->genesis=MagickTrue;\n lzw_info->stack=(LZWStack *) AcquireMagickMemory(sizeof(*lzw_info->stack));\n if (lzw_info->stack == (LZWStack *) NULL)\n {\n lzw_info=RelinquishLZWInfo(lzw_info);\n return((LZWInfo *) NULL);\n }\n lzw_info->stack->codes=(size_t *) AcquireQuantumMemory(2UL*\n MaximumLZWCode,sizeof(*lzw_info->stack->codes));\n if (lzw_info->stack->codes == (size_t *) NULL)\n {\n lzw_info=RelinquishLZWInfo(lzw_info);\n return((LZWInfo *) NULL);\n }\n lzw_info->stack->index=lzw_info->stack->codes;\n lzw_info->stack->top=lzw_info->stack->codes+2*MaximumLZWCode;\n return(lzw_info);\n}",
"static inline int GetNextLZWCode(LZWInfo *lzw_info,const size_t bits)\n{\n int\n code;",
" register ssize_t\n i;",
" size_t\n one;",
" while (((lzw_info->code_info.bit+bits) > (8*lzw_info->code_info.count)) &&\n (lzw_info->code_info.eof == MagickFalse))\n {\n ssize_t\n count;",
" lzw_info->code_info.buffer[0]=lzw_info->code_info.buffer[\n lzw_info->code_info.count-2];\n lzw_info->code_info.buffer[1]=lzw_info->code_info.buffer[\n lzw_info->code_info.count-1];\n lzw_info->code_info.bit-=8*(lzw_info->code_info.count-2);\n lzw_info->code_info.count=2;\n count=ReadBlobBlock(lzw_info->image,&lzw_info->code_info.buffer[\n lzw_info->code_info.count]);\n if (count > 0)\n lzw_info->code_info.count+=count;\n else\n lzw_info->code_info.eof=MagickTrue;\n }\n if ((lzw_info->code_info.bit+bits) > (8*lzw_info->code_info.count))\n return(-1);\n code=0;\n one=1;\n for (i=0; i < (ssize_t) bits; i++)\n {\n code|=((lzw_info->code_info.buffer[lzw_info->code_info.bit/8] &\n (one << (lzw_info->code_info.bit % 8))) != 0) << i;\n lzw_info->code_info.bit++;\n }\n return(code);\n}",
"static inline int PopLZWStack(LZWStack *stack_info)\n{\n if (stack_info->index <= stack_info->codes)\n return(-1);\n stack_info->index--;\n return((int) *stack_info->index);\n}",
"static inline void PushLZWStack(LZWStack *stack_info,const size_t value)\n{\n if (stack_info->index >= stack_info->top)\n return;\n *stack_info->index=value;\n stack_info->index++;\n}",
"static int ReadBlobLZWByte(LZWInfo *lzw_info)\n{\n int\n code;",
" size_t\n one,\n value;",
" ssize_t\n count;",
" if (lzw_info->stack->index != lzw_info->stack->codes)\n return(PopLZWStack(lzw_info->stack));\n if (lzw_info->genesis != MagickFalse)\n {\n lzw_info->genesis=MagickFalse;\n do\n {\n lzw_info->first_code=(size_t) GetNextLZWCode(lzw_info,lzw_info->bits);\n lzw_info->last_code=lzw_info->first_code;\n } while (lzw_info->first_code == lzw_info->clear_code);\n return((int) lzw_info->first_code);\n }\n code=GetNextLZWCode(lzw_info,lzw_info->bits);\n if (code < 0)\n return(code);\n if ((size_t) code == lzw_info->clear_code)\n {\n ResetLZWInfo(lzw_info);\n return(ReadBlobLZWByte(lzw_info));\n }\n if ((size_t) code == lzw_info->end_code)\n return(-1);\n if ((size_t) code < lzw_info->slot)\n value=(size_t) code;\n else\n {\n PushLZWStack(lzw_info->stack,lzw_info->first_code);\n value=lzw_info->last_code;\n }\n count=0;\n while (value > lzw_info->maximum_data_value)\n {\n if ((size_t) count > MaximumLZWCode)\n return(-1);\n count++;\n if ((size_t) value > MaximumLZWCode)\n return(-1);\n PushLZWStack(lzw_info->stack,lzw_info->table[1][value]);\n value=lzw_info->table[0][value];\n }\n lzw_info->first_code=lzw_info->table[1][value];\n PushLZWStack(lzw_info->stack,lzw_info->first_code);\n one=1;\n if (lzw_info->slot < MaximumLZWCode)\n {\n lzw_info->table[0][lzw_info->slot]=lzw_info->last_code;\n lzw_info->table[1][lzw_info->slot]=lzw_info->first_code;\n lzw_info->slot++;\n if ((lzw_info->slot >= lzw_info->maximum_code) &&\n (lzw_info->bits < MaximumLZWBits))\n {\n lzw_info->bits++;\n lzw_info->maximum_code=one << lzw_info->bits;\n }\n }\n lzw_info->last_code=(size_t) code;\n return(PopLZWStack(lzw_info->stack));\n}",
"static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity,\n ExceptionInfo *exception)\n{\n int\n c;",
" LZWInfo\n *lzw_info;",
" size_t\n pass;",
" ssize_t\n index,\n offset,\n y;",
" unsigned char\n data_size;",
" /*\n Allocate decoder tables.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n data_size=(unsigned char) ReadBlobByte(image);\n if (data_size > MaximumLZWBits)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n lzw_info=AcquireLZWInfo(image,data_size);\n if (lzw_info == (LZWInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n pass=0;\n offset=0;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register ssize_t\n x;",
" register Quantum\n *magick_restrict q;",
" q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; )\n {\n c=ReadBlobLZWByte(lzw_info);\n if (c < 0)\n break;\n index=ConstrainColormapIndex(image,(ssize_t) c,exception);\n SetPixelIndex(image,(Quantum) index,q);\n SetPixelViaPixelInfo(image,image->colormap+index,q);\n SetPixelAlpha(image,index == opacity ? TransparentAlpha : OpaqueAlpha,q);\n x++;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n if (x < (ssize_t) image->columns)\n break;\n if (image->interlace == NoInterlace)\n offset++;\n else\n {\n switch (pass)\n {\n case 0:\n default:\n {\n offset+=8;\n break;\n }\n case 1:\n {\n offset+=8;\n break;\n }\n case 2:\n {\n offset+=4;\n break;\n }\n case 3:\n {\n offset+=2;\n break;\n }\n }\n if ((pass == 0) && (offset >= (ssize_t) image->rows))\n {\n pass++;\n offset=4;\n }\n if ((pass == 1) && (offset >= (ssize_t) image->rows))\n {\n pass++;\n offset=2;\n }\n if ((pass == 2) && (offset >= (ssize_t) image->rows))\n {\n pass++;\n offset=1;\n }\n }\n }\n lzw_info=RelinquishLZWInfo(lzw_info);\n if (y < (ssize_t) image->rows)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% E n c o d e I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% EncodeImage compresses an image via GIF-coding.\n%\n% The format of the EncodeImage method is:\n%\n% MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,\n% const size_t data_size)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o image: the address of a structure of type Image.\n%\n% o data_size: The number of bits in the compressed packet.\n%\n*/\nstatic MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,\n const size_t data_size,ExceptionInfo *exception)\n{\n#define MaxCode(number_bits) ((one << (number_bits))-1)\n#define MaxHashTable 5003\n#define MaxGIFBits 12UL\n#define MaxGIFTable (1UL << MaxGIFBits)\n#define GIFOutputCode(code) \\\n{ \\\n /* \\\n Emit a code. \\\n */ \\\n if (bits > 0) \\\n datum|=(size_t) (code) << bits; \\\n else \\\n datum=(size_t) (code); \\\n bits+=number_bits; \\\n while (bits >= 8) \\\n { \\\n /* \\\n Add a character to current packet. \\\n */ \\\n packet[length++]=(unsigned char) (datum & 0xff); \\\n if (length >= 254) \\\n { \\\n (void) WriteBlobByte(image,(unsigned char) length); \\\n (void) WriteBlob(image,length,packet); \\\n length=0; \\\n } \\\n datum>>=8; \\\n bits-=8; \\\n } \\\n if (free_code > max_code) \\\n { \\\n number_bits++; \\\n if (number_bits == MaxGIFBits) \\\n max_code=MaxGIFTable; \\\n else \\\n max_code=MaxCode(number_bits); \\\n } \\\n}",
" Quantum\n index;",
" short\n *hash_code,\n *hash_prefix,\n waiting_code;",
" size_t\n bits,\n clear_code,\n datum,\n end_of_information_code,\n free_code,\n length,\n max_code,\n next_pixel,\n number_bits,\n one,\n pass;",
" ssize_t\n displacement,\n offset,\n k,\n y;",
" unsigned char\n *packet,\n *hash_suffix;",
" /*\n Allocate encoder tables.\n */\n assert(image != (Image *) NULL);\n one=1;\n packet=(unsigned char *) AcquireQuantumMemory(256,sizeof(*packet));\n hash_code=(short *) AcquireQuantumMemory(MaxHashTable,sizeof(*hash_code));\n hash_prefix=(short *) AcquireQuantumMemory(MaxHashTable,sizeof(*hash_prefix));\n hash_suffix=(unsigned char *) AcquireQuantumMemory(MaxHashTable,\n sizeof(*hash_suffix));\n if ((packet == (unsigned char *) NULL) || (hash_code == (short *) NULL) ||\n (hash_prefix == (short *) NULL) ||\n (hash_suffix == (unsigned char *) NULL))\n {\n if (packet != (unsigned char *) NULL)\n packet=(unsigned char *) RelinquishMagickMemory(packet);\n if (hash_code != (short *) NULL)\n hash_code=(short *) RelinquishMagickMemory(hash_code);\n if (hash_prefix != (short *) NULL)\n hash_prefix=(short *) RelinquishMagickMemory(hash_prefix);\n if (hash_suffix != (unsigned char *) NULL)\n hash_suffix=(unsigned char *) RelinquishMagickMemory(hash_suffix);\n return(MagickFalse);\n }\n /*\n Initialize GIF encoder.\n */\n (void) memset(packet,0,256*sizeof(*packet));\n (void) memset(hash_code,0,MaxHashTable*sizeof(*hash_code));\n (void) memset(hash_prefix,0,MaxHashTable*sizeof(*hash_prefix));\n (void) memset(hash_suffix,0,MaxHashTable*sizeof(*hash_suffix));\n number_bits=data_size;\n max_code=MaxCode(number_bits);\n clear_code=((short) one << (data_size-1));\n end_of_information_code=clear_code+1;\n free_code=clear_code+2;\n length=0;\n datum=0;\n bits=0;\n GIFOutputCode(clear_code);\n /*\n Encode pixels.\n */\n offset=0;\n pass=0;\n waiting_code=0;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n register const Quantum\n *magick_restrict p;",
" register ssize_t\n x;",
" p=GetVirtualPixels(image,0,offset,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if (y == 0)\n {\n waiting_code=(short) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n for (x=(ssize_t) (y == 0 ? 1 : 0); x < (ssize_t) image->columns; x++)\n {\n /*\n Probe hash table.\n */",
" next_pixel=MagickFalse;\n displacement=1;",
" index=(Quantum) ((size_t) GetPixelIndex(image,p) & 0xff);\n p+=GetPixelChannels(image);\n k=(ssize_t) (((size_t) index << (MaxGIFBits-8))+waiting_code);\n if (k >= MaxHashTable)\n k-=MaxHashTable;",
" if (k < 0)\n continue;",
" if (hash_code[k] > 0)\n {\n if ((hash_prefix[k] == waiting_code) &&\n (hash_suffix[k] == (unsigned char) index))\n {\n waiting_code=hash_code[k];\n continue;\n }\n if (k != 0)\n displacement=MaxHashTable-k;\n for ( ; ; )\n {\n k-=displacement;\n if (k < 0)\n k+=MaxHashTable;\n if (hash_code[k] == 0)\n break;\n if ((hash_prefix[k] == waiting_code) &&\n (hash_suffix[k] == (unsigned char) index))\n {\n waiting_code=hash_code[k];\n next_pixel=MagickTrue;\n break;\n }\n }\n if (next_pixel != MagickFalse)\n continue;\n }\n GIFOutputCode(waiting_code);\n if (free_code < MaxGIFTable)\n {\n hash_code[k]=(short) free_code++;\n hash_prefix[k]=waiting_code;\n hash_suffix[k]=(unsigned char) index;\n }\n else\n {\n /*\n Fill the hash table with empty entries.\n */\n for (k=0; k < MaxHashTable; k++)\n hash_code[k]=0;\n /*\n Reset compressor and issue a clear code.\n */\n free_code=clear_code+2;\n GIFOutputCode(clear_code);\n number_bits=data_size;\n max_code=MaxCode(number_bits);\n }\n waiting_code=(short) index;\n }\n if (image_info->interlace == NoInterlace)\n offset++;\n else\n switch (pass)\n {\n case 0:\n default:\n {\n offset+=8;\n if (offset >= (ssize_t) image->rows)\n {\n pass++;\n offset=4;\n }\n break;\n }\n case 1:\n {\n offset+=8;\n if (offset >= (ssize_t) image->rows)\n {\n pass++;\n offset=2;\n }\n break;\n }\n case 2:\n {\n offset+=4;\n if (offset >= (ssize_t) image->rows)\n {\n pass++;\n offset=1;\n }\n break;\n }\n case 3:\n {\n offset+=2;\n break;\n }\n }\n }\n /*\n Flush out the buffered code.\n */\n GIFOutputCode(waiting_code);\n GIFOutputCode(end_of_information_code);\n if (bits > 0)\n {\n /*\n Add a character to current packet.\n */\n packet[length++]=(unsigned char) (datum & 0xff);\n if (length >= 254)\n {\n (void) WriteBlobByte(image,(unsigned char) length);\n (void) WriteBlob(image,length,packet);\n length=0;\n }\n }\n /*\n Flush accumulated data.\n */\n if (length > 0)\n {\n (void) WriteBlobByte(image,(unsigned char) length);\n (void) WriteBlob(image,length,packet);\n }\n /*\n Free encoder memory.\n */\n hash_suffix=(unsigned char *) RelinquishMagickMemory(hash_suffix);\n hash_prefix=(short *) RelinquishMagickMemory(hash_prefix);\n hash_code=(short *) RelinquishMagickMemory(hash_code);\n packet=(unsigned char *) RelinquishMagickMemory(packet);\n return(MagickTrue);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% I s G I F %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% IsGIF() returns MagickTrue if the image format type, identified by the\n% magick string, is GIF.\n%\n% The format of the IsGIF method is:\n%\n% MagickBooleanType IsGIF(const unsigned char *magick,const size_t length)\n%\n% A description of each parameter follows:\n%\n% o magick: compare image format pattern against these bytes.\n%\n% o length: Specifies the length of the magick string.\n%\n*/\nstatic MagickBooleanType IsGIF(const unsigned char *magick,const size_t length)\n{\n if (length < 4)\n return(MagickFalse);\n if (LocaleNCompare((char *) magick,\"GIF8\",4) == 0)\n return(MagickTrue);\n return(MagickFalse);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n+ R e a d B l o b B l o c k %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadBlobBlock() reads data from the image file and returns it. The\n% amount of data is determined by first reading a count byte. The number\n% of bytes read is returned.\n%\n% The format of the ReadBlobBlock method is:\n%\n% ssize_t ReadBlobBlock(Image *image,unsigned char *data)\n%\n% A description of each parameter follows:\n%\n% o image: the image.\n%\n% o data: Specifies an area to place the information requested from\n% the file.\n%\n*/\nstatic ssize_t ReadBlobBlock(Image *image,unsigned char *data)\n{\n ssize_t\n count;",
" unsigned char\n block_count;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n assert(data != (unsigned char *) NULL);\n count=ReadBlob(image,1,&block_count);\n if (count != 1)\n return(0);\n count=ReadBlob(image,(size_t) block_count,data);\n if (count != (ssize_t) block_count)\n return(0);\n return(count);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e a d G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% ReadGIFImage() reads a Compuserve Graphics image file and returns it.\n% It allocates the memory necessary for the new Image structure and returns a\n% pointer to the new image.\n%\n% The format of the ReadGIFImage method is:\n%\n% Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n%\n% A description of each parameter follows:\n%\n% o image_info: the image info.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/",
"static void *DestroyGIFProfile(void *profile)\n{\n return((void *) DestroyStringInfo((StringInfo *) profile));\n}",
"static MagickBooleanType PingGIFImage(Image *image,ExceptionInfo *exception)\n{\n unsigned char\n buffer[256],\n length,\n data_size;",
" assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n if (ReadBlob(image,1,&data_size) != 1)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n if (data_size > MaximumLZWBits)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n if (ReadBlob(image,1,&length) != 1)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n while (length != 0)\n {\n if (ReadBlob(image,length,buffer) != (ssize_t) length)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n if (ReadBlob(image,1,&length) != 1)\n ThrowBinaryException(CorruptImageError,\"CorruptImage\",image->filename);\n }\n return(MagickTrue);\n}",
"static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n#define BitSet(byte,bit) (((byte) & (bit)) == (bit))\n#define LSBFirstOrder(x,y) (((y) << 8) | (x))\n#define ThrowGIFException(exception,message) \\\n{ \\\n if (profiles != (LinkedListInfo *) NULL) \\\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile); \\\n if (global_colormap != (unsigned char *) NULL) \\\n global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap); \\\n if (meta_image != (Image *) NULL) \\\n meta_image=DestroyImage(meta_image); \\\n ThrowReaderException((exception),(message)); \\\n}",
" Image\n *image,\n *meta_image;",
" LinkedListInfo\n *profiles;",
" MagickBooleanType\n status;",
" register ssize_t\n i;",
" register unsigned char\n *p;",
" size_t\n duration,\n global_colors,\n image_count,\n local_colors,\n one;",
" ssize_t\n count,\n opacity;",
" unsigned char\n background,\n buffer[257],\n c,\n flag,\n *global_colormap;",
" /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Determine if this a GIF file.\n */\n count=ReadBlob(image,6,buffer);\n if ((count != 6) || ((LocaleNCompare((char *) buffer,\"GIF87\",5) != 0) &&\n (LocaleNCompare((char *) buffer,\"GIF89\",5) != 0)))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n (void) memset(buffer,0,sizeof(buffer));\n meta_image=AcquireImage(image_info,exception); /* metadata container */\n meta_image->page.width=ReadBlobLSBShort(image);\n meta_image->page.height=ReadBlobLSBShort(image);\n meta_image->iterations=1;\n flag=(unsigned char) ReadBlobByte(image);\n profiles=(LinkedListInfo *) NULL;\n background=(unsigned char) ReadBlobByte(image);\n c=(unsigned char) ReadBlobByte(image); /* reserved */\n one=1;\n global_colors=one << (((size_t) flag & 0x07)+1);\n global_colormap=(unsigned char *) AcquireQuantumMemory((size_t)\n MagickMax(global_colors,256),3UL*sizeof(*global_colormap));\n if (global_colormap == (unsigned char *) NULL)\n ThrowGIFException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) memset(global_colormap,0,3*MagickMax(global_colors,256)*\n sizeof(*global_colormap));\n if (BitSet((int) flag,0x80) != 0)\n {\n count=ReadBlob(image,(size_t) (3*global_colors),global_colormap);\n if (count != (ssize_t) (3*global_colors))\n ThrowGIFException(CorruptImageError,\"InsufficientImageDataInFile\");\n }\n duration=0;\n opacity=(-1);\n image_count=0;\n for ( ; ; )\n {\n count=ReadBlob(image,1,&c);\n if (count != 1)\n break;\n if (c == (unsigned char) ';')\n break; /* terminator */\n if (c == (unsigned char) '!')\n {\n /*\n GIF Extension block.\n */\n (void) memset(buffer,0,sizeof(buffer));\n count=ReadBlob(image,1,&c);\n if (count != 1)\n ThrowGIFException(CorruptImageError,\"UnableToReadExtensionBlock\");\n switch (c)\n {\n case 0xf9:\n {\n /*\n Read graphics control extension.\n */\n while (ReadBlobBlock(image,buffer) != 0) ;\n meta_image->dispose=(DisposeType) ((buffer[0] >> 2) & 0x07);\n meta_image->delay=((size_t) buffer[2] << 8) | buffer[1];\n if ((ssize_t) (buffer[0] & 0x01) == 0x01)\n opacity=(ssize_t) buffer[3];\n break;\n }\n case 0xfe:\n {\n char\n *comments;",
" size_t\n extent,\n offset;",
" comments=AcquireString((char *) NULL);\n extent=MagickPathExtent;\n for (offset=0; ; offset+=count)\n {\n count=ReadBlobBlock(image,buffer);\n if (count == 0)\n break;\n buffer[count]='\\0';\n if ((ssize_t) (count+offset+MagickPathExtent) >= (ssize_t) extent)\n {\n extent<<=1;\n comments=(char *) ResizeQuantumMemory(comments,extent+\n MagickPathExtent,sizeof(*comments));\n if (comments == (char *) NULL)\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n (void) CopyMagickString(&comments[offset],(char *) buffer,extent-\n offset);\n }\n (void) SetImageProperty(meta_image,\"comment\",comments,exception);\n comments=DestroyString(comments);\n break;\n }\n case 0xff:\n {\n MagickBooleanType\n loop;",
" /*\n Read Netscape Loop extension.\n */\n loop=MagickFalse;\n if (ReadBlobBlock(image,buffer) != 0)\n loop=LocaleNCompare((char *) buffer,\"NETSCAPE2.0\",11) == 0 ?\n MagickTrue : MagickFalse;\n if (loop != MagickFalse)\n while (ReadBlobBlock(image,buffer) != 0)\n {\n meta_image->iterations=((size_t) buffer[2] << 8) | buffer[1];\n if (meta_image->iterations != 0)\n meta_image->iterations++;\n }\n else\n {\n char\n name[MagickPathExtent];",
" int\n block_length,\n info_length,\n reserved_length;",
" MagickBooleanType\n i8bim,\n icc,\n iptc,\n magick;",
" StringInfo\n *profile;",
" unsigned char\n *info;",
" /*\n Store GIF application extension as a generic profile.\n */\n icc=LocaleNCompare((char *) buffer,\"ICCRGBG1012\",11) == 0 ?\n MagickTrue : MagickFalse;\n magick=LocaleNCompare((char *) buffer,\"ImageMagick\",11) == 0 ?\n MagickTrue : MagickFalse;\n i8bim=LocaleNCompare((char *) buffer,\"MGK8BIM0000\",11) == 0 ?\n MagickTrue : MagickFalse;\n iptc=LocaleNCompare((char *) buffer,\"MGKIPTC0000\",11) == 0 ?\n MagickTrue : MagickFalse;\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Reading GIF application extension\");\n info=(unsigned char *) AcquireQuantumMemory(255UL,\n sizeof(*info));\n if (info == (unsigned char *) NULL)\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n (void) memset(info,0,255UL*sizeof(*info));\n reserved_length=255;\n for (info_length=0; ; )\n {\n block_length=(int) ReadBlobBlock(image,&info[info_length]);\n if (block_length == 0)\n break;\n info_length+=block_length;\n if (info_length > (reserved_length-255))\n {\n reserved_length+=4096;\n info=(unsigned char *) ResizeQuantumMemory(info,(size_t)\n reserved_length,sizeof(*info));\n if (info == (unsigned char *) NULL)\n {\n info=(unsigned char *) RelinquishMagickMemory(info);\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n }\n }\n profile=BlobToStringInfo(info,(size_t) info_length);\n if (profile == (StringInfo *) NULL)\n {\n info=(unsigned char *) RelinquishMagickMemory(info);\n ThrowGIFException(ResourceLimitError,\n \"MemoryAllocationFailed\");\n }\n if (i8bim != MagickFalse)\n (void) CopyMagickString(name,\"8bim\",sizeof(name));\n else if (icc != MagickFalse)\n (void) CopyMagickString(name,\"icc\",sizeof(name));\n else if (iptc != MagickFalse)\n (void) CopyMagickString(name,\"iptc\",sizeof(name));\n else if (magick != MagickFalse)\n {\n (void) CopyMagickString(name,\"magick\",sizeof(name));\n meta_image->gamma=StringToDouble((char *) info+6,\n (char **) NULL);\n }\n else\n (void) FormatLocaleString(name,sizeof(name),\"gif:%.11s\",\n buffer);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" profile name=%s\",name);\n info=(unsigned char *) RelinquishMagickMemory(info);\n if (magick != MagickFalse)\n profile=DestroyStringInfo(profile);\n else\n {\n if (profiles == (LinkedListInfo *) NULL)\n profiles=NewLinkedList(0);\n SetStringInfoName(profile,name);\n (void) AppendValueToLinkedList(profiles,profile);\n }\n }\n break;\n }\n default:\n {\n while (ReadBlobBlock(image,buffer) != 0) ;\n break;\n }\n }\n }\n if (c != (unsigned char) ',')\n continue;\n image_count++;\n if (image_count != 1)\n {\n /*\n Allocate next image structure.\n */\n AcquireNextImage(image_info,image,exception);\n if (GetNextImageInList(image) == (Image *) NULL)\n {\n status=MagickFalse;\n break;\n }\n image=SyncNextImageInList(image);\n }\n /*\n Read image attributes.\n */\n meta_image->page.x=(ssize_t) ReadBlobLSBShort(image);\n meta_image->page.y=(ssize_t) ReadBlobLSBShort(image);\n meta_image->scene=image->scene;\n (void) CloneImageProperties(image,meta_image);\n DestroyImageProperties(meta_image);\n image->storage_class=PseudoClass;\n image->compression=LZWCompression;\n image->columns=ReadBlobLSBShort(image);\n image->rows=ReadBlobLSBShort(image);\n image->depth=8;\n flag=(unsigned char) ReadBlobByte(image);\n image->interlace=BitSet((int) flag,0x40) != 0 ? GIFInterlace : NoInterlace;\n local_colors=BitSet((int) flag,0x80) == 0 ? global_colors : one <<\n ((size_t) (flag & 0x07)+1);\n image->colors=local_colors;\n if (opacity >= (ssize_t) image->colors)\n {\n image->colors++;\n opacity=(-1);\n }\n image->ticks_per_second=100;\n image->alpha_trait=opacity >= 0 ? BlendPixelTrait : UndefinedPixelTrait;\n if ((image->columns == 0) || (image->rows == 0))\n ThrowGIFException(CorruptImageError,\"NegativeOrZeroImageSize\");\n /*\n Inititialize colormap.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowGIFException(ResourceLimitError,\"MemoryAllocationFailed\");\n if (BitSet((int) flag,0x80) == 0)\n {\n /*\n Use global colormap.\n */\n p=global_colormap;\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].green=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].blue=(double) ScaleCharToQuantum(*p++);\n if (i == opacity)\n {\n image->colormap[i].alpha=(double) TransparentAlpha;\n image->transparent_color=image->colormap[opacity];\n }\n }\n image->background_color=image->colormap[MagickMin((ssize_t) background,\n (ssize_t) image->colors-1)];\n }\n else\n {\n unsigned char\n *colormap;",
" /*\n Read local colormap.\n */\n colormap=(unsigned char *) AcquireQuantumMemory((size_t)\n MagickMax(local_colors,256),3UL*sizeof(*colormap));\n if (colormap == (unsigned char *) NULL)\n ThrowGIFException(ResourceLimitError,\"MemoryAllocationFailed\");\n (void) memset(colormap,0,3*MagickMax(local_colors,256)*\n sizeof(*colormap));\n count=ReadBlob(image,(3*local_colors)*sizeof(*colormap),colormap);\n if (count != (ssize_t) (3*local_colors))\n {\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n ThrowGIFException(CorruptImageError,\"InsufficientImageDataInFile\");\n }\n p=colormap;\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n image->colormap[i].red=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].green=(double) ScaleCharToQuantum(*p++);\n image->colormap[i].blue=(double) ScaleCharToQuantum(*p++);\n if (i == opacity)\n image->colormap[i].alpha=(double) TransparentAlpha;\n }\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n }\n if (image->gamma == 1.0)\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n if (IsPixelInfoGray(image->colormap+i) == MagickFalse)\n break;\n (void) SetImageColorspace(image,i == (ssize_t) image->colors ?\n GRAYColorspace : RGBColorspace,exception);\n }\n if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n {\n if (profiles != (LinkedListInfo *) NULL)\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile);\n global_colormap=(unsigned char *) RelinquishMagickMemory(\n global_colormap);\n meta_image=DestroyImage(meta_image);\n return(DestroyImageList(image));\n }\n /*\n Decode image.\n */\n if (image_info->ping != MagickFalse)\n status=PingGIFImage(image,exception);\n else\n status=DecodeImage(image,opacity,exception);\n if ((image_info->ping == MagickFalse) && (status == MagickFalse))\n ThrowGIFException(CorruptImageError,\"CorruptImage\");\n if (profiles != (LinkedListInfo *) NULL)\n {\n StringInfo\n *profile;",
" /*\n Set image profiles.\n */\n ResetLinkedListIterator(profiles);\n profile=(StringInfo *) GetNextValueInLinkedList(profiles);\n while (profile != (StringInfo *) NULL)\n {\n (void) SetImageProfile(image,GetStringInfoName(profile),profile,\n exception);\n profile=(StringInfo *) GetNextValueInLinkedList(profiles);\n }\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile);\n }\n duration+=image->delay*image->iterations;\n if (image_info->number_scenes != 0)\n if (image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n opacity=(-1);\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType)\n image->scene-1,image->scene);\n if (status == MagickFalse)\n break;\n }\n image->duration=duration;\n if (profiles != (LinkedListInfo *) NULL)\n profiles=DestroyLinkedList(profiles,DestroyGIFProfile);\n meta_image=DestroyImage(meta_image);\n global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap);\n if ((image->columns == 0) || (image->rows == 0))\n ThrowReaderException(CorruptImageError,\"NegativeOrZeroImageSize\");\n (void) CloseBlob(image);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n return(GetFirstImageInList(image));\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% R e g i s t e r G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% RegisterGIFImage() adds properties for the GIF image format to\n% the list of supported formats. The properties include the image format\n% tag, a method to read and/or write the format, whether the format\n% supports the saving of more than one frame to the same file or blob,\n% whether the format supports native in-memory I/O, and a brief\n% description of the format.\n%\n% The format of the RegisterGIFImage method is:\n%\n% size_t RegisterGIFImage(void)\n%\n*/\nModuleExport size_t RegisterGIFImage(void)\n{\n MagickInfo\n *entry;",
" entry=AcquireMagickInfo(\"GIF\",\"GIF\",\n \"CompuServe graphics interchange format\");\n entry->decoder=(DecodeImageHandler *) ReadGIFImage;\n entry->encoder=(EncodeImageHandler *) WriteGIFImage;\n entry->magick=(IsImageFormatHandler *) IsGIF;\n entry->mime_type=ConstantString(\"image/gif\");\n (void) RegisterMagickInfo(entry);\n entry=AcquireMagickInfo(\"GIF\",\"GIF87\",\n \"CompuServe graphics interchange format\");\n entry->decoder=(DecodeImageHandler *) ReadGIFImage;\n entry->encoder=(EncodeImageHandler *) WriteGIFImage;\n entry->magick=(IsImageFormatHandler *) IsGIF;\n entry->flags^=CoderAdjoinFlag;\n entry->version=ConstantString(\"version 87a\");\n entry->mime_type=ConstantString(\"image/gif\");\n (void) RegisterMagickInfo(entry);\n return(MagickImageCoderSignature);\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% U n r e g i s t e r G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% UnregisterGIFImage() removes format registrations made by the\n% GIF module from the list of supported formats.\n%\n% The format of the UnregisterGIFImage method is:\n%\n% UnregisterGIFImage(void)\n%\n*/\nModuleExport void UnregisterGIFImage(void)\n{\n (void) UnregisterMagickInfo(\"GIF\");\n (void) UnregisterMagickInfo(\"GIF87\");\n}\n\f\n/*\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n% %\n% %\n% %\n% W r i t e G I F I m a g e %\n% %\n% %\n% %\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%\n% WriteGIFImage() writes an image to a file in the Compuserve Graphics\n% image format.\n%\n% The format of the WriteGIFImage method is:\n%\n% MagickBooleanType WriteGIFImage(const ImageInfo *image_info,\n% Image *image,ExceptionInfo *exception)\n%\n% A description of each parameter follows.\n%\n% o image_info: the image info.\n%\n% o image: The image.\n%\n% o exception: return any errors or warnings in this structure.\n%\n*/\nstatic MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n int\n c;",
" ImageInfo\n *write_info;",
" MagickBooleanType\n status;",
" MagickOffsetType\n scene;",
" RectangleInfo\n page;",
" register ssize_t\n i;",
" register unsigned char\n *q;",
" size_t\n bits_per_pixel,\n delay,\n imageListLength,\n length,\n one;",
" ssize_t\n j,\n opacity;",
" unsigned char\n *colormap,\n *global_colormap;",
" /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(status);\n /*\n Allocate colormap.\n */\n global_colormap=(unsigned char *) AcquireQuantumMemory(768UL,\n sizeof(*global_colormap));\n colormap=(unsigned char *) AcquireQuantumMemory(768UL,sizeof(*colormap));\n if ((global_colormap == (unsigned char *) NULL) ||\n (colormap == (unsigned char *) NULL))\n {\n if (global_colormap != (unsigned char *) NULL)\n global_colormap=(unsigned char *) RelinquishMagickMemory(\n global_colormap);\n if (colormap != (unsigned char *) NULL)\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n for (i=0; i < 768; i++)\n colormap[i]=(unsigned char) 0;\n /*\n Write GIF header.\n */\n write_info=CloneImageInfo(image_info);\n if (LocaleCompare(write_info->magick,\"GIF87\") != 0)\n (void) WriteBlob(image,6,(unsigned char *) \"GIF89a\");\n else\n {\n (void) WriteBlob(image,6,(unsigned char *) \"GIF87a\");\n write_info->adjoin=MagickFalse;\n }\n /*\n Determine image bounding box.\n */\n page.width=image->columns;\n if (image->page.width > page.width)\n page.width=image->page.width;\n page.height=image->rows;\n if (image->page.height > page.height)\n page.height=image->page.height;\n page.x=image->page.x;\n page.y=image->page.y;\n (void) WriteBlobLSBShort(image,(unsigned short) page.width);\n (void) WriteBlobLSBShort(image,(unsigned short) page.height);\n /*\n Write images to file.\n */\n if ((write_info->adjoin != MagickFalse) &&\n (GetNextImageInList(image) != (Image *) NULL))\n write_info->interlace=NoInterlace;\n scene=0;\n one=1;\n imageListLength=GetImageListLength(image);\n do\n {\n (void) TransformImageColorspace(image,sRGBColorspace,exception);\n opacity=(-1);\n if (IsImageOpaque(image,exception) != MagickFalse)\n {\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteType,exception);\n }\n else\n {\n double\n alpha,\n beta;",
" /*\n Identify transparent colormap index.\n */\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n (void) SetImageType(image,PaletteBilevelAlphaType,exception);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].alpha != OpaqueAlpha)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=fabs(image->colormap[i].alpha-TransparentAlpha);\n beta=fabs(image->colormap[opacity].alpha-TransparentAlpha);\n if (alpha < beta)\n opacity=i;\n }\n if (opacity == -1)\n {\n (void) SetImageType(image,PaletteBilevelAlphaType,exception);\n for (i=0; i < (ssize_t) image->colors; i++)\n if (image->colormap[i].alpha != OpaqueAlpha)\n {\n if (opacity < 0)\n {\n opacity=i;\n continue;\n }\n alpha=fabs(image->colormap[i].alpha-TransparentAlpha);\n beta=fabs(image->colormap[opacity].alpha-TransparentAlpha);\n if (alpha < beta)\n opacity=i;\n }\n }\n if (opacity >= 0)\n {\n image->colormap[opacity].red=image->transparent_color.red;\n image->colormap[opacity].green=image->transparent_color.green;\n image->colormap[opacity].blue=image->transparent_color.blue;\n }\n }\n if ((image->storage_class == DirectClass) || (image->colors > 256))\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n for (bits_per_pixel=1; bits_per_pixel < 8; bits_per_pixel++)\n if ((one << bits_per_pixel) >= image->colors)\n break;\n q=colormap;\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));\n *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));\n }\n for ( ; i < (ssize_t) (one << bits_per_pixel); i++)\n {\n *q++=(unsigned char) 0x0;\n *q++=(unsigned char) 0x0;\n *q++=(unsigned char) 0x0;\n }\n if ((GetPreviousImageInList(image) == (Image *) NULL) ||\n (write_info->adjoin == MagickFalse))\n {\n /*\n Write global colormap.\n */\n c=0x80;\n c|=(8-1) << 4; /* color resolution */\n c|=(bits_per_pixel-1); /* size of global colormap */\n (void) WriteBlobByte(image,(unsigned char) c);\n for (j=0; j < (ssize_t) image->colors; j++)\n if (IsPixelInfoEquivalent(&image->background_color,image->colormap+j))\n break;\n (void) WriteBlobByte(image,(unsigned char)\n (j == (ssize_t) image->colors ? 0 : j)); /* background color */\n (void) WriteBlobByte(image,(unsigned char) 0x00); /* reserved */\n length=(size_t) (3*(one << bits_per_pixel));\n (void) WriteBlob(image,length,colormap);\n for (j=0; j < 768; j++)\n global_colormap[j]=colormap[j];\n }\n if (LocaleCompare(write_info->magick,\"GIF87\") != 0)\n {\n const char\n *value;",
" /*\n Write graphics control extension.\n */\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xf9);\n (void) WriteBlobByte(image,(unsigned char) 0x04);\n c=image->dispose << 2;\n if (opacity >= 0)\n c|=0x01;\n (void) WriteBlobByte(image,(unsigned char) c);\n delay=(size_t) (100*image->delay/MagickMax((size_t)\n image->ticks_per_second,1));\n (void) WriteBlobLSBShort(image,(unsigned short) delay);\n (void) WriteBlobByte(image,(unsigned char) (opacity >= 0 ? opacity :\n 0));\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n value=GetImageProperty(image,\"comment\",exception);\n if (value != (const char *) NULL)\n {\n register const char\n *p;",
" size_t\n count;",
" /*\n Write comment extension.\n */\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xfe);\n for (p=value; *p != '\\0'; )\n {\n count=MagickMin(strlen(p),255);\n (void) WriteBlobByte(image,(unsigned char) count);\n for (i=0; i < (ssize_t) count; i++)\n (void) WriteBlobByte(image,(unsigned char) *p++);\n }\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n if ((GetPreviousImageInList(image) == (Image *) NULL) &&\n (GetNextImageInList(image) != (Image *) NULL) &&\n (image->iterations != 1))\n {\n /*\n Write Netscape Loop extension.\n */\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"NETSCAPE2.0\");\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xff);\n (void) WriteBlobByte(image,(unsigned char) 0x0b);\n (void) WriteBlob(image,11,(unsigned char *) \"NETSCAPE2.0\");\n (void) WriteBlobByte(image,(unsigned char) 0x03);\n (void) WriteBlobByte(image,(unsigned char) 0x01);\n (void) WriteBlobLSBShort(image,(unsigned short) (image->iterations ?\n image->iterations-1 : 0));\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n if ((image->gamma != 1.0f/2.2f))\n {\n char\n attributes[MagickPathExtent];",
" ssize_t\n count;",
" /*\n Write ImageMagick extension.\n */\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"ImageMagick\");\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xff);\n (void) WriteBlobByte(image,(unsigned char) 0x0b);\n (void) WriteBlob(image,11,(unsigned char *) \"ImageMagick\");\n count=FormatLocaleString(attributes,MagickPathExtent,\"gamma=%g\",\n image->gamma);\n (void) WriteBlobByte(image,(unsigned char) count);\n (void) WriteBlob(image,(size_t) count,(unsigned char *) attributes);\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n ResetImageProfileIterator(image);\n for ( ; ; )\n {\n char\n *name;",
" const StringInfo\n *profile;",
" name=GetNextImageProfile(image);\n if (name == (const char *) NULL)\n break;\n profile=GetImageProfile(image,name);\n if (profile != (StringInfo *) NULL)\n {\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0) ||\n (LocaleCompare(name,\"IPTC\") == 0) ||\n (LocaleCompare(name,\"8BIM\") == 0) ||\n (LocaleNCompare(name,\"gif:\",4) == 0))\n {\n ssize_t\n offset;",
" unsigned char\n *datum;",
" datum=GetStringInfoDatum(profile);\n length=GetStringInfoLength(profile);\n (void) WriteBlobByte(image,(unsigned char) 0x21);\n (void) WriteBlobByte(image,(unsigned char) 0xff);\n (void) WriteBlobByte(image,(unsigned char) 0x0b);\n if ((LocaleCompare(name,\"ICC\") == 0) ||\n (LocaleCompare(name,\"ICM\") == 0))\n {\n /*\n Write ICC extension.\n */\n (void) WriteBlob(image,11,(unsigned char *) \"ICCRGBG1012\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"ICCRGBG1012\");\n }\n else\n if ((LocaleCompare(name,\"IPTC\") == 0))\n {\n /*\n Write IPTC extension.\n */\n (void) WriteBlob(image,11,(unsigned char *) \"MGKIPTC0000\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"MGKIPTC0000\");\n }\n else\n if ((LocaleCompare(name,\"8BIM\") == 0))\n {\n /*\n Write 8BIM extension.\n */\n (void) WriteBlob(image,11,(unsigned char *)\n \"MGK8BIM0000\");\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",\"MGK8BIM0000\");\n }\n else\n {\n char\n extension[MagickPathExtent];",
" /*\n Write generic extension.\n */\n (void) CopyMagickString(extension,name+4,\n sizeof(extension));\n (void) WriteBlob(image,11,(unsigned char *) extension);\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \" Writing GIF Extension %s\",name);\n }\n offset=0;\n while ((ssize_t) length > offset)\n {\n size_t\n block_length;",
" if ((length-offset) < 255)\n block_length=length-offset;\n else\n block_length=255;\n (void) WriteBlobByte(image,(unsigned char) block_length);\n (void) WriteBlob(image,(size_t) block_length,datum+offset);\n offset+=(ssize_t) block_length;\n }\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n }\n }\n }\n }\n (void) WriteBlobByte(image,','); /* image separator */\n /*\n Write the image header.\n */\n page.x=image->page.x;\n page.y=image->page.y;\n if ((image->page.width != 0) && (image->page.height != 0))\n page=image->page;\n (void) WriteBlobLSBShort(image,(unsigned short) (page.x < 0 ? 0 : page.x));\n (void) WriteBlobLSBShort(image,(unsigned short) (page.y < 0 ? 0 : page.y));\n (void) WriteBlobLSBShort(image,(unsigned short) image->columns);\n (void) WriteBlobLSBShort(image,(unsigned short) image->rows);\n c=0x00;\n if (write_info->interlace != NoInterlace)\n c|=0x40; /* pixel data is interlaced */\n for (j=0; j < (ssize_t) (3*image->colors); j++)\n if (colormap[j] != global_colormap[j])\n break;\n if (j == (ssize_t) (3*image->colors))\n (void) WriteBlobByte(image,(unsigned char) c);\n else\n {\n c|=0x80;\n c|=(bits_per_pixel-1); /* size of local colormap */\n (void) WriteBlobByte(image,(unsigned char) c);\n length=(size_t) (3*(one << bits_per_pixel));\n (void) WriteBlob(image,length,colormap);\n }\n /*\n Write the image data.\n */\n c=(int) MagickMax(bits_per_pixel,2);\n (void) WriteBlobByte(image,(unsigned char) c);\n status=EncodeImage(write_info,image,(size_t) MagickMax(bits_per_pixel,2)+1,\n exception);\n if (status == MagickFalse)\n {\n global_colormap=(unsigned char *) RelinquishMagickMemory(\n global_colormap);\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n write_info=DestroyImageInfo(write_info);\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n }\n (void) WriteBlobByte(image,(unsigned char) 0x00);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n scene++;\n status=SetImageProgress(image,SaveImagesTag,scene,imageListLength);\n if (status == MagickFalse)\n break;\n } while (write_info->adjoin != MagickFalse);\n (void) WriteBlobByte(image,';'); /* terminator */\n global_colormap=(unsigned char *) RelinquishMagickMemory(global_colormap);\n colormap=(unsigned char *) RelinquishMagickMemory(colormap);\n write_info=DestroyImageInfo(write_info);\n (void) CloseBlob(image);\n return(MagickTrue);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [310, 689], "buggy_code_start_loc": [232, 681], "filenames": ["MagickCore/fourier.c", "coders/gif.c"], "fixing_code_end_loc": [306, 691], "fixing_code_start_loc": [232, 682], "message": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:imagemagick:imagemagick:7.0.8-50:q16:*:*:*:*:*:*", "matchCriteriaId": "25CCEA99-8329-46C6-9625-4FE15F24CF69", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:esm:*:*:*", "matchCriteriaId": "7A5301BF-1402-4BE0-A0F8-69FBE79BC6D6", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*", "matchCriteriaId": "23A7C53F-B80F-4E6A-AFA9-58EEA84BE11D", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.04:*:*:*:*:*:*:*", "matchCriteriaId": "CD783B0C-9246-47D9-A937-6144FE8BFF0F", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:canonical:ubuntu_linux:19.10:*:*:*:*:*:*:*", "matchCriteriaId": "A31C8344-3E02-4EB8-8BD8-4C84B7959624", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:opensuse:leap:15.0:*:*:*:*:*:*:*", "matchCriteriaId": "F1E78106-58E6-4D59-990F-75DA575BFAD9", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:opensuse:leap:15.1:*:*:*:*:*:*:*", "matchCriteriaId": "B620311B-34A3-48A6-82DF-6F078D7A4493", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "ImageMagick 7.0.8-50 Q16 has a heap-based buffer overflow in MagickCore/fourier.c in ComplexImage."}, {"lang": "es", "value": "ImageMagick versi\u00f3n 7.0.8-50 Q16 presenta una vulnerabilidad de desbordamiento de b\u00fafer basado en memoria din\u00e1mica (heap) en MagickCore/fourier.c en ComplexImage."}], "evaluatorComment": null, "id": "CVE-2019-13308", "lastModified": "2023-03-02T15:56:47.600", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 2.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2019-07-05T01:15:10.750", "references": [{"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00069.html"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, {"source": "cve@mitre.org", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://github.com/ImageMagick/ImageMagick/issues/1595"}, {"source": "cve@mitre.org", "tags": ["Patch"], "url": "https://github.com/ImageMagick/ImageMagick6/commit/19651f3db63fa1511ed83a348c4c82fa553f8d01"}, {"source": "cve@mitre.org", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2020/09/msg00007.html"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://usn.ubuntu.com/4192-1/"}, {"source": "cve@mitre.org", "tags": ["Third Party Advisory"], "url": "https://www.debian.org/security/2020/dsa-4712"}], "sourceIdentifier": "cve@mitre.org", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-787"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/ImageMagick/ImageMagick/commit/61135001a625364e29bdce83832f043eebde7b5a"}, "type": "CWE-787"}
| 102
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\tby Bram Moolenaar et al.\n *\n * Do \":help uganda\" in Vim to read copying and usage conditions.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */\n/*\n * normal.c:\tContains the main routine for processing characters in command\n *\t\tmode. Communicates closely with the code in ops.c to handle\n *\t\tthe operators.\n */",
"#include \"vim.h\"",
"static int\tVIsual_mode_orig = NUL;\t\t// saved Visual mode",
"#ifdef FEAT_EVAL\nstatic void\tset_vcount_ca(cmdarg_T *cap, int *set_prevcount);\n#endif\nstatic void\tunshift_special(cmdarg_T *cap);\n#ifdef FEAT_CMDL_INFO\nstatic void\tdel_from_showcmd(int);\n#endif",
"/*\n * nv_*(): functions called to handle Normal and Visual mode commands.\n * n_*(): functions called to handle Normal mode commands.\n * v_*(): functions called to handle Visual mode commands.\n */\nstatic void\tnv_ignore(cmdarg_T *cap);\nstatic void\tnv_nop(cmdarg_T *cap);\nstatic void\tnv_error(cmdarg_T *cap);\nstatic void\tnv_help(cmdarg_T *cap);\nstatic void\tnv_addsub(cmdarg_T *cap);\nstatic void\tnv_page(cmdarg_T *cap);\nstatic void\tnv_zet(cmdarg_T *cap);\n#ifdef FEAT_GUI\nstatic void\tnv_ver_scrollbar(cmdarg_T *cap);\nstatic void\tnv_hor_scrollbar(cmdarg_T *cap);\n#endif\n#ifdef FEAT_GUI_TABLINE\nstatic void\tnv_tabline(cmdarg_T *cap);\nstatic void\tnv_tabmenu(cmdarg_T *cap);\n#endif\nstatic void\tnv_exmode(cmdarg_T *cap);\nstatic void\tnv_colon(cmdarg_T *cap);\nstatic void\tnv_ctrlg(cmdarg_T *cap);\nstatic void\tnv_ctrlh(cmdarg_T *cap);\nstatic void\tnv_clear(cmdarg_T *cap);\nstatic void\tnv_ctrlo(cmdarg_T *cap);\nstatic void\tnv_hat(cmdarg_T *cap);\nstatic void\tnv_Zet(cmdarg_T *cap);\nstatic void\tnv_ident(cmdarg_T *cap);\nstatic void\tnv_tagpop(cmdarg_T *cap);\nstatic void\tnv_scroll(cmdarg_T *cap);\nstatic void\tnv_right(cmdarg_T *cap);\nstatic void\tnv_left(cmdarg_T *cap);\nstatic void\tnv_up(cmdarg_T *cap);\nstatic void\tnv_down(cmdarg_T *cap);\nstatic void\tnv_end(cmdarg_T *cap);\nstatic void\tnv_dollar(cmdarg_T *cap);\nstatic void\tnv_search(cmdarg_T *cap);\nstatic void\tnv_next(cmdarg_T *cap);\nstatic int\tnormal_search(cmdarg_T *cap, int dir, char_u *pat, int opt, int *wrapped);\nstatic void\tnv_csearch(cmdarg_T *cap);\nstatic void\tnv_brackets(cmdarg_T *cap);\nstatic void\tnv_percent(cmdarg_T *cap);\nstatic void\tnv_brace(cmdarg_T *cap);\nstatic void\tnv_mark(cmdarg_T *cap);\nstatic void\tnv_findpar(cmdarg_T *cap);\nstatic void\tnv_undo(cmdarg_T *cap);\nstatic void\tnv_kundo(cmdarg_T *cap);\nstatic void\tnv_Replace(cmdarg_T *cap);\nstatic void\tnv_replace(cmdarg_T *cap);\nstatic void\tnv_cursormark(cmdarg_T *cap, int flag, pos_T *pos);\nstatic void\tv_visop(cmdarg_T *cap);\nstatic void\tnv_subst(cmdarg_T *cap);\nstatic void\tnv_abbrev(cmdarg_T *cap);\nstatic void\tnv_optrans(cmdarg_T *cap);\nstatic void\tnv_gomark(cmdarg_T *cap);\nstatic void\tnv_pcmark(cmdarg_T *cap);\nstatic void\tnv_regname(cmdarg_T *cap);\nstatic void\tnv_visual(cmdarg_T *cap);\nstatic void\tn_start_visual_mode(int c);\nstatic void\tnv_window(cmdarg_T *cap);\nstatic void\tnv_suspend(cmdarg_T *cap);\nstatic void\tnv_g_cmd(cmdarg_T *cap);\nstatic void\tnv_dot(cmdarg_T *cap);\nstatic void\tnv_redo_or_register(cmdarg_T *cap);\nstatic void\tnv_Undo(cmdarg_T *cap);\nstatic void\tnv_tilde(cmdarg_T *cap);\nstatic void\tnv_operator(cmdarg_T *cap);\n#ifdef FEAT_EVAL\nstatic void\tset_op_var(int optype);\n#endif\nstatic void\tnv_lineop(cmdarg_T *cap);\nstatic void\tnv_home(cmdarg_T *cap);\nstatic void\tnv_pipe(cmdarg_T *cap);\nstatic void\tnv_bck_word(cmdarg_T *cap);\nstatic void\tnv_wordcmd(cmdarg_T *cap);\nstatic void\tnv_beginline(cmdarg_T *cap);\nstatic void\tadjust_cursor(oparg_T *oap);\nstatic void\tadjust_for_sel(cmdarg_T *cap);\nstatic void\tnv_select(cmdarg_T *cap);\nstatic void\tnv_goto(cmdarg_T *cap);\nstatic void\tnv_normal(cmdarg_T *cap);\nstatic void\tnv_esc(cmdarg_T *oap);\nstatic void\tnv_edit(cmdarg_T *cap);\nstatic void\tinvoke_edit(cmdarg_T *cap, int repl, int cmd, int startln);\n#ifdef FEAT_TEXTOBJ\nstatic void\tnv_object(cmdarg_T *cap);\n#endif\nstatic void\tnv_record(cmdarg_T *cap);\nstatic void\tnv_at(cmdarg_T *cap);\nstatic void\tnv_halfpage(cmdarg_T *cap);\nstatic void\tnv_join(cmdarg_T *cap);\nstatic void\tnv_put(cmdarg_T *cap);\nstatic void\tnv_put_opt(cmdarg_T *cap, int fix_indent);\nstatic void\tnv_open(cmdarg_T *cap);\n#ifdef FEAT_NETBEANS_INTG\nstatic void\tnv_nbcmd(cmdarg_T *cap);\n#endif\n#ifdef FEAT_DND\nstatic void\tnv_drop(cmdarg_T *cap);\n#endif\nstatic void\tnv_cursorhold(cmdarg_T *cap);",
"// Declare nv_cmds[].\n#define DO_DECLARE_NVCMD\n#include \"nv_cmds.h\"",
"// Include the lookuptable generated by create_nvcmdidx.vim.\n#include \"nv_cmdidxs.h\"",
"/*\n * Search for a command in the commands table.\n * Returns -1 for invalid command.\n */\n static int\nfind_command(int cmdchar)\n{\n int\t\ti;\n int\t\tidx;\n int\t\ttop, bot;\n int\t\tc;",
" // A multi-byte character is never a command.\n if (cmdchar >= 0x100)\n\treturn -1;",
" // We use the absolute value of the character. Special keys have a\n // negative value, but are sorted on their absolute value.\n if (cmdchar < 0)\n\tcmdchar = -cmdchar;",
" // If the character is in the first part: The character is the index into\n // nv_cmd_idx[].\n if (cmdchar <= nv_max_linear)\n\treturn nv_cmd_idx[cmdchar];",
" // Perform a binary search.\n bot = nv_max_linear + 1;\n top = NV_CMDS_SIZE - 1;\n idx = -1;\n while (bot <= top)\n {\n\ti = (top + bot) / 2;\n\tc = nv_cmds[nv_cmd_idx[i]].cmd_char;\n\tif (c < 0)\n\t c = -c;\n\tif (cmdchar == c)\n\t{\n\t idx = nv_cmd_idx[i];\n\t break;\n\t}\n\tif (cmdchar > c)\n\t bot = i + 1;\n\telse\n\t top = i - 1;\n }\n return idx;\n}",
"/*\n * If currently editing a cmdline or text is locked: beep and give an error\n * message, return TRUE.\n */\n static int\ncheck_text_locked(oparg_T *oap)\n{\n if (text_locked())\n {\n\tclearopbeep(oap);\n\ttext_locked_msg();\n\treturn TRUE;\n }\n return FALSE;\n}",
"/*\n * Handle the count before a normal command and set cap->count0.\n */\n static int\nnormal_cmd_get_count(\n\tcmdarg_T\t*cap,\n\tint\t\tc,\n\tint\t\ttoplevel UNUSED,\n\tint\t\tset_prevcount UNUSED,\n\tint\t\t*ctrl_w,\n\tint\t\t*need_flushbuf UNUSED)\n{\ngetcount:\n if (!(VIsual_active && VIsual_select))\n {\n\t// Handle a count before a command and compute ca.count0.\n\t// Note that '0' is a command and not the start of a count, but it's\n\t// part of a count after other digits.\n\twhile ((c >= '1' && c <= '9')\n\t\t|| (cap->count0 != 0 && (c == K_DEL || c == K_KDEL\n\t\t\t|| c == '0')))\n\t{\n\t if (c == K_DEL || c == K_KDEL)\n\t {\n\t\tcap->count0 /= 10;\n#ifdef FEAT_CMDL_INFO\n\t\tdel_from_showcmd(4);\t// delete the digit and ~@%\n#endif\n\t }\n\t else if (cap->count0 > 99999999L)\n\t {\n\t\tcap->count0 = 999999999L;\n\t }\n\t else\n\t {\n\t\tcap->count0 = cap->count0 * 10 + (c - '0');\n\t }\n#ifdef FEAT_EVAL\n\t // Set v:count here, when called from main() and not a stuffed\n\t // command, so that v:count can be used in an expression mapping\n\t // right after the count. Do set it for redo.\n\t if (toplevel && readbuf1_empty())\n\t\tset_vcount_ca(cap, &set_prevcount);\n#endif\n\t if (*ctrl_w)\n\t {\n\t\t++no_mapping;\n\t\t++allow_keys;\t\t// no mapping for nchar, but keys\n\t }\n\t ++no_zero_mapping;\t\t// don't map zero here\n\t c = plain_vgetc();\n\t LANGMAP_ADJUST(c, TRUE);\n\t --no_zero_mapping;\n\t if (*ctrl_w)\n\t {\n\t\t--no_mapping;\n\t\t--allow_keys;\n\t }\n#ifdef FEAT_CMDL_INFO\n\t *need_flushbuf |= add_to_showcmd(c);\n#endif\n\t}",
"\t// If we got CTRL-W there may be a/another count\n\tif (c == Ctrl_W && !*ctrl_w && cap->oap->op_type == OP_NOP)\n\t{\n\t *ctrl_w = TRUE;\n\t cap->opcount = cap->count0;\t// remember first count\n\t cap->count0 = 0;\n\t ++no_mapping;\n\t ++allow_keys;\t\t// no mapping for nchar, but keys\n\t c = plain_vgetc();\t\t// get next character\n\t LANGMAP_ADJUST(c, TRUE);\n\t --no_mapping;\n\t --allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t *need_flushbuf |= add_to_showcmd(c);\n#endif\n\t goto getcount;\t\t// jump back\n\t}\n }",
" if (c == K_CURSORHOLD)\n {\n\t// Save the count values so that ca.opcount and ca.count0 are exactly\n\t// the same when coming back here after handling K_CURSORHOLD.\n\tcap->oap->prev_opcount = cap->opcount;\n\tcap->oap->prev_count0 = cap->count0;\n }\n else if (cap->opcount != 0)\n {\n\t// If we're in the middle of an operator (including after entering a\n\t// yank buffer with '\"') AND we had a count before the operator, then\n\t// that count overrides the current value of ca.count0.\n\t// What this means effectively, is that commands like \"3dw\" get turned\n\t// into \"d3w\" which makes things fall into place pretty neatly.\n\t// If you give a count before AND after the operator, they are\n\t// multiplied.\n\tif (cap->count0)\n\t{\n\t if (cap->opcount >= 999999999L / cap->count0)\n\t\tcap->count0 = 999999999L;\n\t else\n\t\tcap->count0 *= cap->opcount;\n\t}\n\telse\n\t cap->count0 = cap->opcount;\n }",
" // Always remember the count. It will be set to zero (on the next call,\n // above) when there is no pending operator.\n // When called from main(), save the count for use by the \"count\" built-in\n // variable.\n cap->opcount = cap->count0;\n cap->count1 = (cap->count0 == 0 ? 1 : cap->count0);",
"#ifdef FEAT_EVAL\n // Only set v:count when called from main() and not a stuffed command.\n // Do set it for redo.\n if (toplevel && readbuf1_empty())\n\tset_vcount(cap->count0, cap->count1, set_prevcount);\n#endif",
" return c;\n}",
"/*\n * Returns TRUE if the normal command (cap) needs a second character.\n */\n static int\nnormal_cmd_needs_more_chars(cmdarg_T *cap, short_u cmd_flags)\n{\n return ((cmd_flags & NV_NCH)\n\t && (((cmd_flags & NV_NCH_NOP) == NV_NCH_NOP\n\t\t && cap->oap->op_type == OP_NOP)\n\t\t|| (cmd_flags & NV_NCH_ALW) == NV_NCH_ALW\n\t\t|| (cap->cmdchar == 'q'\n\t\t && cap->oap->op_type == OP_NOP\n\t\t && reg_recording == 0\n\t\t && reg_executing == 0)\n\t\t|| ((cap->cmdchar == 'a' || cap->cmdchar == 'i')\n\t\t && (cap->oap->op_type != OP_NOP || VIsual_active))));\n}",
"/*\n * Get one or more additional characters for a normal command.\n * Return the updated command index (if changed).\n */\n static int\nnormal_cmd_get_more_chars(\n\tint\t idx_arg,\n\tcmdarg_T *cap,\n\tint\t *need_flushbuf UNUSED)\n{\n int\t\tidx = idx_arg;\n int\t\tc;\n int\t\t*cp;\n int\t\trepl = FALSE;\t// get character for replace mode\n int\t\tlit = FALSE;\t// get extra character literally\n int\t\tlangmap_active = FALSE; // using :lmap mappings\n int\t\tlang;\t\t// getting a text character\n#ifdef HAVE_INPUT_METHOD\n int\t\tsave_smd;\t// saved value of p_smd\n#endif",
" ++no_mapping;\n ++allow_keys;\t\t// no mapping for nchar, but allow key codes\n // Don't generate a CursorHold event here, most commands can't handle\n // it, e.g., nv_replace(), nv_csearch().\n did_cursorhold = TRUE;\n if (cap->cmdchar == 'g')\n {\n\t/*\n\t * For 'g' get the next character now, so that we can check for\n\t * \"gr\", \"g'\" and \"g`\".\n\t */\n\tcap->nchar = plain_vgetc();\n\tLANGMAP_ADJUST(cap->nchar, TRUE);\n#ifdef FEAT_CMDL_INFO\n\t*need_flushbuf |= add_to_showcmd(cap->nchar);\n#endif\n\tif (cap->nchar == 'r' || cap->nchar == '\\'' || cap->nchar == '`'\n\t\t|| cap->nchar == Ctrl_BSL)\n\t{\n\t cp = &cap->extra_char;\t// need to get a third character\n\t if (cap->nchar != 'r')\n\t\tlit = TRUE;\t\t\t// get it literally\n\t else\n\t\trepl = TRUE;\t\t// get it in replace mode\n\t}\n\telse\n\t cp = NULL;\t\t// no third character needed\n }\n else\n {\n\tif (cap->cmdchar == 'r')\t\t// get it in replace mode\n\t repl = TRUE;\n\tcp = &cap->nchar;\n }\n lang = (repl || (nv_cmds[idx].cmd_flags & NV_LANG));",
" /*\n * Get a second or third character.\n */\n if (cp != NULL)\n {\n\tif (repl)\n\t{\n\t State = MODE_REPLACE;\t// pretend Replace mode\n#ifdef CURSOR_SHAPE\n\t ui_cursor_shape();\t// show different cursor shape\n#endif\n\t}\n\tif (lang && curbuf->b_p_iminsert == B_IMODE_LMAP)\n\t{\n\t // Allow mappings defined with \":lmap\".\n\t --no_mapping;\n\t --allow_keys;\n\t if (repl)\n\t\tState = MODE_LREPLACE;\n\t else\n\t\tState = MODE_LANGMAP;\n\t langmap_active = TRUE;\n\t}\n#ifdef HAVE_INPUT_METHOD\n\tsave_smd = p_smd;\n\tp_smd = FALSE;\t// Don't let the IM code show the mode here\n\tif (lang && curbuf->b_p_iminsert == B_IMODE_IM)\n\t im_set_active(TRUE);\n#endif\n\tif ((State & MODE_INSERT) && !p_ek)\n\t{\n#ifdef FEAT_JOB_CHANNEL\n\t ch_log_output = TRUE;\n#endif\n\t // Disable bracketed paste and modifyOtherKeys here, we won't\n\t // recognize the escape sequences with 'esckeys' off.\n\t out_str(T_BD);\n\t out_str(T_CTE);\n\t}",
"\t*cp = plain_vgetc();",
"\tif ((State & MODE_INSERT) && !p_ek)\n\t{\n#ifdef FEAT_JOB_CHANNEL\n\t ch_log_output = TRUE;\n#endif\n\t // Re-enable bracketed paste mode and modifyOtherKeys\n\t out_str(T_BE);\n\t out_str(T_CTI);\n\t}",
"\tif (langmap_active)\n\t{\n\t // Undo the decrement done above\n\t ++no_mapping;\n\t ++allow_keys;\n\t State = MODE_NORMAL_BUSY;\n\t}\n#ifdef HAVE_INPUT_METHOD\n\tif (lang)\n\t{\n\t if (curbuf->b_p_iminsert != B_IMODE_LMAP)\n\t\tim_save_status(&curbuf->b_p_iminsert);\n\t im_set_active(FALSE);\n\t}\n\tp_smd = save_smd;\n#endif\n\tState = MODE_NORMAL_BUSY;\n#ifdef FEAT_CMDL_INFO\n\t*need_flushbuf |= add_to_showcmd(*cp);\n#endif",
"\tif (!lit)\n\t{\n#ifdef FEAT_DIGRAPHS\n\t // Typing CTRL-K gets a digraph.\n\t if (*cp == Ctrl_K\n\t\t && ((nv_cmds[idx].cmd_flags & NV_LANG)\n\t\t\t|| cp == &cap->extra_char)\n\t\t && vim_strchr(p_cpo, CPO_DIGRAPH) == NULL)\n\t {\n\t\tc = get_digraph(FALSE);\n\t\tif (c > 0)\n\t\t{\n\t\t *cp = c;\n# ifdef FEAT_CMDL_INFO\n\t\t // Guessing how to update showcmd here...\n\t\t del_from_showcmd(3);\n\t\t *need_flushbuf |= add_to_showcmd(*cp);\n# endif\n\t\t}\n\t }\n#endif",
"\t // adjust chars > 127, except after \"tTfFr\" commands\n\t LANGMAP_ADJUST(*cp, !lang);\n#ifdef FEAT_RIGHTLEFT\n\t // adjust Hebrew mapped char\n\t if (p_hkmap && lang && KeyTyped)\n\t\t*cp = hkmap(*cp);\n#endif\n\t}",
"\t// When the next character is CTRL-\\ a following CTRL-N means the\n\t// command is aborted and we go to Normal mode.\n\tif (cp == &cap->extra_char\n\t\t&& cap->nchar == Ctrl_BSL\n\t\t&& (cap->extra_char == Ctrl_N || cap->extra_char == Ctrl_G))\n\t{\n\t cap->cmdchar = Ctrl_BSL;\n\t cap->nchar = cap->extra_char;\n\t idx = find_command(cap->cmdchar);\n\t}\n\telse if ((cap->nchar == 'n' || cap->nchar == 'N') && cap->cmdchar == 'g')\n\t cap->oap->op_type = get_op_type(*cp, NUL);\n\telse if (*cp == Ctrl_BSL)\n\t{\n\t long towait = (p_ttm >= 0 ? p_ttm : p_tm);",
"\t // There is a busy wait here when typing \"f<C-\\>\" and then\n\t // something different from CTRL-N. Can't be avoided.\n\t while ((c = vpeekc()) <= 0 && towait > 0L)\n\t {\n\t\tdo_sleep(towait > 50L ? 50L : towait, FALSE);\n\t\ttowait -= 50L;\n\t }\n\t if (c > 0)\n\t {\n\t\tc = plain_vgetc();\n\t\tif (c != Ctrl_N && c != Ctrl_G)\n\t\t vungetc(c);\n\t\telse\n\t\t{\n\t\t cap->cmdchar = Ctrl_BSL;\n\t\t cap->nchar = c;\n\t\t idx = find_command(cap->cmdchar);\n\t\t}\n\t }\n\t}",
"\t// When getting a text character and the next character is a\n\t// multi-byte character, it could be a composing character.\n\t// However, don't wait for it to arrive. Also, do enable mapping,\n\t// because if it's put back with vungetc() it's too late to apply\n\t// mapping.\n\t--no_mapping;\n\twhile (enc_utf8 && lang && (c = vpeekc()) > 0\n\t\t&& (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1))\n\t{\n\t c = plain_vgetc();\n\t if (!utf_iscomposing(c))\n\t {\n\t\tvungetc(c);\t\t// it wasn't, put it back\n\t\tbreak;\n\t }\n\t else if (cap->ncharC1 == 0)\n\t\tcap->ncharC1 = c;\n\t else\n\t\tcap->ncharC2 = c;\n\t}\n\t++no_mapping;\n }\n --no_mapping;\n --allow_keys;",
" return idx;\n}",
"/*\n * Returns TRUE if after processing a normal mode command, need to wait for a\n * moment when a message is displayed that will be overwritten by the mode\n * message.\n */\n static int\nnormal_cmd_need_to_wait_for_msg(cmdarg_T *cap, pos_T *old_pos)\n{\n // In Visual mode and with \"^O\" in Insert mode, a short message will be\n // overwritten by the mode message. Wait a bit, until a key is hit.\n // In Visual mode, it's more important to keep the Visual area updated\n // than keeping a message (e.g. from a /pat search).\n // Only do this if the command was typed, not from a mapping.\n // Don't wait when emsg_silent is non-zero.\n // Also wait a bit after an error message, e.g. for \"^O:\".\n // Don't redraw the screen, it would remove the message.\n return ( ((p_smd\n\t\t && msg_silent == 0\n\t\t && (restart_edit != 0\n\t\t\t|| (VIsual_active\n\t\t\t && old_pos->lnum == curwin->w_cursor.lnum\n\t\t\t && old_pos->col == curwin->w_cursor.col)\n\t\t )\n\t\t && (clear_cmdline\n\t\t\t|| redraw_cmdline)\n\t\t && (msg_didout || (msg_didany && msg_scroll))\n\t\t && !msg_nowait\n\t\t && KeyTyped)\n\t\t|| (restart_edit != 0\n\t\t && !VIsual_active\n\t\t && (msg_scroll\n\t\t\t|| emsg_on_display)))\n\t && cap->oap->regname == 0\n\t && !(cap->retval & CA_COMMAND_BUSY)\n\t && stuff_empty()\n\t && typebuf_typed()\n\t && emsg_silent == 0\n\t && !in_assert_fails\n\t && !did_wait_return\n\t && cap->oap->op_type == OP_NOP);\n}",
"/*\n * After processing a normal mode command, wait for a moment when a message is\n * displayed that will be overwritten by the mode message.\n */\n static void\nnormal_cmd_wait_for_msg(void)\n{\n int\tsave_State = State;",
" // Draw the cursor with the right shape here\n if (restart_edit != 0)\n\tState = MODE_INSERT;",
" // If need to redraw, and there is a \"keep_msg\", redraw before the\n // delay\n if (must_redraw && keep_msg != NULL && !emsg_on_display)\n {\n\tchar_u\t*kmsg;",
"\tkmsg = keep_msg;\n\tkeep_msg = NULL;\n\t// Showmode() will clear keep_msg, but we want to use it anyway.\n\t// First update w_topline.\n\tsetcursor();\n\tupdate_screen(0);\n\t// now reset it, otherwise it's put in the history again\n\tkeep_msg = kmsg;",
"\tkmsg = vim_strsave(keep_msg);\n\tif (kmsg != NULL)\n\t{\n\t msg_attr((char *)kmsg, keep_msg_attr);\n\t vim_free(kmsg);\n\t}\n }\n setcursor();\n#ifdef CURSOR_SHAPE\n ui_cursor_shape();\t\t// may show different cursor shape\n#endif\n cursor_on();\n out_flush();\n if (msg_scroll || emsg_on_display)\n\tui_delay(1003L, TRUE);\t// wait at least one second\n ui_delay(3003L, FALSE);\t\t// wait up to three seconds\n State = save_State;",
" msg_scroll = FALSE;\n emsg_on_display = FALSE;\n}",
"/*\n * Execute a command in Normal mode.\n */\n void\nnormal_cmd(\n oparg_T\t*oap,\n int\t\ttoplevel UNUSED)\t// TRUE when called from main()\n{\n cmdarg_T\tca;\t\t\t// command arguments\n int\t\tc;\n int\t\tctrl_w = FALSE;\t\t// got CTRL-W command\n int\t\told_col = curwin->w_curswant;\n int\t\tneed_flushbuf = FALSE;\t// need to call out_flush()\n pos_T\told_pos;\t\t// cursor position before command\n int\t\tmapped_len;\n static int\told_mapped_len = 0;\n int\t\tidx;\n int\t\tset_prevcount = FALSE;\n int\t\tsave_did_cursorhold = did_cursorhold;",
" CLEAR_FIELD(ca);\t// also resets ca.retval\n ca.oap = oap;",
" // Use a count remembered from before entering an operator. After typing\n // \"3d\" we return from normal_cmd() and come back here, the \"3\" is\n // remembered in \"opcount\".\n ca.opcount = opcount;",
" // If there is an operator pending, then the command we take this time\n // will terminate it. Finish_op tells us to finish the operation before\n // returning this time (unless the operation was cancelled).\n#ifdef CURSOR_SHAPE\n c = finish_op;\n#endif\n finish_op = (oap->op_type != OP_NOP);\n#ifdef CURSOR_SHAPE\n if (finish_op != c)\n {\n\tui_cursor_shape();\t\t// may show different cursor shape\n# ifdef FEAT_MOUSESHAPE\n\tupdate_mouseshape(-1);\n# endif\n }\n#endif\n may_trigger_modechanged();",
" // When not finishing an operator and no register name typed, reset the\n // count.\n if (!finish_op && !oap->regname)\n {\n\tca.opcount = 0;\n#ifdef FEAT_EVAL\n\tset_prevcount = TRUE;\n#endif\n }",
" // Restore counts from before receiving K_CURSORHOLD. This means after\n // typing \"3\", handling K_CURSORHOLD and then typing \"2\" we get \"32\", not\n // \"3 * 2\".\n if (oap->prev_opcount > 0 || oap->prev_count0 > 0)\n {\n\tca.opcount = oap->prev_opcount;\n\tca.count0 = oap->prev_count0;\n\toap->prev_opcount = 0;\n\toap->prev_count0 = 0;\n }",
" mapped_len = typebuf_maplen();",
" State = MODE_NORMAL_BUSY;\n#ifdef USE_ON_FLY_SCROLL\n dont_scroll = FALSE;\t// allow scrolling here\n#endif",
"#ifdef FEAT_EVAL\n // Set v:count here, when called from main() and not a stuffed\n // command, so that v:count can be used in an expression mapping\n // when there is no count. Do set it for redo.\n if (toplevel && readbuf1_empty())\n\tset_vcount_ca(&ca, &set_prevcount);\n#endif",
" /*\n * Get the command character from the user.\n */\n c = safe_vgetc();\n LANGMAP_ADJUST(c, get_real_state() != MODE_SELECT);",
" // If a mapping was started in Visual or Select mode, remember the length\n // of the mapping. This is used below to not return to Insert mode for as\n // long as the mapping is being executed.\n if (restart_edit == 0)\n\told_mapped_len = 0;\n else if (old_mapped_len\n\t\t|| (VIsual_active && mapped_len == 0 && typebuf_maplen() > 0))\n\told_mapped_len = typebuf_maplen();",
" if (c == NUL)\n\tc = K_ZERO;",
" // In Select mode, typed text replaces the selection.\n if (VIsual_active\n\t && VIsual_select\n\t && (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER))\n {\n\tint len;",
"\t// Fake a \"c\"hange command. When \"restart_edit\" is set (e.g., because\n\t// 'insertmode' is set) fake a \"d\"elete command, Insert mode will\n\t// restart automatically.\n\t// Insert the typed character in the typeahead buffer, so that it can\n\t// be mapped in Insert mode. Required for \":lmap\" to work.\n\tlen = ins_char_typebuf(vgetc_char, vgetc_mod_mask);",
"\t// When recording and gotchars() was called the character will be\n\t// recorded again, remove the previous recording.\n\tif (KeyTyped)\n\t ungetchars(len);",
"\tif (restart_edit != 0)\n\t c = 'd';\n\telse\n\t c = 'c';\n\tmsg_nowait = TRUE;\t// don't delay going to insert mode\n\told_mapped_len = 0;\t// do go to Insert mode\n }",
" // If the window was made so small that nothing shows, make it at least one\n // line and one column when typing a command.\n if (KeyTyped && !KeyStuffed)\n\twin_ensure_size();",
"#ifdef FEAT_CMDL_INFO\n need_flushbuf = add_to_showcmd(c);\n#endif",
" // Get the command count\n c = normal_cmd_get_count(&ca, c, toplevel, set_prevcount, &ctrl_w,\n\t\t\t\t\t\t\t&need_flushbuf);",
" // Find the command character in the table of commands.\n // For CTRL-W we already got nchar when looking for a count.\n if (ctrl_w)\n {\n\tca.nchar = c;\n\tca.cmdchar = Ctrl_W;\n }\n else\n\tca.cmdchar = c;\n idx = find_command(ca.cmdchar);\n if (idx < 0)\n {\n\t// Not a known command: beep.\n\tclearopbeep(oap);\n\tgoto normal_end;\n }",
" if ((nv_cmds[idx].cmd_flags & NV_NCW)\n\t\t\t\t&& (check_text_locked(oap) || curbuf_locked()))\n\t// this command is not allowed now\n\tgoto normal_end;",
" // In Visual/Select mode, a few keys are handled in a special way.\n if (VIsual_active)\n {\n\t// when 'keymodel' contains \"stopsel\" may stop Select/Visual mode\n\tif (km_stopsel\n\t\t&& (nv_cmds[idx].cmd_flags & NV_STS)\n\t\t&& !(mod_mask & MOD_MASK_SHIFT))\n\t{\n\t end_visual_mode();\n\t redraw_curbuf_later(INVERTED);\n\t}",
"\t// Keys that work different when 'keymodel' contains \"startsel\"\n\tif (km_startsel)\n\t{\n\t if (nv_cmds[idx].cmd_flags & NV_SS)\n\t {\n\t\tunshift_special(&ca);\n\t\tidx = find_command(ca.cmdchar);\n\t\tif (idx < 0)\n\t\t{\n\t\t // Just in case\n\t\t clearopbeep(oap);\n\t\t goto normal_end;\n\t\t}\n\t }\n\t else if ((nv_cmds[idx].cmd_flags & NV_SSS)\n\t\t\t\t\t && (mod_mask & MOD_MASK_SHIFT))\n\t\tmod_mask &= ~MOD_MASK_SHIFT;\n\t}\n }",
"#ifdef FEAT_RIGHTLEFT\n if (curwin->w_p_rl && KeyTyped && !KeyStuffed\n\t\t\t\t\t && (nv_cmds[idx].cmd_flags & NV_RL))\n {\n\t// Invert horizontal movements and operations. Only when typed by the\n\t// user directly, not when the result of a mapping or \"x\" translated\n\t// to \"dl\".\n\tswitch (ca.cmdchar)\n\t{\n\t case 'l':\t ca.cmdchar = 'h'; break;\n\t case K_RIGHT: ca.cmdchar = K_LEFT; break;\n\t case K_S_RIGHT: ca.cmdchar = K_S_LEFT; break;\n\t case K_C_RIGHT: ca.cmdchar = K_C_LEFT; break;\n\t case 'h':\t ca.cmdchar = 'l'; break;\n\t case K_LEFT: ca.cmdchar = K_RIGHT; break;\n\t case K_S_LEFT: ca.cmdchar = K_S_RIGHT; break;\n\t case K_C_LEFT: ca.cmdchar = K_C_RIGHT; break;\n\t case '>':\t ca.cmdchar = '<'; break;\n\t case '<':\t ca.cmdchar = '>'; break;\n\t}\n\tidx = find_command(ca.cmdchar);\n }\n#endif",
" // Get additional characters if we need them.\n if (normal_cmd_needs_more_chars(&ca, nv_cmds[idx].cmd_flags))\n\tidx = normal_cmd_get_more_chars(idx, &ca, &need_flushbuf);",
"#ifdef FEAT_CMDL_INFO\n // Flush the showcmd characters onto the screen so we can see them while\n // the command is being executed. Only do this when the shown command was\n // actually displayed, otherwise this will slow down a lot when executing\n // mappings.\n if (need_flushbuf)\n\tout_flush();\n#endif\n if (ca.cmdchar != K_IGNORE)\n {\n\tif (ex_normal_busy)\n\t did_cursorhold = save_did_cursorhold;\n\telse\n\t did_cursorhold = FALSE;\n }",
" State = MODE_NORMAL;",
" if (ca.nchar == ESC)\n {\n\tclearop(oap);\n\tif (restart_edit == 0 && goto_im())\n\t restart_edit = 'a';\n\tgoto normal_end;\n }",
" if (ca.cmdchar != K_IGNORE)\n {\n\tmsg_didout = FALSE; // don't scroll screen up for normal command\n\tmsg_col = 0;\n }",
" old_pos = curwin->w_cursor;\t\t// remember where cursor was",
" // When 'keymodel' contains \"startsel\" some keys start Select/Visual\n // mode.\n if (!VIsual_active && km_startsel)\n {\n\tif (nv_cmds[idx].cmd_flags & NV_SS)\n\t{\n\t start_selection();\n\t unshift_special(&ca);\n\t idx = find_command(ca.cmdchar);\n\t}\n\telse if ((nv_cmds[idx].cmd_flags & NV_SSS)\n\t\t\t\t\t && (mod_mask & MOD_MASK_SHIFT))\n\t{\n\t start_selection();\n\t mod_mask &= ~MOD_MASK_SHIFT;\n\t}\n }",
" // Execute the command!\n // Call the command function found in the commands table.\n ca.arg = nv_cmds[idx].cmd_arg;\n (nv_cmds[idx].cmd_func)(&ca);",
" // If we didn't start or finish an operator, reset oap->regname, unless we\n // need it later.\n if (!finish_op\n\t && !oap->op_type\n\t && (idx < 0 || !(nv_cmds[idx].cmd_flags & NV_KEEPREG)))\n {\n\tclearop(oap);\n#ifdef FEAT_EVAL\n\treset_reg_var();\n#endif\n }",
" // Get the length of mapped chars again after typing a count, second\n // character or \"z333<cr>\".\n if (old_mapped_len > 0)\n\told_mapped_len = typebuf_maplen();",
" // If an operation is pending, handle it. But not for K_IGNORE or\n // K_MOUSEMOVE.\n if (ca.cmdchar != K_IGNORE && ca.cmdchar != K_MOUSEMOVE)\n\tdo_pending_operator(&ca, old_col, FALSE);",
" // Wait for a moment when a message is displayed that will be overwritten\n // by the mode message.\n if (normal_cmd_need_to_wait_for_msg(&ca, &old_pos))\n\tnormal_cmd_wait_for_msg();",
" // Finish up after executing a Normal mode command.\nnormal_end:",
" msg_nowait = FALSE;",
"#ifdef FEAT_EVAL\n if (finish_op)\n\treset_reg_var();\n#endif",
" // Reset finish_op, in case it was set\n#ifdef CURSOR_SHAPE\n c = finish_op;\n#endif\n finish_op = FALSE;\n may_trigger_modechanged();\n#ifdef CURSOR_SHAPE\n // Redraw the cursor with another shape, if we were in Operator-pending\n // mode or did a replace command.\n if (c || ca.cmdchar == 'r')\n {\n\tui_cursor_shape();\t\t// may show different cursor shape\n# ifdef FEAT_MOUSESHAPE\n\tupdate_mouseshape(-1);\n# endif\n }\n#endif",
"#ifdef FEAT_CMDL_INFO\n if (oap->op_type == OP_NOP && oap->regname == 0\n\t && ca.cmdchar != K_CURSORHOLD)\n\tclear_showcmd();\n#endif",
" checkpcmark();\t\t// check if we moved since setting pcmark\n vim_free(ca.searchbuf);",
" if (has_mbyte)\n\tmb_adjust_cursor();",
" if (curwin->w_p_scb && toplevel)\n {\n\tvalidate_cursor();\t// may need to update w_leftcol\n\tdo_check_scrollbind(TRUE);\n }",
" if (curwin->w_p_crb && toplevel)\n {\n\tvalidate_cursor();\t// may need to update w_leftcol\n\tdo_check_cursorbind();\n }",
"#ifdef FEAT_TERMINAL\n // don't go to Insert mode if a terminal has a running job\n if (term_job_running(curbuf->b_term))\n\trestart_edit = 0;\n#endif",
" // May restart edit(), if we got here with CTRL-O in Insert mode (but not\n // if still inside a mapping that started in Visual mode).\n // May switch from Visual to Select mode after CTRL-O command.\n if ( oap->op_type == OP_NOP\n\t && ((restart_edit != 0 && !VIsual_active && old_mapped_len == 0)\n\t\t|| restart_VIsual_select == 1)\n\t && !(ca.retval & CA_COMMAND_BUSY)\n\t && stuff_empty()\n\t && oap->regname == 0)\n {\n\tif (restart_VIsual_select == 1)\n\t{\n\t VIsual_select = TRUE;\n\t may_trigger_modechanged();\n\t showmode();\n\t restart_VIsual_select = 0;\n\t VIsual_select_reg = 0;\n\t}\n\tif (restart_edit != 0 && !VIsual_active && old_mapped_len == 0)\n\t (void)edit(restart_edit, FALSE, 1L);\n }",
" if (restart_VIsual_select == 2)\n\trestart_VIsual_select = 1;",
" // Save count before an operator for next time.\n opcount = ca.opcount;\n}",
"#ifdef FEAT_EVAL\n/*\n * Set v:count and v:count1 according to \"cap\".\n * Set v:prevcount only when \"set_prevcount\" is TRUE.\n */\n static void\nset_vcount_ca(cmdarg_T *cap, int *set_prevcount)\n{\n long count = cap->count0;",
" // multiply with cap->opcount the same way as above\n if (cap->opcount != 0)\n\tcount = cap->opcount * (count == 0 ? 1 : count);\n set_vcount(count, count == 0 ? 1 : count, *set_prevcount);\n *set_prevcount = FALSE; // only set v:prevcount once\n}\n#endif",
"/*\n * Check if highlighting for Visual mode is possible, give a warning message\n * if not.\n */\n void\ncheck_visual_highlight(void)\n{\n static int\t did_check = FALSE;",
" if (full_screen)\n {\n\tif (!did_check && HL_ATTR(HLF_V) == 0)\n\t msg(_(\"Warning: terminal cannot highlight\"));\n\tdid_check = TRUE;\n }\n}",
"#if defined(FEAT_CLIPBOARD) && defined(FEAT_EVAL)\n/*\n * Call yank_do_autocmd() for \"regname\".\n */\n static void\ncall_yank_do_autocmd(int regname)\n{\n oparg_T\toa;\n yankreg_T\t*reg;",
" clear_oparg(&oa);\n oa.regname = regname;\n oa.op_type = OP_YANK;\n oa.is_VIsual = TRUE;\n reg = get_register(regname, TRUE);\n yank_do_autocmd(&oa, reg);\n free_register(reg);\n}\n#endif",
"/*\n * End Visual mode.\n * This function or the next should ALWAYS be called to end Visual mode, except\n * from do_pending_operator().\n */\n void\nend_visual_mode()\n{\n end_visual_mode_keep_button();\n reset_held_button();\n}",
" void\nend_visual_mode_keep_button()\n{\n#ifdef FEAT_CLIPBOARD\n // If we are using the clipboard, then remember what was selected in case\n // we need to paste it somewhere while we still own the selection.\n // Only do this when the clipboard is already owned. Don't want to grab\n // the selection when hitting ESC.\n if (clip_star.available && clip_star.owned)\n\tclip_auto_select();",
"# if defined(FEAT_EVAL)\n // Emit a TextYankPost for the automatic copy of the selection into the\n // star and/or plus register.\n if (has_textyankpost())\n {\n\tif (clip_isautosel_star())\n\t call_yank_do_autocmd('*');\n\tif (clip_isautosel_plus())\n\t call_yank_do_autocmd('+');\n }\n# endif\n#endif",
" VIsual_active = FALSE;\n setmouse();\n mouse_dragging = 0;",
" // Save the current VIsual area for '< and '> marks, and \"gv\"\n curbuf->b_visual.vi_mode = VIsual_mode;\n curbuf->b_visual.vi_start = VIsual;\n curbuf->b_visual.vi_end = curwin->w_cursor;\n curbuf->b_visual.vi_curswant = curwin->w_curswant;\n#ifdef FEAT_EVAL\n curbuf->b_visual_mode_eval = VIsual_mode;\n#endif\n if (!virtual_active())\n\tcurwin->w_cursor.coladd = 0;\n may_clear_cmdline();",
" adjust_cursor_eol();\n may_trigger_modechanged();\n}",
"/*\n * Reset VIsual_active and VIsual_reselect.\n */\n void\nreset_VIsual_and_resel(void)\n{\n if (VIsual_active)\n {\n\tend_visual_mode();\n\tredraw_curbuf_later(INVERTED);\t// delete the inversion later\n }\n VIsual_reselect = FALSE;\n}",
"/*\n * Reset VIsual_active and VIsual_reselect if it's set.\n */\n void\nreset_VIsual(void)\n{\n if (VIsual_active)\n {\n\tend_visual_mode();\n\tredraw_curbuf_later(INVERTED);\t// delete the inversion later\n\tVIsual_reselect = FALSE;\n }\n}",
" void\nrestore_visual_mode(void)\n{\n if (VIsual_mode_orig != NUL)\n {\n\tcurbuf->b_visual.vi_mode = VIsual_mode_orig;\n\tVIsual_mode_orig = NUL;\n }\n}",
"/*\n * Check for a balloon-eval special item to include when searching for an\n * identifier. When \"dir\" is BACKWARD \"ptr[-1]\" must be valid!\n * Returns TRUE if the character at \"*ptr\" should be included.\n * \"dir\" is FORWARD or BACKWARD, the direction of searching.\n * \"*colp\" is in/decremented if \"ptr[-dir]\" should also be included.\n * \"bnp\" points to a counter for square brackets.\n */\n static int\nfind_is_eval_item(\n char_u\t*ptr,\n int\t\t*colp,\n int\t\t*bnp,\n int\t\tdir)\n{\n // Accept everything inside [].\n if ((*ptr == ']' && dir == BACKWARD) || (*ptr == '[' && dir == FORWARD))\n\t++*bnp;\n if (*bnp > 0)\n {\n\tif ((*ptr == '[' && dir == BACKWARD) || (*ptr == ']' && dir == FORWARD))\n\t --*bnp;\n\treturn TRUE;\n }",
" // skip over \"s.var\"\n if (*ptr == '.')\n\treturn TRUE;",
" // two-character item: s->var\n if (ptr[dir == BACKWARD ? 0 : 1] == '>'\n\t && ptr[dir == BACKWARD ? -1 : 0] == '-')\n {\n\t*colp += dir;\n\treturn TRUE;\n }\n return FALSE;\n}",
"/*\n * Find the identifier under or to the right of the cursor.\n * \"find_type\" can have one of three values:\n * FIND_IDENT: find an identifier (keyword)\n * FIND_STRING: find any non-white text\n * FIND_IDENT + FIND_STRING: find any non-white text, identifier preferred.\n * FIND_EVAL:\t find text useful for C program debugging\n *\n * There are three steps:\n * 1. Search forward for the start of an identifier/text. Doesn't move if\n * already on one.\n * 2. Search backward for the start of this identifier/text.\n * This doesn't match the real Vi but I like it a little better and it\n * shouldn't bother anyone.\n * 3. Search forward to the end of this identifier/text.\n * When FIND_IDENT isn't defined, we backup until a blank.\n *\n * Returns the length of the text, or zero if no text is found.\n * If text is found, a pointer to the text is put in \"*text\". This\n * points into the current buffer line and is not always NUL terminated.\n */\n int\nfind_ident_under_cursor(char_u **text, int find_type)\n{\n return find_ident_at_pos(curwin, curwin->w_cursor.lnum,\n\t\t\t\tcurwin->w_cursor.col, text, NULL, find_type);\n}",
"/*\n * Like find_ident_under_cursor(), but for any window and any position.\n * However: Uses 'iskeyword' from the current window!.\n */\n int\nfind_ident_at_pos(\n win_T\t*wp,\n linenr_T\tlnum,\n colnr_T\tstartcol,\n char_u\t**text,\n int\t\t*textcol,\t// column where \"text\" starts, can be NULL\n int\t\tfind_type)\n{\n char_u\t*ptr;\n int\t\tcol = 0;\t// init to shut up GCC\n int\t\ti;\n int\t\tthis_class = 0;\n int\t\tprev_class;\n int\t\tprevcol;\n int\t\tbn = 0;\t\t// bracket nesting",
" // if i == 0: try to find an identifier\n // if i == 1: try to find any non-white text\n ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);\n for (i = (find_type & FIND_IDENT) ? 0 : 1;\ti < 2; ++i)\n {\n\t/*\n\t * 1. skip to start of identifier/text\n\t */\n\tcol = startcol;\n\tif (has_mbyte)\n\t{\n\t while (ptr[col] != NUL)\n\t {\n\t\t// Stop at a ']' to evaluate \"a[x]\".\n\t\tif ((find_type & FIND_EVAL) && ptr[col] == ']')\n\t\t break;\n\t\tthis_class = mb_get_class(ptr + col);\n\t\tif (this_class != 0 && (i == 1 || this_class != 1))\n\t\t break;\n\t\tcol += (*mb_ptr2len)(ptr + col);\n\t }\n\t}\n\telse\n\t while (ptr[col] != NUL\n\t\t && (i == 0 ? !vim_iswordc(ptr[col]) : VIM_ISWHITE(ptr[col]))\n\t\t && (!(find_type & FIND_EVAL) || ptr[col] != ']')\n\t\t )\n\t\t++col;",
"\t// When starting on a ']' count it, so that we include the '['.\n\tbn = ptr[col] == ']';",
"\t/*\n\t * 2. Back up to start of identifier/text.\n\t */\n\tif (has_mbyte)\n\t{\n\t // Remember class of character under cursor.\n\t if ((find_type & FIND_EVAL) && ptr[col] == ']')\n\t\tthis_class = mb_get_class((char_u *)\"a\");\n\t else\n\t\tthis_class = mb_get_class(ptr + col);\n\t while (col > 0 && this_class != 0)\n\t {\n\t\tprevcol = col - 1 - (*mb_head_off)(ptr, ptr + col - 1);\n\t\tprev_class = mb_get_class(ptr + prevcol);\n\t\tif (this_class != prev_class\n\t\t\t&& (i == 0\n\t\t\t || prev_class == 0\n\t\t\t || (find_type & FIND_IDENT))\n\t\t\t&& (!(find_type & FIND_EVAL)\n\t\t\t || prevcol == 0\n\t\t\t || !find_is_eval_item(ptr + prevcol, &prevcol,\n\t\t\t\t\t\t\t &bn, BACKWARD))\n\t\t\t)\n\t\t break;\n\t\tcol = prevcol;\n\t }",
"\t // If we don't want just any old text, or we've found an\n\t // identifier, stop searching.\n\t if (this_class > 2)\n\t\tthis_class = 2;\n\t if (!(find_type & FIND_STRING) || this_class == 2)\n\t\tbreak;\n\t}\n\telse\n\t{\n\t while (col > 0\n\t\t && ((i == 0\n\t\t\t ? vim_iswordc(ptr[col - 1])\n\t\t\t : (!VIM_ISWHITE(ptr[col - 1])\n\t\t\t\t&& (!(find_type & FIND_IDENT)\n\t\t\t\t || !vim_iswordc(ptr[col - 1]))))\n\t\t\t|| ((find_type & FIND_EVAL)\n\t\t\t && col > 1\n\t\t\t && find_is_eval_item(ptr + col - 1, &col,\n\t\t\t\t\t\t\t &bn, BACKWARD))\n\t\t\t))\n\t\t--col;",
"\t // If we don't want just any old text, or we've found an\n\t // identifier, stop searching.\n\t if (!(find_type & FIND_STRING) || vim_iswordc(ptr[col]))\n\t\tbreak;\n\t}\n }",
" if (ptr[col] == NUL || (i == 0\n\t\t&& (has_mbyte ? this_class != 2 : !vim_iswordc(ptr[col]))))\n {\n\t// didn't find an identifier or text\n\tif ((find_type & FIND_NOERROR) == 0)\n\t{\n\t if (find_type & FIND_STRING)\n\t\temsg(_(e_no_string_under_cursor));\n\t else\n\t\temsg(_(e_no_identifier_under_cursor));\n\t}\n\treturn 0;\n }\n ptr += col;\n *text = ptr;\n if (textcol != NULL)\n\t*textcol = col;",
" /*\n * 3. Find the end if the identifier/text.\n */\n bn = 0;\n startcol -= col;\n col = 0;\n if (has_mbyte)\n {\n\t// Search for point of changing multibyte character class.\n\tthis_class = mb_get_class(ptr);\n\twhile (ptr[col] != NUL\n\t\t&& ((i == 0 ? mb_get_class(ptr + col) == this_class\n\t\t\t : mb_get_class(ptr + col) != 0)\n\t\t || ((find_type & FIND_EVAL)\n\t\t\t&& col <= (int)startcol\n\t\t\t&& find_is_eval_item(ptr + col, &col, &bn, FORWARD))\n\t\t))\n\t col += (*mb_ptr2len)(ptr + col);\n }\n else\n\twhile ((i == 0 ? vim_iswordc(ptr[col])\n\t\t : (ptr[col] != NUL && !VIM_ISWHITE(ptr[col])))\n\t\t || ((find_type & FIND_EVAL)\n\t\t\t&& col <= (int)startcol\n\t\t\t&& find_is_eval_item(ptr + col, &col, &bn, FORWARD))\n\t\t)\n\t ++col;",
" return col;\n}",
"/*\n * Prepare for redo of a normal command.\n */\n static void\nprep_redo_cmd(cmdarg_T *cap)\n{\n prep_redo(cap->oap->regname, cap->count0,\n\t\t\t\t NUL, cap->cmdchar, NUL, NUL, cap->nchar);\n}",
"/*\n * Prepare for redo of any command.\n * Note that only the last argument can be a multi-byte char.\n */\n void\nprep_redo(\n int\t regname,\n long num,\n int\t cmd1,\n int\t cmd2,\n int\t cmd3,\n int\t cmd4,\n int\t cmd5)\n{\n prep_redo_num2(regname, num, cmd1, cmd2, 0L, cmd3, cmd4, cmd5);\n}",
"/*\n * Prepare for redo of any command with extra count after \"cmd2\".\n */\n void\nprep_redo_num2(\n int\t regname,\n long num1,\n int\t cmd1,\n int\t cmd2,\n long num2,\n int\t cmd3,\n int\t cmd4,\n int\t cmd5)\n{\n ResetRedobuff();\n if (regname != 0)\t// yank from specified buffer\n {\n\tAppendCharToRedobuff('\"');\n\tAppendCharToRedobuff(regname);\n }\n if (num1 != 0)\n\tAppendNumberToRedobuff(num1);\n if (cmd1 != NUL)\n\tAppendCharToRedobuff(cmd1);\n if (cmd2 != NUL)\n\tAppendCharToRedobuff(cmd2);\n if (num2 != 0)\n\tAppendNumberToRedobuff(num2);\n if (cmd3 != NUL)\n\tAppendCharToRedobuff(cmd3);\n if (cmd4 != NUL)\n\tAppendCharToRedobuff(cmd4);\n if (cmd5 != NUL)\n\tAppendCharToRedobuff(cmd5);\n}",
"/*\n * check for operator active and clear it\n *\n * return TRUE if operator was active\n */\n static int\ncheckclearop(oparg_T *oap)\n{\n if (oap->op_type == OP_NOP)\n\treturn FALSE;\n clearopbeep(oap);\n return TRUE;\n}",
"/*\n * Check for operator or Visual active. Clear active operator.\n *\n * Return TRUE if operator or Visual was active.\n */\n static int\ncheckclearopq(oparg_T *oap)\n{\n if (oap->op_type == OP_NOP && !VIsual_active)\n\treturn FALSE;\n clearopbeep(oap);\n return TRUE;\n}",
" void\nclearop(oparg_T *oap)\n{\n oap->op_type = OP_NOP;\n oap->regname = 0;\n oap->motion_force = NUL;\n oap->use_reg_one = FALSE;\n motion_force = NUL;\n}",
" void\nclearopbeep(oparg_T *oap)\n{\n clearop(oap);\n beep_flush();\n}",
"/*\n * Remove the shift modifier from a special key.\n */\n static void\nunshift_special(cmdarg_T *cap)\n{\n switch (cap->cmdchar)\n {\n\tcase K_S_RIGHT:\tcap->cmdchar = K_RIGHT; break;\n\tcase K_S_LEFT:\tcap->cmdchar = K_LEFT; break;\n\tcase K_S_UP:\tcap->cmdchar = K_UP; break;\n\tcase K_S_DOWN:\tcap->cmdchar = K_DOWN; break;\n\tcase K_S_HOME:\tcap->cmdchar = K_HOME; break;\n\tcase K_S_END:\tcap->cmdchar = K_END; break;\n }\n cap->cmdchar = simplify_key(cap->cmdchar, &mod_mask);\n}",
"/*\n * If the mode is currently displayed clear the command line or update the\n * command displayed.\n */\n void\nmay_clear_cmdline(void)\n{\n if (mode_displayed)\n\tclear_cmdline = TRUE; // unshow visual mode later\n#ifdef FEAT_CMDL_INFO\n else\n\tclear_showcmd();\n#endif\n}",
"#if defined(FEAT_CMDL_INFO) || defined(PROTO)\n/*\n * Routines for displaying a partly typed command\n */",
"#define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30)\nstatic char_u\tshowcmd_buf[SHOWCMD_BUFLEN];\nstatic char_u\told_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd()\nstatic int\tshowcmd_is_clear = TRUE;\nstatic int\tshowcmd_visual = FALSE;",
"static void display_showcmd(void);",
" void\nclear_showcmd(void)\n{\n if (!p_sc)\n\treturn;",
" if (VIsual_active && !char_avail())\n {\n\tint\t\tcursor_bot = LT_POS(VIsual, curwin->w_cursor);\n\tlong\t\tlines;\n\tcolnr_T\t\tleftcol, rightcol;\n\tlinenr_T\ttop, bot;",
"\t// Show the size of the Visual area.\n\tif (cursor_bot)\n\t{\n\t top = VIsual.lnum;\n\t bot = curwin->w_cursor.lnum;\n\t}\n\telse\n\t{\n\t top = curwin->w_cursor.lnum;\n\t bot = VIsual.lnum;\n\t}\n# ifdef FEAT_FOLDING\n\t// Include closed folds as a whole.\n\t(void)hasFolding(top, &top, NULL);\n\t(void)hasFolding(bot, NULL, &bot);\n# endif\n\tlines = bot - top + 1;",
"\tif (VIsual_mode == Ctrl_V)\n\t{\n# ifdef FEAT_LINEBREAK\n\t char_u *saved_sbr = p_sbr;\n\t char_u *saved_w_sbr = curwin->w_p_sbr;",
"\t // Make 'sbr' empty for a moment to get the correct size.\n\t p_sbr = empty_option;\n\t curwin->w_p_sbr = empty_option;\n# endif\n\t getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);\n# ifdef FEAT_LINEBREAK\n\t p_sbr = saved_sbr;\n\t curwin->w_p_sbr = saved_w_sbr;\n# endif\n\t sprintf((char *)showcmd_buf, \"%ldx%ld\", lines,\n\t\t\t\t\t (long)(rightcol - leftcol + 1));\n\t}\n\telse if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)\n\t sprintf((char *)showcmd_buf, \"%ld\", lines);\n\telse\n\t{\n\t char_u *s, *e;\n\t int\t l;\n\t int\t bytes = 0;\n\t int\t chars = 0;",
"\t if (cursor_bot)\n\t {\n\t\ts = ml_get_pos(&VIsual);\n\t\te = ml_get_cursor();\n\t }\n\t else\n\t {\n\t\ts = ml_get_cursor();\n\t\te = ml_get_pos(&VIsual);\n\t }\n\t while ((*p_sel != 'e') ? s <= e : s < e)\n\t {\n\t\tl = (*mb_ptr2len)(s);\n\t\tif (l == 0)\n\t\t{\n\t\t ++bytes;\n\t\t ++chars;\n\t\t break; // end of line\n\t\t}\n\t\tbytes += l;\n\t\t++chars;\n\t\ts += l;\n\t }\n\t if (bytes == chars)\n\t\tsprintf((char *)showcmd_buf, \"%d\", chars);\n\t else\n\t\tsprintf((char *)showcmd_buf, \"%d-%d\", chars, bytes);\n\t}\n\tshowcmd_buf[SHOWCMD_COLS] = NUL;\t// truncate\n\tshowcmd_visual = TRUE;\n }\n else\n {\n\tshowcmd_buf[0] = NUL;\n\tshowcmd_visual = FALSE;",
"\t// Don't actually display something if there is nothing to clear.\n\tif (showcmd_is_clear)\n\t return;\n }",
" display_showcmd();\n}",
"/*\n * Add 'c' to string of shown command chars.\n * Return TRUE if output has been written (and setcursor() has been called).\n */\n int\nadd_to_showcmd(int c)\n{\n char_u\t*p;\n int\t\told_len;\n int\t\textra_len;\n int\t\toverflow;\n int\t\ti;\n static int\tignore[] =\n {\n#ifdef FEAT_GUI\n\tK_VER_SCROLLBAR, K_HOR_SCROLLBAR,\n\tK_LEFTMOUSE_NM, K_LEFTRELEASE_NM,\n#endif\n\tK_IGNORE, K_PS,\n\tK_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE,\n\tK_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE,\n\tK_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE,\n\tK_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT,\n\tK_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE,\n\tK_CURSORHOLD,\n\t0\n };",
" if (!p_sc || msg_silent != 0)\n\treturn FALSE;",
" if (showcmd_visual)\n {\n\tshowcmd_buf[0] = NUL;\n\tshowcmd_visual = FALSE;\n }",
" // Ignore keys that are scrollbar updates and mouse clicks\n if (IS_SPECIAL(c))\n\tfor (i = 0; ignore[i] != 0; ++i)\n\t if (ignore[i] == c)\n\t\treturn FALSE;",
" p = transchar(c);\n if (*p == ' ')\n\tSTRCPY(p, \"<20>\");\n old_len = (int)STRLEN(showcmd_buf);\n extra_len = (int)STRLEN(p);\n overflow = old_len + extra_len - SHOWCMD_COLS;\n if (overflow > 0)\n\tmch_memmove(showcmd_buf, showcmd_buf + overflow,\n\t\t\t\t\t\t old_len - overflow + 1);\n STRCAT(showcmd_buf, p);",
" if (char_avail())\n\treturn FALSE;",
" display_showcmd();",
" return TRUE;\n}",
" void\nadd_to_showcmd_c(int c)\n{\n if (!add_to_showcmd(c))\n\tsetcursor();\n}",
"/*\n * Delete 'len' characters from the end of the shown command.\n */\n static void\ndel_from_showcmd(int len)\n{\n int\t old_len;",
" if (!p_sc)\n\treturn;",
" old_len = (int)STRLEN(showcmd_buf);\n if (len > old_len)\n\tlen = old_len;\n showcmd_buf[old_len - len] = NUL;",
" if (!char_avail())\n\tdisplay_showcmd();\n}",
"/*\n * push_showcmd() and pop_showcmd() are used when waiting for the user to type\n * something and there is a partial mapping.\n */\n void\npush_showcmd(void)\n{\n if (p_sc)\n\tSTRCPY(old_showcmd_buf, showcmd_buf);\n}",
" void\npop_showcmd(void)\n{\n if (!p_sc)\n\treturn;",
" STRCPY(showcmd_buf, old_showcmd_buf);",
" display_showcmd();\n}",
" static void\ndisplay_showcmd(void)\n{\n int\t len;",
" cursor_off();",
" len = (int)STRLEN(showcmd_buf);\n if (len == 0)\n\tshowcmd_is_clear = TRUE;\n else\n {\n\tscreen_puts(showcmd_buf, (int)Rows - 1, sc_col, 0);\n\tshowcmd_is_clear = FALSE;\n }",
" // clear the rest of an old message by outputting up to SHOWCMD_COLS\n // spaces\n screen_puts((char_u *)\" \" + len, (int)Rows - 1, sc_col + len, 0);",
" setcursor();\t // put cursor back where it belongs\n}\n#endif",
"/*\n * When \"check\" is FALSE, prepare for commands that scroll the window.\n * When \"check\" is TRUE, take care of scroll-binding after the window has\n * scrolled. Called from normal_cmd() and edit().\n */\n void\ndo_check_scrollbind(int check)\n{\n static win_T\t*old_curwin = NULL;\n static linenr_T\told_topline = 0;\n#ifdef FEAT_DIFF\n static int\t\told_topfill = 0;\n#endif\n static buf_T\t*old_buf = NULL;\n static colnr_T\told_leftcol = 0;",
" if (check && curwin->w_p_scb)\n {\n\t// If a \":syncbind\" command was just used, don't scroll, only reset\n\t// the values.\n\tif (did_syncbind)\n\t did_syncbind = FALSE;\n\telse if (curwin == old_curwin)\n\t{\n\t // Synchronize other windows, as necessary according to\n\t // 'scrollbind'. Don't do this after an \":edit\" command, except\n\t // when 'diff' is set.\n\t if ((curwin->w_buffer == old_buf\n#ifdef FEAT_DIFF\n\t\t\t|| curwin->w_p_diff\n#endif\n\t\t)\n\t\t&& (curwin->w_topline != old_topline\n#ifdef FEAT_DIFF\n\t\t\t|| curwin->w_topfill != old_topfill\n#endif\n\t\t\t|| curwin->w_leftcol != old_leftcol))\n\t {\n\t\tcheck_scrollbind(curwin->w_topline - old_topline,\n\t\t\t(long)(curwin->w_leftcol - old_leftcol));\n\t }\n\t}\n\telse if (vim_strchr(p_sbo, 'j')) // jump flag set in 'scrollopt'\n\t{\n\t // When switching between windows, make sure that the relative\n\t // vertical offset is valid for the new window. The relative\n\t // offset is invalid whenever another 'scrollbind' window has\n\t // scrolled to a point that would force the current window to\n\t // scroll past the beginning or end of its buffer. When the\n\t // resync is performed, some of the other 'scrollbind' windows may\n\t // need to jump so that the current window's relative position is\n\t // visible on-screen.\n\t check_scrollbind(curwin->w_topline - curwin->w_scbind_pos, 0L);\n\t}\n\tcurwin->w_scbind_pos = curwin->w_topline;\n }",
" old_curwin = curwin;\n old_topline = curwin->w_topline;\n#ifdef FEAT_DIFF\n old_topfill = curwin->w_topfill;\n#endif\n old_buf = curwin->w_buffer;\n old_leftcol = curwin->w_leftcol;\n}",
"/*\n * Synchronize any windows that have \"scrollbind\" set, based on the\n * number of rows by which the current window has changed\n * (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>)\n */\n void\ncheck_scrollbind(linenr_T topline_diff, long leftcol_diff)\n{\n int\t\twant_ver;\n int\t\twant_hor;\n win_T\t*old_curwin = curwin;\n buf_T\t*old_curbuf = curbuf;\n int\t\told_VIsual_select = VIsual_select;\n int\t\told_VIsual_active = VIsual_active;\n colnr_T\ttgt_leftcol = curwin->w_leftcol;\n long\ttopline;\n long\ty;",
" // check 'scrollopt' string for vertical and horizontal scroll options\n want_ver = (vim_strchr(p_sbo, 'v') && topline_diff != 0);\n#ifdef FEAT_DIFF\n want_ver |= old_curwin->w_p_diff;\n#endif\n want_hor = (vim_strchr(p_sbo, 'h') && (leftcol_diff || topline_diff != 0));",
" // loop through the scrollbound windows and scroll accordingly\n VIsual_select = VIsual_active = 0;\n FOR_ALL_WINDOWS(curwin)\n {\n\tcurbuf = curwin->w_buffer;\n\t// skip original window and windows with 'noscrollbind'\n\tif (curwin != old_curwin && curwin->w_p_scb)\n\t{\n\t // do the vertical scroll\n\t if (want_ver)\n\t {\n#ifdef FEAT_DIFF\n\t\tif (old_curwin->w_p_diff && curwin->w_p_diff)\n\t\t{\n\t\t diff_set_topline(old_curwin, curwin);\n\t\t}\n\t\telse\n#endif\n\t\t{\n\t\t curwin->w_scbind_pos += topline_diff;\n\t\t topline = curwin->w_scbind_pos;\n\t\t if (topline > curbuf->b_ml.ml_line_count)\n\t\t\ttopline = curbuf->b_ml.ml_line_count;\n\t\t if (topline < 1)\n\t\t\ttopline = 1;",
"\t\t y = topline - curwin->w_topline;\n\t\t if (y > 0)\n\t\t\tscrollup(y, FALSE);\n\t\t else\n\t\t\tscrolldown(-y, FALSE);\n\t\t}",
"\t\tredraw_later(VALID);\n\t\tcursor_correct();\n\t\tcurwin->w_redr_status = TRUE;\n\t }",
"\t // do the horizontal scroll\n\t if (want_hor && curwin->w_leftcol != tgt_leftcol)\n\t {\n\t\tcurwin->w_leftcol = tgt_leftcol;\n\t\tleftcol_changed();\n\t }\n\t}\n }",
" // reset current-window\n VIsual_select = old_VIsual_select;\n VIsual_active = old_VIsual_active;\n curwin = old_curwin;\n curbuf = old_curbuf;\n}",
"/*\n * Command character that's ignored.\n * Used for CTRL-Q and CTRL-S to avoid problems with terminals that use\n * xon/xoff.\n */\n static void\nnv_ignore(cmdarg_T *cap)\n{\n cap->retval |= CA_COMMAND_BUSY;\t// don't call edit() now\n}",
"/*\n * Command character that doesn't do anything, but unlike nv_ignore() does\n * start edit(). Used for \"startinsert\" executed while starting up.\n */\n static void\nnv_nop(cmdarg_T *cap UNUSED)\n{\n}",
"/*\n * Command character doesn't exist.\n */\n static void\nnv_error(cmdarg_T *cap)\n{\n clearopbeep(cap->oap);\n}",
"/*\n * <Help> and <F1> commands.\n */\n static void\nnv_help(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n\tex_help(NULL);\n}",
"/*\n * CTRL-A and CTRL-X: Add or subtract from letter or number under cursor.\n */\n static void\nnv_addsub(cmdarg_T *cap)\n{\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && !prompt_curpos_editable())\n\tclearopbeep(cap->oap);\n else\n#endif\n if (!VIsual_active && cap->oap->op_type == OP_NOP)\n {\n\tprep_redo_cmd(cap);\n\tcap->oap->op_type = cap->cmdchar == Ctrl_A ? OP_NR_ADD : OP_NR_SUB;\n\top_addsub(cap->oap, cap->count1, cap->arg);\n\tcap->oap->op_type = OP_NOP;\n }\n else if (VIsual_active)\n\tnv_operator(cap);\n else\n\tclearop(cap->oap);\n}",
"/*\n * CTRL-F, CTRL-B, etc: Scroll page up or down.\n */\n static void\nnv_page(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n {\n\tif (mod_mask & MOD_MASK_CTRL)\n\t{\n\t // <C-PageUp>: tab page back; <C-PageDown>: tab page forward\n\t if (cap->arg == BACKWARD)\n\t\tgoto_tabpage(-(int)cap->count1);\n\t else\n\t\tgoto_tabpage((int)cap->count0);\n\t}\n\telse\n\t (void)onepage(cap->arg, cap->count1);\n }\n}",
"/*\n * Implementation of \"gd\" and \"gD\" command.\n */\n static void\nnv_gd(\n oparg_T\t*oap,\n int\t\tnchar,\n int\t\tthisblock)\t// 1 for \"1gd\" and \"1gD\"\n{\n int\t\tlen;\n char_u\t*ptr;",
" if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0\n\t || find_decl(ptr, len, nchar == 'd', thisblock, SEARCH_START)\n\t\t\t\t\t\t\t\t == FAIL)\n {\n\tclearopbeep(oap);\n }\n else\n {\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n\t// clear any search statistics\n\tif (messaging() && !msg_silent && !shortmess(SHM_SEARCHCOUNT))\n\t clear_cmdline = TRUE;\n }\n}",
"/*\n * Return TRUE if line[offset] is not inside a C-style comment or string, FALSE\n * otherwise.\n */\n static int\nis_ident(char_u *line, int offset)\n{\n int\ti;\n int\tincomment = FALSE;\n int\tinstring = 0;\n int\tprev = 0;",
" for (i = 0; i < offset && line[i] != NUL; i++)\n {\n\tif (instring != 0)\n\t{\n\t if (prev != '\\\\' && line[i] == instring)\n\t\tinstring = 0;\n\t}\n\telse if ((line[i] == '\"' || line[i] == '\\'') && !incomment)\n\t{\n\t instring = line[i];\n\t}\n\telse\n\t{\n\t if (incomment)\n\t {\n\t\tif (prev == '*' && line[i] == '/')\n\t\t incomment = FALSE;\n\t }\n\t else if (prev == '/' && line[i] == '*')\n\t {\n\t\tincomment = TRUE;\n\t }\n\t else if (prev == '/' && line[i] == '/')\n\t {\n\t\treturn FALSE;\n\t }\n\t}",
"\tprev = line[i];\n }",
" return incomment == FALSE && instring == 0;\n}",
"/*\n * Search for variable declaration of \"ptr[len]\".\n * When \"locally\" is TRUE in the current function (\"gd\"), otherwise in the\n * current file (\"gD\").\n * When \"thisblock\" is TRUE check the {} block scope.\n * Return FAIL when not found.\n */\n int\nfind_decl(\n char_u\t*ptr,\n int\t\tlen,\n int\t\tlocally,\n int\t\tthisblock,\n int\t\tflags_arg)\t// flags passed to searchit()\n{\n char_u\t*pat;\n pos_T\told_pos;\n pos_T\tpar_pos;\n pos_T\tfound_pos;\n int\t\tt;\n int\t\tsave_p_ws;\n int\t\tsave_p_scs;\n int\t\tretval = OK;\n int\t\tincll;\n int\t\tsearchflags = flags_arg;\n int\t\tvalid;",
" if ((pat = alloc(len + 7)) == NULL)\n\treturn FAIL;",
" // Put \"\\V\" before the pattern to avoid that the special meaning of \".\"\n // and \"~\" causes trouble.\n sprintf((char *)pat, vim_iswordp(ptr) ? \"\\\\V\\\\<%.*s\\\\>\" : \"\\\\V%.*s\",\n\t\t\t\t\t\t\t\t len, ptr);\n old_pos = curwin->w_cursor;\n save_p_ws = p_ws;\n save_p_scs = p_scs;\n p_ws = FALSE;\t// don't wrap around end of file now\n p_scs = FALSE;\t// don't switch ignorecase off now",
" // With \"gD\" go to line 1.\n // With \"gd\" Search back for the start of the current function, then go\n // back until a blank line. If this fails go to line 1.\n if (!locally || !findpar(&incll, BACKWARD, 1L, '{', FALSE))\n {\n\tsetpcmark();\t\t\t// Set in findpar() otherwise\n\tcurwin->w_cursor.lnum = 1;\n\tpar_pos = curwin->w_cursor;\n }\n else\n {\n\tpar_pos = curwin->w_cursor;\n\twhile (curwin->w_cursor.lnum > 1 && *skipwhite(ml_get_curline()) != NUL)\n\t --curwin->w_cursor.lnum;\n }\n curwin->w_cursor.col = 0;",
" // Search forward for the identifier, ignore comment lines.\n CLEAR_POS(&found_pos);\n for (;;)\n {\n\tt = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,\n\t\t\t\t\t pat, 1L, searchflags, RE_LAST, NULL);\n\tif (curwin->w_cursor.lnum >= old_pos.lnum)\n\t t = FAIL;\t// match after start is failure too",
"\tif (thisblock && t != FAIL)\n\t{\n\t pos_T\t*pos;",
"\t // Check that the block the match is in doesn't end before the\n\t // position where we started the search from.\n\t if ((pos = findmatchlimit(NULL, '}', FM_FORWARD,\n\t\t (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL\n\t\t && pos->lnum < old_pos.lnum)\n\t {\n\t\t// There can't be a useful match before the end of this block.\n\t\t// Skip to the end.\n\t\tcurwin->w_cursor = *pos;\n\t\tcontinue;\n\t }\n\t}",
"\tif (t == FAIL)\n\t{\n\t // If we previously found a valid position, use it.\n\t if (found_pos.lnum != 0)\n\t {\n\t\tcurwin->w_cursor = found_pos;\n\t\tt = OK;\n\t }\n\t break;\n\t}\n\tif (get_leader_len(ml_get_curline(), NULL, FALSE, TRUE) > 0)\n\t{\n\t // Ignore this line, continue at start of next line.\n\t ++curwin->w_cursor.lnum;\n\t curwin->w_cursor.col = 0;\n\t continue;\n\t}\n\tvalid = is_ident(ml_get_curline(), curwin->w_cursor.col);",
"\t// If the current position is not a valid identifier and a previous\n\t// match is present, favor that one instead.\n\tif (!valid && found_pos.lnum != 0)\n\t{\n\t curwin->w_cursor = found_pos;\n\t break;\n\t}",
"\t// Global search: use first valid match found\n\tif (valid && !locally)\n\t break;\n\tif (valid && curwin->w_cursor.lnum >= par_pos.lnum)\n\t{\n\t // If we previously found a valid position, use it.\n\t if (found_pos.lnum != 0)\n\t\tcurwin->w_cursor = found_pos;\n\t break;\n\t}",
"\t// For finding a local variable and the match is before the \"{\" or\n\t// inside a comment, continue searching. For K&R style function\n\t// declarations this skips the function header without types.\n\tif (!valid)\n\t CLEAR_POS(&found_pos);\n\telse\n\t found_pos = curwin->w_cursor;\n\t// Remove SEARCH_START from flags to avoid getting stuck at one\n\t// position.\n\tsearchflags &= ~SEARCH_START;\n }",
" if (t == FAIL)\n {\n\tretval = FAIL;\n\tcurwin->w_cursor = old_pos;\n }\n else\n {\n\tcurwin->w_set_curswant = TRUE;\n\t// \"n\" searches forward now\n\treset_search_dir();\n }",
" vim_free(pat);\n p_ws = save_p_ws;\n p_scs = save_p_scs;",
" return retval;\n}",
"/*\n * Move 'dist' lines in direction 'dir', counting lines by *screen*\n * lines rather than lines in the file.\n * 'dist' must be positive.\n *\n * Return OK if able to move cursor, FAIL otherwise.\n */\n static int\nnv_screengo(oparg_T *oap, int dir, long dist)\n{\n int\t\tlinelen = linetabsize(ml_get_curline());\n int\t\tretval = OK;\n int\t\tatend = FALSE;\n int\t\tn;\n int\t\tcol_off1;\t// margin offset for first screen line\n int\t\tcol_off2;\t// margin offset for wrapped screen line\n int\t\twidth1;\t\t// text width for first screen line\n int\t\twidth2;\t\t// text width for wrapped screen line",
" oap->motion_type = MCHAR;\n oap->inclusive = (curwin->w_curswant == MAXCOL);",
" col_off1 = curwin_col_off();\n col_off2 = col_off1 - curwin_col_off2();\n width1 = curwin->w_width - col_off1;\n width2 = curwin->w_width - col_off2;\n if (width2 == 0)\n\twidth2 = 1; // avoid divide by zero",
" if (curwin->w_width != 0)\n {\n // Instead of sticking at the last character of the buffer line we\n // try to stick in the last column of the screen.\n if (curwin->w_curswant == MAXCOL)\n {\n\tatend = TRUE;\n\tvalidate_virtcol();\n\tif (width1 <= 0)\n\t curwin->w_curswant = 0;\n\telse\n\t{\n\t curwin->w_curswant = width1 - 1;\n\t if (curwin->w_virtcol > curwin->w_curswant)\n\t\tcurwin->w_curswant += ((curwin->w_virtcol\n\t\t\t - curwin->w_curswant - 1) / width2 + 1) * width2;\n\t}\n }\n else\n {\n\tif (linelen > width1)\n\t n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;\n\telse\n\t n = width1;\n\tif (curwin->w_curswant >= (colnr_T)n)\n\t curwin->w_curswant = n - 1;\n }",
" while (dist--)\n {\n\tif (dir == BACKWARD)\n\t{\n\t if ((long)curwin->w_curswant >= width1\n#ifdef FEAT_FOLDING\n\t\t && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)\n#endif\n\t )\n\t\t// Move back within the line. This can give a negative value\n\t\t// for w_curswant if width1 < width2 (with cpoptions+=n),\n\t\t// which will get clipped to column 0.\n\t\tcurwin->w_curswant -= width2;\n\t else\n\t {\n\t\t// to previous line\n#ifdef FEAT_FOLDING\n\t\t// Move to the start of a closed fold. Don't do that when\n\t\t// 'foldopen' contains \"all\": it will open in a moment.\n\t\tif (!(fdo_flags & FDO_ALL))\n\t\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\t&curwin->w_cursor.lnum, NULL);\n#endif\n\t\tif (curwin->w_cursor.lnum == 1)\n\t\t{\n\t\t retval = FAIL;\n\t\t break;\n\t\t}\n\t\t--curwin->w_cursor.lnum;",
"\t\tlinelen = linetabsize(ml_get_curline());\n\t\tif (linelen > width1)\n\t\t curwin->w_curswant += (((linelen - width1 - 1) / width2)\n\t\t\t\t\t\t\t\t+ 1) * width2;\n\t }\n\t}\n\telse // dir == FORWARD\n\t{\n\t if (linelen > width1)\n\t\tn = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;\n\t else\n\t\tn = width1;\n\t if (curwin->w_curswant + width2 < (colnr_T)n\n#ifdef FEAT_FOLDING\n\t\t && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)\n#endif\n\t\t )\n\t\t// move forward within line\n\t\tcurwin->w_curswant += width2;\n\t else\n\t {\n\t\t// to next line\n#ifdef FEAT_FOLDING\n\t\t// Move to the end of a closed fold.\n\t\t(void)hasFolding(curwin->w_cursor.lnum, NULL,\n\t\t\t\t\t\t &curwin->w_cursor.lnum);\n#endif\n\t\tif (curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)\n\t\t{\n\t\t retval = FAIL;\n\t\t break;\n\t\t}\n\t\tcurwin->w_cursor.lnum++;\n\t\tcurwin->w_curswant %= width2;\n\t\t// Check if the cursor has moved below the number display\n\t\t// when width1 < width2 (with cpoptions+=n). Subtract width2\n\t\t// to get a negative value for w_curswant, which will get\n\t\t// clipped to column 0.\n\t\tif (curwin->w_curswant >= width1)\n\t\t curwin->w_curswant -= width2;\n\t\tlinelen = linetabsize(ml_get_curline());\n\t }\n\t}\n }\n }",
" if (virtual_active() && atend)\n\tcoladvance(MAXCOL);\n else\n\tcoladvance(curwin->w_curswant);",
" if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)\n {\n\tcolnr_T virtcol;\n\tint\tc;",
"\t// Check for landing on a character that got split at the end of the\n\t// last line. We want to advance a screenline, not end up in the same\n\t// screenline or move two screenlines.\n\tvalidate_virtcol();\n\tvirtcol = curwin->w_virtcol;\n#if defined(FEAT_LINEBREAK)\n\tif (virtcol > (colnr_T)width1 && *get_showbreak_value(curwin) != NUL)\n\t virtcol -= vim_strsize(get_showbreak_value(curwin));\n#endif",
"\tc = (*mb_ptr2char)(ml_get_cursor());\n\tif (dir == FORWARD && virtcol < curwin->w_curswant\n\t\t&& (curwin->w_curswant <= (colnr_T)width1)\n\t\t&& !vim_isprintc(c) && c > 255)\n\t oneright();",
"\tif (virtcol > curwin->w_curswant\n\t\t&& (curwin->w_curswant < (colnr_T)width1\n\t\t ? (curwin->w_curswant > (colnr_T)width1 / 2)\n\t\t : ((curwin->w_curswant - width1) % width2\n\t\t\t\t\t\t > (colnr_T)width2 / 2)))\n\t --curwin->w_cursor.col;\n }",
" if (atend)\n\tcurwin->w_curswant = MAXCOL;\t // stick in the last column",
" return retval;\n}",
"/*\n * Handle CTRL-E and CTRL-Y commands: scroll a line up or down.\n * cap->arg must be TRUE for CTRL-E.\n */\n void\nnv_scroll_line(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n\tscroll_redraw(cap->arg, cap->count1);\n}",
"/*\n * Scroll \"count\" lines up or down, and redraw.\n */\n void\nscroll_redraw(int up, long count)\n{\n linenr_T\tprev_topline = curwin->w_topline;\n#ifdef FEAT_DIFF\n int\t\tprev_topfill = curwin->w_topfill;\n#endif\n linenr_T\tprev_lnum = curwin->w_cursor.lnum;",
" if (up)\n\tscrollup(count, TRUE);\n else\n\tscrolldown(count, TRUE);\n if (get_scrolloff_value())\n {\n\t// Adjust the cursor position for 'scrolloff'. Mark w_topline as\n\t// valid, otherwise the screen jumps back at the end of the file.\n\tcursor_correct();\n\tcheck_cursor_moved(curwin);\n\tcurwin->w_valid |= VALID_TOPLINE;",
"\t// If moved back to where we were, at least move the cursor, otherwise\n\t// we get stuck at one position. Don't move the cursor up if the\n\t// first line of the buffer is already on the screen\n\twhile (curwin->w_topline == prev_topline\n#ifdef FEAT_DIFF\n\t\t&& curwin->w_topfill == prev_topfill\n#endif\n\t\t)\n\t{\n\t if (up)\n\t {\n\t\tif (curwin->w_cursor.lnum > prev_lnum\n\t\t\t|| cursor_down(1L, FALSE) == FAIL)\n\t\t break;\n\t }\n\t else\n\t {\n\t\tif (curwin->w_cursor.lnum < prev_lnum\n\t\t\t|| prev_topline == 1L\n\t\t\t|| cursor_up(1L, FALSE) == FAIL)\n\t\t break;\n\t }\n\t // Mark w_topline as valid, otherwise the screen jumps back at the\n\t // end of the file.\n\t check_cursor_moved(curwin);\n\t curwin->w_valid |= VALID_TOPLINE;\n\t}\n }\n if (curwin->w_cursor.lnum != prev_lnum)\n\tcoladvance(curwin->w_curswant);\n redraw_later(VALID);\n}",
"/*\n * Get the count specified after a 'z' command. Only the 'z<CR>', 'zl', 'zh',\n * 'z<Left>', and 'z<Right>' commands accept a count after 'z'.\n * Returns TRUE to process the 'z' command and FALSE to skip it.\n */\n static int\nnv_z_get_count(cmdarg_T *cap, int *nchar_arg)\n{\n int\t\tnchar = *nchar_arg;\n long\tn;",
" // \"z123{nchar}\": edit the count before obtaining {nchar}\n if (checkclearop(cap->oap))\n\treturn FALSE;\n n = nchar - '0';",
" for (;;)\n {\n#ifdef USE_ON_FLY_SCROLL\n\tdont_scroll = TRUE;\t\t// disallow scrolling here\n#endif\n\t++no_mapping;\n\t++allow_keys; // no mapping for nchar, but allow key codes\n\tnchar = plain_vgetc();\n\tLANGMAP_ADJUST(nchar, TRUE);\n\t--no_mapping;\n\t--allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t(void)add_to_showcmd(nchar);\n#endif\n\tif (nchar == K_DEL || nchar == K_KDEL)\n\t n /= 10;\n\telse if (VIM_ISDIGIT(nchar))\n\t n = n * 10 + (nchar - '0');\n\telse if (nchar == CAR)\n\t{\n#ifdef FEAT_GUI\n\t need_mouse_correct = TRUE;\n#endif\n\t win_setheight((int)n);\n\t break;\n\t}\n\telse if (nchar == 'l'\n\t\t|| nchar == 'h'\n\t\t|| nchar == K_LEFT\n\t\t|| nchar == K_RIGHT)\n\t{\n\t cap->count1 = n ? n * cap->count1 : cap->count1;\n\t *nchar_arg = nchar;\n\t return TRUE;\n\t}\n\telse\n\t{\n\t clearopbeep(cap->oap);\n\t break;\n\t}\n }\n cap->oap->op_type = OP_NOP;\n return FALSE;\n}",
"#ifdef FEAT_SPELL\n/*\n * \"zug\" and \"zuw\": undo \"zg\" and \"zw\"\n * \"zg\": add good word to word list\n * \"zw\": add wrong word to word list\n * \"zG\": add good word to temp word list\n * \"zW\": add wrong word to temp word list\n */\n static int\nnv_zg_zw(cmdarg_T *cap, int nchar)\n{\n char_u\t*ptr = NULL;\n int\t\tlen;\n int\t\tundo = FALSE;",
" if (nchar == 'u')\n {\n\t++no_mapping;\n\t++allow_keys; // no mapping for nchar, but allow key codes\n\tnchar = plain_vgetc();\n\tLANGMAP_ADJUST(nchar, TRUE);\n\t--no_mapping;\n\t--allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t(void)add_to_showcmd(nchar);\n#endif\n\tif (vim_strchr((char_u *)\"gGwW\", nchar) == NULL)\n\t{\n\t clearopbeep(cap->oap);\n\t return OK;\n\t}\n\tundo = TRUE;\n }",
" if (checkclearop(cap->oap))\n\treturn OK;\n if (VIsual_active && get_visual_text(cap, &ptr, &len) == FAIL)\n\treturn FAIL;\n if (ptr == NULL)\n {\n\tpos_T\tpos = curwin->w_cursor;",
"\t// Find bad word under the cursor. When 'spell' is\n\t// off this fails and find_ident_under_cursor() is\n\t// used below.\n\temsg_off++;\n\tlen = spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL);\n\temsg_off--;\n\tif (len != 0 && curwin->w_cursor.col <= pos.col)\n\t ptr = ml_get_pos(&curwin->w_cursor);\n\tcurwin->w_cursor = pos;\n }",
" if (ptr == NULL\n\t\t&& (len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)\n\treturn FAIL;\n spell_add_word(ptr, len, nchar == 'w' || nchar == 'W'\n\t ? SPELL_ADD_BAD : SPELL_ADD_GOOD,\n\t (nchar == 'G' || nchar == 'W') ? 0 : (int)cap->count1, undo);",
" return OK;\n}\n#endif",
"/*\n * Commands that start with \"z\".\n */\n static void\nnv_zet(cmdarg_T *cap)\n{\n long\tn;\n colnr_T\tcol;\n int\t\tnchar = cap->nchar;\n#ifdef FEAT_FOLDING\n long\told_fdl = curwin->w_p_fdl;\n int\t\told_fen = curwin->w_p_fen;\n#endif\n long\tsiso = get_sidescrolloff_value();",
" if (VIM_ISDIGIT(nchar) && !nv_z_get_count(cap, &nchar))\n\t return;",
" if (\n#ifdef FEAT_FOLDING\n\t // \"zf\" and \"zF\" are always an operator, \"zd\", \"zo\", \"zO\", \"zc\"\n\t // and \"zC\" only in Visual mode. \"zj\" and \"zk\" are motion\n\t // commands.\n\t cap->nchar != 'f' && cap->nchar != 'F'\n\t && !(VIsual_active && vim_strchr((char_u *)\"dcCoO\", cap->nchar))\n\t && cap->nchar != 'j' && cap->nchar != 'k'\n\t &&\n#endif\n\t checkclearop(cap->oap))\n\treturn;",
" // For \"z+\", \"z<CR>\", \"zt\", \"z.\", \"zz\", \"z^\", \"z-\", \"zb\":\n // If line number given, set cursor.\n if ((vim_strchr((char_u *)\"+\\r\\nt.z^-b\", nchar) != NULL)\n\t && cap->count0\n\t && cap->count0 != curwin->w_cursor.lnum)\n {\n\tsetpcmark();\n\tif (cap->count0 > curbuf->b_ml.ml_line_count)\n\t curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\telse\n\t curwin->w_cursor.lnum = cap->count0;\n\tcheck_cursor_col();\n }",
" switch (nchar)\n {\n\t\t// \"z+\", \"z<CR>\" and \"zt\": put cursor at top of screen\n case '+':\n\t\tif (cap->count0 == 0)\n\t\t{\n\t\t // No count given: put cursor at the line below screen\n\t\t validate_botline();\t// make sure w_botline is valid\n\t\t if (curwin->w_botline > curbuf->b_ml.ml_line_count)\n\t\t\tcurwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t\t else\n\t\t\tcurwin->w_cursor.lnum = curwin->w_botline;\n\t\t}\n\t\t// FALLTHROUGH\n case NL:\n case CAR:\n case K_KENTER:\n\t\tbeginline(BL_WHITE | BL_FIX);\n\t\t// FALLTHROUGH",
" case 't':\tscroll_cursor_top(0, TRUE);\n\t\tredraw_later(VALID);\n\t\tset_fraction(curwin);\n\t\tbreak;",
"\t\t// \"z.\" and \"zz\": put cursor in middle of screen\n case '.':\tbeginline(BL_WHITE | BL_FIX);\n\t\t// FALLTHROUGH",
" case 'z':\tscroll_cursor_halfway(TRUE);\n\t\tredraw_later(VALID);\n\t\tset_fraction(curwin);\n\t\tbreak;",
"\t\t// \"z^\", \"z-\" and \"zb\": put cursor at bottom of screen\n case '^':\t// Strange Vi behavior: <count>z^ finds line at top of window\n\t\t// when <count> is at bottom of window, and puts that one at\n\t\t// bottom of window.\n\t\tif (cap->count0 != 0)\n\t\t{\n\t\t scroll_cursor_bot(0, TRUE);\n\t\t curwin->w_cursor.lnum = curwin->w_topline;\n\t\t}\n\t\telse if (curwin->w_topline == 1)\n\t\t curwin->w_cursor.lnum = 1;\n\t\telse\n\t\t curwin->w_cursor.lnum = curwin->w_topline - 1;\n\t\t// FALLTHROUGH\n case '-':\n\t\tbeginline(BL_WHITE | BL_FIX);\n\t\t// FALLTHROUGH",
" case 'b':\tscroll_cursor_bot(0, TRUE);\n\t\tredraw_later(VALID);\n\t\tset_fraction(curwin);\n\t\tbreak;",
"\t\t// \"zH\" - scroll screen right half-page\n case 'H':\n\t\tcap->count1 *= curwin->w_width / 2;\n\t\t// FALLTHROUGH",
"\t\t// \"zh\" - scroll screen to the right\n case 'h':\n case K_LEFT:\n\t\tif (!curwin->w_p_wrap)\n\t\t{\n\t\t if ((colnr_T)cap->count1 > curwin->w_leftcol)\n\t\t\tcurwin->w_leftcol = 0;\n\t\t else\n\t\t\tcurwin->w_leftcol -= (colnr_T)cap->count1;\n\t\t leftcol_changed();\n\t\t}\n\t\tbreak;",
"\t\t// \"zL\" - scroll screen left half-page\n case 'L':\tcap->count1 *= curwin->w_width / 2;\n\t\t// FALLTHROUGH",
"\t\t// \"zl\" - scroll screen to the left\n case 'l':\n case K_RIGHT:\n\t\tif (!curwin->w_p_wrap)\n\t\t{\n\t\t // scroll the window left\n\t\t curwin->w_leftcol += (colnr_T)cap->count1;\n\t\t leftcol_changed();\n\t\t}\n\t\tbreak;",
"\t\t// \"zs\" - scroll screen, cursor at the start\n case 's':\tif (!curwin->w_p_wrap)\n\t\t{\n#ifdef FEAT_FOLDING\n\t\t if (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t\tcol = 0;\t// like the cursor is in col 0\n\t\t else\n#endif\n\t\t getvcol(curwin, &curwin->w_cursor, &col, NULL, NULL);\n\t\t if ((long)col > siso)\n\t\t\tcol -= siso;\n\t\t else\n\t\t\tcol = 0;\n\t\t if (curwin->w_leftcol != col)\n\t\t {\n\t\t\tcurwin->w_leftcol = col;\n\t\t\tredraw_later(NOT_VALID);\n\t\t }\n\t\t}\n\t\tbreak;",
"\t\t// \"ze\" - scroll screen, cursor at the end\n case 'e':\tif (!curwin->w_p_wrap)\n\t\t{\n#ifdef FEAT_FOLDING\n\t\t if (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t\tcol = 0;\t// like the cursor is in col 0\n\t\t else\n#endif\n\t\t getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);\n\t\t n = curwin->w_width - curwin_col_off();\n\t\t if ((long)col + siso < n)\n\t\t\tcol = 0;\n\t\t else\n\t\t\tcol = col + siso - n + 1;\n\t\t if (curwin->w_leftcol != col)\n\t\t {\n\t\t\tcurwin->w_leftcol = col;\n\t\t\tredraw_later(NOT_VALID);\n\t\t }\n\t\t}\n\t\tbreak;",
"\t\t// \"zp\", \"zP\" in block mode put without addind trailing spaces\n case 'P':\n case 'p': nv_put(cap);\n\t break;\n\t\t// \"zy\" Yank without trailing spaces\n case 'y': nv_operator(cap);\n\t break;\n#ifdef FEAT_FOLDING\n\t\t// \"zF\": create fold command\n\t\t// \"zf\": create fold operator\n case 'F':\n case 'f': if (foldManualAllowed(TRUE))\n\t\t{\n\t\t cap->nchar = 'f';\n\t\t nv_operator(cap);\n\t\t curwin->w_p_fen = TRUE;",
"\t\t // \"zF\" is like \"zfzf\"\n\t\t if (nchar == 'F' && cap->oap->op_type == OP_FOLD)\n\t\t {\n\t\t\tnv_operator(cap);\n\t\t\tfinish_op = TRUE;\n\t\t }\n\t\t}\n\t\telse\n\t\t clearopbeep(cap->oap);\n\t\tbreak;",
"\t\t// \"zd\": delete fold at cursor\n\t\t// \"zD\": delete fold at cursor recursively\n case 'd':\n case 'D':\tif (foldManualAllowed(FALSE))\n\t\t{\n\t\t if (VIsual_active)\n\t\t\tnv_operator(cap);\n\t\t else\n\t\t\tdeleteFold(curwin->w_cursor.lnum,\n\t\t\t\t curwin->w_cursor.lnum, nchar == 'D', FALSE);\n\t\t}\n\t\tbreak;",
"\t\t// \"zE\": erase all folds\n case 'E':\tif (foldmethodIsManual(curwin))\n\t\t{\n\t\t clearFolding(curwin);\n\t\t changed_window_setting();\n\t\t}\n\t\telse if (foldmethodIsMarker(curwin))\n\t\t deleteFold((linenr_T)1, curbuf->b_ml.ml_line_count,\n\t\t\t\t\t\t\t\t TRUE, FALSE);\n\t\telse\n\t\t emsg(_(e_cannot_erase_folds_with_current_foldmethod));\n\t\tbreak;",
"\t\t// \"zn\": fold none: reset 'foldenable'\n case 'n':\tcurwin->w_p_fen = FALSE;\n\t\tbreak;",
"\t\t// \"zN\": fold Normal: set 'foldenable'\n case 'N':\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zi\": invert folding: toggle 'foldenable'\n case 'i':\tcurwin->w_p_fen = !curwin->w_p_fen;\n\t\tbreak;",
"\t\t// \"za\": open closed fold or close open fold at cursor\n case 'a':\tif (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t openFold(curwin->w_cursor.lnum, cap->count1);\n\t\telse\n\t\t{\n\t\t closeFold(curwin->w_cursor.lnum, cap->count1);\n\t\t curwin->w_p_fen = TRUE;\n\t\t}\n\t\tbreak;",
"\t\t// \"zA\": open fold at cursor recursively\n case 'A':\tif (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t openFoldRecurse(curwin->w_cursor.lnum);\n\t\telse\n\t\t{\n\t\t closeFoldRecurse(curwin->w_cursor.lnum);\n\t\t curwin->w_p_fen = TRUE;\n\t\t}\n\t\tbreak;",
"\t\t// \"zo\": open fold at cursor or Visual area\n case 'o':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t openFold(curwin->w_cursor.lnum, cap->count1);\n\t\tbreak;",
"\t\t// \"zO\": open fold recursively\n case 'O':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t openFoldRecurse(curwin->w_cursor.lnum);\n\t\tbreak;",
"\t\t// \"zc\": close fold at cursor or Visual area\n case 'c':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t closeFold(curwin->w_cursor.lnum, cap->count1);\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zC\": close fold recursively\n case 'C':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t closeFoldRecurse(curwin->w_cursor.lnum);\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zv\": open folds at the cursor\n case 'v':\tfoldOpenCursor();\n\t\tbreak;",
"\t\t// \"zx\": re-apply 'foldlevel' and open folds at the cursor\n case 'x':\tcurwin->w_p_fen = TRUE;\n\t\tcurwin->w_foldinvalid = TRUE;\t// recompute folds\n\t\tnewFoldLevel();\t\t\t// update right now\n\t\tfoldOpenCursor();\n\t\tbreak;",
"\t\t// \"zX\": undo manual opens/closes, re-apply 'foldlevel'\n case 'X':\tcurwin->w_p_fen = TRUE;\n\t\tcurwin->w_foldinvalid = TRUE;\t// recompute folds\n\t\told_fdl = -1;\t\t\t// force an update\n\t\tbreak;",
"\t\t// \"zm\": fold more\n case 'm':\tif (curwin->w_p_fdl > 0)\n\t\t{\n\t\t curwin->w_p_fdl -= cap->count1;\n\t\t if (curwin->w_p_fdl < 0)\n\t\t\tcurwin->w_p_fdl = 0;\n\t\t}\n\t\told_fdl = -1;\t\t// force an update\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zM\": close all folds\n case 'M':\tcurwin->w_p_fdl = 0;\n\t\told_fdl = -1;\t\t// force an update\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zr\": reduce folding\n case 'r':\tcurwin->w_p_fdl += cap->count1;\n\t\t{\n\t\t int d = getDeepestNesting();",
"\t\t if (curwin->w_p_fdl >= d)\n\t\t\tcurwin->w_p_fdl = d;\n\t\t}\n\t\tbreak;",
"\t\t// \"zR\": open all folds\n case 'R':\tcurwin->w_p_fdl = getDeepestNesting();\n\t\told_fdl = -1;\t\t// force an update\n\t\tbreak;",
" case 'j':\t// \"zj\" move to next fold downwards\n case 'k':\t// \"zk\" move to next fold upwards\n\t\tif (foldMoveTo(TRUE, nchar == 'j' ? FORWARD : BACKWARD,\n\t\t\t\t\t\t\t cap->count1) == FAIL)\n\t\t clearopbeep(cap->oap);\n\t\tbreak;",
"#endif // FEAT_FOLDING",
"#ifdef FEAT_SPELL\n case 'u':\t// \"zug\" and \"zuw\": undo \"zg\" and \"zw\"\n case 'g':\t// \"zg\": add good word to word list\n case 'w':\t// \"zw\": add wrong word to word list\n case 'G':\t// \"zG\": add good word to temp word list\n case 'W':\t// \"zW\": add wrong word to temp word list\n\t\tif (nv_zg_zw(cap, nchar) == FAIL)\n\t\t return;\n\t\tbreak;",
" case '=':\t// \"z=\": suggestions for a badly spelled word\n\t\tif (!checkclearop(cap->oap))\n\t\t spell_suggest((int)cap->count0);\n\t\tbreak;\n#endif",
" default:\tclearopbeep(cap->oap);\n }",
"#ifdef FEAT_FOLDING\n // Redraw when 'foldenable' changed\n if (old_fen != curwin->w_p_fen)\n {\n# ifdef FEAT_DIFF\n\twin_T\t *wp;",
"\tif (foldmethodIsDiff(curwin) && curwin->w_p_scb)\n\t{\n\t // Adjust 'foldenable' in diff-synced windows.\n\t FOR_ALL_WINDOWS(wp)\n\t {\n\t\tif (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb)\n\t\t{\n\t\t wp->w_p_fen = curwin->w_p_fen;\n\t\t changed_window_setting_win(wp);\n\t\t}\n\t }\n\t}\n# endif\n\tchanged_window_setting();\n }",
" // Redraw when 'foldlevel' changed.\n if (old_fdl != curwin->w_p_fdl)\n\tnewFoldLevel();\n#endif\n}",
"#ifdef FEAT_GUI\n/*\n * Vertical scrollbar movement.\n */\n static void\nnv_ver_scrollbar(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to scroll\n gui_do_scroll();\n}",
"/*\n * Horizontal scrollbar movement.\n */\n static void\nnv_hor_scrollbar(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to scroll\n gui_do_horiz_scroll(scrollbar_value, FALSE);\n}\n#endif",
"#if defined(FEAT_GUI_TABLINE) || defined(PROTO)\n/*\n * Click in GUI tab.\n */\n static void\nnv_tabline(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to jump tabs.\n goto_tabpage(current_tab);\n}",
"/*\n * Selected item in tab line menu.\n */\n static void\nnv_tabmenu(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to jump tabs.\n handle_tabmenu();\n}",
"/*\n * Handle selecting an item of the GUI tab line menu.\n * Used in Normal and Insert mode.\n */\n void\nhandle_tabmenu(void)\n{\n switch (current_tabmenu)\n {\n\tcase TABLINE_MENU_CLOSE:\n\t if (current_tab == 0)\n\t\tdo_cmdline_cmd((char_u *)\"tabclose\");\n\t else\n\t {\n\t\tvim_snprintf((char *)IObuff, IOSIZE, \"tabclose %d\",\n\t\t\t\t\t\t\t\t current_tab);\n\t\tdo_cmdline_cmd(IObuff);\n\t }\n\t break;",
"\tcase TABLINE_MENU_NEW:\n\t if (current_tab == 0)\n\t\tdo_cmdline_cmd((char_u *)\"$tabnew\");\n\t else\n\t {\n\t\tvim_snprintf((char *)IObuff, IOSIZE, \"%dtabnew\",\n\t\t\t\t\t\t\t current_tab - 1);\n\t\tdo_cmdline_cmd(IObuff);\n\t }\n\t break;",
"\tcase TABLINE_MENU_OPEN:\n\t if (current_tab == 0)\n\t\tdo_cmdline_cmd((char_u *)\"browse $tabnew\");\n\t else\n\t {\n\t\tvim_snprintf((char *)IObuff, IOSIZE, \"browse %dtabnew\",\n\t\t\t\t\t\t\t current_tab - 1);\n\t\tdo_cmdline_cmd(IObuff);\n\t }\n\t break;\n }\n}\n#endif",
"/*\n * \"Q\" command.\n */\n static void\nnv_exmode(cmdarg_T *cap)\n{\n // Ignore 'Q' in Visual mode, just give a beep.\n if (VIsual_active)\n\tvim_beep(BO_EX);\n else if (!checkclearop(cap->oap))\n\tdo_exmode(FALSE);\n}",
"/*\n * Handle a \":\" command.\n */\n static void\nnv_colon(cmdarg_T *cap)\n{\n int\told_p_im;\n int\tcmd_result;\n int\tis_cmdkey = cap->cmdchar == K_COMMAND\n\t\t\t\t\t || cap->cmdchar == K_SCRIPT_COMMAND;\n int\tflags;",
" if (VIsual_active && !is_cmdkey)\n\tnv_operator(cap);\n else\n {\n\tif (cap->oap->op_type != OP_NOP)\n\t{\n\t // Using \":\" as a movement is characterwise exclusive.\n\t cap->oap->motion_type = MCHAR;\n\t cap->oap->inclusive = FALSE;\n\t}\n\telse if (cap->count0 && !is_cmdkey)\n\t{\n\t // translate \"count:\" into \":.,.+(count - 1)\"\n\t stuffcharReadbuff('.');\n\t if (cap->count0 > 1)\n\t {\n\t\tstuffReadbuff((char_u *)\",.+\");\n\t\tstuffnumReadbuff((long)cap->count0 - 1L);\n\t }\n\t}",
"\t// When typing, don't type below an old message\n\tif (KeyTyped)\n\t compute_cmdrow();",
"\told_p_im = p_im;",
"\t// get a command line and execute it\n\tflags = cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0;\n\tif (is_cmdkey)\n\t cmd_result = do_cmdkey_command(cap->cmdchar, flags);\n\telse\n\t cmd_result = do_cmdline(NULL, getexline, NULL, flags);",
"\t// If 'insertmode' changed, enter or exit Insert mode\n\tif (p_im != old_p_im)\n\t{\n\t if (p_im)\n\t\trestart_edit = 'i';\n\t else\n\t\trestart_edit = 0;\n\t}",
"\tif (cmd_result == FAIL)\n\t // The Ex command failed, do not execute the operator.\n\t clearop(cap->oap);\n\telse if (cap->oap->op_type != OP_NOP\n\t\t&& (cap->oap->start.lnum > curbuf->b_ml.ml_line_count\n\t\t || cap->oap->start.col >\n\t\t\t (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))\n\t\t || did_emsg\n\t\t ))\n\t // The start of the operator has become invalid by the Ex command.\n\t clearopbeep(cap->oap);\n }\n}",
"/*\n * Handle CTRL-G command.\n */\n static void\nnv_ctrlg(cmdarg_T *cap)\n{\n if (VIsual_active)\t// toggle Selection/Visual mode\n {\n\tVIsual_select = !VIsual_select;\n\tmay_trigger_modechanged();\n\tshowmode();\n }\n else if (!checkclearop(cap->oap))\n\t// print full name if count given or :cd used\n\tfileinfo((int)cap->count0, FALSE, TRUE);\n}",
"/*\n * Handle CTRL-H <Backspace> command.\n */\n static void\nnv_ctrlh(cmdarg_T *cap)\n{\n if (VIsual_active && VIsual_select)\n {\n\tcap->cmdchar = 'x';\t// BS key behaves like 'x' in Select mode\n\tv_visop(cap);\n }\n else\n\tnv_left(cap);\n}",
"/*\n * CTRL-L: clear screen and redraw.\n */\n static void\nnv_clear(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n {\n#ifdef FEAT_SYN_HL\n\t// Clear all syntax states to force resyncing.\n\tsyn_stack_free_all(curwin->w_s);\n# ifdef FEAT_RELTIME\n\t{\n\t win_T *wp;",
"\t FOR_ALL_WINDOWS(wp)\n\t\twp->w_s->b_syn_slow = FALSE;\n\t}\n# endif\n#endif\n\tredraw_later(CLEAR);\n#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))\n# ifdef VIMDLL\n\tif (!gui.in_use)\n# endif\n\t resize_console_buf();\n#endif\n }\n}",
"/*\n * CTRL-O: In Select mode: switch to Visual mode for one command.\n * Otherwise: Go to older pcmark.\n */\n static void\nnv_ctrlo(cmdarg_T *cap)\n{\n if (VIsual_active && VIsual_select)\n {\n\tVIsual_select = FALSE;\n\tmay_trigger_modechanged();\n\tshowmode();\n\trestart_VIsual_select = 2;\t// restart Select mode later\n }\n else\n {\n\tcap->count1 = -cap->count1;\n\tnv_pcmark(cap);\n }\n}",
"/*\n * CTRL-^ command, short for \":e #\". Works even when the alternate buffer is\n * not named.\n */\n static void\nnv_hat(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n\t(void)buflist_getfile((int)cap->count0, (linenr_T)0,\n\t\t\t\t\t\tGETF_SETMARK|GETF_ALT, FALSE);\n}",
"/*\n * \"Z\" commands.\n */\n static void\nnv_Zet(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n {\n\tswitch (cap->nchar)\n\t{\n\t\t\t// \"ZZ\": equivalent to \":x\".\n\t case 'Z':\tdo_cmdline_cmd((char_u *)\"x\");\n\t\t\tbreak;",
"\t\t\t// \"ZQ\": equivalent to \":q!\" (Elvis compatible).\n\t case 'Q':\tdo_cmdline_cmd((char_u *)\"q!\");\n\t\t\tbreak;",
"\t default:\tclearopbeep(cap->oap);\n\t}\n }\n}",
"/*\n * Call nv_ident() as if \"c1\" was used, with \"c2\" as next character.\n */\n void\ndo_nv_ident(int c1, int c2)\n{\n oparg_T\toa;\n cmdarg_T\tca;",
" clear_oparg(&oa);\n CLEAR_FIELD(ca);\n ca.oap = &oa;\n ca.cmdchar = c1;\n ca.nchar = c2;\n nv_ident(&ca);\n}",
"/*\n * 'K' normal-mode command. Get the command to lookup the keyword under the\n * cursor.\n */\n static int\nnv_K_getcmd(\n\tcmdarg_T\t*cap,\n\tchar_u\t\t*kp,\n\tint\t\tkp_help,\n\tint\t\tkp_ex,\n\tchar_u\t\t**ptr_arg,\n\tint\t\tn,\n\tchar_u\t\t*buf,\n\tunsigned\tbuflen)\n{\n char_u\t*ptr = *ptr_arg;\n int\t\tisman;\n int\t\tisman_s;",
" if (kp_help)\n {\n\t// in the help buffer\n\tSTRCPY(buf, \"he! \");\n\treturn n;\n }",
" if (kp_ex)\n {\n\t// 'keywordprog' is an ex command\n\tif (cap->count0 != 0)\n\t vim_snprintf((char *)buf, buflen, \"%s %ld\", kp, cap->count0);\n\telse\n\t STRCPY(buf, kp);\n\tSTRCAT(buf, \" \");\n\treturn n;\n }",
" // An external command will probably use an argument starting\n // with \"-\" as an option. To avoid trouble we skip the \"-\".\n while (*ptr == '-' && n > 0)\n {\n\t++ptr;\n\t--n;\n }\n if (n == 0)\n {\n\t// found dashes only\n\temsg(_(e_no_identifier_under_cursor));\n\tvim_free(buf);\n\t*ptr_arg = ptr;\n\treturn 0;\n }",
" // When a count is given, turn it into a range. Is this\n // really what we want?\n isman = (STRCMP(kp, \"man\") == 0);\n isman_s = (STRCMP(kp, \"man -s\") == 0);\n if (cap->count0 != 0 && !(isman || isman_s))\n\tsprintf((char *)buf, \".,.+%ld\", cap->count0 - 1);",
" STRCAT(buf, \"! \");\n if (cap->count0 == 0 && isman_s)\n\tSTRCAT(buf, \"man\");\n else\n\tSTRCAT(buf, kp);\n STRCAT(buf, \" \");\n if (cap->count0 != 0 && (isman || isman_s))\n {\n\tsprintf((char *)buf + STRLEN(buf), \"%ld\", cap->count0);\n\tSTRCAT(buf, \" \");\n }",
" *ptr_arg = ptr;\n return n;\n}",
"/*\n * Handle the commands that use the word under the cursor.\n * [g] CTRL-]\t:ta to current identifier\n * [g] 'K'\trun program for current identifier\n * [g] '*'\t/ to current identifier or string\n * [g] '#'\t? to current identifier or string\n * g ']'\t:tselect for current identifier\n */\n static void\nnv_ident(cmdarg_T *cap)\n{\n char_u\t*ptr = NULL;\n char_u\t*buf;\n unsigned\tbuflen;\n char_u\t*newbuf;\n char_u\t*p;\n char_u\t*kp;\t\t// value of 'keywordprg'\n int\t\tkp_help;\t// 'keywordprg' is \":he\"\n int\t\tkp_ex;\t\t// 'keywordprg' starts with \":\"\n int\t\tn = 0;\t\t// init for GCC\n int\t\tcmdchar;\n int\t\tg_cmd;\t\t// \"g\" command\n int\t\ttag_cmd = FALSE;\n char_u\t*aux_ptr;",
" if (cap->cmdchar == 'g')\t// \"g*\", \"g#\", \"g]\" and \"gCTRL-]\"\n {\n\tcmdchar = cap->nchar;\n\tg_cmd = TRUE;\n }\n else\n {\n\tcmdchar = cap->cmdchar;\n\tg_cmd = FALSE;\n }",
" if (cmdchar == POUND)\t// the pound sign, '#' for English keyboards\n\tcmdchar = '#';",
" // The \"]\", \"CTRL-]\" and \"K\" commands accept an argument in Visual mode.\n if (cmdchar == ']' || cmdchar == Ctrl_RSB || cmdchar == 'K')\n {\n\tif (VIsual_active && get_visual_text(cap, &ptr, &n) == FAIL)\n\t return;\n\tif (checkclearopq(cap->oap))\n\t return;\n }",
" if (ptr == NULL && (n = find_ident_under_cursor(&ptr,\n\t\t (cmdchar == '*' || cmdchar == '#')\n\t\t\t\t ? FIND_IDENT|FIND_STRING : FIND_IDENT)) == 0)\n {\n\tclearop(cap->oap);\n\treturn;\n }",
" // Allocate buffer to put the command in. Inserting backslashes can\n // double the length of the word. p_kp / curbuf->b_p_kp could be added\n // and some numbers.\n kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);\n kp_help = (*kp == NUL || STRCMP(kp, \":he\") == 0\n\t\t\t\t\t\t || STRCMP(kp, \":help\") == 0);\n if (kp_help && *skipwhite(ptr) == NUL)\n {\n\temsg(_(e_no_identifier_under_cursor));\t // found white space only\n\treturn;\n }\n kp_ex = (*kp == ':');\n buflen = (unsigned)(n * 2 + 30 + STRLEN(kp));\n buf = alloc(buflen);\n if (buf == NULL)\n\treturn;\n buf[0] = NUL;",
" switch (cmdchar)\n {\n\tcase '*':\n\tcase '#':\n\t // Put cursor at start of word, makes search skip the word\n\t // under the cursor.\n\t // Call setpcmark() first, so \"*``\" puts the cursor back where\n\t // it was.\n\t setpcmark();\n\t curwin->w_cursor.col = (colnr_T) (ptr - ml_get_curline());",
"\t if (!g_cmd && vim_iswordp(ptr))\n\t\tSTRCPY(buf, \"\\\\<\");\n\t no_smartcase = TRUE;\t// don't use 'smartcase' now\n\t break;",
"\tcase 'K':\n\t n = nv_K_getcmd(cap, kp, kp_help, kp_ex, &ptr, n, buf, buflen);\n\t if (n == 0)\n\t\treturn;\n\t break;",
"\tcase ']':\n\t tag_cmd = TRUE;\n#ifdef FEAT_CSCOPE\n\t if (p_cst)\n\t\tSTRCPY(buf, \"cstag \");\n\t else\n#endif\n\t\tSTRCPY(buf, \"ts \");\n\t break;",
"\tdefault:\n\t tag_cmd = TRUE;\n\t if (curbuf->b_help)\n\t\tSTRCPY(buf, \"he! \");\n\t else\n\t {\n\t\tif (g_cmd)\n\t\t STRCPY(buf, \"tj \");\n\t\telse if (cap->count0 == 0)\n\t\t STRCPY(buf, \"ta \");\n\t\telse\n\t\t sprintf((char *)buf, \":%ldta \", cap->count0);\n\t }\n }",
" // Now grab the chars in the identifier\n if (cmdchar == 'K' && !kp_help)\n {\n\tptr = vim_strnsave(ptr, n);\n\tif (kp_ex)\n\t // Escape the argument properly for an Ex command\n\t p = vim_strsave_fnameescape(ptr, VSE_NONE);\n\telse\n\t // Escape the argument properly for a shell command\n\t p = vim_strsave_shellescape(ptr, TRUE, TRUE);\n\tvim_free(ptr);\n\tif (p == NULL)\n\t{\n\t vim_free(buf);\n\t return;\n\t}\n\tnewbuf = vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);\n\tif (newbuf == NULL)\n\t{\n\t vim_free(buf);\n\t vim_free(p);\n\t return;\n\t}\n\tbuf = newbuf;\n\tSTRCAT(buf, p);\n\tvim_free(p);\n }\n else\n {\n\tif (cmdchar == '*')\n\t aux_ptr = (char_u *)(magic_isset() ? \"/.*~[^$\\\\\" : \"/^$\\\\\");\n\telse if (cmdchar == '#')\n\t aux_ptr = (char_u *)(magic_isset() ? \"/?.*~[^$\\\\\" : \"/?^$\\\\\");\n\telse if (tag_cmd)\n\t{\n\t if (curbuf->b_help)\n\t\t// \":help\" handles unescaped argument\n\t\taux_ptr = (char_u *)\"\";\n\t else\n\t\taux_ptr = (char_u *)\"\\\\|\\\"\\n[\";\n\t}\n\telse\n\t aux_ptr = (char_u *)\"\\\\|\\\"\\n*?[\";",
"\tp = buf + STRLEN(buf);\n\twhile (n-- > 0)\n\t{\n\t // put a backslash before \\ and some others\n\t if (vim_strchr(aux_ptr, *ptr) != NULL)\n\t\t*p++ = '\\\\';\n\t // When current byte is a part of multibyte character, copy all\n\t // bytes of that character.\n\t if (has_mbyte)\n\t {\n\t\tint i;\n\t\tint len = (*mb_ptr2len)(ptr) - 1;",
"\t\tfor (i = 0; i < len && n >= 1; ++i, --n)\n\t\t *p++ = *ptr++;\n\t }\n\t *p++ = *ptr++;\n\t}\n\t*p = NUL;\n }",
" // Execute the command.\n if (cmdchar == '*' || cmdchar == '#')\n {\n\tif (!g_cmd && (has_mbyte\n\t\t ? vim_iswordp(mb_prevptr(ml_get_curline(), ptr))\n\t\t : vim_iswordc(ptr[-1])))\n\t STRCAT(buf, \"\\\\>\");",
"\t// put pattern in search history\n\tinit_history();\n\tadd_to_history(HIST_SEARCH, buf, TRUE, NUL);",
"\t(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0, NULL);\n }\n else\n {\n\tg_tag_at_cursor = TRUE;\n\tdo_cmdline_cmd(buf);\n\tg_tag_at_cursor = FALSE;\n }",
" vim_free(buf);\n}",
"/*\n * Get visually selected text, within one line only.\n * Returns FAIL if more than one line selected.\n */\n int\nget_visual_text(\n cmdarg_T\t*cap,\n char_u\t**pp,\t // return: start of selected text\n int\t\t*lenp)\t // return: length of selected text\n{\n if (VIsual_mode != 'V')\n\tunadjust_for_sel();\n if (VIsual.lnum != curwin->w_cursor.lnum)\n {\n\tif (cap != NULL)\n\t clearopbeep(cap->oap);\n\treturn FAIL;\n }\n if (VIsual_mode == 'V')\n {\n\t*pp = ml_get_curline();\n\t*lenp = (int)STRLEN(*pp);\n }\n else\n {\n\tif (LT_POS(curwin->w_cursor, VIsual))\n\t{\n\t *pp = ml_get_pos(&curwin->w_cursor);\n\t *lenp = VIsual.col - curwin->w_cursor.col + 1;\n\t}\n\telse\n\t{\n\t *pp = ml_get_pos(&VIsual);\n\t *lenp = curwin->w_cursor.col - VIsual.col + 1;\n\t}\n\tif (**pp == NUL)\n\t *lenp = 0;\n\tif (*lenp > 0)\n\t{\n\t if (has_mbyte)\n\t\t// Correct the length to include all bytes of the last\n\t\t// character.\n\t\t*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;\n\t else if ((*pp)[*lenp - 1] == NUL)\n\t\t// Do not include a trailing NUL.\n\t\t*lenp -= 1;\n\t}\n }\n reset_VIsual_and_resel();\n return OK;\n}",
"/*\n * CTRL-T: backwards in tag stack\n */\n static void\nnv_tagpop(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n\tdo_tag((char_u *)\"\", DT_POP, (int)cap->count1, FALSE, TRUE);\n}",
"/*\n * Handle scrolling command 'H', 'L' and 'M'.\n */\n static void\nnv_scroll(cmdarg_T *cap)\n{\n int\t\tused = 0;\n long\tn;\n#ifdef FEAT_FOLDING\n linenr_T\tlnum;\n#endif\n int\t\thalf;",
" cap->oap->motion_type = MLINE;\n setpcmark();",
" if (cap->cmdchar == 'L')\n {\n\tvalidate_botline();\t // make sure curwin->w_botline is valid\n\tcurwin->w_cursor.lnum = curwin->w_botline - 1;\n\tif (cap->count1 - 1 >= curwin->w_cursor.lnum)\n\t curwin->w_cursor.lnum = 1;\n\telse\n\t{\n#ifdef FEAT_FOLDING\n\t if (hasAnyFolding(curwin))\n\t {\n\t\t// Count a fold for one screen line.\n\t\tfor (n = cap->count1 - 1; n > 0\n\t\t\t && curwin->w_cursor.lnum > curwin->w_topline; --n)\n\t\t{\n\t\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\t&curwin->w_cursor.lnum, NULL);\n\t\t --curwin->w_cursor.lnum;\n\t\t}\n\t }\n\t else\n#endif\n\t\tcurwin->w_cursor.lnum -= cap->count1 - 1;\n\t}\n }\n else\n {\n\tif (cap->cmdchar == 'M')\n\t{\n#ifdef FEAT_DIFF\n\t // Don't count filler lines above the window.\n\t used -= diff_check_fill(curwin, curwin->w_topline)\n\t\t\t\t\t\t\t - curwin->w_topfill;\n#endif\n\t validate_botline();\t // make sure w_empty_rows is valid\n\t half = (curwin->w_height - curwin->w_empty_rows + 1) / 2;\n\t for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; ++n)\n\t {\n#ifdef FEAT_DIFF\n\t\t// Count half he number of filler lines to be \"below this\n\t\t// line\" and half to be \"above the next line\".\n\t\tif (n > 0 && used + diff_check_fill(curwin, curwin->w_topline\n\t\t\t\t\t\t\t + n) / 2 >= half)\n\t\t{\n\t\t --n;\n\t\t break;\n\t\t}\n#endif\n\t\tused += plines(curwin->w_topline + n);\n\t\tif (used >= half)\n\t\t break;\n#ifdef FEAT_FOLDING\n\t\tif (hasFolding(curwin->w_topline + n, NULL, &lnum))\n\t\t n = lnum - curwin->w_topline;\n#endif\n\t }\n\t if (n > 0 && used > curwin->w_height)\n\t\t--n;\n\t}\n\telse // (cap->cmdchar == 'H')\n\t{\n\t n = cap->count1 - 1;\n#ifdef FEAT_FOLDING\n\t if (hasAnyFolding(curwin))\n\t {\n\t\t// Count a fold for one screen line.\n\t\tlnum = curwin->w_topline;\n\t\twhile (n-- > 0 && lnum < curwin->w_botline - 1)\n\t\t{\n\t\t (void)hasFolding(lnum, NULL, &lnum);\n\t\t ++lnum;\n\t\t}\n\t\tn = lnum - curwin->w_topline;\n\t }\n#endif\n\t}\n\tcurwin->w_cursor.lnum = curwin->w_topline + n;\n\tif (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n }",
" // Correct for 'so', except when an operator is pending.\n if (cap->oap->op_type == OP_NOP)\n\tcursor_correct();\n beginline(BL_SOL | BL_FIX);\n}",
"/*\n * Cursor right commands.\n */\n static void\nnv_right(cmdarg_T *cap)\n{\n long\tn;\n int\t\tpast_line;",
" if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))\n {\n\t// <C-Right> and <S-Right> move a word or WORD right\n\tif (mod_mask & MOD_MASK_CTRL)\n\t cap->arg = TRUE;\n\tnv_wordcmd(cap);\n\treturn;\n }",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n past_line = (VIsual_active && *p_sel != 'o');",
" // In virtual edit mode, there's no such thing as \"past_line\", as lines\n // are (theoretically) infinitely long.\n if (virtual_active())\n\tpast_line = 0;",
" for (n = cap->count1; n > 0; --n)\n {\n\tif ((!past_line && oneright() == FAIL)\n\t\t|| (past_line && *ml_get_cursor() == NUL)\n\t\t)\n\t{\n\t //\t <Space> wraps to next line if 'whichwrap' has 's'.\n\t //\t 'l' wraps to next line if 'whichwrap' has 'l'.\n\t // CURS_RIGHT wraps to next line if 'whichwrap' has '>'.\n\t if ( ((cap->cmdchar == ' '\n\t\t\t && vim_strchr(p_ww, 's') != NULL)\n\t\t\t|| (cap->cmdchar == 'l'\n\t\t\t && vim_strchr(p_ww, 'l') != NULL)\n\t\t\t|| (cap->cmdchar == K_RIGHT\n\t\t\t && vim_strchr(p_ww, '>') != NULL))\n\t\t && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)\n\t {\n\t\t// When deleting we also count the NL as a character.\n\t\t// Set cap->oap->inclusive when last char in the line is\n\t\t// included, move to next line after that\n\t\tif (\t cap->oap->op_type != OP_NOP\n\t\t\t&& !cap->oap->inclusive\n\t\t\t&& !LINEEMPTY(curwin->w_cursor.lnum))\n\t\t cap->oap->inclusive = TRUE;\n\t\telse\n\t\t{\n\t\t ++curwin->w_cursor.lnum;\n\t\t curwin->w_cursor.col = 0;\n\t\t curwin->w_cursor.coladd = 0;\n\t\t curwin->w_set_curswant = TRUE;\n\t\t cap->oap->inclusive = FALSE;\n\t\t}\n\t\tcontinue;\n\t }\n\t if (cap->oap->op_type == OP_NOP)\n\t {\n\t\t// Only beep and flush if not moved at all\n\t\tif (n == cap->count1)\n\t\t beep_flush();\n\t }\n\t else\n\t {\n\t\tif (!LINEEMPTY(curwin->w_cursor.lnum))\n\t\t cap->oap->inclusive = TRUE;\n\t }\n\t break;\n\t}\n\telse if (past_line)\n\t{\n\t curwin->w_set_curswant = TRUE;\n\t if (virtual_active())\n\t\toneright();\n\t else\n\t {\n\t\tif (has_mbyte)\n\t\t curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());\n\t\telse\n\t\t ++curwin->w_cursor.col;\n\t }\n\t}\n }\n#ifdef FEAT_FOLDING\n if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped\n\t\t\t\t\t && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Cursor left commands.\n *\n * Returns TRUE when operator end should not be adjusted.\n */\n static void\nnv_left(cmdarg_T *cap)\n{\n long\tn;",
" if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))\n {\n\t// <C-Left> and <S-Left> move a word or WORD left\n\tif (mod_mask & MOD_MASK_CTRL)\n\t cap->arg = 1;\n\tnv_bck_word(cap);\n\treturn;\n }",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n for (n = cap->count1; n > 0; --n)\n {\n\tif (oneleft() == FAIL)\n\t{\n\t // <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'.\n\t //\t\t 'h' wraps to previous line if 'whichwrap' has 'h'.\n\t //\t CURS_LEFT wraps to previous line if 'whichwrap' has '<'.\n\t if ( (((cap->cmdchar == K_BS\n\t\t\t\t|| cap->cmdchar == Ctrl_H)\n\t\t\t && vim_strchr(p_ww, 'b') != NULL)\n\t\t\t|| (cap->cmdchar == 'h'\n\t\t\t && vim_strchr(p_ww, 'h') != NULL)\n\t\t\t|| (cap->cmdchar == K_LEFT\n\t\t\t && vim_strchr(p_ww, '<') != NULL))\n\t\t && curwin->w_cursor.lnum > 1)\n\t {\n\t\t--(curwin->w_cursor.lnum);\n\t\tcoladvance((colnr_T)MAXCOL);\n\t\tcurwin->w_set_curswant = TRUE;",
"\t\t// When the NL before the first char has to be deleted we\n\t\t// put the cursor on the NUL after the previous line.\n\t\t// This is a very special case, be careful!\n\t\t// Don't adjust op_end now, otherwise it won't work.\n\t\tif (\t (cap->oap->op_type == OP_DELETE\n\t\t\t || cap->oap->op_type == OP_CHANGE)\n\t\t\t&& !LINEEMPTY(curwin->w_cursor.lnum))\n\t\t{\n\t\t char_u *cp = ml_get_cursor();",
"\t\t if (*cp != NUL)\n\t\t {\n\t\t\tif (has_mbyte)\n\t\t\t curwin->w_cursor.col += (*mb_ptr2len)(cp);\n\t\t\telse\n\t\t\t ++curwin->w_cursor.col;\n\t\t }\n\t\t cap->retval |= CA_NO_ADJ_OP_END;\n\t\t}\n\t\tcontinue;\n\t }\n\t // Only beep and flush if not moved at all\n\t else if (cap->oap->op_type == OP_NOP && n == cap->count1)\n\t\tbeep_flush();\n\t break;\n\t}\n }\n#ifdef FEAT_FOLDING\n if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped\n\t\t\t\t\t && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Cursor up commands.\n * cap->arg is TRUE for \"-\": Move cursor to first non-blank.\n */\n static void\nnv_up(cmdarg_T *cap)\n{\n if (mod_mask & MOD_MASK_SHIFT)\n {\n\t// <S-Up> is page up\n\tcap->arg = BACKWARD;\n\tnv_page(cap);\n }\n else\n {\n\tcap->oap->motion_type = MLINE;\n\tif (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL)\n\t clearopbeep(cap->oap);\n\telse if (cap->arg)\n\t beginline(BL_WHITE | BL_FIX);\n }\n}",
"/*\n * Cursor down commands.\n * cap->arg is TRUE for CR and \"+\": Move cursor to first non-blank.\n */\n static void\nnv_down(cmdarg_T *cap)\n{\n if (mod_mask & MOD_MASK_SHIFT)\n {\n\t// <S-Down> is page down\n\tcap->arg = FORWARD;\n\tnv_page(cap);\n }\n#if defined(FEAT_QUICKFIX)\n // Quickfix window only: view the result under the cursor.\n else if (bt_quickfix(curbuf) && cap->cmdchar == CAR)\n\tqf_view_result(FALSE);\n#endif\n else\n {\n#ifdef FEAT_CMDWIN\n\t// In the cmdline window a <CR> executes the command.\n\tif (cmdwin_type != 0 && cap->cmdchar == CAR)\n\t cmdwin_result = CAR;\n\telse\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t// In a prompt buffer a <CR> in the last line invokes the callback.\n\tif (bt_prompt(curbuf) && cap->cmdchar == CAR\n\t\t && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)\n\t{\n\t invoke_prompt_callback();\n\t if (restart_edit == 0)\n\t\trestart_edit = 'a';\n\t}\n\telse\n#endif\n\t{\n\t cap->oap->motion_type = MLINE;\n\t if (cursor_down(cap->count1, cap->oap->op_type == OP_NOP) == FAIL)\n\t\tclearopbeep(cap->oap);\n\t else if (cap->arg)\n\t\tbeginline(BL_WHITE | BL_FIX);\n\t}\n }\n}",
"#ifdef FEAT_SEARCHPATH\n/*\n * Grab the file name under the cursor and edit it.\n */\n static void\nnv_gotofile(cmdarg_T *cap)\n{\n char_u\t*ptr;\n linenr_T\tlnum = -1;",
" if (check_text_locked(cap->oap))\n\treturn;\n if (curbuf_locked())\n {\n\tclearop(cap->oap);\n\treturn;\n }\n#ifdef FEAT_PROP_POPUP\n if (ERROR_IF_TERM_POPUP_WINDOW)\n\treturn;\n#endif",
" ptr = grab_file_name(cap->count1, &lnum);",
" if (ptr != NULL)\n {\n\t// do autowrite if necessary\n\tif (curbufIsChanged() && curbuf->b_nwindows <= 1 && !buf_hide(curbuf))\n\t (void)autowrite(curbuf, FALSE);\n\tsetpcmark();\n\tif (do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,\n\t\t\t\tbuf_hide(curbuf) ? ECMD_HIDE : 0, curwin) == OK\n\t\t&& cap->nchar == 'F' && lnum >= 0)\n\t{\n\t curwin->w_cursor.lnum = lnum;\n\t check_cursor_lnum();\n\t beginline(BL_SOL | BL_FIX);\n\t}\n\tvim_free(ptr);\n }\n else\n\tclearop(cap->oap);\n}\n#endif",
"/*\n * <End> command: to end of current line or last line.\n */\n static void\nnv_end(cmdarg_T *cap)\n{\n if (cap->arg || (mod_mask & MOD_MASK_CTRL))\t// CTRL-END = goto last line\n {\n\tcap->arg = TRUE;\n\tnv_goto(cap);\n\tcap->count1 = 1;\t\t// to end of current line\n }\n nv_dollar(cap);\n}",
"/*\n * Handle the \"$\" command.\n */\n static void\nnv_dollar(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = TRUE;\n // In virtual mode when off the edge of a line and an operator\n // is pending (whew!) keep the cursor where it is.\n // Otherwise, send it to the end of the line.\n if (!virtual_active() || gchar_cursor() != NUL\n\t\t\t\t\t || cap->oap->op_type == OP_NOP)\n\tcurwin->w_curswant = MAXCOL;\t// so we stay at the end\n if (cursor_down((long)(cap->count1 - 1),\n\t\t\t\t\t cap->oap->op_type == OP_NOP) == FAIL)\n\tclearopbeep(cap->oap);\n#ifdef FEAT_FOLDING\n else if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Implementation of '?' and '/' commands.\n * If cap->arg is TRUE don't set PC mark.\n */\n static void\nnv_search(cmdarg_T *cap)\n{\n oparg_T\t*oap = cap->oap;\n pos_T\tsave_cursor = curwin->w_cursor;",
" if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13)\n {\n\t// Translate \"g??\" to \"g?g?\"\n\tcap->cmdchar = 'g';\n\tcap->nchar = '?';\n\tnv_operator(cap);\n\treturn;\n }",
" // When using 'incsearch' the cursor may be moved to set a different search\n // start position.\n cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, 0);",
" if (cap->searchbuf == NULL)\n {\n\tclearop(oap);\n\treturn;\n }",
" (void)normal_search(cap, cap->cmdchar, cap->searchbuf,\n\t\t\t(cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))\n\t\t\t\t\t\t ? 0 : SEARCH_MARK, NULL);\n}",
"\n/*\n * Handle \"N\" and \"n\" commands.\n * cap->arg is SEARCH_REV for \"N\", 0 for \"n\".\n */\n static void\nnv_next(cmdarg_T *cap)\n{\n pos_T old = curwin->w_cursor;\n int\t wrapped = FALSE;\n int\t i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, &wrapped);",
" if (i == 1 && !wrapped && EQUAL_POS(old, curwin->w_cursor))\n {\n\t// Avoid getting stuck on the current cursor position, which can\n\t// happen when an offset is given and the cursor is on the last char\n\t// in the buffer: Repeat with count + 1.\n\tcap->count1 += 1;\n\t(void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL);\n\tcap->count1 -= 1;\n }",
"#ifdef FEAT_SEARCH_EXTRA\n // Redraw the window to refresh the highlighted matches.\n if (i > 0 && p_hls && !no_hlsearch)\n\tredraw_later(SOME_VALID);\n#endif\n}",
"/*\n * Search for \"pat\" in direction \"dir\" ('/' or '?', 0 for repeat).\n * Uses only cap->count1 and cap->oap from \"cap\".\n * Return 0 for failure, 1 for found, 2 for found and line offset added.\n */\n static int\nnormal_search(\n cmdarg_T\t*cap,\n int\t\tdir,\n char_u\t*pat,\n int\t\topt,\t\t// extra flags for do_search()\n int\t\t*wrapped)\n{\n int\t\ti;\n searchit_arg_T sia;\n#ifdef FEAT_SEARCH_EXTRA\n pos_T\tprev_cursor = curwin->w_cursor;\n#endif",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n cap->oap->use_reg_one = TRUE;\n curwin->w_set_curswant = TRUE;",
" CLEAR_FIELD(sia);\n i = do_search(cap->oap, dir, dir, pat, cap->count1,\n\t\t\t opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);\n if (wrapped != NULL)\n\t*wrapped = sia.sa_wrapped;\n if (i == 0)\n\tclearop(cap->oap);\n else\n {\n\tif (i == 2)\n\t cap->oap->motion_type = MLINE;\n\tcurwin->w_cursor.coladd = 0;\n#ifdef FEAT_FOLDING\n\tif (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)\n\t foldOpenCursor();\n#endif\n }\n#ifdef FEAT_SEARCH_EXTRA\n // Redraw the window to refresh the highlighted matches.\n if (!EQUAL_POS(curwin->w_cursor, prev_cursor) && p_hls && !no_hlsearch)\n\tredraw_later(SOME_VALID);\n#endif",
" // \"/$\" will put the cursor after the end of the line, may need to\n // correct that here\n check_cursor();\n return i;\n}",
"/*\n * Character search commands.\n * cap->arg is BACKWARD for 'F' and 'T', FORWARD for 'f' and 't', TRUE for\n * ',' and FALSE for ';'.\n * cap->nchar is NUL for ',' and ';' (repeat the search)\n */\n static void\nnv_csearch(cmdarg_T *cap)\n{\n int\t\tt_cmd;",
" if (cap->cmdchar == 't' || cap->cmdchar == 'T')\n\tt_cmd = TRUE;\n else\n\tt_cmd = FALSE;",
" cap->oap->motion_type = MCHAR;\n if (IS_SPECIAL(cap->nchar) || searchc(cap, t_cmd) == FAIL)\n\tclearopbeep(cap->oap);\n else\n {\n\tcurwin->w_set_curswant = TRUE;\n\t// Include a Tab for \"tx\" and for \"dfx\".\n\tif (gchar_cursor() == TAB && virtual_active() && cap->arg == FORWARD\n\t\t&& (t_cmd || cap->oap->op_type != OP_NOP))\n\t{\n\t colnr_T\tscol, ecol;",
"\t getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);\n\t curwin->w_cursor.coladd = ecol - scol;\n\t}\n\telse\n\t curwin->w_cursor.coladd = 0;\n\tadjust_for_sel(cap);\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"[{\", \"[(\", \"]}\" or \"])\": go to Nth unclosed '{', '(', '}' or ')'\n * \"[#\", \"]#\": go to start/end of Nth innermost #if..#endif construct.\n * \"[/\", \"[*\", \"]/\", \"]*\": go to Nth comment start/end.\n * \"[m\" or \"]m\" search for prev/next start of (Java) method.\n * \"[M\" or \"]M\" search for prev/next end of (Java) method.\n */\n static void\nnv_bracket_block(cmdarg_T *cap, pos_T *old_pos)\n{\n pos_T\tnew_pos = {0, 0, 0};\n pos_T\t*pos = NULL;\t // init for GCC\n pos_T\tprev_pos;\n long\tn;\n int\t\tfindc;\n int\t\tc;",
" if (cap->nchar == '*')\n\tcap->nchar = '/';\n prev_pos.lnum = 0;\n if (cap->nchar == 'm' || cap->nchar == 'M')\n {\n\tif (cap->cmdchar == '[')\n\t findc = '{';\n\telse\n\t findc = '}';\n\tn = 9999;\n }\n else\n {\n\tfindc = cap->nchar;\n\tn = cap->count1;\n }\n for ( ; n > 0; --n)\n {\n\tif ((pos = findmatchlimit(cap->oap, findc,\n\t\t\t(cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD, 0)) == NULL)\n\t{\n\t if (new_pos.lnum == 0)\t// nothing found\n\t {\n\t\tif (cap->nchar != 'm' && cap->nchar != 'M')\n\t\t clearopbeep(cap->oap);\n\t }\n\t else\n\t\tpos = &new_pos;\t// use last one found\n\t break;\n\t}\n\tprev_pos = new_pos;\n\tcurwin->w_cursor = *pos;\n\tnew_pos = *pos;\n }\n curwin->w_cursor = *old_pos;",
" // Handle \"[m\", \"]m\", \"[M\" and \"[M\". The findmatchlimit() only\n // brought us to the match for \"[m\" and \"]M\" when inside a method.\n // Try finding the '{' or '}' we want to be at.\n // Also repeat for the given count.\n if (cap->nchar == 'm' || cap->nchar == 'M')\n {\n\t// norm is TRUE for \"]M\" and \"[m\"\n\tint\t norm = ((findc == '{') == (cap->nchar == 'm'));",
"\tn = cap->count1;\n\t// found a match: we were inside a method\n\tif (prev_pos.lnum != 0)\n\t{\n\t pos = &prev_pos;\n\t curwin->w_cursor = prev_pos;\n\t if (norm)\n\t\t--n;\n\t}\n\telse\n\t pos = NULL;\n\twhile (n > 0)\n\t{\n\t for (;;)\n\t {\n\t\tif ((findc == '{' ? dec_cursor() : inc_cursor()) < 0)\n\t\t{\n\t\t // if not found anything, that's an error\n\t\t if (pos == NULL)\n\t\t\tclearopbeep(cap->oap);\n\t\t n = 0;\n\t\t break;\n\t\t}\n\t\tc = gchar_cursor();\n\t\tif (c == '{' || c == '}')\n\t\t{\n\t\t // Must have found end/start of class: use it.\n\t\t // Or found the place to be at.\n\t\t if ((c == findc && norm) || (n == 1 && !norm))\n\t\t {\n\t\t\tnew_pos = curwin->w_cursor;\n\t\t\tpos = &new_pos;\n\t\t\tn = 0;\n\t\t }\n\t\t // if no match found at all, we started outside of the\n\t\t // class and we're inside now. Just go on.\n\t\t else if (new_pos.lnum == 0)\n\t\t {\n\t\t\tnew_pos = curwin->w_cursor;\n\t\t\tpos = &new_pos;\n\t\t }\n\t\t // found start/end of other method: go to match\n\t\t else if ((pos = findmatchlimit(cap->oap, findc,\n\t\t\t (cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD,\n\t\t\t\t\t\t\t\t 0)) == NULL)\n\t\t\tn = 0;\n\t\t else\n\t\t\tcurwin->w_cursor = *pos;\n\t\t break;\n\t\t}\n\t }\n\t --n;\n\t}\n\tcurwin->w_cursor = *old_pos;\n\tif (pos == NULL && new_pos.lnum != 0)\n\t clearopbeep(cap->oap);\n }\n if (pos != NULL)\n {\n\tsetpcmark();\n\tcurwin->w_cursor = *pos;\n\tcurwin->w_set_curswant = TRUE;\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_BLOCK) && KeyTyped\n\t\t&& cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"[\" and \"]\" commands.\n * cap->arg is BACKWARD for \"[\" and FORWARD for \"]\".\n */\n static void\nnv_brackets(cmdarg_T *cap)\n{\n pos_T\tprev_pos;\n pos_T\t*pos = NULL;\t // init for GCC\n pos_T\told_pos;\t // cursor position before command\n int\t\tflag;\n long\tn;",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n old_pos = curwin->w_cursor;\n curwin->w_cursor.coladd = 0; // TODO: don't do this for an error.",
"#ifdef FEAT_SEARCHPATH\n // \"[f\" or \"]f\" : Edit file under the cursor (same as \"gf\")\n if (cap->nchar == 'f')\n\tnv_gotofile(cap);\n else\n#endif",
"#ifdef FEAT_FIND_ID\n // Find the occurrence(s) of the identifier or define under cursor\n // in current and included files or jump to the first occurrence.\n //\n //\t\t\tsearch\t list\t jump\n //\t\t fwd bwd fwd\t bwd\t fwd\tbwd\n // identifier \"]i\" \"[i\" \"]I\" \"[I\"\t\"]^I\" \"[^I\"\n // define\t \"]d\" \"[d\" \"]D\" \"[D\"\t\"]^D\" \"[^D\"\n if (vim_strchr((char_u *)\"iI\\011dD\\004\", cap->nchar) != NULL)\n {\n\tchar_u\t*ptr;\n\tint\tlen;",
"\tif ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)\n\t clearop(cap->oap);\n\telse\n\t{",
"",
"\t find_pattern_in_path(ptr, 0, len, TRUE,\n\t\tcap->count0 == 0 ? !isupper(cap->nchar) : FALSE,\n\t\t((cap->nchar & 0xf) == ('d' & 0xf)) ? FIND_DEFINE : FIND_ANY,\n\t\tcap->count1,\n\t\tisupper(cap->nchar) ? ACTION_SHOW_ALL :\n\t\t\t islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO,\n\t\tcap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1,\n\t\t(linenr_T)MAXLNUM);",
"",
"\t curwin->w_set_curswant = TRUE;\n\t}\n }\n else\n#endif",
" // \"[{\", \"[(\", \"]}\" or \"])\": go to Nth unclosed '{', '(', '}' or ')'\n // \"[#\", \"]#\": go to start/end of Nth innermost #if..#endif construct.\n // \"[/\", \"[*\", \"]/\", \"]*\": go to Nth comment start/end.\n // \"[m\" or \"]m\" search for prev/next start of (Java) method.\n // \"[M\" or \"]M\" search for prev/next end of (Java) method.\n if ( (cap->cmdchar == '['\n\t\t&& vim_strchr((char_u *)\"{(*/#mM\", cap->nchar) != NULL)\n\t || (cap->cmdchar == ']'\n\t\t&& vim_strchr((char_u *)\"})*/#mM\", cap->nchar) != NULL))\n\tnv_bracket_block(cap, &old_pos);",
" // \"[[\", \"[]\", \"]]\" and \"][\": move to start or end of function\n else if (cap->nchar == '[' || cap->nchar == ']')\n {\n\tif (cap->nchar == cap->cmdchar)\t\t // \"]]\" or \"[[\"\n\t flag = '{';\n\telse\n\t flag = '}';\t\t // \"][\" or \"[]\"",
"\tcurwin->w_set_curswant = TRUE;\n\t// Imitate strange Vi behaviour: When using \"]]\" with an operator\n\t// we also stop at '}'.\n\tif (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, flag,\n\t (cap->oap->op_type != OP_NOP\n\t\t\t\t && cap->arg == FORWARD && flag == '{')))\n\t clearopbeep(cap->oap);\n\telse\n\t{\n\t if (cap->oap->op_type == OP_NOP)\n\t\tbeginline(BL_WHITE | BL_FIX);\n#ifdef FEAT_FOLDING\n\t if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t\tfoldOpenCursor();\n#endif\n\t}\n }",
" // \"[p\", \"[P\", \"]P\" and \"]p\": put with indent adjustment\n else if (cap->nchar == 'p' || cap->nchar == 'P')\n {\n\tnv_put_opt(cap, TRUE);\n }",
" // \"['\", \"[`\", \"]'\" and \"]`\": jump to next mark\n else if (cap->nchar == '\\'' || cap->nchar == '`')\n {\n\tpos = &curwin->w_cursor;\n\tfor (n = cap->count1; n > 0; --n)\n\t{\n\t prev_pos = *pos;\n\t pos = getnextmark(pos, cap->cmdchar == '[' ? BACKWARD : FORWARD,\n\t\t\t\t\t\t\t cap->nchar == '\\'');\n\t if (pos == NULL)\n\t\tbreak;\n\t}\n\tif (pos == NULL)\n\t pos = &prev_pos;\n\tnv_cursormark(cap, cap->nchar == '\\'', pos);\n }",
" // [ or ] followed by a middle mouse click: put selected text with\n // indent adjustment. Any other button just does as usual.\n else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE)\n {\n\t(void)do_mouse(cap->oap, cap->nchar,\n\t\t (cap->cmdchar == ']') ? FORWARD : BACKWARD,\n\t\t cap->count1, PUT_FIXINDENT);\n }",
"#ifdef FEAT_FOLDING\n // \"[z\" and \"]z\": move to start or end of open fold.\n else if (cap->nchar == 'z')\n {\n\tif (foldMoveTo(FALSE, cap->cmdchar == ']' ? FORWARD : BACKWARD,\n\t\t\t\t\t\t\t cap->count1) == FAIL)\n\t clearopbeep(cap->oap);\n }\n#endif",
"#ifdef FEAT_DIFF\n // \"[c\" and \"]c\": move to next or previous diff-change.\n else if (cap->nchar == 'c')\n {\n\tif (diff_move_to(cap->cmdchar == ']' ? FORWARD : BACKWARD,\n\t\t\t\t\t\t\t cap->count1) == FAIL)\n\t clearopbeep(cap->oap);\n }\n#endif",
"#ifdef FEAT_SPELL\n // \"[s\", \"[S\", \"]s\" and \"]S\": move to next spell error.\n else if (cap->nchar == 's' || cap->nchar == 'S')\n {\n\tsetpcmark();\n\tfor (n = 0; n < cap->count1; ++n)\n\t if (spell_move_to(curwin, cap->cmdchar == ']' ? FORWARD : BACKWARD,\n\t\t\t cap->nchar == 's' ? TRUE : FALSE, FALSE, NULL) == 0)\n\t {\n\t\tclearopbeep(cap->oap);\n\t\tbreak;\n\t }\n\t else\n\t\tcurwin->w_set_curswant = TRUE;\n# ifdef FEAT_FOLDING\n\tif (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)\n\t foldOpenCursor();\n# endif\n }\n#endif",
" // Not a valid cap->nchar.\n else\n\tclearopbeep(cap->oap);\n}",
"/*\n * Handle Normal mode \"%\" command.\n */\n static void\nnv_percent(cmdarg_T *cap)\n{\n pos_T\t*pos;\n#if defined(FEAT_FOLDING)\n linenr_T\tlnum = curwin->w_cursor.lnum;\n#endif",
" cap->oap->inclusive = TRUE;\n if (cap->count0)\t // {cnt}% : goto {cnt} percentage in file\n {\n\tif (cap->count0 > 100)\n\t clearopbeep(cap->oap);\n\telse\n\t{\n\t cap->oap->motion_type = MLINE;\n\t setpcmark();\n\t // Round up, so 'normal 100%' always jumps at the line line.\n\t // Beyond 21474836 lines, (ml_line_count * 100 + 99) would\n\t // overflow on 32-bits, so use a formula with less accuracy\n\t // to avoid overflows.\n\t if (curbuf->b_ml.ml_line_count >= 21474836)\n\t\tcurwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L)\n\t\t\t\t\t\t\t / 100L * cap->count0;\n\t else\n\t\tcurwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *\n\t\t\t\t\t\t cap->count0 + 99L) / 100L;\n\t if (curwin->w_cursor.lnum < 1)\n\t\tcurwin->w_cursor.lnum = 1;\n\t if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t\tcurwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t beginline(BL_SOL | BL_FIX);\n\t}\n }\n else\t\t // \"%\" : go to matching paren\n {\n\tcap->oap->motion_type = MCHAR;\n\tcap->oap->use_reg_one = TRUE;\n\tif ((pos = findmatch(cap->oap, NUL)) == NULL)\n\t clearopbeep(cap->oap);\n\telse\n\t{\n\t setpcmark();\n\t curwin->w_cursor = *pos;\n\t curwin->w_set_curswant = TRUE;\n\t curwin->w_cursor.coladd = 0;\n\t adjust_for_sel(cap);\n\t}\n }\n#ifdef FEAT_FOLDING\n if (cap->oap->op_type == OP_NOP\n\t && lnum != curwin->w_cursor.lnum\n\t && (fdo_flags & FDO_PERCENT)\n\t && KeyTyped)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Handle \"(\" and \")\" commands.\n * cap->arg is BACKWARD for \"(\" and FORWARD for \")\".\n */\n static void\nnv_brace(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->use_reg_one = TRUE;\n // The motion used to be inclusive for \"(\", but that is not what Vi does.\n cap->oap->inclusive = FALSE;\n curwin->w_set_curswant = TRUE;",
" if (findsent(cap->arg, cap->count1) == FAIL)\n\tclearopbeep(cap->oap);\n else\n {\n\t// Don't leave the cursor on the NUL past end of line.\n\tadjust_cursor(cap->oap);\n\tcurwin->w_cursor.coladd = 0;\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"m\" command: Mark a position.\n */\n static void\nnv_mark(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n {\n\tif (setmark(cap->nchar) == FAIL)\n\t clearopbeep(cap->oap);\n }\n}",
"/*\n * \"{\" and \"}\" commands.\n * cmd->arg is BACKWARD for \"{\" and FORWARD for \"}\".\n */\n static void\nnv_findpar(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n cap->oap->use_reg_one = TRUE;\n curwin->w_set_curswant = TRUE;\n if (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, NUL, FALSE))\n\tclearopbeep(cap->oap);\n else\n {\n\tcurwin->w_cursor.coladd = 0;\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"u\" command: Undo or make lower case.\n */\n static void\nnv_undo(cmdarg_T *cap)\n{\n if (cap->oap->op_type == OP_LOWER || VIsual_active)\n {\n\t// translate \"<Visual>u\" to \"<Visual>gu\" and \"guu\" to \"gugu\"\n\tcap->cmdchar = 'g';\n\tcap->nchar = 'u';\n\tnv_operator(cap);\n }\n else\n\tnv_kundo(cap);\n}",
"/*\n * <Undo> command.\n */\n static void\nnv_kundo(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n {\n#ifdef FEAT_JOB_CHANNEL\n\tif (bt_prompt(curbuf))\n\t{\n\t clearopbeep(cap->oap);\n\t return;\n\t}\n#endif\n\tu_undo((int)cap->count1);\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * Handle the \"r\" command.\n */\n static void\nnv_replace(cmdarg_T *cap)\n{\n char_u\t*ptr;\n int\t\thad_ctrl_v;\n long\tn;",
" if (checkclearop(cap->oap))\n\treturn;\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }\n#endif",
" // get another character\n if (cap->nchar == Ctrl_V)\n {\n\thad_ctrl_v = Ctrl_V;\n\tcap->nchar = get_literal(FALSE);\n\t// Don't redo a multibyte character with CTRL-V.\n\tif (cap->nchar > DEL)\n\t had_ctrl_v = NUL;\n }\n else\n\thad_ctrl_v = NUL;",
" // Abort if the character is a special key.\n if (IS_SPECIAL(cap->nchar))\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" // Visual mode \"r\"\n if (VIsual_active)\n {\n\tif (got_int)\n\t reset_VIsual();\n\tif (had_ctrl_v)\n\t{\n\t // Use a special (negative) number to make a difference between a\n\t // literal CR or NL and a line break.\n\t if (cap->nchar == CAR)\n\t\tcap->nchar = REPLACE_CR_NCHAR;\n\t else if (cap->nchar == NL)\n\t\tcap->nchar = REPLACE_NL_NCHAR;\n\t}\n\tnv_operator(cap);\n\treturn;\n }",
" // Break tabs, etc.\n if (virtual_active())\n {\n\tif (u_save_cursor() == FAIL)\n\t return;\n\tif (gchar_cursor() == NUL)\n\t{\n\t // Add extra space and put the cursor on the first one.\n\t coladvance_force((colnr_T)(getviscol() + cap->count1));\n\t curwin->w_cursor.col -= cap->count1;\n\t}\n\telse if (gchar_cursor() == TAB)\n\t coladvance_force(getviscol());\n }",
" // Abort if not enough characters to replace.\n ptr = ml_get_cursor();\n if (STRLEN(ptr) < (unsigned)cap->count1\n\t || (has_mbyte && mb_charlen(ptr) < cap->count1))\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" // Replacing with a TAB is done by edit() when it is complicated because\n // 'expandtab' or 'smarttab' is set. CTRL-V TAB inserts a literal TAB.\n // Other characters are done below to avoid problems with things like\n // CTRL-V 048 (for edit() this would be R CTRL-V 0 ESC).\n if (had_ctrl_v != Ctrl_V && cap->nchar == '\\t' && (curbuf->b_p_et || p_sta))\n {\n\tstuffnumReadbuff(cap->count1);\n\tstuffcharReadbuff('R');\n\tstuffcharReadbuff('\\t');\n\tstuffcharReadbuff(ESC);\n\treturn;\n }",
" // save line for undo\n if (u_save_cursor() == FAIL)\n\treturn;",
" if (had_ctrl_v != Ctrl_V && (cap->nchar == '\\r' || cap->nchar == '\\n'))\n {\n\t// Replace character(s) by a single newline.\n\t// Strange vi behaviour: Only one newline is inserted.\n\t// Delete the characters here.\n\t// Insert the newline with an insert command, takes care of\n\t// autoindent.\tThe insert command depends on being on the last\n\t// character of a line or not.\n\t(void)del_chars(cap->count1, FALSE);\t// delete the characters\n\tstuffcharReadbuff('\\r');\n\tstuffcharReadbuff(ESC);",
"\t// Give 'r' to edit(), to get the redo command right.\n\tinvoke_edit(cap, TRUE, 'r', FALSE);\n }\n else\n {\n\tprep_redo(cap->oap->regname, cap->count1,\n\t\t\t\t NUL, 'r', NUL, had_ctrl_v, cap->nchar);",
"\tcurbuf->b_op_start = curwin->w_cursor;\n\tif (has_mbyte)\n\t{\n\t int\t\told_State = State;",
"\t if (cap->ncharC1 != 0)\n\t\tAppendCharToRedobuff(cap->ncharC1);\n\t if (cap->ncharC2 != 0)\n\t\tAppendCharToRedobuff(cap->ncharC2);",
"\t // This is slow, but it handles replacing a single-byte with a\n\t // multi-byte and the other way around. Also handles adding\n\t // composing characters for utf-8.\n\t for (n = cap->count1; n > 0; --n)\n\t {\n\t\tState = MODE_REPLACE;\n\t\tif (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)\n\t\t{\n\t\t int c = ins_copychar(curwin->w_cursor.lnum\n\t\t\t\t\t + (cap->nchar == Ctrl_Y ? -1 : 1));\n\t\t if (c != NUL)\n\t\t\tins_char(c);\n\t\t else\n\t\t\t// will be decremented further down\n\t\t\t++curwin->w_cursor.col;\n\t\t}\n\t\telse\n\t\t ins_char(cap->nchar);\n\t\tState = old_State;\n\t\tif (cap->ncharC1 != 0)\n\t\t ins_char(cap->ncharC1);\n\t\tif (cap->ncharC2 != 0)\n\t\t ins_char(cap->ncharC2);\n\t }\n\t}\n\telse\n\t{\n\t // Replace the characters within one line.\n\t for (n = cap->count1; n > 0; --n)\n\t {\n\t\t// Get ptr again, because u_save and/or showmatch() will have\n\t\t// released the line. This may also happen in ins_copychar().\n\t\t// At the same time we let know that the line will be changed.\n\t\tif (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)\n\t\t{\n\t\t int c = ins_copychar(curwin->w_cursor.lnum\n\t\t\t\t\t + (cap->nchar == Ctrl_Y ? -1 : 1));",
"\t\t ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);\n\t\t if (c != NUL)\n\t\t ptr[curwin->w_cursor.col] = c;\n\t\t}\n\t\telse\n\t\t{\n\t\t ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);\n\t\t ptr[curwin->w_cursor.col] = cap->nchar;\n\t\t}\n\t\tif (p_sm && msg_silent == 0)\n\t\t showmatch(cap->nchar);\n\t\t++curwin->w_cursor.col;\n\t }\n#ifdef FEAT_NETBEANS_INTG\n\t if (netbeans_active())\n\t {\n\t\tcolnr_T start = (colnr_T)(curwin->w_cursor.col - cap->count1);",
"\t\tnetbeans_removed(curbuf, curwin->w_cursor.lnum, start,\n\t\t\t\t\t\t\t cap->count1);\n\t\tnetbeans_inserted(curbuf, curwin->w_cursor.lnum, start,\n\t\t\t\t\t &ptr[start], (int)cap->count1);\n\t }\n#endif",
"\t // mark the buffer as changed and prepare for displaying\n\t changed_bytes(curwin->w_cursor.lnum,\n\t\t\t (colnr_T)(curwin->w_cursor.col - cap->count1));\n\t}\n\t--curwin->w_cursor.col;\t // cursor on the last replaced char\n\t// if the character on the left of the current cursor is a multi-byte\n\t// character, move two characters left\n\tif (has_mbyte)\n\t mb_adjust_cursor();\n\tcurbuf->b_op_end = curwin->w_cursor;\n\tcurwin->w_set_curswant = TRUE;\n\tset_last_insert(cap->nchar);\n }\n}",
"/*\n * 'o': Exchange start and end of Visual area.\n * 'O': same, but in block mode exchange left and right corners.\n */\n static void\nv_swap_corners(int cmdchar)\n{\n pos_T\told_cursor;\n colnr_T\tleft, right;",
" if (cmdchar == 'O' && VIsual_mode == Ctrl_V)\n {\n\told_cursor = curwin->w_cursor;\n\tgetvcols(curwin, &old_cursor, &VIsual, &left, &right);\n\tcurwin->w_cursor.lnum = VIsual.lnum;\n\tcoladvance(left);\n\tVIsual = curwin->w_cursor;",
"\tcurwin->w_cursor.lnum = old_cursor.lnum;\n\tcurwin->w_curswant = right;\n\t// 'selection \"exclusive\" and cursor at right-bottom corner: move it\n\t// right one column\n\tif (old_cursor.lnum >= VIsual.lnum && *p_sel == 'e')\n\t ++curwin->w_curswant;\n\tcoladvance(curwin->w_curswant);\n\tif (curwin->w_cursor.col == old_cursor.col\n\t\t&& (!virtual_active()\n\t\t || curwin->w_cursor.coladd == old_cursor.coladd))\n\t{\n\t curwin->w_cursor.lnum = VIsual.lnum;\n\t if (old_cursor.lnum <= VIsual.lnum && *p_sel == 'e')\n\t\t++right;\n\t coladvance(right);\n\t VIsual = curwin->w_cursor;",
"\t curwin->w_cursor.lnum = old_cursor.lnum;\n\t coladvance(left);\n\t curwin->w_curswant = left;\n\t}\n }\n else\n {\n\told_cursor = curwin->w_cursor;\n\tcurwin->w_cursor = VIsual;\n\tVIsual = old_cursor;\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * \"R\" (cap->arg is FALSE) and \"gR\" (cap->arg is TRUE).\n */\n static void\nnv_Replace(cmdarg_T *cap)\n{\n if (VIsual_active)\t\t// \"R\" is replace lines\n {\n\tcap->cmdchar = 'c';\n\tcap->nchar = NUL;\n\tVIsual_mode_orig = VIsual_mode; // remember original area for gv\n\tVIsual_mode = 'V';\n\tnv_operator(cap);\n }\n else if (!checkclearopq(cap->oap))\n {\n\tif (!curbuf->b_p_ma)\n\t emsg(_(e_cannot_make_changes_modifiable_is_off));\n\telse\n\t{\n\t if (virtual_active())\n\t\tcoladvance(getviscol());\n\t invoke_edit(cap, FALSE, cap->arg ? 'V' : 'R', FALSE);\n\t}\n }\n}",
"/*\n * \"gr\".\n */\n static void\nnv_vreplace(cmdarg_T *cap)\n{\n if (VIsual_active)\n {\n\tcap->cmdchar = 'r';\n\tcap->nchar = cap->extra_char;\n\tnv_replace(cap);\t// Do same as \"r\" in Visual mode for now\n }\n else if (!checkclearopq(cap->oap))\n {\n\tif (!curbuf->b_p_ma)\n\t emsg(_(e_cannot_make_changes_modifiable_is_off));\n\telse\n\t{\n\t if (cap->extra_char == Ctrl_V)\t// get another character\n\t\tcap->extra_char = get_literal(FALSE);\n\t stuffcharReadbuff(cap->extra_char);\n\t stuffcharReadbuff(ESC);\n\t if (virtual_active())\n\t\tcoladvance(getviscol());\n\t invoke_edit(cap, TRUE, 'v', FALSE);\n\t}\n }\n}",
"/*\n * Swap case for \"~\" command, when it does not work like an operator.\n */\n static void\nn_swapchar(cmdarg_T *cap)\n{\n long\tn;\n pos_T\tstartpos;\n int\t\tdid_change = 0;\n#ifdef FEAT_NETBEANS_INTG\n pos_T\tpos;\n char_u\t*ptr;\n int\t\tcount;\n#endif",
" if (checkclearopq(cap->oap))\n\treturn;",
" if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL)\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" prep_redo_cmd(cap);",
" if (u_save_cursor() == FAIL)\n\treturn;",
" startpos = curwin->w_cursor;\n#ifdef FEAT_NETBEANS_INTG\n pos = startpos;\n#endif\n for (n = cap->count1; n > 0; --n)\n {\n\tdid_change |= swapchar(cap->oap->op_type, &curwin->w_cursor);\n\tinc_cursor();\n\tif (gchar_cursor() == NUL)\n\t{\n\t if (vim_strchr(p_ww, '~') != NULL\n\t\t && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)\n\t {\n#ifdef FEAT_NETBEANS_INTG\n\t\tif (netbeans_active())\n\t\t{\n\t\t if (did_change)\n\t\t {\n\t\t\tptr = ml_get(pos.lnum);\n\t\t\tcount = (int)STRLEN(ptr) - pos.col;\n\t\t\tnetbeans_removed(curbuf, pos.lnum, pos.col,\n\t\t\t\t\t\t\t\t (long)count);\n\t\t\tnetbeans_inserted(curbuf, pos.lnum, pos.col,\n\t\t\t\t\t\t\t&ptr[pos.col], count);\n\t\t }\n\t\t pos.col = 0;\n\t\t pos.lnum++;\n\t\t}\n#endif\n\t\t++curwin->w_cursor.lnum;\n\t\tcurwin->w_cursor.col = 0;\n\t\tif (n > 1)\n\t\t{\n\t\t if (u_savesub(curwin->w_cursor.lnum) == FAIL)\n\t\t\tbreak;\n\t\t u_clearline();\n\t\t}\n\t }\n\t else\n\t\tbreak;\n\t}\n }\n#ifdef FEAT_NETBEANS_INTG\n if (did_change && netbeans_active())\n {\n\tptr = ml_get(pos.lnum);\n\tcount = curwin->w_cursor.col - pos.col;\n\tnetbeans_removed(curbuf, pos.lnum, pos.col, (long)count);\n\tnetbeans_inserted(curbuf, pos.lnum, pos.col, &ptr[pos.col], count);\n }\n#endif",
"\n check_cursor();\n curwin->w_set_curswant = TRUE;\n if (did_change)\n {\n\tchanged_lines(startpos.lnum, startpos.col, curwin->w_cursor.lnum + 1,\n\t\t\t\t\t\t\t\t\t 0L);\n\tcurbuf->b_op_start = startpos;\n\tcurbuf->b_op_end = curwin->w_cursor;\n\tif (curbuf->b_op_end.col > 0)\n\t --curbuf->b_op_end.col;\n }\n}",
"/*\n * Move cursor to mark.\n */\n static void\nnv_cursormark(cmdarg_T *cap, int flag, pos_T *pos)\n{\n if (check_mark(pos) == FAIL)\n\tclearop(cap->oap);\n else\n {\n\tif (cap->cmdchar == '\\''\n\t\t|| cap->cmdchar == '`'\n\t\t|| cap->cmdchar == '['\n\t\t|| cap->cmdchar == ']')\n\t setpcmark();\n\tcurwin->w_cursor = *pos;\n\tif (flag)\n\t beginline(BL_WHITE | BL_FIX);\n\telse\n\t check_cursor();\n }\n cap->oap->motion_type = flag ? MLINE : MCHAR;\n if (cap->cmdchar == '`')\n\tcap->oap->use_reg_one = TRUE;\n cap->oap->inclusive = FALSE;\t\t// ignored if not MCHAR\n curwin->w_set_curswant = TRUE;\n}",
"/*\n * Handle commands that are operators in Visual mode.\n */\n static void\nv_visop(cmdarg_T *cap)\n{\n static char_u trans[] = \"YyDdCcxdXdAAIIrr\";",
" // Uppercase means linewise, except in block mode, then \"D\" deletes till\n // the end of the line, and \"C\" replaces till EOL\n if (isupper(cap->cmdchar))\n {\n\tif (VIsual_mode != Ctrl_V)\n\t{\n\t VIsual_mode_orig = VIsual_mode;\n\t VIsual_mode = 'V';\n\t}\n\telse if (cap->cmdchar == 'C' || cap->cmdchar == 'D')\n\t curwin->w_curswant = MAXCOL;\n }\n cap->cmdchar = *(vim_strchr(trans, cap->cmdchar) + 1);\n nv_operator(cap);\n}",
"/*\n * \"s\" and \"S\" commands.\n */\n static void\nnv_subst(cmdarg_T *cap)\n{\n#ifdef FEAT_TERMINAL\n // When showing output of term_dumpdiff() swap the top and bottom.\n if (term_swap_diff() == OK)\n\treturn;\n#endif\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }\n#endif\n if (VIsual_active)\t// \"vs\" and \"vS\" are the same as \"vc\"\n {\n\tif (cap->cmdchar == 'S')\n\t{\n\t VIsual_mode_orig = VIsual_mode;\n\t VIsual_mode = 'V';\n\t}\n\tcap->cmdchar = 'c';\n\tnv_operator(cap);\n }\n else\n\tnv_optrans(cap);\n}",
"/*\n * Abbreviated commands.\n */\n static void\nnv_abbrev(cmdarg_T *cap)\n{\n if (cap->cmdchar == K_DEL || cap->cmdchar == K_KDEL)\n\tcap->cmdchar = 'x';\t\t// DEL key behaves like 'x'",
" // in Visual mode these commands are operators\n if (VIsual_active)\n\tv_visop(cap);\n else\n\tnv_optrans(cap);\n}",
"/*\n * Translate a command into another command.\n */\n static void\nnv_optrans(cmdarg_T *cap)\n{\n static char_u *(ar[8]) = {(char_u *)\"dl\", (char_u *)\"dh\",\n\t\t\t (char_u *)\"d$\", (char_u *)\"c$\",\n\t\t\t (char_u *)\"cl\", (char_u *)\"cc\",\n\t\t\t (char_u *)\"yy\", (char_u *)\":s\\r\"};\n static char_u *str = (char_u *)\"xXDCsSY&\";",
" if (!checkclearopq(cap->oap))\n {\n\t// In Vi \"2D\" doesn't delete the next line. Can't translate it\n\t// either, because \"2.\" should also not use the count.\n\tif (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL)\n\t{\n\t cap->oap->start = curwin->w_cursor;\n\t cap->oap->op_type = OP_DELETE;\n#ifdef FEAT_EVAL\n\t set_op_var(OP_DELETE);\n#endif\n\t cap->count1 = 1;\n\t nv_dollar(cap);\n\t finish_op = TRUE;\n\t ResetRedobuff();\n\t AppendCharToRedobuff('D');\n\t}\n\telse\n\t{\n\t if (cap->count0)\n\t\tstuffnumReadbuff(cap->count0);\n\t stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);\n\t}\n }\n cap->opcount = 0;\n}",
"/*\n * \"'\" and \"`\" commands. Also for \"g'\" and \"g`\".\n * cap->arg is TRUE for \"'\" and \"g'\".\n */\n static void\nnv_gomark(cmdarg_T *cap)\n{\n pos_T\t*pos;\n int\t\tc;\n#ifdef FEAT_FOLDING\n pos_T\told_cursor = curwin->w_cursor;\n int\t\told_KeyTyped = KeyTyped; // getting file may reset it\n#endif",
" if (cap->cmdchar == 'g')\n\tc = cap->extra_char;\n else\n\tc = cap->nchar;\n pos = getmark(c, (cap->oap->op_type == OP_NOP));\n if (pos == (pos_T *)-1)\t // jumped to other file\n {\n\tif (cap->arg)\n\t{\n\t check_cursor_lnum();\n\t beginline(BL_WHITE | BL_FIX);\n\t}\n\telse\n\t check_cursor();\n }\n else\n\tnv_cursormark(cap, cap->arg, pos);",
" // May need to clear the coladd that a mark includes.\n if (!virtual_active())\n\tcurwin->w_cursor.coladd = 0;\n check_cursor_col();\n#ifdef FEAT_FOLDING\n if (cap->oap->op_type == OP_NOP\n\t && pos != NULL\n\t && (pos == (pos_T *)-1 || !EQUAL_POS(old_cursor, *pos))\n\t && (fdo_flags & FDO_MARK)\n\t && old_KeyTyped)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Handle CTRL-O, CTRL-I, \"g;\", \"g,\" and \"CTRL-Tab\" commands.\n */\n static void\nnv_pcmark(cmdarg_T *cap)\n{\n pos_T\t*pos;\n#ifdef FEAT_FOLDING\n linenr_T\tlnum = curwin->w_cursor.lnum;\n int\t\told_KeyTyped = KeyTyped; // getting file may reset it\n#endif",
" if (!checkclearopq(cap->oap))\n {\n\tif (cap->cmdchar == TAB && mod_mask == MOD_MASK_CTRL)\n\t{\n\t if (goto_tabpage_lastused() == FAIL)\n\t\tclearopbeep(cap->oap);\n\t return;\n\t}\n\tif (cap->cmdchar == 'g')\n\t pos = movechangelist((int)cap->count1);\n\telse\n\t pos = movemark((int)cap->count1);\n\tif (pos == (pos_T *)-1)\t\t// jump to other file\n\t{\n\t curwin->w_set_curswant = TRUE;\n\t check_cursor();\n\t}\n\telse if (pos != NULL)\t\t // can jump\n\t nv_cursormark(cap, FALSE, pos);\n\telse if (cap->cmdchar == 'g')\n\t{\n\t if (curbuf->b_changelistlen == 0)\n\t\temsg(_(e_changelist_is_empty));\n\t else if (cap->count1 < 0)\n\t\temsg(_(e_at_start_of_changelist));\n\t else\n\t\temsg(_(e_at_end_of_changelist));\n\t}\n\telse\n\t clearopbeep(cap->oap);\n# ifdef FEAT_FOLDING\n\tif (cap->oap->op_type == OP_NOP\n\t\t&& (pos == (pos_T *)-1 || lnum != curwin->w_cursor.lnum)\n\t\t&& (fdo_flags & FDO_MARK)\n\t\t&& old_KeyTyped)\n\t foldOpenCursor();\n# endif\n }\n}",
"/*\n * Handle '\"' command.\n */\n static void\nnv_regname(cmdarg_T *cap)\n{\n if (checkclearop(cap->oap))\n\treturn;\n#ifdef FEAT_EVAL\n if (cap->nchar == '=')\n\tcap->nchar = get_expr_register();\n#endif\n if (cap->nchar != NUL && valid_yank_reg(cap->nchar, FALSE))\n {\n\tcap->oap->regname = cap->nchar;\n\tcap->opcount = cap->count0;\t// remember count before '\"'\n#ifdef FEAT_EVAL\n\tset_reg_var(cap->oap->regname);\n#endif\n }\n else\n\tclearopbeep(cap->oap);\n}",
"/*\n * Handle \"v\", \"V\" and \"CTRL-V\" commands.\n * Also for \"gh\", \"gH\" and \"g^H\" commands: Always start Select mode, cap->arg\n * is TRUE.\n * Handle CTRL-Q just like CTRL-V.\n */\n static void\nnv_visual(cmdarg_T *cap)\n{\n if (cap->cmdchar == Ctrl_Q)\n\tcap->cmdchar = Ctrl_V;",
" // 'v', 'V' and CTRL-V can be used while an operator is pending to make it\n // characterwise, linewise, or blockwise.\n if (cap->oap->op_type != OP_NOP)\n {\n\tmotion_force = cap->oap->motion_force = cap->cmdchar;\n\tfinish_op = FALSE;\t// operator doesn't finish now but later\n\treturn;\n }",
" VIsual_select = cap->arg;\n if (VIsual_active)\t // change Visual mode\n {\n\tif (VIsual_mode == cap->cmdchar) // stop visual mode\n\t end_visual_mode();\n\telse\t\t\t\t // toggle char/block mode\n\t{\t\t\t\t //\t or char/line mode\n\t VIsual_mode = cap->cmdchar;\n\t showmode();\n\t may_trigger_modechanged();\n\t}\n\tredraw_curbuf_later(INVERTED);\t // update the inversion\n }\n else\t\t // start Visual mode\n {\n\tcheck_visual_highlight();\n\tif (cap->count0 > 0 && resel_VIsual_mode != NUL)\n\t{\n\t // use previously selected part\n\t VIsual = curwin->w_cursor;",
"\t VIsual_active = TRUE;\n\t VIsual_reselect = TRUE;\n\t if (!cap->arg)\n\t\t// start Select mode when 'selectmode' contains \"cmd\"\n\t\tmay_start_select('c');\n\t setmouse();\n\t if (p_smd && msg_silent == 0)\n\t\tredraw_cmdline = TRUE;\t // show visual mode later\n\t // For V and ^V, we multiply the number of lines even if there\n\t // was only one -- webb\n\t if (resel_VIsual_mode != 'v' || resel_VIsual_line_count > 1)\n\t {\n\t\tcurwin->w_cursor.lnum +=\n\t\t\t\t resel_VIsual_line_count * cap->count0 - 1;\n\t\tcheck_cursor();\n\t }\n\t VIsual_mode = resel_VIsual_mode;\n\t if (VIsual_mode == 'v')\n\t {\n\t\tif (resel_VIsual_line_count <= 1)\n\t\t{\n\t\t validate_virtcol();\n\t\t curwin->w_curswant = curwin->w_virtcol\n\t\t\t\t\t+ resel_VIsual_vcol * cap->count0 - 1;\n\t\t}\n\t\telse\n\t\t curwin->w_curswant = resel_VIsual_vcol;\n\t\tcoladvance(curwin->w_curswant);\n\t }\n\t if (resel_VIsual_vcol == MAXCOL)\n\t {\n\t\tcurwin->w_curswant = MAXCOL;\n\t\tcoladvance((colnr_T)MAXCOL);\n\t }\n\t else if (VIsual_mode == Ctrl_V)\n\t {\n\t\tvalidate_virtcol();\n\t\tcurwin->w_curswant = curwin->w_virtcol\n\t\t\t\t\t+ resel_VIsual_vcol * cap->count0 - 1;\n\t\tcoladvance(curwin->w_curswant);\n\t }\n\t else\n\t\tcurwin->w_set_curswant = TRUE;\n\t redraw_curbuf_later(INVERTED);\t// show the inversion\n\t}\n\telse\n\t{\n\t if (!cap->arg)\n\t\t// start Select mode when 'selectmode' contains \"cmd\"\n\t\tmay_start_select('c');\n\t n_start_visual_mode(cap->cmdchar);\n\t if (VIsual_mode != 'V' && *p_sel == 'e')\n\t\t++cap->count1; // include one more char\n\t if (cap->count0 > 0 && --cap->count1 > 0)\n\t {\n\t\t// With a count select that many characters or lines.\n\t\tif (VIsual_mode == 'v' || VIsual_mode == Ctrl_V)\n\t\t nv_right(cap);\n\t\telse if (VIsual_mode == 'V')\n\t\t nv_down(cap);\n\t }\n\t}\n }\n}",
"/*\n * Start selection for Shift-movement keys.\n */\n void\nstart_selection(void)\n{\n // if 'selectmode' contains \"key\", start Select mode\n may_start_select('k');\n n_start_visual_mode('v');\n}",
"/*\n * Start Select mode, if \"c\" is in 'selectmode' and not in a mapping or menu.\n * When \"c\" is 'o' (checking for \"mouse\") then also when mapped.\n */\n void\nmay_start_select(int c)\n{\n VIsual_select = (c == 'o' || (stuff_empty() && typebuf_typed()))\n\t\t && vim_strchr(p_slm, c) != NULL;\n}",
"/*\n * Start Visual mode \"c\".\n * Should set VIsual_select before calling this.\n */\n static void\nn_start_visual_mode(int c)\n{\n#ifdef FEAT_CONCEAL\n int cursor_line_was_concealed = curwin->w_p_cole > 0\n\t\t\t\t\t\t&& conceal_cursor_line(curwin);\n#endif",
" VIsual_mode = c;\n VIsual_active = TRUE;\n VIsual_reselect = TRUE;",
" // Corner case: the 0 position in a tab may change when going into\n // virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting.\n if (c == Ctrl_V && (get_ve_flags() & VE_BLOCK) && gchar_cursor() == TAB)\n {\n\tvalidate_virtcol();\n\tcoladvance(curwin->w_virtcol);\n }\n VIsual = curwin->w_cursor;",
"#ifdef FEAT_FOLDING\n foldAdjustVisual();\n#endif",
" may_trigger_modechanged();\n setmouse();\n#ifdef FEAT_CONCEAL\n // Check if redraw is needed after changing the state.\n conceal_check_cursor_line(cursor_line_was_concealed);\n#endif",
" if (p_smd && msg_silent == 0)\n\tredraw_cmdline = TRUE;\t// show visual mode later\n#ifdef FEAT_CLIPBOARD\n // Make sure the clipboard gets updated. Needed because start and\n // end may still be the same, and the selection needs to be owned\n clip_star.vmode = NUL;\n#endif",
" // Only need to redraw this line, unless still need to redraw an old\n // Visual area (when 'lazyredraw' is set).\n if (curwin->w_redr_type < INVERTED)\n {\n\tcurwin->w_old_cursor_lnum = curwin->w_cursor.lnum;\n\tcurwin->w_old_visual_lnum = curwin->w_cursor.lnum;\n }\n}",
"\n/*\n * CTRL-W: Window commands\n */\n static void\nnv_window(cmdarg_T *cap)\n{\n if (cap->nchar == ':')\n {\n\t// \"CTRL-W :\" is the same as typing \":\"; useful in a terminal window\n\tcap->cmdchar = ':';\n\tcap->nchar = NUL;\n\tnv_colon(cap);\n }\n else if (!checkclearop(cap->oap))\n\tdo_window(cap->nchar, cap->count0, NUL); // everything is in window.c\n}",
"/*\n * CTRL-Z: Suspend\n */\n static void\nnv_suspend(cmdarg_T *cap)\n{\n clearop(cap->oap);\n if (VIsual_active)\n\tend_visual_mode();\t\t// stop Visual mode\n do_cmdline_cmd((char_u *)\"stop\");\n}",
"/*\n * \"gv\": Reselect the previous Visual area. If Visual already active,\n * exchange previous and current Visual area.\n */\n static void\nnv_gv_cmd(cmdarg_T *cap)\n{\n pos_T\ttpos;\n int\t\ti;",
" if (checkclearop(cap->oap))\n\treturn;",
" if (curbuf->b_visual.vi_start.lnum == 0\n\t || curbuf->b_visual.vi_start.lnum > curbuf->b_ml.ml_line_count\n\t || curbuf->b_visual.vi_end.lnum == 0)\n {\n\tbeep_flush();\n\treturn;\n }",
" // set w_cursor to the start of the Visual area, tpos to the end\n if (VIsual_active)\n {\n\ti = VIsual_mode;\n\tVIsual_mode = curbuf->b_visual.vi_mode;\n\tcurbuf->b_visual.vi_mode = i;\n# ifdef FEAT_EVAL\n\tcurbuf->b_visual_mode_eval = i;\n# endif\n\ti = curwin->w_curswant;\n\tcurwin->w_curswant = curbuf->b_visual.vi_curswant;\n\tcurbuf->b_visual.vi_curswant = i;",
"\ttpos = curbuf->b_visual.vi_end;\n\tcurbuf->b_visual.vi_end = curwin->w_cursor;\n\tcurwin->w_cursor = curbuf->b_visual.vi_start;\n\tcurbuf->b_visual.vi_start = VIsual;\n }\n else\n {\n\tVIsual_mode = curbuf->b_visual.vi_mode;\n\tcurwin->w_curswant = curbuf->b_visual.vi_curswant;\n\ttpos = curbuf->b_visual.vi_end;\n\tcurwin->w_cursor = curbuf->b_visual.vi_start;\n }",
" VIsual_active = TRUE;\n VIsual_reselect = TRUE;",
" // Set Visual to the start and w_cursor to the end of the Visual\n // area. Make sure they are on an existing character.\n check_cursor();\n VIsual = curwin->w_cursor;\n curwin->w_cursor = tpos;\n check_cursor();\n update_topline();",
" // When called from normal \"g\" command: start Select mode when\n // 'selectmode' contains \"cmd\". When called for K_SELECT, always\n // start Select mode.\n if (cap->arg)\n {\n\tVIsual_select = TRUE;\n\tVIsual_select_reg = 0;\n }\n else\n\tmay_start_select('c');\n setmouse();\n#ifdef FEAT_CLIPBOARD\n // Make sure the clipboard gets updated. Needed because start and\n // end are still the same, and the selection needs to be owned\n clip_star.vmode = NUL;\n#endif\n redraw_curbuf_later(INVERTED);\n showmode();\n}",
"/*\n * \"g0\", \"g^\" : Like \"0\" and \"^\" but for screen lines.\n * \"gm\": middle of \"g0\" and \"g$\".\n */\n static void\nnv_g_home_m_cmd(cmdarg_T *cap)\n{\n int\t\ti;\n int\t\tflag = FALSE;",
" if (cap->nchar == '^')\n\tflag = TRUE;",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n if (curwin->w_p_wrap && curwin->w_width != 0)\n {\n\tint\t\twidth1 = curwin->w_width - curwin_col_off();\n\tint\t\twidth2 = width1 + curwin_col_off2();",
"\tvalidate_virtcol();\n\ti = 0;\n\tif (curwin->w_virtcol >= (colnr_T)width1 && width2 > 0)\n\t i = (curwin->w_virtcol - width1) / width2 * width2 + width1;\n }\n else\n\ti = curwin->w_leftcol;\n // Go to the middle of the screen line. When 'number' or\n // 'relativenumber' is on and lines are wrapping the middle can be more\n // to the left.\n if (cap->nchar == 'm')\n\ti += (curwin->w_width - curwin_col_off()\n\t\t+ ((curwin->w_p_wrap && i > 0)\n\t\t ? curwin_col_off2() : 0)) / 2;\n coladvance((colnr_T)i);\n if (flag)\n {\n\tdo\n\t i = gchar_cursor();\n\twhile (VIM_ISWHITE(i) && oneright() == OK);\n\tcurwin->w_valid &= ~VALID_WCOL;\n }\n curwin->w_set_curswant = TRUE;\n}",
"/*\n * \"g_\": to the last non-blank character in the line or <count> lines\n * downward.\n */\n static void\nnv_g_underscore_cmd(cmdarg_T *cap)\n{\n char_u *ptr;",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = TRUE;\n curwin->w_curswant = MAXCOL;\n if (cursor_down((long)(cap->count1 - 1),\n\t\t\t\t\tcap->oap->op_type == OP_NOP) == FAIL)\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" ptr = ml_get_curline();",
" // In Visual mode we may end up after the line.\n if (curwin->w_cursor.col > 0 && ptr[curwin->w_cursor.col] == NUL)\n\t--curwin->w_cursor.col;",
" // Decrease the cursor column until it's on a non-blank.\n while (curwin->w_cursor.col > 0\n\t && VIM_ISWHITE(ptr[curwin->w_cursor.col]))\n\t--curwin->w_cursor.col;\n curwin->w_set_curswant = TRUE;\n adjust_for_sel(cap);\n}",
"/*\n * \"g$\" : Like \"$\" but for screen lines.\n */\n static void\nnv_g_dollar_cmd(cmdarg_T *cap)\n{\n oparg_T\t*oap = cap->oap;\n int\t\ti;\n int\t\tcol_off = curwin_col_off();",
" oap->motion_type = MCHAR;\n oap->inclusive = TRUE;\n if (curwin->w_p_wrap && curwin->w_width != 0)\n {\n\tcurwin->w_curswant = MAXCOL; // so we stay at the end\n\tif (cap->count1 == 1)\n\t{\n\t int\t\twidth1 = curwin->w_width - col_off;\n\t int\t\twidth2 = width1 + curwin_col_off2();",
"\t validate_virtcol();\n\t i = width1 - 1;\n\t if (curwin->w_virtcol >= (colnr_T)width1)\n\t\ti += ((curwin->w_virtcol - width1) / width2 + 1)\n\t\t * width2;\n\t coladvance((colnr_T)i);",
"\t // Make sure we stick in this column.\n\t validate_virtcol();\n\t curwin->w_curswant = curwin->w_virtcol;\n\t curwin->w_set_curswant = FALSE;\n\t if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)\n\t {\n\t\t// Check for landing on a character that got split at\n\t\t// the end of the line. We do not want to advance to\n\t\t// the next screen line.\n\t\tif (curwin->w_virtcol > (colnr_T)i)\n\t\t --curwin->w_cursor.col;\n\t }\n\t}\n\telse if (nv_screengo(oap, FORWARD, cap->count1 - 1) == FAIL)\n\t clearopbeep(oap);\n }\n else\n {\n\tif (cap->count1 > 1)\n\t // if it fails, let the cursor still move to the last char\n\t (void)cursor_down(cap->count1 - 1, FALSE);",
"\ti = curwin->w_leftcol + curwin->w_width - col_off - 1;\n\tcoladvance((colnr_T)i);",
"\t// if the character doesn't fit move one back\n\tif (curwin->w_cursor.col > 0\n\t\t&& (*mb_ptr2cells)(ml_get_cursor()) > 1)\n\t{\n\t colnr_T vcol;",
"\t getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol);\n\t if (vcol >= curwin->w_leftcol + curwin->w_width - col_off)\n\t\t--curwin->w_cursor.col;\n\t}",
"\t// Make sure we stick in this column.\n\tvalidate_virtcol();\n\tcurwin->w_curswant = curwin->w_virtcol;\n\tcurwin->w_set_curswant = FALSE;\n }\n}",
"/*\n * \"gi\": start Insert at the last position.\n */\n static void\nnv_gi_cmd(cmdarg_T *cap)\n{\n int\t\ti;",
" if (curbuf->b_last_insert.lnum != 0)\n {\n\tcurwin->w_cursor = curbuf->b_last_insert;\n\tcheck_cursor_lnum();\n\ti = (int)STRLEN(ml_get_curline());\n\tif (curwin->w_cursor.col > (colnr_T)i)\n\t{\n\t if (virtual_active())\n\t\tcurwin->w_cursor.coladd += curwin->w_cursor.col - i;\n\t curwin->w_cursor.col = i;\n\t}\n }\n cap->cmdchar = 'i';\n nv_edit(cap);\n}",
"/*\n * Commands starting with \"g\".\n */\n static void\nnv_g_cmd(cmdarg_T *cap)\n{\n oparg_T\t*oap = cap->oap;\n int\t\ti;",
" switch (cap->nchar)\n {\n case Ctrl_A:\n case Ctrl_X:\n#ifdef MEM_PROFILE\n // \"g^A\": dump log of used memory.\n\tif (!VIsual_active && cap->nchar == Ctrl_A)\n\t vim_mem_profile_dump();\n\telse\n#endif\n // \"g^A/g^X\": sequentially increment visually selected region\n\t if (VIsual_active)\n\t{\n\t cap->arg = TRUE;\n\t cap->cmdchar = cap->nchar;\n\t cap->nchar = NUL;\n\t nv_addsub(cap);\n\t}\n\telse\n\t clearopbeep(oap);\n\tbreak;",
" // \"gR\": Enter virtual replace mode.\n case 'R':\n\tcap->arg = TRUE;\n\tnv_Replace(cap);\n\tbreak;",
" case 'r':\n\tnv_vreplace(cap);\n\tbreak;",
" case '&':\n\tdo_cmdline_cmd((char_u *)\"%s//~/&\");\n\tbreak;",
" // \"gv\": Reselect the previous Visual area. If Visual already active,\n // exchange previous and current Visual area.\n case 'v':\n\tnv_gv_cmd(cap);\n\tbreak;",
" // \"gV\": Don't reselect the previous Visual area after a Select mode\n // mapping of menu.\n case 'V':\n\tVIsual_reselect = FALSE;\n\tbreak;",
" // \"gh\": start Select mode.\n // \"gH\": start Select line mode.\n // \"g^H\": start Select block mode.\n case K_BS:\n\tcap->nchar = Ctrl_H;\n\t// FALLTHROUGH\n case 'h':\n case 'H':\n case Ctrl_H:\n\tcap->cmdchar = cap->nchar + ('v' - 'h');\n\tcap->arg = TRUE;\n\tnv_visual(cap);\n\tbreak;",
" // \"gn\", \"gN\" visually select next/previous search match\n // \"gn\" selects next match\n // \"gN\" selects previous match\n case 'N':\n case 'n':\n\tif (!current_search(cap->count1, cap->nchar == 'n'))\n\t clearopbeep(oap);\n\tbreak;",
" // \"gj\" and \"gk\" two new funny movement keys -- up and down\n // movement based on *screen* line rather than *file* line.\n case 'j':\n case K_DOWN:\n\t// with 'nowrap' it works just like the normal \"j\" command.\n\tif (!curwin->w_p_wrap)\n\t{\n\t oap->motion_type = MLINE;\n\t i = cursor_down(cap->count1, oap->op_type == OP_NOP);\n\t}\n\telse\n\t i = nv_screengo(oap, FORWARD, cap->count1);\n\tif (i == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" case 'k':\n case K_UP:\n\t// with 'nowrap' it works just like the normal \"k\" command.\n\tif (!curwin->w_p_wrap)\n\t{\n\t oap->motion_type = MLINE;\n\t i = cursor_up(cap->count1, oap->op_type == OP_NOP);\n\t}\n\telse\n\t i = nv_screengo(oap, BACKWARD, cap->count1);\n\tif (i == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" // \"gJ\": join two lines without inserting a space.\n case 'J':\n\tnv_join(cap);\n\tbreak;",
" // \"g0\", \"g^\" : Like \"0\" and \"^\" but for screen lines.\n // \"gm\": middle of \"g0\" and \"g$\".\n case '^':\n case '0':\n case 'm':\n case K_HOME:\n case K_KHOME:\n\tnv_g_home_m_cmd(cap);\n\tbreak;",
" case 'M':\n\t{\n\t oap->motion_type = MCHAR;\n\t oap->inclusive = FALSE;\n\t i = linetabsize(ml_get_curline());\n\t if (cap->count0 > 0 && cap->count0 <= 100)\n\t\tcoladvance((colnr_T)(i * cap->count0 / 100));\n\t else\n\t\tcoladvance((colnr_T)(i / 2));\n\t curwin->w_set_curswant = TRUE;\n\t}\n\tbreak;",
" // \"g_\": to the last non-blank character in the line or <count> lines\n // downward.\n case '_':\n\tnv_g_underscore_cmd(cap);\n\tbreak;",
" // \"g$\" : Like \"$\" but for screen lines.\n case '$':\n case K_END:\n case K_KEND:\n\tnv_g_dollar_cmd(cap);\n\tbreak;",
" // \"g*\" and \"g#\", like \"*\" and \"#\" but without using \"\\<\" and \"\\>\"\n case '*':\n case '#':\n#if POUND != '#'\n case POUND:\t\t// pound sign (sometimes equal to '#')\n#endif\n case Ctrl_RSB:\t\t// :tag or :tselect for current identifier\n case ']':\t\t\t// :tselect for current identifier\n\tnv_ident(cap);\n\tbreak;",
" // ge and gE: go back to end of word\n case 'e':\n case 'E':\n\toap->motion_type = MCHAR;\n\tcurwin->w_set_curswant = TRUE;\n\toap->inclusive = TRUE;\n\tif (bckend_word(cap->count1, cap->nchar == 'E', FALSE) == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" // \"g CTRL-G\": display info about cursor position\n case Ctrl_G:\n\tcursor_pos_info(NULL);\n\tbreak;",
" // \"gi\": start Insert at the last position.\n case 'i':\n\tnv_gi_cmd(cap);\n\tbreak;",
" // \"gI\": Start insert in column 1.\n case 'I':\n\tbeginline(0);\n\tif (!checkclearopq(oap))\n\t invoke_edit(cap, FALSE, 'g', FALSE);\n\tbreak;",
"#ifdef FEAT_SEARCHPATH\n // \"gf\": goto file, edit file under cursor\n // \"]f\" and \"[f\": can also be used.\n case 'f':\n case 'F':\n\tnv_gotofile(cap);\n\tbreak;\n#endif",
" // \"g'm\" and \"g`m\": jump to mark without setting pcmark\n case '\\'':\n\tcap->arg = TRUE;\n\t// FALLTHROUGH\n case '`':\n\tnv_gomark(cap);\n\tbreak;",
" // \"gs\": Goto sleep.\n case 's':\n\tdo_sleep(cap->count1 * 1000L, FALSE);\n\tbreak;",
" // \"ga\": Display the ascii value of the character under the\n // cursor.\tIt is displayed in decimal, hex, and octal. -- webb\n case 'a':\n\tdo_ascii(NULL);\n\tbreak;",
" // \"g8\": Display the bytes used for the UTF-8 character under the\n // cursor.\tIt is displayed in hex.\n // \"8g8\" finds illegal byte sequence.\n case '8':\n\tif (cap->count0 == 8)\n\t utf_find_illegal();\n\telse\n\t show_utf8();\n\tbreak;",
" // \"g<\": show scrollback text\n case '<':\n\tshow_sb_text();\n\tbreak;",
" // \"gg\": Goto the first line in file. With a count it goes to\n // that line number like for \"G\". -- webb\n case 'g':\n\tcap->arg = FALSE;\n\tnv_goto(cap);\n\tbreak;",
" //\t Two-character operators:\n //\t \"gq\"\t Format text\n //\t \"gw\"\t Format text and keep cursor position\n //\t \"g~\"\t Toggle the case of the text.\n //\t \"gu\"\t Change text to lower case.\n //\t \"gU\"\t Change text to upper case.\n // \"g?\"\t rot13 encoding\n // \"g@\"\t call 'operatorfunc'\n case 'q':\n case 'w':\n\toap->cursor_start = curwin->w_cursor;\n\t// FALLTHROUGH\n case '~':\n case 'u':\n case 'U':\n case '?':\n case '@':\n\tnv_operator(cap);\n\tbreak;",
" // \"gd\": Find first occurrence of pattern under the cursor in the\n //\t current function\n // \"gD\": idem, but in the current file.\n case 'd':\n case 'D':\n\tnv_gd(oap, cap->nchar, (int)cap->count0);\n\tbreak;",
" // g<*Mouse> : <C-*mouse>\n case K_MIDDLEMOUSE:\n case K_MIDDLEDRAG:\n case K_MIDDLERELEASE:\n case K_LEFTMOUSE:\n case K_LEFTDRAG:\n case K_LEFTRELEASE:\n case K_MOUSEMOVE:\n case K_RIGHTMOUSE:\n case K_RIGHTDRAG:\n case K_RIGHTRELEASE:\n case K_X1MOUSE:\n case K_X1DRAG:\n case K_X1RELEASE:\n case K_X2MOUSE:\n case K_X2DRAG:\n case K_X2RELEASE:\n\tmod_mask = MOD_MASK_CTRL;\n\t(void)do_mouse(oap, cap->nchar, BACKWARD, cap->count1, 0);\n\tbreak;",
" case K_IGNORE:\n\tbreak;",
" // \"gP\" and \"gp\": same as \"P\" and \"p\" but leave cursor just after new text\n case 'p':\n case 'P':\n\tnv_put(cap);\n\tbreak;",
"#ifdef FEAT_BYTEOFF\n // \"go\": goto byte count from start of buffer\n case 'o':\n\tgoto_byte(cap->count0);\n\tbreak;\n#endif",
" // \"gQ\": improved Ex mode\n case 'Q':\n\tif (!check_text_locked(cap->oap) && !checkclearopq(oap))\n\t do_exmode(TRUE);\n\tbreak;",
" case ',':\n\tnv_pcmark(cap);\n\tbreak;",
" case ';':\n\tcap->count1 = -cap->count1;\n\tnv_pcmark(cap);\n\tbreak;",
" case 't':\n\tif (!checkclearop(oap))\n\t goto_tabpage((int)cap->count0);\n\tbreak;\n case 'T':\n\tif (!checkclearop(oap))\n\t goto_tabpage(-(int)cap->count1);\n\tbreak;",
" case TAB:\n\tif (!checkclearop(oap) && goto_tabpage_lastused() == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" case '+':\n case '-': // \"g+\" and \"g-\": undo or redo along the timeline\n\tif (!checkclearopq(oap))\n\t undo_time(cap->nchar == '-' ? -cap->count1 : cap->count1,\n\t\t\t\t\t\t\t FALSE, FALSE, FALSE);\n\tbreak;",
" default:\n\tclearopbeep(oap);\n\tbreak;\n }\n}",
"/*\n * Handle \"o\" and \"O\" commands.\n */\n static void\nn_opencmd(cmdarg_T *cap)\n{\n#ifdef FEAT_CONCEAL\n linenr_T\toldline = curwin->w_cursor.lnum;\n#endif",
" if (!checkclearopq(cap->oap))\n {\n#ifdef FEAT_FOLDING\n\tif (cap->cmdchar == 'O')\n\t // Open above the first line of a folded sequence of lines\n\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\t&curwin->w_cursor.lnum, NULL);\n\telse\n\t // Open below the last line of a folded sequence of lines\n\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\tNULL, &curwin->w_cursor.lnum);\n#endif\n\tif (u_save((linenr_T)(curwin->w_cursor.lnum -\n\t\t\t\t\t (cap->cmdchar == 'O' ? 1 : 0)),\n\t\t (linenr_T)(curwin->w_cursor.lnum +\n\t\t\t\t\t (cap->cmdchar == 'o' ? 1 : 0))\n\t\t ) == OK\n\t\t&& open_line(cap->cmdchar == 'O' ? BACKWARD : FORWARD,\n\t\t\t has_format_option(FO_OPEN_COMS) ? OPENLINE_DO_COM : 0,\n\t\t\t\t\t\t\t\t0, NULL) == OK)\n\t{\n#ifdef FEAT_CONCEAL\n\t if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum)\n\t\tredrawWinline(curwin, oldline);\n#endif\n#ifdef FEAT_SYN_HL\n\t if (curwin->w_p_cul)\n\t\t// force redraw of cursorline\n\t\tcurwin->w_valid &= ~VALID_CROW;\n#endif\n\t // When '#' is in 'cpoptions' ignore the count.\n\t if (vim_strchr(p_cpo, CPO_HASH) != NULL)\n\t\tcap->count1 = 1;\n\t invoke_edit(cap, FALSE, cap->cmdchar, TRUE);\n\t}\n }\n}",
"/*\n * \".\" command: redo last change.\n */\n static void\nnv_dot(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n {\n\t// If \"restart_edit\" is TRUE, the last but one command is repeated\n\t// instead of the last command (inserting text). This is used for\n\t// CTRL-O <.> in insert mode.\n\tif (start_redo(cap->count0, restart_edit != 0 && !arrow_used) == FAIL)\n\t clearopbeep(cap->oap);\n }\n}",
"/*\n * CTRL-R: undo undo or specify register in select mode\n */\n static void\nnv_redo_or_register(cmdarg_T *cap)\n{\n if (VIsual_select && VIsual_active)\n {\n\tint reg;\n\t// Get register name\n\t++no_mapping;\n\t++allow_keys;\n\treg = plain_vgetc();\n\tLANGMAP_ADJUST(reg, TRUE);\n\t--no_mapping;\n\t--allow_keys;",
"\tif (reg == '\"')\n\t // the unnamed register is 0\n\t reg = 0;",
"\tVIsual_select_reg = valid_yank_reg(reg, TRUE) ? reg : 0;\n\treturn;\n }",
" if (!checkclearopq(cap->oap))\n {\n\tu_redo((int)cap->count1);\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * Handle \"U\" command.\n */\n static void\nnv_Undo(cmdarg_T *cap)\n{\n // In Visual mode and typing \"gUU\" triggers an operator\n if (cap->oap->op_type == OP_UPPER || VIsual_active)\n {\n\t// translate \"gUU\" to \"gUgU\"\n\tcap->cmdchar = 'g';\n\tcap->nchar = 'U';\n\tnv_operator(cap);\n }\n else if (!checkclearopq(cap->oap))\n {\n\tu_undoline();\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * '~' command: If tilde is not an operator and Visual is off: swap case of a\n * single character.\n */\n static void\nnv_tilde(cmdarg_T *cap)\n{\n if (!p_to && !VIsual_active && cap->oap->op_type != OP_TILDE)\n {\n#ifdef FEAT_JOB_CHANNEL\n\tif (bt_prompt(curbuf) && !prompt_curpos_editable())\n\t{\n\t clearopbeep(cap->oap);\n\t return;\n\t}\n#endif\n\tn_swapchar(cap);\n }\n else\n\tnv_operator(cap);\n}",
"/*\n * Handle an operator command.\n * The actual work is done by do_pending_operator().\n */\n static void\nnv_operator(cmdarg_T *cap)\n{\n int\t op_type;",
" op_type = get_op_type(cap->cmdchar, cap->nchar);\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && op_is_change(op_type) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }\n#endif",
" if (op_type == cap->oap->op_type)\t // double operator works on lines\n\tnv_lineop(cap);\n else if (!checkclearop(cap->oap))\n {\n\tcap->oap->start = curwin->w_cursor;\n\tcap->oap->op_type = op_type;\n#ifdef FEAT_EVAL\n\tset_op_var(op_type);\n#endif\n }\n}",
"#ifdef FEAT_EVAL\n/*\n * Set v:operator to the characters for \"optype\".\n */\n static void\nset_op_var(int optype)\n{\n char_u\topchars[3];",
" if (optype == OP_NOP)\n\tset_vim_var_string(VV_OP, NULL, 0);\n else\n {\n\topchars[0] = get_op_char(optype);\n\topchars[1] = get_extra_op_char(optype);\n\topchars[2] = NUL;\n\tset_vim_var_string(VV_OP, opchars, -1);\n }\n}\n#endif",
"/*\n * Handle linewise operator \"dd\", \"yy\", etc.\n *\n * \"_\" is is a strange motion command that helps make operators more logical.\n * It is actually implemented, but not documented in the real Vi. This motion\n * command actually refers to \"the current line\". Commands like \"dd\" and \"yy\"\n * are really an alternate form of \"d_\" and \"y_\". It does accept a count, so\n * \"d3_\" works to delete 3 lines.\n */\n static void\nnv_lineop(cmdarg_T *cap)\n{\n cap->oap->motion_type = MLINE;\n if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL)\n\tclearopbeep(cap->oap);\n else if ( (cap->oap->op_type == OP_DELETE // only with linewise motions\n\t\t&& cap->oap->motion_force != 'v'\n\t\t&& cap->oap->motion_force != Ctrl_V)\n\t || cap->oap->op_type == OP_LSHIFT\n\t || cap->oap->op_type == OP_RSHIFT)\n\tbeginline(BL_SOL | BL_FIX);\n else if (cap->oap->op_type != OP_YANK)\t// 'Y' does not move cursor\n\tbeginline(BL_WHITE | BL_FIX);\n}",
"/*\n * <Home> command.\n */\n static void\nnv_home(cmdarg_T *cap)\n{\n // CTRL-HOME is like \"gg\"\n if (mod_mask & MOD_MASK_CTRL)\n\tnv_goto(cap);\n else\n {\n\tcap->count0 = 1;\n\tnv_pipe(cap);\n }\n ins_at_eol = FALSE;\t // Don't move cursor past eol (only necessary in a\n\t\t\t // one-character line).\n}",
"/*\n * \"|\" command.\n */\n static void\nnv_pipe(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n beginline(0);\n if (cap->count0 > 0)\n {\n\tcoladvance((colnr_T)(cap->count0 - 1));\n\tcurwin->w_curswant = (colnr_T)(cap->count0 - 1);\n }\n else\n\tcurwin->w_curswant = 0;\n // keep curswant at the column where we wanted to go, not where\n // we ended; differs if line is too short\n curwin->w_set_curswant = FALSE;\n}",
"/*\n * Handle back-word command \"b\" and \"B\".\n * cap->arg is 1 for \"B\"\n */\n static void\nnv_bck_word(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n curwin->w_set_curswant = TRUE;\n if (bck_word(cap->count1, cap->arg, FALSE) == FAIL)\n\tclearopbeep(cap->oap);\n#ifdef FEAT_FOLDING\n else if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Handle word motion commands \"e\", \"E\", \"w\" and \"W\".\n * cap->arg is TRUE for \"E\" and \"W\".\n */\n static void\nnv_wordcmd(cmdarg_T *cap)\n{\n int\t\tn;\n int\t\tword_end;\n int\t\tflag = FALSE;\n pos_T\tstartpos = curwin->w_cursor;",
" // Set inclusive for the \"E\" and \"e\" command.\n if (cap->cmdchar == 'e' || cap->cmdchar == 'E')\n\tword_end = TRUE;\n else\n\tword_end = FALSE;\n cap->oap->inclusive = word_end;",
" // \"cw\" and \"cW\" are a special case.\n if (!word_end && cap->oap->op_type == OP_CHANGE)\n {\n\tn = gchar_cursor();\n\tif (n != NUL)\t\t\t// not an empty line\n\t{\n\t if (VIM_ISWHITE(n))\n\t {\n\t\t// Reproduce a funny Vi behaviour: \"cw\" on a blank only\n\t\t// changes one character, not all blanks until the start of\n\t\t// the next word. Only do this when the 'w' flag is included\n\t\t// in 'cpoptions'.\n\t\tif (cap->count1 == 1 && vim_strchr(p_cpo, CPO_CW) != NULL)\n\t\t{\n\t\t cap->oap->inclusive = TRUE;\n\t\t cap->oap->motion_type = MCHAR;\n\t\t return;\n\t\t}\n\t }\n\t else\n\t {\n\t\t// This is a little strange. To match what the real Vi does,\n\t\t// we effectively map 'cw' to 'ce', and 'cW' to 'cE', provided\n\t\t// that we are not on a space or a TAB. This seems impolite\n\t\t// at first, but it's really more what we mean when we say\n\t\t// 'cw'.\n\t\t// Another strangeness: When standing on the end of a word\n\t\t// \"ce\" will change until the end of the next word, but \"cw\"\n\t\t// will change only one character! This is done by setting\n\t\t// flag.\n\t\tcap->oap->inclusive = TRUE;\n\t\tword_end = TRUE;\n\t\tflag = TRUE;\n\t }\n\t}\n }",
" cap->oap->motion_type = MCHAR;\n curwin->w_set_curswant = TRUE;\n if (word_end)\n\tn = end_word(cap->count1, cap->arg, flag, FALSE);\n else\n\tn = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP);",
" // Don't leave the cursor on the NUL past the end of line. Unless we\n // didn't move it forward.\n if (LT_POS(startpos, curwin->w_cursor))\n\tadjust_cursor(cap->oap);",
" if (n == FAIL && cap->oap->op_type == OP_NOP)\n\tclearopbeep(cap->oap);\n else\n {\n\tadjust_for_sel(cap);\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * Used after a movement command: If the cursor ends up on the NUL after the\n * end of the line, may move it back to the last character and make the motion\n * inclusive.\n */\n static void\nadjust_cursor(oparg_T *oap)\n{\n // The cursor cannot remain on the NUL when:\n // - the column is > 0\n // - not in Visual mode or 'selection' is \"o\"\n // - 'virtualedit' is not \"all\" and not \"onemore\".\n if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL\n\t\t&& (!VIsual_active || *p_sel == 'o')\n\t\t&& !virtual_active() && (get_ve_flags() & VE_ONEMORE) == 0)\n {\n\t--curwin->w_cursor.col;\n\t// prevent cursor from moving on the trail byte\n\tif (has_mbyte)\n\t mb_adjust_cursor();\n\toap->inclusive = TRUE;\n }\n}",
"/*\n * \"0\" and \"^\" commands.\n * cap->arg is the argument for beginline().\n */\n static void\nnv_beginline(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n beginline(cap->arg);\n#ifdef FEAT_FOLDING\n if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n ins_at_eol = FALSE;\t // Don't move cursor past eol (only necessary in a\n\t\t\t // one-character line).\n}",
"/*\n * In exclusive Visual mode, may include the last character.\n */\n static void\nadjust_for_sel(cmdarg_T *cap)\n{\n if (VIsual_active && cap->oap->inclusive && *p_sel == 'e'\n\t && gchar_cursor() != NUL && LT_POS(VIsual, curwin->w_cursor))\n {\n\tif (has_mbyte)\n\t inc_cursor();\n\telse\n\t ++curwin->w_cursor.col;\n\tcap->oap->inclusive = FALSE;\n }\n}",
"/*\n * Exclude last character at end of Visual area for 'selection' == \"exclusive\".\n * Should check VIsual_mode before calling this.\n * Returns TRUE when backed up to the previous line.\n */\n int\nunadjust_for_sel(void)\n{\n pos_T\t*pp;",
" if (*p_sel == 'e' && !EQUAL_POS(VIsual, curwin->w_cursor))\n {\n\tif (LT_POS(VIsual, curwin->w_cursor))\n\t pp = &curwin->w_cursor;\n\telse\n\t pp = &VIsual;\n\tif (pp->coladd > 0)\n\t --pp->coladd;\n\telse\n\tif (pp->col > 0)\n\t{\n\t --pp->col;\n\t mb_adjustpos(curbuf, pp);\n\t}\n\telse if (pp->lnum > 1)\n\t{\n\t --pp->lnum;\n\t pp->col = (colnr_T)STRLEN(ml_get(pp->lnum));\n\t return TRUE;\n\t}\n }\n return FALSE;\n}",
"/*\n * SELECT key in Normal or Visual mode: end of Select mode mapping.\n */\n static void\nnv_select(cmdarg_T *cap)\n{\n if (VIsual_active)\n {\n\tVIsual_select = TRUE;\n\tVIsual_select_reg = 0;\n }\n else if (VIsual_reselect)\n {\n\tcap->nchar = 'v';\t // fake \"gv\" command\n\tcap->arg = TRUE;\n\tnv_g_cmd(cap);\n }\n}",
"\n/*\n * \"G\", \"gg\", CTRL-END, CTRL-HOME.\n * cap->arg is TRUE for \"G\".\n */\n static void\nnv_goto(cmdarg_T *cap)\n{\n linenr_T\tlnum;",
" if (cap->arg)\n\tlnum = curbuf->b_ml.ml_line_count;\n else\n\tlnum = 1L;\n cap->oap->motion_type = MLINE;\n setpcmark();",
" // When a count is given, use it instead of the default lnum\n if (cap->count0 != 0)\n\tlnum = cap->count0;\n if (lnum < 1L)\n\tlnum = 1L;\n else if (lnum > curbuf->b_ml.ml_line_count)\n\tlnum = curbuf->b_ml.ml_line_count;\n curwin->w_cursor.lnum = lnum;\n beginline(BL_SOL | BL_FIX);\n#ifdef FEAT_FOLDING\n if ((fdo_flags & FDO_JUMP) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * CTRL-\\ in Normal mode.\n */\n static void\nnv_normal(cmdarg_T *cap)\n{\n if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G)\n {\n\tclearop(cap->oap);\n\tif (restart_edit != 0 && mode_displayed)\n\t clear_cmdline = TRUE;\t\t// unshow mode later\n\trestart_edit = 0;\n#ifdef FEAT_CMDWIN\n\tif (cmdwin_type != 0)\n\t cmdwin_result = Ctrl_C;\n#endif\n\tif (VIsual_active)\n\t{\n\t end_visual_mode();\t\t// stop Visual\n\t redraw_curbuf_later(INVERTED);\n\t}\n\t// CTRL-\\ CTRL-G restarts Insert mode when 'insertmode' is set.\n\tif (cap->nchar == Ctrl_G && p_im)\n\t restart_edit = 'a';\n }\n else\n\tclearopbeep(cap->oap);\n}",
"/*\n * ESC in Normal mode: beep, but don't flush buffers.\n * Don't even beep if we are canceling a command.\n */\n static void\nnv_esc(cmdarg_T *cap)\n{\n int\t\tno_reason;",
" no_reason = (cap->oap->op_type == OP_NOP\n\t\t&& cap->opcount == 0\n\t\t&& cap->count0 == 0\n\t\t&& cap->oap->regname == 0\n\t\t&& !p_im);",
" if (cap->arg)\t\t// TRUE for CTRL-C\n {\n\tif (restart_edit == 0\n#ifdef FEAT_CMDWIN\n\t\t&& cmdwin_type == 0\n#endif\n\t\t&& !VIsual_active\n\t\t&& no_reason)\n\t{\n\t if (anyBufIsChanged())\n\t\tmsg(_(\"Type :qa! and press <Enter> to abandon all changes and exit Vim\"));\n\t else\n\t\tmsg(_(\"Type :qa and press <Enter> to exit Vim\"));\n\t}",
"\t// Don't reset \"restart_edit\" when 'insertmode' is set, it won't be\n\t// set again below when halfway a mapping.\n\tif (!p_im)\n\t restart_edit = 0;\n#ifdef FEAT_CMDWIN\n\tif (cmdwin_type != 0)\n\t{\n\t cmdwin_result = K_IGNORE;\n\t got_int = FALSE;\t// don't stop executing autocommands et al.\n\t return;\n\t}\n#endif\n }\n#ifdef FEAT_CMDWIN\n else if (cmdwin_type != 0 && ex_normal_busy)\n {\n\t// When :normal runs out of characters while in the command line window\n\t// vgetorpeek() will return ESC. Exit the cmdline window to break the\n\t// loop.\n\tcmdwin_result = K_IGNORE;\n\treturn;\n }\n#endif",
" if (VIsual_active)\n {\n\tend_visual_mode();\t// stop Visual\n\tcheck_cursor_col();\t// make sure cursor is not beyond EOL\n\tcurwin->w_set_curswant = TRUE;\n\tredraw_curbuf_later(INVERTED);\n }\n else if (no_reason)\n\tvim_beep(BO_ESC);\n clearop(cap->oap);",
" // A CTRL-C is often used at the start of a menu. When 'insertmode' is\n // set return to Insert mode afterwards.\n if (restart_edit == 0 && goto_im() && ex_normal_busy == 0)\n\trestart_edit = 'a';\n}",
"/*\n * Move the cursor for the \"A\" command.\n */\n void\nset_cursor_for_append_to_line(void)\n{\n curwin->w_set_curswant = TRUE;\n if (get_ve_flags() == VE_ALL)\n {\n\tint save_State = State;",
"\t// Pretend Insert mode here to allow the cursor on the\n\t// character past the end of the line\n\tState = MODE_INSERT;\n\tcoladvance((colnr_T)MAXCOL);\n\tState = save_State;\n }\n else\n\tcurwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor());\n}",
"/*\n * Handle \"A\", \"a\", \"I\", \"i\" and <Insert> commands.\n * Also handle K_PS, start bracketed paste.\n */\n static void\nnv_edit(cmdarg_T *cap)\n{\n // <Insert> is equal to \"i\"\n if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS)\n\tcap->cmdchar = 'i';",
" // in Visual mode \"A\" and \"I\" are an operator\n if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I'))\n {\n#ifdef FEAT_TERMINAL\n\tif (term_in_normal_mode())\n\t{\n\t end_visual_mode();\n\t clearop(cap->oap);\n\t term_enter_job_mode();\n\t return;\n\t}\n#endif\n\tv_visop(cap);\n }",
" // in Visual mode and after an operator \"a\" and \"i\" are for text objects\n else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i')\n\t && (cap->oap->op_type != OP_NOP || VIsual_active))\n {\n#ifdef FEAT_TEXTOBJ\n\tnv_object(cap);\n#else\n\tclearopbeep(cap->oap);\n#endif\n }\n#ifdef FEAT_TERMINAL\n else if (term_in_normal_mode())\n {\n\tclearop(cap->oap);\n\tterm_enter_job_mode();\n\treturn;\n }\n#endif\n else if (!curbuf->b_p_ma && !p_im)\n {\n\t// Only give this error when 'insertmode' is off.\n\temsg(_(e_cannot_make_changes_modifiable_is_off));\n\tclearop(cap->oap);\n\tif (cap->cmdchar == K_PS)\n\t // drop the pasted text\n\t bracketed_paste(PASTE_INSERT, TRUE, NULL);\n }\n else if (cap->cmdchar == K_PS && VIsual_active)\n {\n\tpos_T old_pos = curwin->w_cursor;\n\tpos_T old_visual = VIsual;\n\tint old_visual_mode = VIsual_mode;",
"\t// In Visual mode the selected text is deleted.\n\tif (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum)\n\t{\n\t shift_delete_registers();\n\t cap->oap->regname = '1';\n\t}\n\telse\n\t cap->oap->regname = '-';\n\tcap->cmdchar = 'd';\n\tcap->nchar = NUL;\n\tnv_operator(cap);\n\tdo_pending_operator(cap, 0, FALSE);\n\tcap->cmdchar = K_PS;",
"\tif (*ml_get_cursor() != NUL)\n\t{\n\t if (old_visual_mode == 'V')\n\t {\n\t\t// In linewise Visual mode insert before the beginning of the\n\t\t// next line.\n\t\t// When the last line in the buffer was deleted then create a\n\t\t// new line, otherwise there is not need to move cursor.\n\t\t// Detect this by checking if cursor moved above Visual area.\n\t\tif (curwin->w_cursor.lnum < old_pos.lnum\n\t\t\t\t&& curwin->w_cursor.lnum < old_visual.lnum)\n\t\t{\n\t\t if (u_save_cursor() == OK)\n\t\t {\n\t\t\tml_append(curwin->w_cursor.lnum, (char_u *)\"\", 0,\n\t\t\t\t\t\t\t\t\tFALSE);\n\t\t\tappended_lines(curwin->w_cursor.lnum++, 1L);\n\t\t }\n\t\t}\n\t }\n\t // When the last char in the line was deleted then append.\n\t // Detect this by checking if cursor moved before Visual area.\n\t else if (curwin->w_cursor.col < old_pos.col\n\t\t\t\t&& curwin->w_cursor.col < old_visual.col)\n\t\tinc_cursor();\n\t}",
"\t// Insert to replace the deleted text with the pasted text.\n\tinvoke_edit(cap, FALSE, cap->cmdchar, FALSE);\n }\n else if (!checkclearopq(cap->oap))\n {\n\tswitch (cap->cmdchar)\n\t{\n\t case 'A':\t// \"A\"ppend after the line\n\t\tset_cursor_for_append_to_line();\n\t\tbreak;",
"\t case 'I':\t// \"I\"nsert before the first non-blank\n\t\tif (vim_strchr(p_cpo, CPO_INSEND) == NULL)\n\t\t beginline(BL_WHITE);\n\t\telse\n\t\t beginline(BL_WHITE|BL_FIX);\n\t\tbreak;",
"\t case K_PS:\n\t\t// Bracketed paste works like \"a\"ppend, unless the cursor is in\n\t\t// the first column, then it inserts.\n\t\tif (curwin->w_cursor.col == 0)\n\t\t break;\n\t\t// FALLTHROUGH",
"\t case 'a':\t// \"a\"ppend is like \"i\"nsert on the next character.\n\t\t// increment coladd when in virtual space, increment the\n\t\t// column otherwise, also to append after an unprintable char\n\t\tif (virtual_active()\n\t\t\t&& (curwin->w_cursor.coladd > 0\n\t\t\t || *ml_get_cursor() == NUL\n\t\t\t || *ml_get_cursor() == TAB))\n\t\t curwin->w_cursor.coladd++;\n\t\telse if (*ml_get_cursor() != NUL)\n\t\t inc_cursor();\n\t\tbreak;\n\t}",
"\tif (curwin->w_cursor.coladd && cap->cmdchar != 'A')\n\t{\n\t int save_State = State;",
"\t // Pretend Insert mode here to allow the cursor on the\n\t // character past the end of the line\n\t State = MODE_INSERT;\n\t coladvance(getviscol());\n\t State = save_State;\n\t}",
"\tinvoke_edit(cap, FALSE, cap->cmdchar, FALSE);\n }\n else if (cap->cmdchar == K_PS)\n\t// drop the pasted text\n\tbracketed_paste(PASTE_INSERT, TRUE, NULL);\n}",
"/*\n * Invoke edit() and take care of \"restart_edit\" and the return value.\n */\n static void\ninvoke_edit(\n cmdarg_T\t*cap,\n int\t\trepl,\t\t// \"r\" or \"gr\" command\n int\t\tcmd,\n int\t\tstartln)\n{\n int\t\trestart_edit_save = 0;",
" // Complicated: When the user types \"a<C-O>a\" we don't want to do Insert\n // mode recursively. But when doing \"a<C-O>.\" or \"a<C-O>rx\" we do allow\n // it.\n if (repl || !stuff_empty())\n\trestart_edit_save = restart_edit;\n else\n\trestart_edit_save = 0;",
" // Always reset \"restart_edit\", this is not a restarted edit.\n restart_edit = 0;",
" if (edit(cmd, startln, cap->count1))\n\tcap->retval |= CA_COMMAND_BUSY;",
" if (restart_edit == 0)\n\trestart_edit = restart_edit_save;\n}",
"#ifdef FEAT_TEXTOBJ\n/*\n * \"a\" or \"i\" while an operator is pending or in Visual mode: object motion.\n */\n static void\nnv_object(\n cmdarg_T\t*cap)\n{\n int\t\tflag;\n int\t\tinclude;\n char_u\t*mps_save;",
" if (cap->cmdchar == 'i')\n\tinclude = FALSE; // \"ix\" = inner object: exclude white space\n else\n\tinclude = TRUE;\t // \"ax\" = an object: include white space",
" // Make sure (), [], {} and <> are in 'matchpairs'\n mps_save = curbuf->b_p_mps;\n curbuf->b_p_mps = (char_u *)\"(:),{:},[:],<:>\";",
" switch (cap->nchar)\n {\n\tcase 'w': // \"aw\" = a word\n\t\tflag = current_word(cap->oap, cap->count1, include, FALSE);\n\t\tbreak;\n\tcase 'W': // \"aW\" = a WORD\n\t\tflag = current_word(cap->oap, cap->count1, include, TRUE);\n\t\tbreak;\n\tcase 'b': // \"ab\" = a braces block\n\tcase '(':\n\tcase ')':\n\t\tflag = current_block(cap->oap, cap->count1, include, '(', ')');\n\t\tbreak;\n\tcase 'B': // \"aB\" = a Brackets block\n\tcase '{':\n\tcase '}':\n\t\tflag = current_block(cap->oap, cap->count1, include, '{', '}');\n\t\tbreak;\n\tcase '[': // \"a[\" = a [] block\n\tcase ']':\n\t\tflag = current_block(cap->oap, cap->count1, include, '[', ']');\n\t\tbreak;\n\tcase '<': // \"a<\" = a <> block\n\tcase '>':\n\t\tflag = current_block(cap->oap, cap->count1, include, '<', '>');\n\t\tbreak;\n\tcase 't': // \"at\" = a tag block (xml and html)\n\t\t// Do not adjust oap->end in do_pending_operator()\n\t\t// otherwise there are different results for 'dit'\n\t\t// (note leading whitespace in last line):\n\t\t// 1) <b> 2) <b>\n\t\t// foobar foobar\n\t\t// </b> </b>\n\t\tcap->retval |= CA_NO_ADJ_OP_END;\n\t\tflag = current_tagblock(cap->oap, cap->count1, include);\n\t\tbreak;\n\tcase 'p': // \"ap\" = a paragraph\n\t\tflag = current_par(cap->oap, cap->count1, include, 'p');\n\t\tbreak;\n\tcase 's': // \"as\" = a sentence\n\t\tflag = current_sent(cap->oap, cap->count1, include);\n\t\tbreak;\n\tcase '\"': // \"a\"\" = a double quoted string\n\tcase '\\'': // \"a'\" = a single quoted string\n\tcase '`': // \"a`\" = a backtick quoted string\n\t\tflag = current_quote(cap->oap, cap->count1, include,\n\t\t\t\t\t\t\t\t cap->nchar);\n\t\tbreak;\n#if 0\t// TODO\n\tcase 'S': // \"aS\" = a section\n\tcase 'f': // \"af\" = a filename\n\tcase 'u': // \"au\" = a URL\n#endif\n\tdefault:\n\t\tflag = FAIL;\n\t\tbreak;\n }",
" curbuf->b_p_mps = mps_save;\n if (flag == FAIL)\n\tclearopbeep(cap->oap);\n adjust_cursor_col();\n curwin->w_set_curswant = TRUE;\n}\n#endif",
"/*\n * \"q\" command: Start/stop recording.\n * \"q:\", \"q/\", \"q?\": edit command-line in command-line window.\n */\n static void\nnv_record(cmdarg_T *cap)\n{\n if (cap->oap->op_type == OP_FORMAT)\n {\n\t// \"gqq\" is the same as \"gqgq\": format line\n\tcap->cmdchar = 'g';\n\tcap->nchar = 'q';\n\tnv_operator(cap);\n }\n else if (!checkclearop(cap->oap))\n {\n#ifdef FEAT_CMDWIN\n\tif (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?')\n\t{\n\t stuffcharReadbuff(cap->nchar);\n\t stuffcharReadbuff(K_CMDWIN);\n\t}\n\telse\n#endif\n\t // (stop) recording into a named register, unless executing a\n\t // register\n\t if (reg_executing == 0 && do_record(cap->nchar) == FAIL)\n\t\tclearopbeep(cap->oap);\n }\n}",
"/*\n * Handle the \"@r\" command.\n */\n static void\nnv_at(cmdarg_T *cap)\n{\n if (checkclearop(cap->oap))\n\treturn;\n#ifdef FEAT_EVAL\n if (cap->nchar == '=')\n {\n\tif (get_expr_register() == NUL)\n\t return;\n }\n#endif\n while (cap->count1-- && !got_int)\n {\n\tif (do_execreg(cap->nchar, FALSE, FALSE, FALSE) == FAIL)\n\t{\n\t clearopbeep(cap->oap);\n\t break;\n\t}\n\tline_breakcheck();\n }\n}",
"/*\n * Handle the CTRL-U and CTRL-D commands.\n */\n static void\nnv_halfpage(cmdarg_T *cap)\n{\n if ((cap->cmdchar == Ctrl_U && curwin->w_cursor.lnum == 1)\n\t || (cap->cmdchar == Ctrl_D\n\t\t&& curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count))\n\tclearopbeep(cap->oap);\n else if (!checkclearop(cap->oap))\n\thalfpage(cap->cmdchar == Ctrl_D, cap->count0);\n}",
"/*\n * Handle \"J\" or \"gJ\" command.\n */\n static void\nnv_join(cmdarg_T *cap)\n{\n if (VIsual_active)\t// join the visual lines\n\tnv_operator(cap);\n else if (!checkclearop(cap->oap))\n {\n\tif (cap->count0 <= 1)\n\t cap->count0 = 2;\t // default for join is two lines!\n\tif (curwin->w_cursor.lnum + cap->count0 - 1 >\n\t\t\t\t\t\t curbuf->b_ml.ml_line_count)\n\t{\n\t // can't join when on the last line\n\t if (cap->count0 <= 2)\n\t {\n\t\tclearopbeep(cap->oap);\n\t\treturn;\n\t }\n\t cap->count0 = curbuf->b_ml.ml_line_count\n\t\t\t\t\t\t - curwin->w_cursor.lnum + 1;\n\t}",
"\tprep_redo(cap->oap->regname, cap->count0,\n\t\t\t\t NUL, cap->cmdchar, NUL, NUL, cap->nchar);\n\t(void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);\n }\n}",
"/*\n * \"P\", \"gP\", \"p\" and \"gp\" commands.\n */\n static void\nnv_put(cmdarg_T *cap)\n{\n nv_put_opt(cap, FALSE);\n}",
"/*\n * \"P\", \"gP\", \"p\" and \"gp\" commands.\n * \"fix_indent\" is TRUE for \"[p\", \"[P\", \"]p\" and \"]P\".\n */\n static void\nnv_put_opt(cmdarg_T *cap, int fix_indent)\n{\n int\t\tregname = 0;\n void\t*reg1 = NULL, *reg2 = NULL;\n int\t\tempty = FALSE;\n int\t\twas_visual = FALSE;\n int\t\tdir;\n int\t\tflags = 0;\n int\t\tkeep_registers = FALSE;",
" if (cap->oap->op_type != OP_NOP)\n {\n#ifdef FEAT_DIFF\n\t// \"dp\" is \":diffput\"\n\tif (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p')\n\t{\n\t clearop(cap->oap);\n\t nv_diffgetput(TRUE, cap->opcount);\n\t}\n\telse\n#endif\n\tclearopbeep(cap->oap);\n }\n#ifdef FEAT_JOB_CHANNEL\n else if (bt_prompt(curbuf) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n }\n#endif\n else\n {\n\tif (fix_indent)\n\t{\n\t dir = (cap->cmdchar == ']' && cap->nchar == 'p')\n\t\t\t\t\t\t\t ? FORWARD : BACKWARD;\n\t flags |= PUT_FIXINDENT;\n\t}\n\telse\n\t dir = (cap->cmdchar == 'P'\n\t\t || ((cap->cmdchar == 'g' || cap->cmdchar == 'z')\n\t\t\t&& cap->nchar == 'P')) ? BACKWARD : FORWARD;\n\tprep_redo_cmd(cap);\n\tif (cap->cmdchar == 'g')\n\t flags |= PUT_CURSEND;\n\telse if (cap->cmdchar == 'z')\n\t flags |= PUT_BLOCK_INNER;",
"\tif (VIsual_active)\n\t{\n\t // Putting in Visual mode: The put text replaces the selected\n\t // text. First delete the selected text, then put the new text.\n\t // Need to save and restore the registers that the delete\n\t // overwrites if the old contents is being put.\n\t was_visual = TRUE;\n\t regname = cap->oap->regname;\n\t keep_registers = cap->cmdchar == 'P';\n#ifdef FEAT_CLIPBOARD\n\t adjust_clip_reg(®name);\n#endif\n\t if (regname == 0 || regname == '\"'\n\t\t\t\t || VIM_ISDIGIT(regname) || regname == '-'\n#ifdef FEAT_CLIPBOARD\n\t\t || (clip_unnamed && (regname == '*' || regname == '+'))\n#endif",
"\t\t )\n\t {\n\t\t// The delete is going to overwrite the register we want to\n\t\t// put, save it first.\n\t\treg1 = get_register(regname, TRUE);\n\t }",
"\t // Now delete the selected text. Avoid messages here.\n\t cap->cmdchar = 'd';\n\t cap->nchar = NUL;\n\t cap->oap->regname = keep_registers ? '_' : NUL;\n\t ++msg_silent;\n\t nv_operator(cap);\n\t do_pending_operator(cap, 0, FALSE);\n\t empty = (curbuf->b_ml.ml_flags & ML_EMPTY);\n\t --msg_silent;",
"\t // delete PUT_LINE_BACKWARD;\n\t cap->oap->regname = regname;",
"\t if (reg1 != NULL)\n\t {\n\t\t// Delete probably changed the register we want to put, save\n\t\t// it first. Then put back what was there before the delete.\n\t\treg2 = get_register(regname, FALSE);\n\t\tput_register(regname, reg1);\n\t }",
"\t // When deleted a linewise Visual area, put the register as\n\t // lines to avoid it joined with the next line. When deletion was\n\t // characterwise, split a line when putting lines.\n\t if (VIsual_mode == 'V')\n\t\tflags |= PUT_LINE;\n\t else if (VIsual_mode == 'v')\n\t\tflags |= PUT_LINE_SPLIT;\n\t if (VIsual_mode == Ctrl_V && dir == FORWARD)\n\t\tflags |= PUT_LINE_FORWARD;\n\t dir = BACKWARD;\n\t if ((VIsual_mode != 'V'\n\t\t\t&& curwin->w_cursor.col < curbuf->b_op_start.col)\n\t\t || (VIsual_mode == 'V'\n\t\t\t&& curwin->w_cursor.lnum < curbuf->b_op_start.lnum))\n\t\t// cursor is at the end of the line or end of file, put\n\t\t// forward.\n\t\tdir = FORWARD;\n\t // May have been reset in do_put().\n\t VIsual_active = TRUE;\n\t}\n\tdo_put(cap->oap->regname, NULL, dir, cap->count1, flags);",
"\t// If a register was saved, put it back now.\n\tif (reg2 != NULL)\n\t put_register(regname, reg2);",
"\t// What to reselect with \"gv\"? Selecting the just put text seems to\n\t// be the most useful, since the original text was removed.\n\tif (was_visual)\n\t{\n\t curbuf->b_visual.vi_start = curbuf->b_op_start;\n\t curbuf->b_visual.vi_end = curbuf->b_op_end;\n\t // need to adjust cursor position\n\t if (*p_sel == 'e')\n\t\tinc(&curbuf->b_visual.vi_end);\n\t}",
"\t// When all lines were selected and deleted do_put() leaves an empty\n\t// line that needs to be deleted now.\n\tif (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL)\n\t{\n\t ml_delete_flags(curbuf->b_ml.ml_line_count, ML_DEL_MESSAGE);\n\t deleted_lines(curbuf->b_ml.ml_line_count + 1, 1);",
"\t // If the cursor was in that line, move it to the end of the last\n\t // line.\n\t if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t {\n\t\tcurwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t\tcoladvance((colnr_T)MAXCOL);\n\t }\n\t}\n\tauto_format(FALSE, TRUE);\n }\n}",
"/*\n * \"o\" and \"O\" commands.\n */\n static void\nnv_open(cmdarg_T *cap)\n{\n#ifdef FEAT_DIFF\n // \"do\" is \":diffget\"\n if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o')\n {\n\tclearop(cap->oap);\n\tnv_diffgetput(FALSE, cap->opcount);\n }\n else\n#endif\n if (VIsual_active) // switch start and end of visual\n\tv_swap_corners(cap->cmdchar);\n#ifdef FEAT_JOB_CHANNEL\n else if (bt_prompt(curbuf))\n\tclearopbeep(cap->oap);\n#endif\n else\n\tn_opencmd(cap);\n}",
"#ifdef FEAT_NETBEANS_INTG\n static void\nnv_nbcmd(cmdarg_T *cap)\n{\n netbeans_keycommand(cap->nchar);\n}\n#endif",
"#ifdef FEAT_DND\n static void\nnv_drop(cmdarg_T *cap UNUSED)\n{\n do_put('~', NULL, BACKWARD, 1L, PUT_CURSEND);\n}\n#endif",
"/*\n * Trigger CursorHold event.\n * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the\n * input buffer. \"did_cursorhold\" is set to avoid retriggering.\n */\n static void\nnv_cursorhold(cmdarg_T *cap)\n{\n apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);\n did_cursorhold = TRUE;\n cap->retval |= CA_COMMAND_BUSY;\t// don't call edit() now\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [4474, 1400, 736], "buggy_code_start_loc": [4466, 1400, 736], "filenames": ["src/normal.c", "src/testdir/test_tagjump.vim", "src/version.c"], "fixing_code_end_loc": [4481, 1407, 739], "fixing_code_start_loc": [4467, 1401, 737], "message": "Use After Free in GitHub repository vim/vim prior to 8.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "C9328925-FDFF-4283-A085-666EB6616272", "versionEndExcluding": "8.2.5024", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*", "matchCriteriaId": "71E032AD-F827-4944-9699-BB1E6D4233FC", "versionEndExcluding": "13.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use After Free in GitHub repository vim/vim prior to 8.2."}, {"lang": "es", "value": "Un Uso de Memoria Previamente Liberada en el repositorio de GitHub vim/vim versiones anteriores a 8.2"}], "evaluatorComment": null, "id": "CVE-2022-1898", "lastModified": "2023-05-03T12:15:36.347", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-05-27T09:15:08.030", "references": [{"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/28"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/41"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/45aad635-c2f1-47ca-a4f9-db5b25979cea"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00014.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZSLFIKFYU5Y2KM5EJKQNYHWRUBDQ4GJ/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMFHBC5OQXDPV2SDYA2JUQGVCPYASTJB/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TYNK6SDCMOLQJOI3B4AOE66P2G2IH4ZM/"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/202208-32"}, {"source": "security@huntr.dev", "tags": null, "url": "https://security.gentoo.org/glsa/202305-16"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://support.apple.com/kb/HT213488"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, "type": "CWE-416"}
| 103
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\tby Bram Moolenaar et al.\n *\n * Do \":help uganda\" in Vim to read copying and usage conditions.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */\n/*\n * normal.c:\tContains the main routine for processing characters in command\n *\t\tmode. Communicates closely with the code in ops.c to handle\n *\t\tthe operators.\n */",
"#include \"vim.h\"",
"static int\tVIsual_mode_orig = NUL;\t\t// saved Visual mode",
"#ifdef FEAT_EVAL\nstatic void\tset_vcount_ca(cmdarg_T *cap, int *set_prevcount);\n#endif\nstatic void\tunshift_special(cmdarg_T *cap);\n#ifdef FEAT_CMDL_INFO\nstatic void\tdel_from_showcmd(int);\n#endif",
"/*\n * nv_*(): functions called to handle Normal and Visual mode commands.\n * n_*(): functions called to handle Normal mode commands.\n * v_*(): functions called to handle Visual mode commands.\n */\nstatic void\tnv_ignore(cmdarg_T *cap);\nstatic void\tnv_nop(cmdarg_T *cap);\nstatic void\tnv_error(cmdarg_T *cap);\nstatic void\tnv_help(cmdarg_T *cap);\nstatic void\tnv_addsub(cmdarg_T *cap);\nstatic void\tnv_page(cmdarg_T *cap);\nstatic void\tnv_zet(cmdarg_T *cap);\n#ifdef FEAT_GUI\nstatic void\tnv_ver_scrollbar(cmdarg_T *cap);\nstatic void\tnv_hor_scrollbar(cmdarg_T *cap);\n#endif\n#ifdef FEAT_GUI_TABLINE\nstatic void\tnv_tabline(cmdarg_T *cap);\nstatic void\tnv_tabmenu(cmdarg_T *cap);\n#endif\nstatic void\tnv_exmode(cmdarg_T *cap);\nstatic void\tnv_colon(cmdarg_T *cap);\nstatic void\tnv_ctrlg(cmdarg_T *cap);\nstatic void\tnv_ctrlh(cmdarg_T *cap);\nstatic void\tnv_clear(cmdarg_T *cap);\nstatic void\tnv_ctrlo(cmdarg_T *cap);\nstatic void\tnv_hat(cmdarg_T *cap);\nstatic void\tnv_Zet(cmdarg_T *cap);\nstatic void\tnv_ident(cmdarg_T *cap);\nstatic void\tnv_tagpop(cmdarg_T *cap);\nstatic void\tnv_scroll(cmdarg_T *cap);\nstatic void\tnv_right(cmdarg_T *cap);\nstatic void\tnv_left(cmdarg_T *cap);\nstatic void\tnv_up(cmdarg_T *cap);\nstatic void\tnv_down(cmdarg_T *cap);\nstatic void\tnv_end(cmdarg_T *cap);\nstatic void\tnv_dollar(cmdarg_T *cap);\nstatic void\tnv_search(cmdarg_T *cap);\nstatic void\tnv_next(cmdarg_T *cap);\nstatic int\tnormal_search(cmdarg_T *cap, int dir, char_u *pat, int opt, int *wrapped);\nstatic void\tnv_csearch(cmdarg_T *cap);\nstatic void\tnv_brackets(cmdarg_T *cap);\nstatic void\tnv_percent(cmdarg_T *cap);\nstatic void\tnv_brace(cmdarg_T *cap);\nstatic void\tnv_mark(cmdarg_T *cap);\nstatic void\tnv_findpar(cmdarg_T *cap);\nstatic void\tnv_undo(cmdarg_T *cap);\nstatic void\tnv_kundo(cmdarg_T *cap);\nstatic void\tnv_Replace(cmdarg_T *cap);\nstatic void\tnv_replace(cmdarg_T *cap);\nstatic void\tnv_cursormark(cmdarg_T *cap, int flag, pos_T *pos);\nstatic void\tv_visop(cmdarg_T *cap);\nstatic void\tnv_subst(cmdarg_T *cap);\nstatic void\tnv_abbrev(cmdarg_T *cap);\nstatic void\tnv_optrans(cmdarg_T *cap);\nstatic void\tnv_gomark(cmdarg_T *cap);\nstatic void\tnv_pcmark(cmdarg_T *cap);\nstatic void\tnv_regname(cmdarg_T *cap);\nstatic void\tnv_visual(cmdarg_T *cap);\nstatic void\tn_start_visual_mode(int c);\nstatic void\tnv_window(cmdarg_T *cap);\nstatic void\tnv_suspend(cmdarg_T *cap);\nstatic void\tnv_g_cmd(cmdarg_T *cap);\nstatic void\tnv_dot(cmdarg_T *cap);\nstatic void\tnv_redo_or_register(cmdarg_T *cap);\nstatic void\tnv_Undo(cmdarg_T *cap);\nstatic void\tnv_tilde(cmdarg_T *cap);\nstatic void\tnv_operator(cmdarg_T *cap);\n#ifdef FEAT_EVAL\nstatic void\tset_op_var(int optype);\n#endif\nstatic void\tnv_lineop(cmdarg_T *cap);\nstatic void\tnv_home(cmdarg_T *cap);\nstatic void\tnv_pipe(cmdarg_T *cap);\nstatic void\tnv_bck_word(cmdarg_T *cap);\nstatic void\tnv_wordcmd(cmdarg_T *cap);\nstatic void\tnv_beginline(cmdarg_T *cap);\nstatic void\tadjust_cursor(oparg_T *oap);\nstatic void\tadjust_for_sel(cmdarg_T *cap);\nstatic void\tnv_select(cmdarg_T *cap);\nstatic void\tnv_goto(cmdarg_T *cap);\nstatic void\tnv_normal(cmdarg_T *cap);\nstatic void\tnv_esc(cmdarg_T *oap);\nstatic void\tnv_edit(cmdarg_T *cap);\nstatic void\tinvoke_edit(cmdarg_T *cap, int repl, int cmd, int startln);\n#ifdef FEAT_TEXTOBJ\nstatic void\tnv_object(cmdarg_T *cap);\n#endif\nstatic void\tnv_record(cmdarg_T *cap);\nstatic void\tnv_at(cmdarg_T *cap);\nstatic void\tnv_halfpage(cmdarg_T *cap);\nstatic void\tnv_join(cmdarg_T *cap);\nstatic void\tnv_put(cmdarg_T *cap);\nstatic void\tnv_put_opt(cmdarg_T *cap, int fix_indent);\nstatic void\tnv_open(cmdarg_T *cap);\n#ifdef FEAT_NETBEANS_INTG\nstatic void\tnv_nbcmd(cmdarg_T *cap);\n#endif\n#ifdef FEAT_DND\nstatic void\tnv_drop(cmdarg_T *cap);\n#endif\nstatic void\tnv_cursorhold(cmdarg_T *cap);",
"// Declare nv_cmds[].\n#define DO_DECLARE_NVCMD\n#include \"nv_cmds.h\"",
"// Include the lookuptable generated by create_nvcmdidx.vim.\n#include \"nv_cmdidxs.h\"",
"/*\n * Search for a command in the commands table.\n * Returns -1 for invalid command.\n */\n static int\nfind_command(int cmdchar)\n{\n int\t\ti;\n int\t\tidx;\n int\t\ttop, bot;\n int\t\tc;",
" // A multi-byte character is never a command.\n if (cmdchar >= 0x100)\n\treturn -1;",
" // We use the absolute value of the character. Special keys have a\n // negative value, but are sorted on their absolute value.\n if (cmdchar < 0)\n\tcmdchar = -cmdchar;",
" // If the character is in the first part: The character is the index into\n // nv_cmd_idx[].\n if (cmdchar <= nv_max_linear)\n\treturn nv_cmd_idx[cmdchar];",
" // Perform a binary search.\n bot = nv_max_linear + 1;\n top = NV_CMDS_SIZE - 1;\n idx = -1;\n while (bot <= top)\n {\n\ti = (top + bot) / 2;\n\tc = nv_cmds[nv_cmd_idx[i]].cmd_char;\n\tif (c < 0)\n\t c = -c;\n\tif (cmdchar == c)\n\t{\n\t idx = nv_cmd_idx[i];\n\t break;\n\t}\n\tif (cmdchar > c)\n\t bot = i + 1;\n\telse\n\t top = i - 1;\n }\n return idx;\n}",
"/*\n * If currently editing a cmdline or text is locked: beep and give an error\n * message, return TRUE.\n */\n static int\ncheck_text_locked(oparg_T *oap)\n{\n if (text_locked())\n {\n\tclearopbeep(oap);\n\ttext_locked_msg();\n\treturn TRUE;\n }\n return FALSE;\n}",
"/*\n * Handle the count before a normal command and set cap->count0.\n */\n static int\nnormal_cmd_get_count(\n\tcmdarg_T\t*cap,\n\tint\t\tc,\n\tint\t\ttoplevel UNUSED,\n\tint\t\tset_prevcount UNUSED,\n\tint\t\t*ctrl_w,\n\tint\t\t*need_flushbuf UNUSED)\n{\ngetcount:\n if (!(VIsual_active && VIsual_select))\n {\n\t// Handle a count before a command and compute ca.count0.\n\t// Note that '0' is a command and not the start of a count, but it's\n\t// part of a count after other digits.\n\twhile ((c >= '1' && c <= '9')\n\t\t|| (cap->count0 != 0 && (c == K_DEL || c == K_KDEL\n\t\t\t|| c == '0')))\n\t{\n\t if (c == K_DEL || c == K_KDEL)\n\t {\n\t\tcap->count0 /= 10;\n#ifdef FEAT_CMDL_INFO\n\t\tdel_from_showcmd(4);\t// delete the digit and ~@%\n#endif\n\t }\n\t else if (cap->count0 > 99999999L)\n\t {\n\t\tcap->count0 = 999999999L;\n\t }\n\t else\n\t {\n\t\tcap->count0 = cap->count0 * 10 + (c - '0');\n\t }\n#ifdef FEAT_EVAL\n\t // Set v:count here, when called from main() and not a stuffed\n\t // command, so that v:count can be used in an expression mapping\n\t // right after the count. Do set it for redo.\n\t if (toplevel && readbuf1_empty())\n\t\tset_vcount_ca(cap, &set_prevcount);\n#endif\n\t if (*ctrl_w)\n\t {\n\t\t++no_mapping;\n\t\t++allow_keys;\t\t// no mapping for nchar, but keys\n\t }\n\t ++no_zero_mapping;\t\t// don't map zero here\n\t c = plain_vgetc();\n\t LANGMAP_ADJUST(c, TRUE);\n\t --no_zero_mapping;\n\t if (*ctrl_w)\n\t {\n\t\t--no_mapping;\n\t\t--allow_keys;\n\t }\n#ifdef FEAT_CMDL_INFO\n\t *need_flushbuf |= add_to_showcmd(c);\n#endif\n\t}",
"\t// If we got CTRL-W there may be a/another count\n\tif (c == Ctrl_W && !*ctrl_w && cap->oap->op_type == OP_NOP)\n\t{\n\t *ctrl_w = TRUE;\n\t cap->opcount = cap->count0;\t// remember first count\n\t cap->count0 = 0;\n\t ++no_mapping;\n\t ++allow_keys;\t\t// no mapping for nchar, but keys\n\t c = plain_vgetc();\t\t// get next character\n\t LANGMAP_ADJUST(c, TRUE);\n\t --no_mapping;\n\t --allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t *need_flushbuf |= add_to_showcmd(c);\n#endif\n\t goto getcount;\t\t// jump back\n\t}\n }",
" if (c == K_CURSORHOLD)\n {\n\t// Save the count values so that ca.opcount and ca.count0 are exactly\n\t// the same when coming back here after handling K_CURSORHOLD.\n\tcap->oap->prev_opcount = cap->opcount;\n\tcap->oap->prev_count0 = cap->count0;\n }\n else if (cap->opcount != 0)\n {\n\t// If we're in the middle of an operator (including after entering a\n\t// yank buffer with '\"') AND we had a count before the operator, then\n\t// that count overrides the current value of ca.count0.\n\t// What this means effectively, is that commands like \"3dw\" get turned\n\t// into \"d3w\" which makes things fall into place pretty neatly.\n\t// If you give a count before AND after the operator, they are\n\t// multiplied.\n\tif (cap->count0)\n\t{\n\t if (cap->opcount >= 999999999L / cap->count0)\n\t\tcap->count0 = 999999999L;\n\t else\n\t\tcap->count0 *= cap->opcount;\n\t}\n\telse\n\t cap->count0 = cap->opcount;\n }",
" // Always remember the count. It will be set to zero (on the next call,\n // above) when there is no pending operator.\n // When called from main(), save the count for use by the \"count\" built-in\n // variable.\n cap->opcount = cap->count0;\n cap->count1 = (cap->count0 == 0 ? 1 : cap->count0);",
"#ifdef FEAT_EVAL\n // Only set v:count when called from main() and not a stuffed command.\n // Do set it for redo.\n if (toplevel && readbuf1_empty())\n\tset_vcount(cap->count0, cap->count1, set_prevcount);\n#endif",
" return c;\n}",
"/*\n * Returns TRUE if the normal command (cap) needs a second character.\n */\n static int\nnormal_cmd_needs_more_chars(cmdarg_T *cap, short_u cmd_flags)\n{\n return ((cmd_flags & NV_NCH)\n\t && (((cmd_flags & NV_NCH_NOP) == NV_NCH_NOP\n\t\t && cap->oap->op_type == OP_NOP)\n\t\t|| (cmd_flags & NV_NCH_ALW) == NV_NCH_ALW\n\t\t|| (cap->cmdchar == 'q'\n\t\t && cap->oap->op_type == OP_NOP\n\t\t && reg_recording == 0\n\t\t && reg_executing == 0)\n\t\t|| ((cap->cmdchar == 'a' || cap->cmdchar == 'i')\n\t\t && (cap->oap->op_type != OP_NOP || VIsual_active))));\n}",
"/*\n * Get one or more additional characters for a normal command.\n * Return the updated command index (if changed).\n */\n static int\nnormal_cmd_get_more_chars(\n\tint\t idx_arg,\n\tcmdarg_T *cap,\n\tint\t *need_flushbuf UNUSED)\n{\n int\t\tidx = idx_arg;\n int\t\tc;\n int\t\t*cp;\n int\t\trepl = FALSE;\t// get character for replace mode\n int\t\tlit = FALSE;\t// get extra character literally\n int\t\tlangmap_active = FALSE; // using :lmap mappings\n int\t\tlang;\t\t// getting a text character\n#ifdef HAVE_INPUT_METHOD\n int\t\tsave_smd;\t// saved value of p_smd\n#endif",
" ++no_mapping;\n ++allow_keys;\t\t// no mapping for nchar, but allow key codes\n // Don't generate a CursorHold event here, most commands can't handle\n // it, e.g., nv_replace(), nv_csearch().\n did_cursorhold = TRUE;\n if (cap->cmdchar == 'g')\n {\n\t/*\n\t * For 'g' get the next character now, so that we can check for\n\t * \"gr\", \"g'\" and \"g`\".\n\t */\n\tcap->nchar = plain_vgetc();\n\tLANGMAP_ADJUST(cap->nchar, TRUE);\n#ifdef FEAT_CMDL_INFO\n\t*need_flushbuf |= add_to_showcmd(cap->nchar);\n#endif\n\tif (cap->nchar == 'r' || cap->nchar == '\\'' || cap->nchar == '`'\n\t\t|| cap->nchar == Ctrl_BSL)\n\t{\n\t cp = &cap->extra_char;\t// need to get a third character\n\t if (cap->nchar != 'r')\n\t\tlit = TRUE;\t\t\t// get it literally\n\t else\n\t\trepl = TRUE;\t\t// get it in replace mode\n\t}\n\telse\n\t cp = NULL;\t\t// no third character needed\n }\n else\n {\n\tif (cap->cmdchar == 'r')\t\t// get it in replace mode\n\t repl = TRUE;\n\tcp = &cap->nchar;\n }\n lang = (repl || (nv_cmds[idx].cmd_flags & NV_LANG));",
" /*\n * Get a second or third character.\n */\n if (cp != NULL)\n {\n\tif (repl)\n\t{\n\t State = MODE_REPLACE;\t// pretend Replace mode\n#ifdef CURSOR_SHAPE\n\t ui_cursor_shape();\t// show different cursor shape\n#endif\n\t}\n\tif (lang && curbuf->b_p_iminsert == B_IMODE_LMAP)\n\t{\n\t // Allow mappings defined with \":lmap\".\n\t --no_mapping;\n\t --allow_keys;\n\t if (repl)\n\t\tState = MODE_LREPLACE;\n\t else\n\t\tState = MODE_LANGMAP;\n\t langmap_active = TRUE;\n\t}\n#ifdef HAVE_INPUT_METHOD\n\tsave_smd = p_smd;\n\tp_smd = FALSE;\t// Don't let the IM code show the mode here\n\tif (lang && curbuf->b_p_iminsert == B_IMODE_IM)\n\t im_set_active(TRUE);\n#endif\n\tif ((State & MODE_INSERT) && !p_ek)\n\t{\n#ifdef FEAT_JOB_CHANNEL\n\t ch_log_output = TRUE;\n#endif\n\t // Disable bracketed paste and modifyOtherKeys here, we won't\n\t // recognize the escape sequences with 'esckeys' off.\n\t out_str(T_BD);\n\t out_str(T_CTE);\n\t}",
"\t*cp = plain_vgetc();",
"\tif ((State & MODE_INSERT) && !p_ek)\n\t{\n#ifdef FEAT_JOB_CHANNEL\n\t ch_log_output = TRUE;\n#endif\n\t // Re-enable bracketed paste mode and modifyOtherKeys\n\t out_str(T_BE);\n\t out_str(T_CTI);\n\t}",
"\tif (langmap_active)\n\t{\n\t // Undo the decrement done above\n\t ++no_mapping;\n\t ++allow_keys;\n\t State = MODE_NORMAL_BUSY;\n\t}\n#ifdef HAVE_INPUT_METHOD\n\tif (lang)\n\t{\n\t if (curbuf->b_p_iminsert != B_IMODE_LMAP)\n\t\tim_save_status(&curbuf->b_p_iminsert);\n\t im_set_active(FALSE);\n\t}\n\tp_smd = save_smd;\n#endif\n\tState = MODE_NORMAL_BUSY;\n#ifdef FEAT_CMDL_INFO\n\t*need_flushbuf |= add_to_showcmd(*cp);\n#endif",
"\tif (!lit)\n\t{\n#ifdef FEAT_DIGRAPHS\n\t // Typing CTRL-K gets a digraph.\n\t if (*cp == Ctrl_K\n\t\t && ((nv_cmds[idx].cmd_flags & NV_LANG)\n\t\t\t|| cp == &cap->extra_char)\n\t\t && vim_strchr(p_cpo, CPO_DIGRAPH) == NULL)\n\t {\n\t\tc = get_digraph(FALSE);\n\t\tif (c > 0)\n\t\t{\n\t\t *cp = c;\n# ifdef FEAT_CMDL_INFO\n\t\t // Guessing how to update showcmd here...\n\t\t del_from_showcmd(3);\n\t\t *need_flushbuf |= add_to_showcmd(*cp);\n# endif\n\t\t}\n\t }\n#endif",
"\t // adjust chars > 127, except after \"tTfFr\" commands\n\t LANGMAP_ADJUST(*cp, !lang);\n#ifdef FEAT_RIGHTLEFT\n\t // adjust Hebrew mapped char\n\t if (p_hkmap && lang && KeyTyped)\n\t\t*cp = hkmap(*cp);\n#endif\n\t}",
"\t// When the next character is CTRL-\\ a following CTRL-N means the\n\t// command is aborted and we go to Normal mode.\n\tif (cp == &cap->extra_char\n\t\t&& cap->nchar == Ctrl_BSL\n\t\t&& (cap->extra_char == Ctrl_N || cap->extra_char == Ctrl_G))\n\t{\n\t cap->cmdchar = Ctrl_BSL;\n\t cap->nchar = cap->extra_char;\n\t idx = find_command(cap->cmdchar);\n\t}\n\telse if ((cap->nchar == 'n' || cap->nchar == 'N') && cap->cmdchar == 'g')\n\t cap->oap->op_type = get_op_type(*cp, NUL);\n\telse if (*cp == Ctrl_BSL)\n\t{\n\t long towait = (p_ttm >= 0 ? p_ttm : p_tm);",
"\t // There is a busy wait here when typing \"f<C-\\>\" and then\n\t // something different from CTRL-N. Can't be avoided.\n\t while ((c = vpeekc()) <= 0 && towait > 0L)\n\t {\n\t\tdo_sleep(towait > 50L ? 50L : towait, FALSE);\n\t\ttowait -= 50L;\n\t }\n\t if (c > 0)\n\t {\n\t\tc = plain_vgetc();\n\t\tif (c != Ctrl_N && c != Ctrl_G)\n\t\t vungetc(c);\n\t\telse\n\t\t{\n\t\t cap->cmdchar = Ctrl_BSL;\n\t\t cap->nchar = c;\n\t\t idx = find_command(cap->cmdchar);\n\t\t}\n\t }\n\t}",
"\t// When getting a text character and the next character is a\n\t// multi-byte character, it could be a composing character.\n\t// However, don't wait for it to arrive. Also, do enable mapping,\n\t// because if it's put back with vungetc() it's too late to apply\n\t// mapping.\n\t--no_mapping;\n\twhile (enc_utf8 && lang && (c = vpeekc()) > 0\n\t\t&& (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1))\n\t{\n\t c = plain_vgetc();\n\t if (!utf_iscomposing(c))\n\t {\n\t\tvungetc(c);\t\t// it wasn't, put it back\n\t\tbreak;\n\t }\n\t else if (cap->ncharC1 == 0)\n\t\tcap->ncharC1 = c;\n\t else\n\t\tcap->ncharC2 = c;\n\t}\n\t++no_mapping;\n }\n --no_mapping;\n --allow_keys;",
" return idx;\n}",
"/*\n * Returns TRUE if after processing a normal mode command, need to wait for a\n * moment when a message is displayed that will be overwritten by the mode\n * message.\n */\n static int\nnormal_cmd_need_to_wait_for_msg(cmdarg_T *cap, pos_T *old_pos)\n{\n // In Visual mode and with \"^O\" in Insert mode, a short message will be\n // overwritten by the mode message. Wait a bit, until a key is hit.\n // In Visual mode, it's more important to keep the Visual area updated\n // than keeping a message (e.g. from a /pat search).\n // Only do this if the command was typed, not from a mapping.\n // Don't wait when emsg_silent is non-zero.\n // Also wait a bit after an error message, e.g. for \"^O:\".\n // Don't redraw the screen, it would remove the message.\n return ( ((p_smd\n\t\t && msg_silent == 0\n\t\t && (restart_edit != 0\n\t\t\t|| (VIsual_active\n\t\t\t && old_pos->lnum == curwin->w_cursor.lnum\n\t\t\t && old_pos->col == curwin->w_cursor.col)\n\t\t )\n\t\t && (clear_cmdline\n\t\t\t|| redraw_cmdline)\n\t\t && (msg_didout || (msg_didany && msg_scroll))\n\t\t && !msg_nowait\n\t\t && KeyTyped)\n\t\t|| (restart_edit != 0\n\t\t && !VIsual_active\n\t\t && (msg_scroll\n\t\t\t|| emsg_on_display)))\n\t && cap->oap->regname == 0\n\t && !(cap->retval & CA_COMMAND_BUSY)\n\t && stuff_empty()\n\t && typebuf_typed()\n\t && emsg_silent == 0\n\t && !in_assert_fails\n\t && !did_wait_return\n\t && cap->oap->op_type == OP_NOP);\n}",
"/*\n * After processing a normal mode command, wait for a moment when a message is\n * displayed that will be overwritten by the mode message.\n */\n static void\nnormal_cmd_wait_for_msg(void)\n{\n int\tsave_State = State;",
" // Draw the cursor with the right shape here\n if (restart_edit != 0)\n\tState = MODE_INSERT;",
" // If need to redraw, and there is a \"keep_msg\", redraw before the\n // delay\n if (must_redraw && keep_msg != NULL && !emsg_on_display)\n {\n\tchar_u\t*kmsg;",
"\tkmsg = keep_msg;\n\tkeep_msg = NULL;\n\t// Showmode() will clear keep_msg, but we want to use it anyway.\n\t// First update w_topline.\n\tsetcursor();\n\tupdate_screen(0);\n\t// now reset it, otherwise it's put in the history again\n\tkeep_msg = kmsg;",
"\tkmsg = vim_strsave(keep_msg);\n\tif (kmsg != NULL)\n\t{\n\t msg_attr((char *)kmsg, keep_msg_attr);\n\t vim_free(kmsg);\n\t}\n }\n setcursor();\n#ifdef CURSOR_SHAPE\n ui_cursor_shape();\t\t// may show different cursor shape\n#endif\n cursor_on();\n out_flush();\n if (msg_scroll || emsg_on_display)\n\tui_delay(1003L, TRUE);\t// wait at least one second\n ui_delay(3003L, FALSE);\t\t// wait up to three seconds\n State = save_State;",
" msg_scroll = FALSE;\n emsg_on_display = FALSE;\n}",
"/*\n * Execute a command in Normal mode.\n */\n void\nnormal_cmd(\n oparg_T\t*oap,\n int\t\ttoplevel UNUSED)\t// TRUE when called from main()\n{\n cmdarg_T\tca;\t\t\t// command arguments\n int\t\tc;\n int\t\tctrl_w = FALSE;\t\t// got CTRL-W command\n int\t\told_col = curwin->w_curswant;\n int\t\tneed_flushbuf = FALSE;\t// need to call out_flush()\n pos_T\told_pos;\t\t// cursor position before command\n int\t\tmapped_len;\n static int\told_mapped_len = 0;\n int\t\tidx;\n int\t\tset_prevcount = FALSE;\n int\t\tsave_did_cursorhold = did_cursorhold;",
" CLEAR_FIELD(ca);\t// also resets ca.retval\n ca.oap = oap;",
" // Use a count remembered from before entering an operator. After typing\n // \"3d\" we return from normal_cmd() and come back here, the \"3\" is\n // remembered in \"opcount\".\n ca.opcount = opcount;",
" // If there is an operator pending, then the command we take this time\n // will terminate it. Finish_op tells us to finish the operation before\n // returning this time (unless the operation was cancelled).\n#ifdef CURSOR_SHAPE\n c = finish_op;\n#endif\n finish_op = (oap->op_type != OP_NOP);\n#ifdef CURSOR_SHAPE\n if (finish_op != c)\n {\n\tui_cursor_shape();\t\t// may show different cursor shape\n# ifdef FEAT_MOUSESHAPE\n\tupdate_mouseshape(-1);\n# endif\n }\n#endif\n may_trigger_modechanged();",
" // When not finishing an operator and no register name typed, reset the\n // count.\n if (!finish_op && !oap->regname)\n {\n\tca.opcount = 0;\n#ifdef FEAT_EVAL\n\tset_prevcount = TRUE;\n#endif\n }",
" // Restore counts from before receiving K_CURSORHOLD. This means after\n // typing \"3\", handling K_CURSORHOLD and then typing \"2\" we get \"32\", not\n // \"3 * 2\".\n if (oap->prev_opcount > 0 || oap->prev_count0 > 0)\n {\n\tca.opcount = oap->prev_opcount;\n\tca.count0 = oap->prev_count0;\n\toap->prev_opcount = 0;\n\toap->prev_count0 = 0;\n }",
" mapped_len = typebuf_maplen();",
" State = MODE_NORMAL_BUSY;\n#ifdef USE_ON_FLY_SCROLL\n dont_scroll = FALSE;\t// allow scrolling here\n#endif",
"#ifdef FEAT_EVAL\n // Set v:count here, when called from main() and not a stuffed\n // command, so that v:count can be used in an expression mapping\n // when there is no count. Do set it for redo.\n if (toplevel && readbuf1_empty())\n\tset_vcount_ca(&ca, &set_prevcount);\n#endif",
" /*\n * Get the command character from the user.\n */\n c = safe_vgetc();\n LANGMAP_ADJUST(c, get_real_state() != MODE_SELECT);",
" // If a mapping was started in Visual or Select mode, remember the length\n // of the mapping. This is used below to not return to Insert mode for as\n // long as the mapping is being executed.\n if (restart_edit == 0)\n\told_mapped_len = 0;\n else if (old_mapped_len\n\t\t|| (VIsual_active && mapped_len == 0 && typebuf_maplen() > 0))\n\told_mapped_len = typebuf_maplen();",
" if (c == NUL)\n\tc = K_ZERO;",
" // In Select mode, typed text replaces the selection.\n if (VIsual_active\n\t && VIsual_select\n\t && (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER))\n {\n\tint len;",
"\t// Fake a \"c\"hange command. When \"restart_edit\" is set (e.g., because\n\t// 'insertmode' is set) fake a \"d\"elete command, Insert mode will\n\t// restart automatically.\n\t// Insert the typed character in the typeahead buffer, so that it can\n\t// be mapped in Insert mode. Required for \":lmap\" to work.\n\tlen = ins_char_typebuf(vgetc_char, vgetc_mod_mask);",
"\t// When recording and gotchars() was called the character will be\n\t// recorded again, remove the previous recording.\n\tif (KeyTyped)\n\t ungetchars(len);",
"\tif (restart_edit != 0)\n\t c = 'd';\n\telse\n\t c = 'c';\n\tmsg_nowait = TRUE;\t// don't delay going to insert mode\n\told_mapped_len = 0;\t// do go to Insert mode\n }",
" // If the window was made so small that nothing shows, make it at least one\n // line and one column when typing a command.\n if (KeyTyped && !KeyStuffed)\n\twin_ensure_size();",
"#ifdef FEAT_CMDL_INFO\n need_flushbuf = add_to_showcmd(c);\n#endif",
" // Get the command count\n c = normal_cmd_get_count(&ca, c, toplevel, set_prevcount, &ctrl_w,\n\t\t\t\t\t\t\t&need_flushbuf);",
" // Find the command character in the table of commands.\n // For CTRL-W we already got nchar when looking for a count.\n if (ctrl_w)\n {\n\tca.nchar = c;\n\tca.cmdchar = Ctrl_W;\n }\n else\n\tca.cmdchar = c;\n idx = find_command(ca.cmdchar);\n if (idx < 0)\n {\n\t// Not a known command: beep.\n\tclearopbeep(oap);\n\tgoto normal_end;\n }",
" if ((nv_cmds[idx].cmd_flags & NV_NCW)\n\t\t\t\t&& (check_text_locked(oap) || curbuf_locked()))\n\t// this command is not allowed now\n\tgoto normal_end;",
" // In Visual/Select mode, a few keys are handled in a special way.\n if (VIsual_active)\n {\n\t// when 'keymodel' contains \"stopsel\" may stop Select/Visual mode\n\tif (km_stopsel\n\t\t&& (nv_cmds[idx].cmd_flags & NV_STS)\n\t\t&& !(mod_mask & MOD_MASK_SHIFT))\n\t{\n\t end_visual_mode();\n\t redraw_curbuf_later(INVERTED);\n\t}",
"\t// Keys that work different when 'keymodel' contains \"startsel\"\n\tif (km_startsel)\n\t{\n\t if (nv_cmds[idx].cmd_flags & NV_SS)\n\t {\n\t\tunshift_special(&ca);\n\t\tidx = find_command(ca.cmdchar);\n\t\tif (idx < 0)\n\t\t{\n\t\t // Just in case\n\t\t clearopbeep(oap);\n\t\t goto normal_end;\n\t\t}\n\t }\n\t else if ((nv_cmds[idx].cmd_flags & NV_SSS)\n\t\t\t\t\t && (mod_mask & MOD_MASK_SHIFT))\n\t\tmod_mask &= ~MOD_MASK_SHIFT;\n\t}\n }",
"#ifdef FEAT_RIGHTLEFT\n if (curwin->w_p_rl && KeyTyped && !KeyStuffed\n\t\t\t\t\t && (nv_cmds[idx].cmd_flags & NV_RL))\n {\n\t// Invert horizontal movements and operations. Only when typed by the\n\t// user directly, not when the result of a mapping or \"x\" translated\n\t// to \"dl\".\n\tswitch (ca.cmdchar)\n\t{\n\t case 'l':\t ca.cmdchar = 'h'; break;\n\t case K_RIGHT: ca.cmdchar = K_LEFT; break;\n\t case K_S_RIGHT: ca.cmdchar = K_S_LEFT; break;\n\t case K_C_RIGHT: ca.cmdchar = K_C_LEFT; break;\n\t case 'h':\t ca.cmdchar = 'l'; break;\n\t case K_LEFT: ca.cmdchar = K_RIGHT; break;\n\t case K_S_LEFT: ca.cmdchar = K_S_RIGHT; break;\n\t case K_C_LEFT: ca.cmdchar = K_C_RIGHT; break;\n\t case '>':\t ca.cmdchar = '<'; break;\n\t case '<':\t ca.cmdchar = '>'; break;\n\t}\n\tidx = find_command(ca.cmdchar);\n }\n#endif",
" // Get additional characters if we need them.\n if (normal_cmd_needs_more_chars(&ca, nv_cmds[idx].cmd_flags))\n\tidx = normal_cmd_get_more_chars(idx, &ca, &need_flushbuf);",
"#ifdef FEAT_CMDL_INFO\n // Flush the showcmd characters onto the screen so we can see them while\n // the command is being executed. Only do this when the shown command was\n // actually displayed, otherwise this will slow down a lot when executing\n // mappings.\n if (need_flushbuf)\n\tout_flush();\n#endif\n if (ca.cmdchar != K_IGNORE)\n {\n\tif (ex_normal_busy)\n\t did_cursorhold = save_did_cursorhold;\n\telse\n\t did_cursorhold = FALSE;\n }",
" State = MODE_NORMAL;",
" if (ca.nchar == ESC)\n {\n\tclearop(oap);\n\tif (restart_edit == 0 && goto_im())\n\t restart_edit = 'a';\n\tgoto normal_end;\n }",
" if (ca.cmdchar != K_IGNORE)\n {\n\tmsg_didout = FALSE; // don't scroll screen up for normal command\n\tmsg_col = 0;\n }",
" old_pos = curwin->w_cursor;\t\t// remember where cursor was",
" // When 'keymodel' contains \"startsel\" some keys start Select/Visual\n // mode.\n if (!VIsual_active && km_startsel)\n {\n\tif (nv_cmds[idx].cmd_flags & NV_SS)\n\t{\n\t start_selection();\n\t unshift_special(&ca);\n\t idx = find_command(ca.cmdchar);\n\t}\n\telse if ((nv_cmds[idx].cmd_flags & NV_SSS)\n\t\t\t\t\t && (mod_mask & MOD_MASK_SHIFT))\n\t{\n\t start_selection();\n\t mod_mask &= ~MOD_MASK_SHIFT;\n\t}\n }",
" // Execute the command!\n // Call the command function found in the commands table.\n ca.arg = nv_cmds[idx].cmd_arg;\n (nv_cmds[idx].cmd_func)(&ca);",
" // If we didn't start or finish an operator, reset oap->regname, unless we\n // need it later.\n if (!finish_op\n\t && !oap->op_type\n\t && (idx < 0 || !(nv_cmds[idx].cmd_flags & NV_KEEPREG)))\n {\n\tclearop(oap);\n#ifdef FEAT_EVAL\n\treset_reg_var();\n#endif\n }",
" // Get the length of mapped chars again after typing a count, second\n // character or \"z333<cr>\".\n if (old_mapped_len > 0)\n\told_mapped_len = typebuf_maplen();",
" // If an operation is pending, handle it. But not for K_IGNORE or\n // K_MOUSEMOVE.\n if (ca.cmdchar != K_IGNORE && ca.cmdchar != K_MOUSEMOVE)\n\tdo_pending_operator(&ca, old_col, FALSE);",
" // Wait for a moment when a message is displayed that will be overwritten\n // by the mode message.\n if (normal_cmd_need_to_wait_for_msg(&ca, &old_pos))\n\tnormal_cmd_wait_for_msg();",
" // Finish up after executing a Normal mode command.\nnormal_end:",
" msg_nowait = FALSE;",
"#ifdef FEAT_EVAL\n if (finish_op)\n\treset_reg_var();\n#endif",
" // Reset finish_op, in case it was set\n#ifdef CURSOR_SHAPE\n c = finish_op;\n#endif\n finish_op = FALSE;\n may_trigger_modechanged();\n#ifdef CURSOR_SHAPE\n // Redraw the cursor with another shape, if we were in Operator-pending\n // mode or did a replace command.\n if (c || ca.cmdchar == 'r')\n {\n\tui_cursor_shape();\t\t// may show different cursor shape\n# ifdef FEAT_MOUSESHAPE\n\tupdate_mouseshape(-1);\n# endif\n }\n#endif",
"#ifdef FEAT_CMDL_INFO\n if (oap->op_type == OP_NOP && oap->regname == 0\n\t && ca.cmdchar != K_CURSORHOLD)\n\tclear_showcmd();\n#endif",
" checkpcmark();\t\t// check if we moved since setting pcmark\n vim_free(ca.searchbuf);",
" if (has_mbyte)\n\tmb_adjust_cursor();",
" if (curwin->w_p_scb && toplevel)\n {\n\tvalidate_cursor();\t// may need to update w_leftcol\n\tdo_check_scrollbind(TRUE);\n }",
" if (curwin->w_p_crb && toplevel)\n {\n\tvalidate_cursor();\t// may need to update w_leftcol\n\tdo_check_cursorbind();\n }",
"#ifdef FEAT_TERMINAL\n // don't go to Insert mode if a terminal has a running job\n if (term_job_running(curbuf->b_term))\n\trestart_edit = 0;\n#endif",
" // May restart edit(), if we got here with CTRL-O in Insert mode (but not\n // if still inside a mapping that started in Visual mode).\n // May switch from Visual to Select mode after CTRL-O command.\n if ( oap->op_type == OP_NOP\n\t && ((restart_edit != 0 && !VIsual_active && old_mapped_len == 0)\n\t\t|| restart_VIsual_select == 1)\n\t && !(ca.retval & CA_COMMAND_BUSY)\n\t && stuff_empty()\n\t && oap->regname == 0)\n {\n\tif (restart_VIsual_select == 1)\n\t{\n\t VIsual_select = TRUE;\n\t may_trigger_modechanged();\n\t showmode();\n\t restart_VIsual_select = 0;\n\t VIsual_select_reg = 0;\n\t}\n\tif (restart_edit != 0 && !VIsual_active && old_mapped_len == 0)\n\t (void)edit(restart_edit, FALSE, 1L);\n }",
" if (restart_VIsual_select == 2)\n\trestart_VIsual_select = 1;",
" // Save count before an operator for next time.\n opcount = ca.opcount;\n}",
"#ifdef FEAT_EVAL\n/*\n * Set v:count and v:count1 according to \"cap\".\n * Set v:prevcount only when \"set_prevcount\" is TRUE.\n */\n static void\nset_vcount_ca(cmdarg_T *cap, int *set_prevcount)\n{\n long count = cap->count0;",
" // multiply with cap->opcount the same way as above\n if (cap->opcount != 0)\n\tcount = cap->opcount * (count == 0 ? 1 : count);\n set_vcount(count, count == 0 ? 1 : count, *set_prevcount);\n *set_prevcount = FALSE; // only set v:prevcount once\n}\n#endif",
"/*\n * Check if highlighting for Visual mode is possible, give a warning message\n * if not.\n */\n void\ncheck_visual_highlight(void)\n{\n static int\t did_check = FALSE;",
" if (full_screen)\n {\n\tif (!did_check && HL_ATTR(HLF_V) == 0)\n\t msg(_(\"Warning: terminal cannot highlight\"));\n\tdid_check = TRUE;\n }\n}",
"#if defined(FEAT_CLIPBOARD) && defined(FEAT_EVAL)\n/*\n * Call yank_do_autocmd() for \"regname\".\n */\n static void\ncall_yank_do_autocmd(int regname)\n{\n oparg_T\toa;\n yankreg_T\t*reg;",
" clear_oparg(&oa);\n oa.regname = regname;\n oa.op_type = OP_YANK;\n oa.is_VIsual = TRUE;\n reg = get_register(regname, TRUE);\n yank_do_autocmd(&oa, reg);\n free_register(reg);\n}\n#endif",
"/*\n * End Visual mode.\n * This function or the next should ALWAYS be called to end Visual mode, except\n * from do_pending_operator().\n */\n void\nend_visual_mode()\n{\n end_visual_mode_keep_button();\n reset_held_button();\n}",
" void\nend_visual_mode_keep_button()\n{\n#ifdef FEAT_CLIPBOARD\n // If we are using the clipboard, then remember what was selected in case\n // we need to paste it somewhere while we still own the selection.\n // Only do this when the clipboard is already owned. Don't want to grab\n // the selection when hitting ESC.\n if (clip_star.available && clip_star.owned)\n\tclip_auto_select();",
"# if defined(FEAT_EVAL)\n // Emit a TextYankPost for the automatic copy of the selection into the\n // star and/or plus register.\n if (has_textyankpost())\n {\n\tif (clip_isautosel_star())\n\t call_yank_do_autocmd('*');\n\tif (clip_isautosel_plus())\n\t call_yank_do_autocmd('+');\n }\n# endif\n#endif",
" VIsual_active = FALSE;\n setmouse();\n mouse_dragging = 0;",
" // Save the current VIsual area for '< and '> marks, and \"gv\"\n curbuf->b_visual.vi_mode = VIsual_mode;\n curbuf->b_visual.vi_start = VIsual;\n curbuf->b_visual.vi_end = curwin->w_cursor;\n curbuf->b_visual.vi_curswant = curwin->w_curswant;\n#ifdef FEAT_EVAL\n curbuf->b_visual_mode_eval = VIsual_mode;\n#endif\n if (!virtual_active())\n\tcurwin->w_cursor.coladd = 0;\n may_clear_cmdline();",
" adjust_cursor_eol();\n may_trigger_modechanged();\n}",
"/*\n * Reset VIsual_active and VIsual_reselect.\n */\n void\nreset_VIsual_and_resel(void)\n{\n if (VIsual_active)\n {\n\tend_visual_mode();\n\tredraw_curbuf_later(INVERTED);\t// delete the inversion later\n }\n VIsual_reselect = FALSE;\n}",
"/*\n * Reset VIsual_active and VIsual_reselect if it's set.\n */\n void\nreset_VIsual(void)\n{\n if (VIsual_active)\n {\n\tend_visual_mode();\n\tredraw_curbuf_later(INVERTED);\t// delete the inversion later\n\tVIsual_reselect = FALSE;\n }\n}",
" void\nrestore_visual_mode(void)\n{\n if (VIsual_mode_orig != NUL)\n {\n\tcurbuf->b_visual.vi_mode = VIsual_mode_orig;\n\tVIsual_mode_orig = NUL;\n }\n}",
"/*\n * Check for a balloon-eval special item to include when searching for an\n * identifier. When \"dir\" is BACKWARD \"ptr[-1]\" must be valid!\n * Returns TRUE if the character at \"*ptr\" should be included.\n * \"dir\" is FORWARD or BACKWARD, the direction of searching.\n * \"*colp\" is in/decremented if \"ptr[-dir]\" should also be included.\n * \"bnp\" points to a counter for square brackets.\n */\n static int\nfind_is_eval_item(\n char_u\t*ptr,\n int\t\t*colp,\n int\t\t*bnp,\n int\t\tdir)\n{\n // Accept everything inside [].\n if ((*ptr == ']' && dir == BACKWARD) || (*ptr == '[' && dir == FORWARD))\n\t++*bnp;\n if (*bnp > 0)\n {\n\tif ((*ptr == '[' && dir == BACKWARD) || (*ptr == ']' && dir == FORWARD))\n\t --*bnp;\n\treturn TRUE;\n }",
" // skip over \"s.var\"\n if (*ptr == '.')\n\treturn TRUE;",
" // two-character item: s->var\n if (ptr[dir == BACKWARD ? 0 : 1] == '>'\n\t && ptr[dir == BACKWARD ? -1 : 0] == '-')\n {\n\t*colp += dir;\n\treturn TRUE;\n }\n return FALSE;\n}",
"/*\n * Find the identifier under or to the right of the cursor.\n * \"find_type\" can have one of three values:\n * FIND_IDENT: find an identifier (keyword)\n * FIND_STRING: find any non-white text\n * FIND_IDENT + FIND_STRING: find any non-white text, identifier preferred.\n * FIND_EVAL:\t find text useful for C program debugging\n *\n * There are three steps:\n * 1. Search forward for the start of an identifier/text. Doesn't move if\n * already on one.\n * 2. Search backward for the start of this identifier/text.\n * This doesn't match the real Vi but I like it a little better and it\n * shouldn't bother anyone.\n * 3. Search forward to the end of this identifier/text.\n * When FIND_IDENT isn't defined, we backup until a blank.\n *\n * Returns the length of the text, or zero if no text is found.\n * If text is found, a pointer to the text is put in \"*text\". This\n * points into the current buffer line and is not always NUL terminated.\n */\n int\nfind_ident_under_cursor(char_u **text, int find_type)\n{\n return find_ident_at_pos(curwin, curwin->w_cursor.lnum,\n\t\t\t\tcurwin->w_cursor.col, text, NULL, find_type);\n}",
"/*\n * Like find_ident_under_cursor(), but for any window and any position.\n * However: Uses 'iskeyword' from the current window!.\n */\n int\nfind_ident_at_pos(\n win_T\t*wp,\n linenr_T\tlnum,\n colnr_T\tstartcol,\n char_u\t**text,\n int\t\t*textcol,\t// column where \"text\" starts, can be NULL\n int\t\tfind_type)\n{\n char_u\t*ptr;\n int\t\tcol = 0;\t// init to shut up GCC\n int\t\ti;\n int\t\tthis_class = 0;\n int\t\tprev_class;\n int\t\tprevcol;\n int\t\tbn = 0;\t\t// bracket nesting",
" // if i == 0: try to find an identifier\n // if i == 1: try to find any non-white text\n ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);\n for (i = (find_type & FIND_IDENT) ? 0 : 1;\ti < 2; ++i)\n {\n\t/*\n\t * 1. skip to start of identifier/text\n\t */\n\tcol = startcol;\n\tif (has_mbyte)\n\t{\n\t while (ptr[col] != NUL)\n\t {\n\t\t// Stop at a ']' to evaluate \"a[x]\".\n\t\tif ((find_type & FIND_EVAL) && ptr[col] == ']')\n\t\t break;\n\t\tthis_class = mb_get_class(ptr + col);\n\t\tif (this_class != 0 && (i == 1 || this_class != 1))\n\t\t break;\n\t\tcol += (*mb_ptr2len)(ptr + col);\n\t }\n\t}\n\telse\n\t while (ptr[col] != NUL\n\t\t && (i == 0 ? !vim_iswordc(ptr[col]) : VIM_ISWHITE(ptr[col]))\n\t\t && (!(find_type & FIND_EVAL) || ptr[col] != ']')\n\t\t )\n\t\t++col;",
"\t// When starting on a ']' count it, so that we include the '['.\n\tbn = ptr[col] == ']';",
"\t/*\n\t * 2. Back up to start of identifier/text.\n\t */\n\tif (has_mbyte)\n\t{\n\t // Remember class of character under cursor.\n\t if ((find_type & FIND_EVAL) && ptr[col] == ']')\n\t\tthis_class = mb_get_class((char_u *)\"a\");\n\t else\n\t\tthis_class = mb_get_class(ptr + col);\n\t while (col > 0 && this_class != 0)\n\t {\n\t\tprevcol = col - 1 - (*mb_head_off)(ptr, ptr + col - 1);\n\t\tprev_class = mb_get_class(ptr + prevcol);\n\t\tif (this_class != prev_class\n\t\t\t&& (i == 0\n\t\t\t || prev_class == 0\n\t\t\t || (find_type & FIND_IDENT))\n\t\t\t&& (!(find_type & FIND_EVAL)\n\t\t\t || prevcol == 0\n\t\t\t || !find_is_eval_item(ptr + prevcol, &prevcol,\n\t\t\t\t\t\t\t &bn, BACKWARD))\n\t\t\t)\n\t\t break;\n\t\tcol = prevcol;\n\t }",
"\t // If we don't want just any old text, or we've found an\n\t // identifier, stop searching.\n\t if (this_class > 2)\n\t\tthis_class = 2;\n\t if (!(find_type & FIND_STRING) || this_class == 2)\n\t\tbreak;\n\t}\n\telse\n\t{\n\t while (col > 0\n\t\t && ((i == 0\n\t\t\t ? vim_iswordc(ptr[col - 1])\n\t\t\t : (!VIM_ISWHITE(ptr[col - 1])\n\t\t\t\t&& (!(find_type & FIND_IDENT)\n\t\t\t\t || !vim_iswordc(ptr[col - 1]))))\n\t\t\t|| ((find_type & FIND_EVAL)\n\t\t\t && col > 1\n\t\t\t && find_is_eval_item(ptr + col - 1, &col,\n\t\t\t\t\t\t\t &bn, BACKWARD))\n\t\t\t))\n\t\t--col;",
"\t // If we don't want just any old text, or we've found an\n\t // identifier, stop searching.\n\t if (!(find_type & FIND_STRING) || vim_iswordc(ptr[col]))\n\t\tbreak;\n\t}\n }",
" if (ptr[col] == NUL || (i == 0\n\t\t&& (has_mbyte ? this_class != 2 : !vim_iswordc(ptr[col]))))\n {\n\t// didn't find an identifier or text\n\tif ((find_type & FIND_NOERROR) == 0)\n\t{\n\t if (find_type & FIND_STRING)\n\t\temsg(_(e_no_string_under_cursor));\n\t else\n\t\temsg(_(e_no_identifier_under_cursor));\n\t}\n\treturn 0;\n }\n ptr += col;\n *text = ptr;\n if (textcol != NULL)\n\t*textcol = col;",
" /*\n * 3. Find the end if the identifier/text.\n */\n bn = 0;\n startcol -= col;\n col = 0;\n if (has_mbyte)\n {\n\t// Search for point of changing multibyte character class.\n\tthis_class = mb_get_class(ptr);\n\twhile (ptr[col] != NUL\n\t\t&& ((i == 0 ? mb_get_class(ptr + col) == this_class\n\t\t\t : mb_get_class(ptr + col) != 0)\n\t\t || ((find_type & FIND_EVAL)\n\t\t\t&& col <= (int)startcol\n\t\t\t&& find_is_eval_item(ptr + col, &col, &bn, FORWARD))\n\t\t))\n\t col += (*mb_ptr2len)(ptr + col);\n }\n else\n\twhile ((i == 0 ? vim_iswordc(ptr[col])\n\t\t : (ptr[col] != NUL && !VIM_ISWHITE(ptr[col])))\n\t\t || ((find_type & FIND_EVAL)\n\t\t\t&& col <= (int)startcol\n\t\t\t&& find_is_eval_item(ptr + col, &col, &bn, FORWARD))\n\t\t)\n\t ++col;",
" return col;\n}",
"/*\n * Prepare for redo of a normal command.\n */\n static void\nprep_redo_cmd(cmdarg_T *cap)\n{\n prep_redo(cap->oap->regname, cap->count0,\n\t\t\t\t NUL, cap->cmdchar, NUL, NUL, cap->nchar);\n}",
"/*\n * Prepare for redo of any command.\n * Note that only the last argument can be a multi-byte char.\n */\n void\nprep_redo(\n int\t regname,\n long num,\n int\t cmd1,\n int\t cmd2,\n int\t cmd3,\n int\t cmd4,\n int\t cmd5)\n{\n prep_redo_num2(regname, num, cmd1, cmd2, 0L, cmd3, cmd4, cmd5);\n}",
"/*\n * Prepare for redo of any command with extra count after \"cmd2\".\n */\n void\nprep_redo_num2(\n int\t regname,\n long num1,\n int\t cmd1,\n int\t cmd2,\n long num2,\n int\t cmd3,\n int\t cmd4,\n int\t cmd5)\n{\n ResetRedobuff();\n if (regname != 0)\t// yank from specified buffer\n {\n\tAppendCharToRedobuff('\"');\n\tAppendCharToRedobuff(regname);\n }\n if (num1 != 0)\n\tAppendNumberToRedobuff(num1);\n if (cmd1 != NUL)\n\tAppendCharToRedobuff(cmd1);\n if (cmd2 != NUL)\n\tAppendCharToRedobuff(cmd2);\n if (num2 != 0)\n\tAppendNumberToRedobuff(num2);\n if (cmd3 != NUL)\n\tAppendCharToRedobuff(cmd3);\n if (cmd4 != NUL)\n\tAppendCharToRedobuff(cmd4);\n if (cmd5 != NUL)\n\tAppendCharToRedobuff(cmd5);\n}",
"/*\n * check for operator active and clear it\n *\n * return TRUE if operator was active\n */\n static int\ncheckclearop(oparg_T *oap)\n{\n if (oap->op_type == OP_NOP)\n\treturn FALSE;\n clearopbeep(oap);\n return TRUE;\n}",
"/*\n * Check for operator or Visual active. Clear active operator.\n *\n * Return TRUE if operator or Visual was active.\n */\n static int\ncheckclearopq(oparg_T *oap)\n{\n if (oap->op_type == OP_NOP && !VIsual_active)\n\treturn FALSE;\n clearopbeep(oap);\n return TRUE;\n}",
" void\nclearop(oparg_T *oap)\n{\n oap->op_type = OP_NOP;\n oap->regname = 0;\n oap->motion_force = NUL;\n oap->use_reg_one = FALSE;\n motion_force = NUL;\n}",
" void\nclearopbeep(oparg_T *oap)\n{\n clearop(oap);\n beep_flush();\n}",
"/*\n * Remove the shift modifier from a special key.\n */\n static void\nunshift_special(cmdarg_T *cap)\n{\n switch (cap->cmdchar)\n {\n\tcase K_S_RIGHT:\tcap->cmdchar = K_RIGHT; break;\n\tcase K_S_LEFT:\tcap->cmdchar = K_LEFT; break;\n\tcase K_S_UP:\tcap->cmdchar = K_UP; break;\n\tcase K_S_DOWN:\tcap->cmdchar = K_DOWN; break;\n\tcase K_S_HOME:\tcap->cmdchar = K_HOME; break;\n\tcase K_S_END:\tcap->cmdchar = K_END; break;\n }\n cap->cmdchar = simplify_key(cap->cmdchar, &mod_mask);\n}",
"/*\n * If the mode is currently displayed clear the command line or update the\n * command displayed.\n */\n void\nmay_clear_cmdline(void)\n{\n if (mode_displayed)\n\tclear_cmdline = TRUE; // unshow visual mode later\n#ifdef FEAT_CMDL_INFO\n else\n\tclear_showcmd();\n#endif\n}",
"#if defined(FEAT_CMDL_INFO) || defined(PROTO)\n/*\n * Routines for displaying a partly typed command\n */",
"#define SHOWCMD_BUFLEN (SHOWCMD_COLS + 1 + 30)\nstatic char_u\tshowcmd_buf[SHOWCMD_BUFLEN];\nstatic char_u\told_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd()\nstatic int\tshowcmd_is_clear = TRUE;\nstatic int\tshowcmd_visual = FALSE;",
"static void display_showcmd(void);",
" void\nclear_showcmd(void)\n{\n if (!p_sc)\n\treturn;",
" if (VIsual_active && !char_avail())\n {\n\tint\t\tcursor_bot = LT_POS(VIsual, curwin->w_cursor);\n\tlong\t\tlines;\n\tcolnr_T\t\tleftcol, rightcol;\n\tlinenr_T\ttop, bot;",
"\t// Show the size of the Visual area.\n\tif (cursor_bot)\n\t{\n\t top = VIsual.lnum;\n\t bot = curwin->w_cursor.lnum;\n\t}\n\telse\n\t{\n\t top = curwin->w_cursor.lnum;\n\t bot = VIsual.lnum;\n\t}\n# ifdef FEAT_FOLDING\n\t// Include closed folds as a whole.\n\t(void)hasFolding(top, &top, NULL);\n\t(void)hasFolding(bot, NULL, &bot);\n# endif\n\tlines = bot - top + 1;",
"\tif (VIsual_mode == Ctrl_V)\n\t{\n# ifdef FEAT_LINEBREAK\n\t char_u *saved_sbr = p_sbr;\n\t char_u *saved_w_sbr = curwin->w_p_sbr;",
"\t // Make 'sbr' empty for a moment to get the correct size.\n\t p_sbr = empty_option;\n\t curwin->w_p_sbr = empty_option;\n# endif\n\t getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);\n# ifdef FEAT_LINEBREAK\n\t p_sbr = saved_sbr;\n\t curwin->w_p_sbr = saved_w_sbr;\n# endif\n\t sprintf((char *)showcmd_buf, \"%ldx%ld\", lines,\n\t\t\t\t\t (long)(rightcol - leftcol + 1));\n\t}\n\telse if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)\n\t sprintf((char *)showcmd_buf, \"%ld\", lines);\n\telse\n\t{\n\t char_u *s, *e;\n\t int\t l;\n\t int\t bytes = 0;\n\t int\t chars = 0;",
"\t if (cursor_bot)\n\t {\n\t\ts = ml_get_pos(&VIsual);\n\t\te = ml_get_cursor();\n\t }\n\t else\n\t {\n\t\ts = ml_get_cursor();\n\t\te = ml_get_pos(&VIsual);\n\t }\n\t while ((*p_sel != 'e') ? s <= e : s < e)\n\t {\n\t\tl = (*mb_ptr2len)(s);\n\t\tif (l == 0)\n\t\t{\n\t\t ++bytes;\n\t\t ++chars;\n\t\t break; // end of line\n\t\t}\n\t\tbytes += l;\n\t\t++chars;\n\t\ts += l;\n\t }\n\t if (bytes == chars)\n\t\tsprintf((char *)showcmd_buf, \"%d\", chars);\n\t else\n\t\tsprintf((char *)showcmd_buf, \"%d-%d\", chars, bytes);\n\t}\n\tshowcmd_buf[SHOWCMD_COLS] = NUL;\t// truncate\n\tshowcmd_visual = TRUE;\n }\n else\n {\n\tshowcmd_buf[0] = NUL;\n\tshowcmd_visual = FALSE;",
"\t// Don't actually display something if there is nothing to clear.\n\tif (showcmd_is_clear)\n\t return;\n }",
" display_showcmd();\n}",
"/*\n * Add 'c' to string of shown command chars.\n * Return TRUE if output has been written (and setcursor() has been called).\n */\n int\nadd_to_showcmd(int c)\n{\n char_u\t*p;\n int\t\told_len;\n int\t\textra_len;\n int\t\toverflow;\n int\t\ti;\n static int\tignore[] =\n {\n#ifdef FEAT_GUI\n\tK_VER_SCROLLBAR, K_HOR_SCROLLBAR,\n\tK_LEFTMOUSE_NM, K_LEFTRELEASE_NM,\n#endif\n\tK_IGNORE, K_PS,\n\tK_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE,\n\tK_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE,\n\tK_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE,\n\tK_MOUSEDOWN, K_MOUSEUP, K_MOUSELEFT, K_MOUSERIGHT,\n\tK_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE,\n\tK_CURSORHOLD,\n\t0\n };",
" if (!p_sc || msg_silent != 0)\n\treturn FALSE;",
" if (showcmd_visual)\n {\n\tshowcmd_buf[0] = NUL;\n\tshowcmd_visual = FALSE;\n }",
" // Ignore keys that are scrollbar updates and mouse clicks\n if (IS_SPECIAL(c))\n\tfor (i = 0; ignore[i] != 0; ++i)\n\t if (ignore[i] == c)\n\t\treturn FALSE;",
" p = transchar(c);\n if (*p == ' ')\n\tSTRCPY(p, \"<20>\");\n old_len = (int)STRLEN(showcmd_buf);\n extra_len = (int)STRLEN(p);\n overflow = old_len + extra_len - SHOWCMD_COLS;\n if (overflow > 0)\n\tmch_memmove(showcmd_buf, showcmd_buf + overflow,\n\t\t\t\t\t\t old_len - overflow + 1);\n STRCAT(showcmd_buf, p);",
" if (char_avail())\n\treturn FALSE;",
" display_showcmd();",
" return TRUE;\n}",
" void\nadd_to_showcmd_c(int c)\n{\n if (!add_to_showcmd(c))\n\tsetcursor();\n}",
"/*\n * Delete 'len' characters from the end of the shown command.\n */\n static void\ndel_from_showcmd(int len)\n{\n int\t old_len;",
" if (!p_sc)\n\treturn;",
" old_len = (int)STRLEN(showcmd_buf);\n if (len > old_len)\n\tlen = old_len;\n showcmd_buf[old_len - len] = NUL;",
" if (!char_avail())\n\tdisplay_showcmd();\n}",
"/*\n * push_showcmd() and pop_showcmd() are used when waiting for the user to type\n * something and there is a partial mapping.\n */\n void\npush_showcmd(void)\n{\n if (p_sc)\n\tSTRCPY(old_showcmd_buf, showcmd_buf);\n}",
" void\npop_showcmd(void)\n{\n if (!p_sc)\n\treturn;",
" STRCPY(showcmd_buf, old_showcmd_buf);",
" display_showcmd();\n}",
" static void\ndisplay_showcmd(void)\n{\n int\t len;",
" cursor_off();",
" len = (int)STRLEN(showcmd_buf);\n if (len == 0)\n\tshowcmd_is_clear = TRUE;\n else\n {\n\tscreen_puts(showcmd_buf, (int)Rows - 1, sc_col, 0);\n\tshowcmd_is_clear = FALSE;\n }",
" // clear the rest of an old message by outputting up to SHOWCMD_COLS\n // spaces\n screen_puts((char_u *)\" \" + len, (int)Rows - 1, sc_col + len, 0);",
" setcursor();\t // put cursor back where it belongs\n}\n#endif",
"/*\n * When \"check\" is FALSE, prepare for commands that scroll the window.\n * When \"check\" is TRUE, take care of scroll-binding after the window has\n * scrolled. Called from normal_cmd() and edit().\n */\n void\ndo_check_scrollbind(int check)\n{\n static win_T\t*old_curwin = NULL;\n static linenr_T\told_topline = 0;\n#ifdef FEAT_DIFF\n static int\t\told_topfill = 0;\n#endif\n static buf_T\t*old_buf = NULL;\n static colnr_T\told_leftcol = 0;",
" if (check && curwin->w_p_scb)\n {\n\t// If a \":syncbind\" command was just used, don't scroll, only reset\n\t// the values.\n\tif (did_syncbind)\n\t did_syncbind = FALSE;\n\telse if (curwin == old_curwin)\n\t{\n\t // Synchronize other windows, as necessary according to\n\t // 'scrollbind'. Don't do this after an \":edit\" command, except\n\t // when 'diff' is set.\n\t if ((curwin->w_buffer == old_buf\n#ifdef FEAT_DIFF\n\t\t\t|| curwin->w_p_diff\n#endif\n\t\t)\n\t\t&& (curwin->w_topline != old_topline\n#ifdef FEAT_DIFF\n\t\t\t|| curwin->w_topfill != old_topfill\n#endif\n\t\t\t|| curwin->w_leftcol != old_leftcol))\n\t {\n\t\tcheck_scrollbind(curwin->w_topline - old_topline,\n\t\t\t(long)(curwin->w_leftcol - old_leftcol));\n\t }\n\t}\n\telse if (vim_strchr(p_sbo, 'j')) // jump flag set in 'scrollopt'\n\t{\n\t // When switching between windows, make sure that the relative\n\t // vertical offset is valid for the new window. The relative\n\t // offset is invalid whenever another 'scrollbind' window has\n\t // scrolled to a point that would force the current window to\n\t // scroll past the beginning or end of its buffer. When the\n\t // resync is performed, some of the other 'scrollbind' windows may\n\t // need to jump so that the current window's relative position is\n\t // visible on-screen.\n\t check_scrollbind(curwin->w_topline - curwin->w_scbind_pos, 0L);\n\t}\n\tcurwin->w_scbind_pos = curwin->w_topline;\n }",
" old_curwin = curwin;\n old_topline = curwin->w_topline;\n#ifdef FEAT_DIFF\n old_topfill = curwin->w_topfill;\n#endif\n old_buf = curwin->w_buffer;\n old_leftcol = curwin->w_leftcol;\n}",
"/*\n * Synchronize any windows that have \"scrollbind\" set, based on the\n * number of rows by which the current window has changed\n * (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>)\n */\n void\ncheck_scrollbind(linenr_T topline_diff, long leftcol_diff)\n{\n int\t\twant_ver;\n int\t\twant_hor;\n win_T\t*old_curwin = curwin;\n buf_T\t*old_curbuf = curbuf;\n int\t\told_VIsual_select = VIsual_select;\n int\t\told_VIsual_active = VIsual_active;\n colnr_T\ttgt_leftcol = curwin->w_leftcol;\n long\ttopline;\n long\ty;",
" // check 'scrollopt' string for vertical and horizontal scroll options\n want_ver = (vim_strchr(p_sbo, 'v') && topline_diff != 0);\n#ifdef FEAT_DIFF\n want_ver |= old_curwin->w_p_diff;\n#endif\n want_hor = (vim_strchr(p_sbo, 'h') && (leftcol_diff || topline_diff != 0));",
" // loop through the scrollbound windows and scroll accordingly\n VIsual_select = VIsual_active = 0;\n FOR_ALL_WINDOWS(curwin)\n {\n\tcurbuf = curwin->w_buffer;\n\t// skip original window and windows with 'noscrollbind'\n\tif (curwin != old_curwin && curwin->w_p_scb)\n\t{\n\t // do the vertical scroll\n\t if (want_ver)\n\t {\n#ifdef FEAT_DIFF\n\t\tif (old_curwin->w_p_diff && curwin->w_p_diff)\n\t\t{\n\t\t diff_set_topline(old_curwin, curwin);\n\t\t}\n\t\telse\n#endif\n\t\t{\n\t\t curwin->w_scbind_pos += topline_diff;\n\t\t topline = curwin->w_scbind_pos;\n\t\t if (topline > curbuf->b_ml.ml_line_count)\n\t\t\ttopline = curbuf->b_ml.ml_line_count;\n\t\t if (topline < 1)\n\t\t\ttopline = 1;",
"\t\t y = topline - curwin->w_topline;\n\t\t if (y > 0)\n\t\t\tscrollup(y, FALSE);\n\t\t else\n\t\t\tscrolldown(-y, FALSE);\n\t\t}",
"\t\tredraw_later(VALID);\n\t\tcursor_correct();\n\t\tcurwin->w_redr_status = TRUE;\n\t }",
"\t // do the horizontal scroll\n\t if (want_hor && curwin->w_leftcol != tgt_leftcol)\n\t {\n\t\tcurwin->w_leftcol = tgt_leftcol;\n\t\tleftcol_changed();\n\t }\n\t}\n }",
" // reset current-window\n VIsual_select = old_VIsual_select;\n VIsual_active = old_VIsual_active;\n curwin = old_curwin;\n curbuf = old_curbuf;\n}",
"/*\n * Command character that's ignored.\n * Used for CTRL-Q and CTRL-S to avoid problems with terminals that use\n * xon/xoff.\n */\n static void\nnv_ignore(cmdarg_T *cap)\n{\n cap->retval |= CA_COMMAND_BUSY;\t// don't call edit() now\n}",
"/*\n * Command character that doesn't do anything, but unlike nv_ignore() does\n * start edit(). Used for \"startinsert\" executed while starting up.\n */\n static void\nnv_nop(cmdarg_T *cap UNUSED)\n{\n}",
"/*\n * Command character doesn't exist.\n */\n static void\nnv_error(cmdarg_T *cap)\n{\n clearopbeep(cap->oap);\n}",
"/*\n * <Help> and <F1> commands.\n */\n static void\nnv_help(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n\tex_help(NULL);\n}",
"/*\n * CTRL-A and CTRL-X: Add or subtract from letter or number under cursor.\n */\n static void\nnv_addsub(cmdarg_T *cap)\n{\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && !prompt_curpos_editable())\n\tclearopbeep(cap->oap);\n else\n#endif\n if (!VIsual_active && cap->oap->op_type == OP_NOP)\n {\n\tprep_redo_cmd(cap);\n\tcap->oap->op_type = cap->cmdchar == Ctrl_A ? OP_NR_ADD : OP_NR_SUB;\n\top_addsub(cap->oap, cap->count1, cap->arg);\n\tcap->oap->op_type = OP_NOP;\n }\n else if (VIsual_active)\n\tnv_operator(cap);\n else\n\tclearop(cap->oap);\n}",
"/*\n * CTRL-F, CTRL-B, etc: Scroll page up or down.\n */\n static void\nnv_page(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n {\n\tif (mod_mask & MOD_MASK_CTRL)\n\t{\n\t // <C-PageUp>: tab page back; <C-PageDown>: tab page forward\n\t if (cap->arg == BACKWARD)\n\t\tgoto_tabpage(-(int)cap->count1);\n\t else\n\t\tgoto_tabpage((int)cap->count0);\n\t}\n\telse\n\t (void)onepage(cap->arg, cap->count1);\n }\n}",
"/*\n * Implementation of \"gd\" and \"gD\" command.\n */\n static void\nnv_gd(\n oparg_T\t*oap,\n int\t\tnchar,\n int\t\tthisblock)\t// 1 for \"1gd\" and \"1gD\"\n{\n int\t\tlen;\n char_u\t*ptr;",
" if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0\n\t || find_decl(ptr, len, nchar == 'd', thisblock, SEARCH_START)\n\t\t\t\t\t\t\t\t == FAIL)\n {\n\tclearopbeep(oap);\n }\n else\n {\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n\t// clear any search statistics\n\tif (messaging() && !msg_silent && !shortmess(SHM_SEARCHCOUNT))\n\t clear_cmdline = TRUE;\n }\n}",
"/*\n * Return TRUE if line[offset] is not inside a C-style comment or string, FALSE\n * otherwise.\n */\n static int\nis_ident(char_u *line, int offset)\n{\n int\ti;\n int\tincomment = FALSE;\n int\tinstring = 0;\n int\tprev = 0;",
" for (i = 0; i < offset && line[i] != NUL; i++)\n {\n\tif (instring != 0)\n\t{\n\t if (prev != '\\\\' && line[i] == instring)\n\t\tinstring = 0;\n\t}\n\telse if ((line[i] == '\"' || line[i] == '\\'') && !incomment)\n\t{\n\t instring = line[i];\n\t}\n\telse\n\t{\n\t if (incomment)\n\t {\n\t\tif (prev == '*' && line[i] == '/')\n\t\t incomment = FALSE;\n\t }\n\t else if (prev == '/' && line[i] == '*')\n\t {\n\t\tincomment = TRUE;\n\t }\n\t else if (prev == '/' && line[i] == '/')\n\t {\n\t\treturn FALSE;\n\t }\n\t}",
"\tprev = line[i];\n }",
" return incomment == FALSE && instring == 0;\n}",
"/*\n * Search for variable declaration of \"ptr[len]\".\n * When \"locally\" is TRUE in the current function (\"gd\"), otherwise in the\n * current file (\"gD\").\n * When \"thisblock\" is TRUE check the {} block scope.\n * Return FAIL when not found.\n */\n int\nfind_decl(\n char_u\t*ptr,\n int\t\tlen,\n int\t\tlocally,\n int\t\tthisblock,\n int\t\tflags_arg)\t// flags passed to searchit()\n{\n char_u\t*pat;\n pos_T\told_pos;\n pos_T\tpar_pos;\n pos_T\tfound_pos;\n int\t\tt;\n int\t\tsave_p_ws;\n int\t\tsave_p_scs;\n int\t\tretval = OK;\n int\t\tincll;\n int\t\tsearchflags = flags_arg;\n int\t\tvalid;",
" if ((pat = alloc(len + 7)) == NULL)\n\treturn FAIL;",
" // Put \"\\V\" before the pattern to avoid that the special meaning of \".\"\n // and \"~\" causes trouble.\n sprintf((char *)pat, vim_iswordp(ptr) ? \"\\\\V\\\\<%.*s\\\\>\" : \"\\\\V%.*s\",\n\t\t\t\t\t\t\t\t len, ptr);\n old_pos = curwin->w_cursor;\n save_p_ws = p_ws;\n save_p_scs = p_scs;\n p_ws = FALSE;\t// don't wrap around end of file now\n p_scs = FALSE;\t// don't switch ignorecase off now",
" // With \"gD\" go to line 1.\n // With \"gd\" Search back for the start of the current function, then go\n // back until a blank line. If this fails go to line 1.\n if (!locally || !findpar(&incll, BACKWARD, 1L, '{', FALSE))\n {\n\tsetpcmark();\t\t\t// Set in findpar() otherwise\n\tcurwin->w_cursor.lnum = 1;\n\tpar_pos = curwin->w_cursor;\n }\n else\n {\n\tpar_pos = curwin->w_cursor;\n\twhile (curwin->w_cursor.lnum > 1 && *skipwhite(ml_get_curline()) != NUL)\n\t --curwin->w_cursor.lnum;\n }\n curwin->w_cursor.col = 0;",
" // Search forward for the identifier, ignore comment lines.\n CLEAR_POS(&found_pos);\n for (;;)\n {\n\tt = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,\n\t\t\t\t\t pat, 1L, searchflags, RE_LAST, NULL);\n\tif (curwin->w_cursor.lnum >= old_pos.lnum)\n\t t = FAIL;\t// match after start is failure too",
"\tif (thisblock && t != FAIL)\n\t{\n\t pos_T\t*pos;",
"\t // Check that the block the match is in doesn't end before the\n\t // position where we started the search from.\n\t if ((pos = findmatchlimit(NULL, '}', FM_FORWARD,\n\t\t (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL\n\t\t && pos->lnum < old_pos.lnum)\n\t {\n\t\t// There can't be a useful match before the end of this block.\n\t\t// Skip to the end.\n\t\tcurwin->w_cursor = *pos;\n\t\tcontinue;\n\t }\n\t}",
"\tif (t == FAIL)\n\t{\n\t // If we previously found a valid position, use it.\n\t if (found_pos.lnum != 0)\n\t {\n\t\tcurwin->w_cursor = found_pos;\n\t\tt = OK;\n\t }\n\t break;\n\t}\n\tif (get_leader_len(ml_get_curline(), NULL, FALSE, TRUE) > 0)\n\t{\n\t // Ignore this line, continue at start of next line.\n\t ++curwin->w_cursor.lnum;\n\t curwin->w_cursor.col = 0;\n\t continue;\n\t}\n\tvalid = is_ident(ml_get_curline(), curwin->w_cursor.col);",
"\t// If the current position is not a valid identifier and a previous\n\t// match is present, favor that one instead.\n\tif (!valid && found_pos.lnum != 0)\n\t{\n\t curwin->w_cursor = found_pos;\n\t break;\n\t}",
"\t// Global search: use first valid match found\n\tif (valid && !locally)\n\t break;\n\tif (valid && curwin->w_cursor.lnum >= par_pos.lnum)\n\t{\n\t // If we previously found a valid position, use it.\n\t if (found_pos.lnum != 0)\n\t\tcurwin->w_cursor = found_pos;\n\t break;\n\t}",
"\t// For finding a local variable and the match is before the \"{\" or\n\t// inside a comment, continue searching. For K&R style function\n\t// declarations this skips the function header without types.\n\tif (!valid)\n\t CLEAR_POS(&found_pos);\n\telse\n\t found_pos = curwin->w_cursor;\n\t// Remove SEARCH_START from flags to avoid getting stuck at one\n\t// position.\n\tsearchflags &= ~SEARCH_START;\n }",
" if (t == FAIL)\n {\n\tretval = FAIL;\n\tcurwin->w_cursor = old_pos;\n }\n else\n {\n\tcurwin->w_set_curswant = TRUE;\n\t// \"n\" searches forward now\n\treset_search_dir();\n }",
" vim_free(pat);\n p_ws = save_p_ws;\n p_scs = save_p_scs;",
" return retval;\n}",
"/*\n * Move 'dist' lines in direction 'dir', counting lines by *screen*\n * lines rather than lines in the file.\n * 'dist' must be positive.\n *\n * Return OK if able to move cursor, FAIL otherwise.\n */\n static int\nnv_screengo(oparg_T *oap, int dir, long dist)\n{\n int\t\tlinelen = linetabsize(ml_get_curline());\n int\t\tretval = OK;\n int\t\tatend = FALSE;\n int\t\tn;\n int\t\tcol_off1;\t// margin offset for first screen line\n int\t\tcol_off2;\t// margin offset for wrapped screen line\n int\t\twidth1;\t\t// text width for first screen line\n int\t\twidth2;\t\t// text width for wrapped screen line",
" oap->motion_type = MCHAR;\n oap->inclusive = (curwin->w_curswant == MAXCOL);",
" col_off1 = curwin_col_off();\n col_off2 = col_off1 - curwin_col_off2();\n width1 = curwin->w_width - col_off1;\n width2 = curwin->w_width - col_off2;\n if (width2 == 0)\n\twidth2 = 1; // avoid divide by zero",
" if (curwin->w_width != 0)\n {\n // Instead of sticking at the last character of the buffer line we\n // try to stick in the last column of the screen.\n if (curwin->w_curswant == MAXCOL)\n {\n\tatend = TRUE;\n\tvalidate_virtcol();\n\tif (width1 <= 0)\n\t curwin->w_curswant = 0;\n\telse\n\t{\n\t curwin->w_curswant = width1 - 1;\n\t if (curwin->w_virtcol > curwin->w_curswant)\n\t\tcurwin->w_curswant += ((curwin->w_virtcol\n\t\t\t - curwin->w_curswant - 1) / width2 + 1) * width2;\n\t}\n }\n else\n {\n\tif (linelen > width1)\n\t n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;\n\telse\n\t n = width1;\n\tif (curwin->w_curswant >= (colnr_T)n)\n\t curwin->w_curswant = n - 1;\n }",
" while (dist--)\n {\n\tif (dir == BACKWARD)\n\t{\n\t if ((long)curwin->w_curswant >= width1\n#ifdef FEAT_FOLDING\n\t\t && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)\n#endif\n\t )\n\t\t// Move back within the line. This can give a negative value\n\t\t// for w_curswant if width1 < width2 (with cpoptions+=n),\n\t\t// which will get clipped to column 0.\n\t\tcurwin->w_curswant -= width2;\n\t else\n\t {\n\t\t// to previous line\n#ifdef FEAT_FOLDING\n\t\t// Move to the start of a closed fold. Don't do that when\n\t\t// 'foldopen' contains \"all\": it will open in a moment.\n\t\tif (!(fdo_flags & FDO_ALL))\n\t\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\t&curwin->w_cursor.lnum, NULL);\n#endif\n\t\tif (curwin->w_cursor.lnum == 1)\n\t\t{\n\t\t retval = FAIL;\n\t\t break;\n\t\t}\n\t\t--curwin->w_cursor.lnum;",
"\t\tlinelen = linetabsize(ml_get_curline());\n\t\tif (linelen > width1)\n\t\t curwin->w_curswant += (((linelen - width1 - 1) / width2)\n\t\t\t\t\t\t\t\t+ 1) * width2;\n\t }\n\t}\n\telse // dir == FORWARD\n\t{\n\t if (linelen > width1)\n\t\tn = ((linelen - width1 - 1) / width2 + 1) * width2 + width1;\n\t else\n\t\tn = width1;\n\t if (curwin->w_curswant + width2 < (colnr_T)n\n#ifdef FEAT_FOLDING\n\t\t && !hasFolding(curwin->w_cursor.lnum, NULL, NULL)\n#endif\n\t\t )\n\t\t// move forward within line\n\t\tcurwin->w_curswant += width2;\n\t else\n\t {\n\t\t// to next line\n#ifdef FEAT_FOLDING\n\t\t// Move to the end of a closed fold.\n\t\t(void)hasFolding(curwin->w_cursor.lnum, NULL,\n\t\t\t\t\t\t &curwin->w_cursor.lnum);\n#endif\n\t\tif (curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)\n\t\t{\n\t\t retval = FAIL;\n\t\t break;\n\t\t}\n\t\tcurwin->w_cursor.lnum++;\n\t\tcurwin->w_curswant %= width2;\n\t\t// Check if the cursor has moved below the number display\n\t\t// when width1 < width2 (with cpoptions+=n). Subtract width2\n\t\t// to get a negative value for w_curswant, which will get\n\t\t// clipped to column 0.\n\t\tif (curwin->w_curswant >= width1)\n\t\t curwin->w_curswant -= width2;\n\t\tlinelen = linetabsize(ml_get_curline());\n\t }\n\t}\n }\n }",
" if (virtual_active() && atend)\n\tcoladvance(MAXCOL);\n else\n\tcoladvance(curwin->w_curswant);",
" if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)\n {\n\tcolnr_T virtcol;\n\tint\tc;",
"\t// Check for landing on a character that got split at the end of the\n\t// last line. We want to advance a screenline, not end up in the same\n\t// screenline or move two screenlines.\n\tvalidate_virtcol();\n\tvirtcol = curwin->w_virtcol;\n#if defined(FEAT_LINEBREAK)\n\tif (virtcol > (colnr_T)width1 && *get_showbreak_value(curwin) != NUL)\n\t virtcol -= vim_strsize(get_showbreak_value(curwin));\n#endif",
"\tc = (*mb_ptr2char)(ml_get_cursor());\n\tif (dir == FORWARD && virtcol < curwin->w_curswant\n\t\t&& (curwin->w_curswant <= (colnr_T)width1)\n\t\t&& !vim_isprintc(c) && c > 255)\n\t oneright();",
"\tif (virtcol > curwin->w_curswant\n\t\t&& (curwin->w_curswant < (colnr_T)width1\n\t\t ? (curwin->w_curswant > (colnr_T)width1 / 2)\n\t\t : ((curwin->w_curswant - width1) % width2\n\t\t\t\t\t\t > (colnr_T)width2 / 2)))\n\t --curwin->w_cursor.col;\n }",
" if (atend)\n\tcurwin->w_curswant = MAXCOL;\t // stick in the last column",
" return retval;\n}",
"/*\n * Handle CTRL-E and CTRL-Y commands: scroll a line up or down.\n * cap->arg must be TRUE for CTRL-E.\n */\n void\nnv_scroll_line(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n\tscroll_redraw(cap->arg, cap->count1);\n}",
"/*\n * Scroll \"count\" lines up or down, and redraw.\n */\n void\nscroll_redraw(int up, long count)\n{\n linenr_T\tprev_topline = curwin->w_topline;\n#ifdef FEAT_DIFF\n int\t\tprev_topfill = curwin->w_topfill;\n#endif\n linenr_T\tprev_lnum = curwin->w_cursor.lnum;",
" if (up)\n\tscrollup(count, TRUE);\n else\n\tscrolldown(count, TRUE);\n if (get_scrolloff_value())\n {\n\t// Adjust the cursor position for 'scrolloff'. Mark w_topline as\n\t// valid, otherwise the screen jumps back at the end of the file.\n\tcursor_correct();\n\tcheck_cursor_moved(curwin);\n\tcurwin->w_valid |= VALID_TOPLINE;",
"\t// If moved back to where we were, at least move the cursor, otherwise\n\t// we get stuck at one position. Don't move the cursor up if the\n\t// first line of the buffer is already on the screen\n\twhile (curwin->w_topline == prev_topline\n#ifdef FEAT_DIFF\n\t\t&& curwin->w_topfill == prev_topfill\n#endif\n\t\t)\n\t{\n\t if (up)\n\t {\n\t\tif (curwin->w_cursor.lnum > prev_lnum\n\t\t\t|| cursor_down(1L, FALSE) == FAIL)\n\t\t break;\n\t }\n\t else\n\t {\n\t\tif (curwin->w_cursor.lnum < prev_lnum\n\t\t\t|| prev_topline == 1L\n\t\t\t|| cursor_up(1L, FALSE) == FAIL)\n\t\t break;\n\t }\n\t // Mark w_topline as valid, otherwise the screen jumps back at the\n\t // end of the file.\n\t check_cursor_moved(curwin);\n\t curwin->w_valid |= VALID_TOPLINE;\n\t}\n }\n if (curwin->w_cursor.lnum != prev_lnum)\n\tcoladvance(curwin->w_curswant);\n redraw_later(VALID);\n}",
"/*\n * Get the count specified after a 'z' command. Only the 'z<CR>', 'zl', 'zh',\n * 'z<Left>', and 'z<Right>' commands accept a count after 'z'.\n * Returns TRUE to process the 'z' command and FALSE to skip it.\n */\n static int\nnv_z_get_count(cmdarg_T *cap, int *nchar_arg)\n{\n int\t\tnchar = *nchar_arg;\n long\tn;",
" // \"z123{nchar}\": edit the count before obtaining {nchar}\n if (checkclearop(cap->oap))\n\treturn FALSE;\n n = nchar - '0';",
" for (;;)\n {\n#ifdef USE_ON_FLY_SCROLL\n\tdont_scroll = TRUE;\t\t// disallow scrolling here\n#endif\n\t++no_mapping;\n\t++allow_keys; // no mapping for nchar, but allow key codes\n\tnchar = plain_vgetc();\n\tLANGMAP_ADJUST(nchar, TRUE);\n\t--no_mapping;\n\t--allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t(void)add_to_showcmd(nchar);\n#endif\n\tif (nchar == K_DEL || nchar == K_KDEL)\n\t n /= 10;\n\telse if (VIM_ISDIGIT(nchar))\n\t n = n * 10 + (nchar - '0');\n\telse if (nchar == CAR)\n\t{\n#ifdef FEAT_GUI\n\t need_mouse_correct = TRUE;\n#endif\n\t win_setheight((int)n);\n\t break;\n\t}\n\telse if (nchar == 'l'\n\t\t|| nchar == 'h'\n\t\t|| nchar == K_LEFT\n\t\t|| nchar == K_RIGHT)\n\t{\n\t cap->count1 = n ? n * cap->count1 : cap->count1;\n\t *nchar_arg = nchar;\n\t return TRUE;\n\t}\n\telse\n\t{\n\t clearopbeep(cap->oap);\n\t break;\n\t}\n }\n cap->oap->op_type = OP_NOP;\n return FALSE;\n}",
"#ifdef FEAT_SPELL\n/*\n * \"zug\" and \"zuw\": undo \"zg\" and \"zw\"\n * \"zg\": add good word to word list\n * \"zw\": add wrong word to word list\n * \"zG\": add good word to temp word list\n * \"zW\": add wrong word to temp word list\n */\n static int\nnv_zg_zw(cmdarg_T *cap, int nchar)\n{\n char_u\t*ptr = NULL;\n int\t\tlen;\n int\t\tundo = FALSE;",
" if (nchar == 'u')\n {\n\t++no_mapping;\n\t++allow_keys; // no mapping for nchar, but allow key codes\n\tnchar = plain_vgetc();\n\tLANGMAP_ADJUST(nchar, TRUE);\n\t--no_mapping;\n\t--allow_keys;\n#ifdef FEAT_CMDL_INFO\n\t(void)add_to_showcmd(nchar);\n#endif\n\tif (vim_strchr((char_u *)\"gGwW\", nchar) == NULL)\n\t{\n\t clearopbeep(cap->oap);\n\t return OK;\n\t}\n\tundo = TRUE;\n }",
" if (checkclearop(cap->oap))\n\treturn OK;\n if (VIsual_active && get_visual_text(cap, &ptr, &len) == FAIL)\n\treturn FAIL;\n if (ptr == NULL)\n {\n\tpos_T\tpos = curwin->w_cursor;",
"\t// Find bad word under the cursor. When 'spell' is\n\t// off this fails and find_ident_under_cursor() is\n\t// used below.\n\temsg_off++;\n\tlen = spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL);\n\temsg_off--;\n\tif (len != 0 && curwin->w_cursor.col <= pos.col)\n\t ptr = ml_get_pos(&curwin->w_cursor);\n\tcurwin->w_cursor = pos;\n }",
" if (ptr == NULL\n\t\t&& (len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)\n\treturn FAIL;\n spell_add_word(ptr, len, nchar == 'w' || nchar == 'W'\n\t ? SPELL_ADD_BAD : SPELL_ADD_GOOD,\n\t (nchar == 'G' || nchar == 'W') ? 0 : (int)cap->count1, undo);",
" return OK;\n}\n#endif",
"/*\n * Commands that start with \"z\".\n */\n static void\nnv_zet(cmdarg_T *cap)\n{\n long\tn;\n colnr_T\tcol;\n int\t\tnchar = cap->nchar;\n#ifdef FEAT_FOLDING\n long\told_fdl = curwin->w_p_fdl;\n int\t\told_fen = curwin->w_p_fen;\n#endif\n long\tsiso = get_sidescrolloff_value();",
" if (VIM_ISDIGIT(nchar) && !nv_z_get_count(cap, &nchar))\n\t return;",
" if (\n#ifdef FEAT_FOLDING\n\t // \"zf\" and \"zF\" are always an operator, \"zd\", \"zo\", \"zO\", \"zc\"\n\t // and \"zC\" only in Visual mode. \"zj\" and \"zk\" are motion\n\t // commands.\n\t cap->nchar != 'f' && cap->nchar != 'F'\n\t && !(VIsual_active && vim_strchr((char_u *)\"dcCoO\", cap->nchar))\n\t && cap->nchar != 'j' && cap->nchar != 'k'\n\t &&\n#endif\n\t checkclearop(cap->oap))\n\treturn;",
" // For \"z+\", \"z<CR>\", \"zt\", \"z.\", \"zz\", \"z^\", \"z-\", \"zb\":\n // If line number given, set cursor.\n if ((vim_strchr((char_u *)\"+\\r\\nt.z^-b\", nchar) != NULL)\n\t && cap->count0\n\t && cap->count0 != curwin->w_cursor.lnum)\n {\n\tsetpcmark();\n\tif (cap->count0 > curbuf->b_ml.ml_line_count)\n\t curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\telse\n\t curwin->w_cursor.lnum = cap->count0;\n\tcheck_cursor_col();\n }",
" switch (nchar)\n {\n\t\t// \"z+\", \"z<CR>\" and \"zt\": put cursor at top of screen\n case '+':\n\t\tif (cap->count0 == 0)\n\t\t{\n\t\t // No count given: put cursor at the line below screen\n\t\t validate_botline();\t// make sure w_botline is valid\n\t\t if (curwin->w_botline > curbuf->b_ml.ml_line_count)\n\t\t\tcurwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t\t else\n\t\t\tcurwin->w_cursor.lnum = curwin->w_botline;\n\t\t}\n\t\t// FALLTHROUGH\n case NL:\n case CAR:\n case K_KENTER:\n\t\tbeginline(BL_WHITE | BL_FIX);\n\t\t// FALLTHROUGH",
" case 't':\tscroll_cursor_top(0, TRUE);\n\t\tredraw_later(VALID);\n\t\tset_fraction(curwin);\n\t\tbreak;",
"\t\t// \"z.\" and \"zz\": put cursor in middle of screen\n case '.':\tbeginline(BL_WHITE | BL_FIX);\n\t\t// FALLTHROUGH",
" case 'z':\tscroll_cursor_halfway(TRUE);\n\t\tredraw_later(VALID);\n\t\tset_fraction(curwin);\n\t\tbreak;",
"\t\t// \"z^\", \"z-\" and \"zb\": put cursor at bottom of screen\n case '^':\t// Strange Vi behavior: <count>z^ finds line at top of window\n\t\t// when <count> is at bottom of window, and puts that one at\n\t\t// bottom of window.\n\t\tif (cap->count0 != 0)\n\t\t{\n\t\t scroll_cursor_bot(0, TRUE);\n\t\t curwin->w_cursor.lnum = curwin->w_topline;\n\t\t}\n\t\telse if (curwin->w_topline == 1)\n\t\t curwin->w_cursor.lnum = 1;\n\t\telse\n\t\t curwin->w_cursor.lnum = curwin->w_topline - 1;\n\t\t// FALLTHROUGH\n case '-':\n\t\tbeginline(BL_WHITE | BL_FIX);\n\t\t// FALLTHROUGH",
" case 'b':\tscroll_cursor_bot(0, TRUE);\n\t\tredraw_later(VALID);\n\t\tset_fraction(curwin);\n\t\tbreak;",
"\t\t// \"zH\" - scroll screen right half-page\n case 'H':\n\t\tcap->count1 *= curwin->w_width / 2;\n\t\t// FALLTHROUGH",
"\t\t// \"zh\" - scroll screen to the right\n case 'h':\n case K_LEFT:\n\t\tif (!curwin->w_p_wrap)\n\t\t{\n\t\t if ((colnr_T)cap->count1 > curwin->w_leftcol)\n\t\t\tcurwin->w_leftcol = 0;\n\t\t else\n\t\t\tcurwin->w_leftcol -= (colnr_T)cap->count1;\n\t\t leftcol_changed();\n\t\t}\n\t\tbreak;",
"\t\t// \"zL\" - scroll screen left half-page\n case 'L':\tcap->count1 *= curwin->w_width / 2;\n\t\t// FALLTHROUGH",
"\t\t// \"zl\" - scroll screen to the left\n case 'l':\n case K_RIGHT:\n\t\tif (!curwin->w_p_wrap)\n\t\t{\n\t\t // scroll the window left\n\t\t curwin->w_leftcol += (colnr_T)cap->count1;\n\t\t leftcol_changed();\n\t\t}\n\t\tbreak;",
"\t\t// \"zs\" - scroll screen, cursor at the start\n case 's':\tif (!curwin->w_p_wrap)\n\t\t{\n#ifdef FEAT_FOLDING\n\t\t if (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t\tcol = 0;\t// like the cursor is in col 0\n\t\t else\n#endif\n\t\t getvcol(curwin, &curwin->w_cursor, &col, NULL, NULL);\n\t\t if ((long)col > siso)\n\t\t\tcol -= siso;\n\t\t else\n\t\t\tcol = 0;\n\t\t if (curwin->w_leftcol != col)\n\t\t {\n\t\t\tcurwin->w_leftcol = col;\n\t\t\tredraw_later(NOT_VALID);\n\t\t }\n\t\t}\n\t\tbreak;",
"\t\t// \"ze\" - scroll screen, cursor at the end\n case 'e':\tif (!curwin->w_p_wrap)\n\t\t{\n#ifdef FEAT_FOLDING\n\t\t if (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t\tcol = 0;\t// like the cursor is in col 0\n\t\t else\n#endif\n\t\t getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);\n\t\t n = curwin->w_width - curwin_col_off();\n\t\t if ((long)col + siso < n)\n\t\t\tcol = 0;\n\t\t else\n\t\t\tcol = col + siso - n + 1;\n\t\t if (curwin->w_leftcol != col)\n\t\t {\n\t\t\tcurwin->w_leftcol = col;\n\t\t\tredraw_later(NOT_VALID);\n\t\t }\n\t\t}\n\t\tbreak;",
"\t\t// \"zp\", \"zP\" in block mode put without addind trailing spaces\n case 'P':\n case 'p': nv_put(cap);\n\t break;\n\t\t// \"zy\" Yank without trailing spaces\n case 'y': nv_operator(cap);\n\t break;\n#ifdef FEAT_FOLDING\n\t\t// \"zF\": create fold command\n\t\t// \"zf\": create fold operator\n case 'F':\n case 'f': if (foldManualAllowed(TRUE))\n\t\t{\n\t\t cap->nchar = 'f';\n\t\t nv_operator(cap);\n\t\t curwin->w_p_fen = TRUE;",
"\t\t // \"zF\" is like \"zfzf\"\n\t\t if (nchar == 'F' && cap->oap->op_type == OP_FOLD)\n\t\t {\n\t\t\tnv_operator(cap);\n\t\t\tfinish_op = TRUE;\n\t\t }\n\t\t}\n\t\telse\n\t\t clearopbeep(cap->oap);\n\t\tbreak;",
"\t\t// \"zd\": delete fold at cursor\n\t\t// \"zD\": delete fold at cursor recursively\n case 'd':\n case 'D':\tif (foldManualAllowed(FALSE))\n\t\t{\n\t\t if (VIsual_active)\n\t\t\tnv_operator(cap);\n\t\t else\n\t\t\tdeleteFold(curwin->w_cursor.lnum,\n\t\t\t\t curwin->w_cursor.lnum, nchar == 'D', FALSE);\n\t\t}\n\t\tbreak;",
"\t\t// \"zE\": erase all folds\n case 'E':\tif (foldmethodIsManual(curwin))\n\t\t{\n\t\t clearFolding(curwin);\n\t\t changed_window_setting();\n\t\t}\n\t\telse if (foldmethodIsMarker(curwin))\n\t\t deleteFold((linenr_T)1, curbuf->b_ml.ml_line_count,\n\t\t\t\t\t\t\t\t TRUE, FALSE);\n\t\telse\n\t\t emsg(_(e_cannot_erase_folds_with_current_foldmethod));\n\t\tbreak;",
"\t\t// \"zn\": fold none: reset 'foldenable'\n case 'n':\tcurwin->w_p_fen = FALSE;\n\t\tbreak;",
"\t\t// \"zN\": fold Normal: set 'foldenable'\n case 'N':\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zi\": invert folding: toggle 'foldenable'\n case 'i':\tcurwin->w_p_fen = !curwin->w_p_fen;\n\t\tbreak;",
"\t\t// \"za\": open closed fold or close open fold at cursor\n case 'a':\tif (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t openFold(curwin->w_cursor.lnum, cap->count1);\n\t\telse\n\t\t{\n\t\t closeFold(curwin->w_cursor.lnum, cap->count1);\n\t\t curwin->w_p_fen = TRUE;\n\t\t}\n\t\tbreak;",
"\t\t// \"zA\": open fold at cursor recursively\n case 'A':\tif (hasFolding(curwin->w_cursor.lnum, NULL, NULL))\n\t\t openFoldRecurse(curwin->w_cursor.lnum);\n\t\telse\n\t\t{\n\t\t closeFoldRecurse(curwin->w_cursor.lnum);\n\t\t curwin->w_p_fen = TRUE;\n\t\t}\n\t\tbreak;",
"\t\t// \"zo\": open fold at cursor or Visual area\n case 'o':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t openFold(curwin->w_cursor.lnum, cap->count1);\n\t\tbreak;",
"\t\t// \"zO\": open fold recursively\n case 'O':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t openFoldRecurse(curwin->w_cursor.lnum);\n\t\tbreak;",
"\t\t// \"zc\": close fold at cursor or Visual area\n case 'c':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t closeFold(curwin->w_cursor.lnum, cap->count1);\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zC\": close fold recursively\n case 'C':\tif (VIsual_active)\n\t\t nv_operator(cap);\n\t\telse\n\t\t closeFoldRecurse(curwin->w_cursor.lnum);\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zv\": open folds at the cursor\n case 'v':\tfoldOpenCursor();\n\t\tbreak;",
"\t\t// \"zx\": re-apply 'foldlevel' and open folds at the cursor\n case 'x':\tcurwin->w_p_fen = TRUE;\n\t\tcurwin->w_foldinvalid = TRUE;\t// recompute folds\n\t\tnewFoldLevel();\t\t\t// update right now\n\t\tfoldOpenCursor();\n\t\tbreak;",
"\t\t// \"zX\": undo manual opens/closes, re-apply 'foldlevel'\n case 'X':\tcurwin->w_p_fen = TRUE;\n\t\tcurwin->w_foldinvalid = TRUE;\t// recompute folds\n\t\told_fdl = -1;\t\t\t// force an update\n\t\tbreak;",
"\t\t// \"zm\": fold more\n case 'm':\tif (curwin->w_p_fdl > 0)\n\t\t{\n\t\t curwin->w_p_fdl -= cap->count1;\n\t\t if (curwin->w_p_fdl < 0)\n\t\t\tcurwin->w_p_fdl = 0;\n\t\t}\n\t\told_fdl = -1;\t\t// force an update\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zM\": close all folds\n case 'M':\tcurwin->w_p_fdl = 0;\n\t\told_fdl = -1;\t\t// force an update\n\t\tcurwin->w_p_fen = TRUE;\n\t\tbreak;",
"\t\t// \"zr\": reduce folding\n case 'r':\tcurwin->w_p_fdl += cap->count1;\n\t\t{\n\t\t int d = getDeepestNesting();",
"\t\t if (curwin->w_p_fdl >= d)\n\t\t\tcurwin->w_p_fdl = d;\n\t\t}\n\t\tbreak;",
"\t\t// \"zR\": open all folds\n case 'R':\tcurwin->w_p_fdl = getDeepestNesting();\n\t\told_fdl = -1;\t\t// force an update\n\t\tbreak;",
" case 'j':\t// \"zj\" move to next fold downwards\n case 'k':\t// \"zk\" move to next fold upwards\n\t\tif (foldMoveTo(TRUE, nchar == 'j' ? FORWARD : BACKWARD,\n\t\t\t\t\t\t\t cap->count1) == FAIL)\n\t\t clearopbeep(cap->oap);\n\t\tbreak;",
"#endif // FEAT_FOLDING",
"#ifdef FEAT_SPELL\n case 'u':\t// \"zug\" and \"zuw\": undo \"zg\" and \"zw\"\n case 'g':\t// \"zg\": add good word to word list\n case 'w':\t// \"zw\": add wrong word to word list\n case 'G':\t// \"zG\": add good word to temp word list\n case 'W':\t// \"zW\": add wrong word to temp word list\n\t\tif (nv_zg_zw(cap, nchar) == FAIL)\n\t\t return;\n\t\tbreak;",
" case '=':\t// \"z=\": suggestions for a badly spelled word\n\t\tif (!checkclearop(cap->oap))\n\t\t spell_suggest((int)cap->count0);\n\t\tbreak;\n#endif",
" default:\tclearopbeep(cap->oap);\n }",
"#ifdef FEAT_FOLDING\n // Redraw when 'foldenable' changed\n if (old_fen != curwin->w_p_fen)\n {\n# ifdef FEAT_DIFF\n\twin_T\t *wp;",
"\tif (foldmethodIsDiff(curwin) && curwin->w_p_scb)\n\t{\n\t // Adjust 'foldenable' in diff-synced windows.\n\t FOR_ALL_WINDOWS(wp)\n\t {\n\t\tif (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb)\n\t\t{\n\t\t wp->w_p_fen = curwin->w_p_fen;\n\t\t changed_window_setting_win(wp);\n\t\t}\n\t }\n\t}\n# endif\n\tchanged_window_setting();\n }",
" // Redraw when 'foldlevel' changed.\n if (old_fdl != curwin->w_p_fdl)\n\tnewFoldLevel();\n#endif\n}",
"#ifdef FEAT_GUI\n/*\n * Vertical scrollbar movement.\n */\n static void\nnv_ver_scrollbar(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to scroll\n gui_do_scroll();\n}",
"/*\n * Horizontal scrollbar movement.\n */\n static void\nnv_hor_scrollbar(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to scroll\n gui_do_horiz_scroll(scrollbar_value, FALSE);\n}\n#endif",
"#if defined(FEAT_GUI_TABLINE) || defined(PROTO)\n/*\n * Click in GUI tab.\n */\n static void\nnv_tabline(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to jump tabs.\n goto_tabpage(current_tab);\n}",
"/*\n * Selected item in tab line menu.\n */\n static void\nnv_tabmenu(cmdarg_T *cap)\n{\n if (cap->oap->op_type != OP_NOP)\n\tclearopbeep(cap->oap);",
" // Even if an operator was pending, we still want to jump tabs.\n handle_tabmenu();\n}",
"/*\n * Handle selecting an item of the GUI tab line menu.\n * Used in Normal and Insert mode.\n */\n void\nhandle_tabmenu(void)\n{\n switch (current_tabmenu)\n {\n\tcase TABLINE_MENU_CLOSE:\n\t if (current_tab == 0)\n\t\tdo_cmdline_cmd((char_u *)\"tabclose\");\n\t else\n\t {\n\t\tvim_snprintf((char *)IObuff, IOSIZE, \"tabclose %d\",\n\t\t\t\t\t\t\t\t current_tab);\n\t\tdo_cmdline_cmd(IObuff);\n\t }\n\t break;",
"\tcase TABLINE_MENU_NEW:\n\t if (current_tab == 0)\n\t\tdo_cmdline_cmd((char_u *)\"$tabnew\");\n\t else\n\t {\n\t\tvim_snprintf((char *)IObuff, IOSIZE, \"%dtabnew\",\n\t\t\t\t\t\t\t current_tab - 1);\n\t\tdo_cmdline_cmd(IObuff);\n\t }\n\t break;",
"\tcase TABLINE_MENU_OPEN:\n\t if (current_tab == 0)\n\t\tdo_cmdline_cmd((char_u *)\"browse $tabnew\");\n\t else\n\t {\n\t\tvim_snprintf((char *)IObuff, IOSIZE, \"browse %dtabnew\",\n\t\t\t\t\t\t\t current_tab - 1);\n\t\tdo_cmdline_cmd(IObuff);\n\t }\n\t break;\n }\n}\n#endif",
"/*\n * \"Q\" command.\n */\n static void\nnv_exmode(cmdarg_T *cap)\n{\n // Ignore 'Q' in Visual mode, just give a beep.\n if (VIsual_active)\n\tvim_beep(BO_EX);\n else if (!checkclearop(cap->oap))\n\tdo_exmode(FALSE);\n}",
"/*\n * Handle a \":\" command.\n */\n static void\nnv_colon(cmdarg_T *cap)\n{\n int\told_p_im;\n int\tcmd_result;\n int\tis_cmdkey = cap->cmdchar == K_COMMAND\n\t\t\t\t\t || cap->cmdchar == K_SCRIPT_COMMAND;\n int\tflags;",
" if (VIsual_active && !is_cmdkey)\n\tnv_operator(cap);\n else\n {\n\tif (cap->oap->op_type != OP_NOP)\n\t{\n\t // Using \":\" as a movement is characterwise exclusive.\n\t cap->oap->motion_type = MCHAR;\n\t cap->oap->inclusive = FALSE;\n\t}\n\telse if (cap->count0 && !is_cmdkey)\n\t{\n\t // translate \"count:\" into \":.,.+(count - 1)\"\n\t stuffcharReadbuff('.');\n\t if (cap->count0 > 1)\n\t {\n\t\tstuffReadbuff((char_u *)\",.+\");\n\t\tstuffnumReadbuff((long)cap->count0 - 1L);\n\t }\n\t}",
"\t// When typing, don't type below an old message\n\tif (KeyTyped)\n\t compute_cmdrow();",
"\told_p_im = p_im;",
"\t// get a command line and execute it\n\tflags = cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0;\n\tif (is_cmdkey)\n\t cmd_result = do_cmdkey_command(cap->cmdchar, flags);\n\telse\n\t cmd_result = do_cmdline(NULL, getexline, NULL, flags);",
"\t// If 'insertmode' changed, enter or exit Insert mode\n\tif (p_im != old_p_im)\n\t{\n\t if (p_im)\n\t\trestart_edit = 'i';\n\t else\n\t\trestart_edit = 0;\n\t}",
"\tif (cmd_result == FAIL)\n\t // The Ex command failed, do not execute the operator.\n\t clearop(cap->oap);\n\telse if (cap->oap->op_type != OP_NOP\n\t\t&& (cap->oap->start.lnum > curbuf->b_ml.ml_line_count\n\t\t || cap->oap->start.col >\n\t\t\t (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))\n\t\t || did_emsg\n\t\t ))\n\t // The start of the operator has become invalid by the Ex command.\n\t clearopbeep(cap->oap);\n }\n}",
"/*\n * Handle CTRL-G command.\n */\n static void\nnv_ctrlg(cmdarg_T *cap)\n{\n if (VIsual_active)\t// toggle Selection/Visual mode\n {\n\tVIsual_select = !VIsual_select;\n\tmay_trigger_modechanged();\n\tshowmode();\n }\n else if (!checkclearop(cap->oap))\n\t// print full name if count given or :cd used\n\tfileinfo((int)cap->count0, FALSE, TRUE);\n}",
"/*\n * Handle CTRL-H <Backspace> command.\n */\n static void\nnv_ctrlh(cmdarg_T *cap)\n{\n if (VIsual_active && VIsual_select)\n {\n\tcap->cmdchar = 'x';\t// BS key behaves like 'x' in Select mode\n\tv_visop(cap);\n }\n else\n\tnv_left(cap);\n}",
"/*\n * CTRL-L: clear screen and redraw.\n */\n static void\nnv_clear(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n {\n#ifdef FEAT_SYN_HL\n\t// Clear all syntax states to force resyncing.\n\tsyn_stack_free_all(curwin->w_s);\n# ifdef FEAT_RELTIME\n\t{\n\t win_T *wp;",
"\t FOR_ALL_WINDOWS(wp)\n\t\twp->w_s->b_syn_slow = FALSE;\n\t}\n# endif\n#endif\n\tredraw_later(CLEAR);\n#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL))\n# ifdef VIMDLL\n\tif (!gui.in_use)\n# endif\n\t resize_console_buf();\n#endif\n }\n}",
"/*\n * CTRL-O: In Select mode: switch to Visual mode for one command.\n * Otherwise: Go to older pcmark.\n */\n static void\nnv_ctrlo(cmdarg_T *cap)\n{\n if (VIsual_active && VIsual_select)\n {\n\tVIsual_select = FALSE;\n\tmay_trigger_modechanged();\n\tshowmode();\n\trestart_VIsual_select = 2;\t// restart Select mode later\n }\n else\n {\n\tcap->count1 = -cap->count1;\n\tnv_pcmark(cap);\n }\n}",
"/*\n * CTRL-^ command, short for \":e #\". Works even when the alternate buffer is\n * not named.\n */\n static void\nnv_hat(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n\t(void)buflist_getfile((int)cap->count0, (linenr_T)0,\n\t\t\t\t\t\tGETF_SETMARK|GETF_ALT, FALSE);\n}",
"/*\n * \"Z\" commands.\n */\n static void\nnv_Zet(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n {\n\tswitch (cap->nchar)\n\t{\n\t\t\t// \"ZZ\": equivalent to \":x\".\n\t case 'Z':\tdo_cmdline_cmd((char_u *)\"x\");\n\t\t\tbreak;",
"\t\t\t// \"ZQ\": equivalent to \":q!\" (Elvis compatible).\n\t case 'Q':\tdo_cmdline_cmd((char_u *)\"q!\");\n\t\t\tbreak;",
"\t default:\tclearopbeep(cap->oap);\n\t}\n }\n}",
"/*\n * Call nv_ident() as if \"c1\" was used, with \"c2\" as next character.\n */\n void\ndo_nv_ident(int c1, int c2)\n{\n oparg_T\toa;\n cmdarg_T\tca;",
" clear_oparg(&oa);\n CLEAR_FIELD(ca);\n ca.oap = &oa;\n ca.cmdchar = c1;\n ca.nchar = c2;\n nv_ident(&ca);\n}",
"/*\n * 'K' normal-mode command. Get the command to lookup the keyword under the\n * cursor.\n */\n static int\nnv_K_getcmd(\n\tcmdarg_T\t*cap,\n\tchar_u\t\t*kp,\n\tint\t\tkp_help,\n\tint\t\tkp_ex,\n\tchar_u\t\t**ptr_arg,\n\tint\t\tn,\n\tchar_u\t\t*buf,\n\tunsigned\tbuflen)\n{\n char_u\t*ptr = *ptr_arg;\n int\t\tisman;\n int\t\tisman_s;",
" if (kp_help)\n {\n\t// in the help buffer\n\tSTRCPY(buf, \"he! \");\n\treturn n;\n }",
" if (kp_ex)\n {\n\t// 'keywordprog' is an ex command\n\tif (cap->count0 != 0)\n\t vim_snprintf((char *)buf, buflen, \"%s %ld\", kp, cap->count0);\n\telse\n\t STRCPY(buf, kp);\n\tSTRCAT(buf, \" \");\n\treturn n;\n }",
" // An external command will probably use an argument starting\n // with \"-\" as an option. To avoid trouble we skip the \"-\".\n while (*ptr == '-' && n > 0)\n {\n\t++ptr;\n\t--n;\n }\n if (n == 0)\n {\n\t// found dashes only\n\temsg(_(e_no_identifier_under_cursor));\n\tvim_free(buf);\n\t*ptr_arg = ptr;\n\treturn 0;\n }",
" // When a count is given, turn it into a range. Is this\n // really what we want?\n isman = (STRCMP(kp, \"man\") == 0);\n isman_s = (STRCMP(kp, \"man -s\") == 0);\n if (cap->count0 != 0 && !(isman || isman_s))\n\tsprintf((char *)buf, \".,.+%ld\", cap->count0 - 1);",
" STRCAT(buf, \"! \");\n if (cap->count0 == 0 && isman_s)\n\tSTRCAT(buf, \"man\");\n else\n\tSTRCAT(buf, kp);\n STRCAT(buf, \" \");\n if (cap->count0 != 0 && (isman || isman_s))\n {\n\tsprintf((char *)buf + STRLEN(buf), \"%ld\", cap->count0);\n\tSTRCAT(buf, \" \");\n }",
" *ptr_arg = ptr;\n return n;\n}",
"/*\n * Handle the commands that use the word under the cursor.\n * [g] CTRL-]\t:ta to current identifier\n * [g] 'K'\trun program for current identifier\n * [g] '*'\t/ to current identifier or string\n * [g] '#'\t? to current identifier or string\n * g ']'\t:tselect for current identifier\n */\n static void\nnv_ident(cmdarg_T *cap)\n{\n char_u\t*ptr = NULL;\n char_u\t*buf;\n unsigned\tbuflen;\n char_u\t*newbuf;\n char_u\t*p;\n char_u\t*kp;\t\t// value of 'keywordprg'\n int\t\tkp_help;\t// 'keywordprg' is \":he\"\n int\t\tkp_ex;\t\t// 'keywordprg' starts with \":\"\n int\t\tn = 0;\t\t// init for GCC\n int\t\tcmdchar;\n int\t\tg_cmd;\t\t// \"g\" command\n int\t\ttag_cmd = FALSE;\n char_u\t*aux_ptr;",
" if (cap->cmdchar == 'g')\t// \"g*\", \"g#\", \"g]\" and \"gCTRL-]\"\n {\n\tcmdchar = cap->nchar;\n\tg_cmd = TRUE;\n }\n else\n {\n\tcmdchar = cap->cmdchar;\n\tg_cmd = FALSE;\n }",
" if (cmdchar == POUND)\t// the pound sign, '#' for English keyboards\n\tcmdchar = '#';",
" // The \"]\", \"CTRL-]\" and \"K\" commands accept an argument in Visual mode.\n if (cmdchar == ']' || cmdchar == Ctrl_RSB || cmdchar == 'K')\n {\n\tif (VIsual_active && get_visual_text(cap, &ptr, &n) == FAIL)\n\t return;\n\tif (checkclearopq(cap->oap))\n\t return;\n }",
" if (ptr == NULL && (n = find_ident_under_cursor(&ptr,\n\t\t (cmdchar == '*' || cmdchar == '#')\n\t\t\t\t ? FIND_IDENT|FIND_STRING : FIND_IDENT)) == 0)\n {\n\tclearop(cap->oap);\n\treturn;\n }",
" // Allocate buffer to put the command in. Inserting backslashes can\n // double the length of the word. p_kp / curbuf->b_p_kp could be added\n // and some numbers.\n kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp);\n kp_help = (*kp == NUL || STRCMP(kp, \":he\") == 0\n\t\t\t\t\t\t || STRCMP(kp, \":help\") == 0);\n if (kp_help && *skipwhite(ptr) == NUL)\n {\n\temsg(_(e_no_identifier_under_cursor));\t // found white space only\n\treturn;\n }\n kp_ex = (*kp == ':');\n buflen = (unsigned)(n * 2 + 30 + STRLEN(kp));\n buf = alloc(buflen);\n if (buf == NULL)\n\treturn;\n buf[0] = NUL;",
" switch (cmdchar)\n {\n\tcase '*':\n\tcase '#':\n\t // Put cursor at start of word, makes search skip the word\n\t // under the cursor.\n\t // Call setpcmark() first, so \"*``\" puts the cursor back where\n\t // it was.\n\t setpcmark();\n\t curwin->w_cursor.col = (colnr_T) (ptr - ml_get_curline());",
"\t if (!g_cmd && vim_iswordp(ptr))\n\t\tSTRCPY(buf, \"\\\\<\");\n\t no_smartcase = TRUE;\t// don't use 'smartcase' now\n\t break;",
"\tcase 'K':\n\t n = nv_K_getcmd(cap, kp, kp_help, kp_ex, &ptr, n, buf, buflen);\n\t if (n == 0)\n\t\treturn;\n\t break;",
"\tcase ']':\n\t tag_cmd = TRUE;\n#ifdef FEAT_CSCOPE\n\t if (p_cst)\n\t\tSTRCPY(buf, \"cstag \");\n\t else\n#endif\n\t\tSTRCPY(buf, \"ts \");\n\t break;",
"\tdefault:\n\t tag_cmd = TRUE;\n\t if (curbuf->b_help)\n\t\tSTRCPY(buf, \"he! \");\n\t else\n\t {\n\t\tif (g_cmd)\n\t\t STRCPY(buf, \"tj \");\n\t\telse if (cap->count0 == 0)\n\t\t STRCPY(buf, \"ta \");\n\t\telse\n\t\t sprintf((char *)buf, \":%ldta \", cap->count0);\n\t }\n }",
" // Now grab the chars in the identifier\n if (cmdchar == 'K' && !kp_help)\n {\n\tptr = vim_strnsave(ptr, n);\n\tif (kp_ex)\n\t // Escape the argument properly for an Ex command\n\t p = vim_strsave_fnameescape(ptr, VSE_NONE);\n\telse\n\t // Escape the argument properly for a shell command\n\t p = vim_strsave_shellescape(ptr, TRUE, TRUE);\n\tvim_free(ptr);\n\tif (p == NULL)\n\t{\n\t vim_free(buf);\n\t return;\n\t}\n\tnewbuf = vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);\n\tif (newbuf == NULL)\n\t{\n\t vim_free(buf);\n\t vim_free(p);\n\t return;\n\t}\n\tbuf = newbuf;\n\tSTRCAT(buf, p);\n\tvim_free(p);\n }\n else\n {\n\tif (cmdchar == '*')\n\t aux_ptr = (char_u *)(magic_isset() ? \"/.*~[^$\\\\\" : \"/^$\\\\\");\n\telse if (cmdchar == '#')\n\t aux_ptr = (char_u *)(magic_isset() ? \"/?.*~[^$\\\\\" : \"/?^$\\\\\");\n\telse if (tag_cmd)\n\t{\n\t if (curbuf->b_help)\n\t\t// \":help\" handles unescaped argument\n\t\taux_ptr = (char_u *)\"\";\n\t else\n\t\taux_ptr = (char_u *)\"\\\\|\\\"\\n[\";\n\t}\n\telse\n\t aux_ptr = (char_u *)\"\\\\|\\\"\\n*?[\";",
"\tp = buf + STRLEN(buf);\n\twhile (n-- > 0)\n\t{\n\t // put a backslash before \\ and some others\n\t if (vim_strchr(aux_ptr, *ptr) != NULL)\n\t\t*p++ = '\\\\';\n\t // When current byte is a part of multibyte character, copy all\n\t // bytes of that character.\n\t if (has_mbyte)\n\t {\n\t\tint i;\n\t\tint len = (*mb_ptr2len)(ptr) - 1;",
"\t\tfor (i = 0; i < len && n >= 1; ++i, --n)\n\t\t *p++ = *ptr++;\n\t }\n\t *p++ = *ptr++;\n\t}\n\t*p = NUL;\n }",
" // Execute the command.\n if (cmdchar == '*' || cmdchar == '#')\n {\n\tif (!g_cmd && (has_mbyte\n\t\t ? vim_iswordp(mb_prevptr(ml_get_curline(), ptr))\n\t\t : vim_iswordc(ptr[-1])))\n\t STRCAT(buf, \"\\\\>\");",
"\t// put pattern in search history\n\tinit_history();\n\tadd_to_history(HIST_SEARCH, buf, TRUE, NUL);",
"\t(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0, NULL);\n }\n else\n {\n\tg_tag_at_cursor = TRUE;\n\tdo_cmdline_cmd(buf);\n\tg_tag_at_cursor = FALSE;\n }",
" vim_free(buf);\n}",
"/*\n * Get visually selected text, within one line only.\n * Returns FAIL if more than one line selected.\n */\n int\nget_visual_text(\n cmdarg_T\t*cap,\n char_u\t**pp,\t // return: start of selected text\n int\t\t*lenp)\t // return: length of selected text\n{\n if (VIsual_mode != 'V')\n\tunadjust_for_sel();\n if (VIsual.lnum != curwin->w_cursor.lnum)\n {\n\tif (cap != NULL)\n\t clearopbeep(cap->oap);\n\treturn FAIL;\n }\n if (VIsual_mode == 'V')\n {\n\t*pp = ml_get_curline();\n\t*lenp = (int)STRLEN(*pp);\n }\n else\n {\n\tif (LT_POS(curwin->w_cursor, VIsual))\n\t{\n\t *pp = ml_get_pos(&curwin->w_cursor);\n\t *lenp = VIsual.col - curwin->w_cursor.col + 1;\n\t}\n\telse\n\t{\n\t *pp = ml_get_pos(&VIsual);\n\t *lenp = curwin->w_cursor.col - VIsual.col + 1;\n\t}\n\tif (**pp == NUL)\n\t *lenp = 0;\n\tif (*lenp > 0)\n\t{\n\t if (has_mbyte)\n\t\t// Correct the length to include all bytes of the last\n\t\t// character.\n\t\t*lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1;\n\t else if ((*pp)[*lenp - 1] == NUL)\n\t\t// Do not include a trailing NUL.\n\t\t*lenp -= 1;\n\t}\n }\n reset_VIsual_and_resel();\n return OK;\n}",
"/*\n * CTRL-T: backwards in tag stack\n */\n static void\nnv_tagpop(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n\tdo_tag((char_u *)\"\", DT_POP, (int)cap->count1, FALSE, TRUE);\n}",
"/*\n * Handle scrolling command 'H', 'L' and 'M'.\n */\n static void\nnv_scroll(cmdarg_T *cap)\n{\n int\t\tused = 0;\n long\tn;\n#ifdef FEAT_FOLDING\n linenr_T\tlnum;\n#endif\n int\t\thalf;",
" cap->oap->motion_type = MLINE;\n setpcmark();",
" if (cap->cmdchar == 'L')\n {\n\tvalidate_botline();\t // make sure curwin->w_botline is valid\n\tcurwin->w_cursor.lnum = curwin->w_botline - 1;\n\tif (cap->count1 - 1 >= curwin->w_cursor.lnum)\n\t curwin->w_cursor.lnum = 1;\n\telse\n\t{\n#ifdef FEAT_FOLDING\n\t if (hasAnyFolding(curwin))\n\t {\n\t\t// Count a fold for one screen line.\n\t\tfor (n = cap->count1 - 1; n > 0\n\t\t\t && curwin->w_cursor.lnum > curwin->w_topline; --n)\n\t\t{\n\t\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\t&curwin->w_cursor.lnum, NULL);\n\t\t --curwin->w_cursor.lnum;\n\t\t}\n\t }\n\t else\n#endif\n\t\tcurwin->w_cursor.lnum -= cap->count1 - 1;\n\t}\n }\n else\n {\n\tif (cap->cmdchar == 'M')\n\t{\n#ifdef FEAT_DIFF\n\t // Don't count filler lines above the window.\n\t used -= diff_check_fill(curwin, curwin->w_topline)\n\t\t\t\t\t\t\t - curwin->w_topfill;\n#endif\n\t validate_botline();\t // make sure w_empty_rows is valid\n\t half = (curwin->w_height - curwin->w_empty_rows + 1) / 2;\n\t for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; ++n)\n\t {\n#ifdef FEAT_DIFF\n\t\t// Count half he number of filler lines to be \"below this\n\t\t// line\" and half to be \"above the next line\".\n\t\tif (n > 0 && used + diff_check_fill(curwin, curwin->w_topline\n\t\t\t\t\t\t\t + n) / 2 >= half)\n\t\t{\n\t\t --n;\n\t\t break;\n\t\t}\n#endif\n\t\tused += plines(curwin->w_topline + n);\n\t\tif (used >= half)\n\t\t break;\n#ifdef FEAT_FOLDING\n\t\tif (hasFolding(curwin->w_topline + n, NULL, &lnum))\n\t\t n = lnum - curwin->w_topline;\n#endif\n\t }\n\t if (n > 0 && used > curwin->w_height)\n\t\t--n;\n\t}\n\telse // (cap->cmdchar == 'H')\n\t{\n\t n = cap->count1 - 1;\n#ifdef FEAT_FOLDING\n\t if (hasAnyFolding(curwin))\n\t {\n\t\t// Count a fold for one screen line.\n\t\tlnum = curwin->w_topline;\n\t\twhile (n-- > 0 && lnum < curwin->w_botline - 1)\n\t\t{\n\t\t (void)hasFolding(lnum, NULL, &lnum);\n\t\t ++lnum;\n\t\t}\n\t\tn = lnum - curwin->w_topline;\n\t }\n#endif\n\t}\n\tcurwin->w_cursor.lnum = curwin->w_topline + n;\n\tif (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n }",
" // Correct for 'so', except when an operator is pending.\n if (cap->oap->op_type == OP_NOP)\n\tcursor_correct();\n beginline(BL_SOL | BL_FIX);\n}",
"/*\n * Cursor right commands.\n */\n static void\nnv_right(cmdarg_T *cap)\n{\n long\tn;\n int\t\tpast_line;",
" if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))\n {\n\t// <C-Right> and <S-Right> move a word or WORD right\n\tif (mod_mask & MOD_MASK_CTRL)\n\t cap->arg = TRUE;\n\tnv_wordcmd(cap);\n\treturn;\n }",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n past_line = (VIsual_active && *p_sel != 'o');",
" // In virtual edit mode, there's no such thing as \"past_line\", as lines\n // are (theoretically) infinitely long.\n if (virtual_active())\n\tpast_line = 0;",
" for (n = cap->count1; n > 0; --n)\n {\n\tif ((!past_line && oneright() == FAIL)\n\t\t|| (past_line && *ml_get_cursor() == NUL)\n\t\t)\n\t{\n\t //\t <Space> wraps to next line if 'whichwrap' has 's'.\n\t //\t 'l' wraps to next line if 'whichwrap' has 'l'.\n\t // CURS_RIGHT wraps to next line if 'whichwrap' has '>'.\n\t if ( ((cap->cmdchar == ' '\n\t\t\t && vim_strchr(p_ww, 's') != NULL)\n\t\t\t|| (cap->cmdchar == 'l'\n\t\t\t && vim_strchr(p_ww, 'l') != NULL)\n\t\t\t|| (cap->cmdchar == K_RIGHT\n\t\t\t && vim_strchr(p_ww, '>') != NULL))\n\t\t && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)\n\t {\n\t\t// When deleting we also count the NL as a character.\n\t\t// Set cap->oap->inclusive when last char in the line is\n\t\t// included, move to next line after that\n\t\tif (\t cap->oap->op_type != OP_NOP\n\t\t\t&& !cap->oap->inclusive\n\t\t\t&& !LINEEMPTY(curwin->w_cursor.lnum))\n\t\t cap->oap->inclusive = TRUE;\n\t\telse\n\t\t{\n\t\t ++curwin->w_cursor.lnum;\n\t\t curwin->w_cursor.col = 0;\n\t\t curwin->w_cursor.coladd = 0;\n\t\t curwin->w_set_curswant = TRUE;\n\t\t cap->oap->inclusive = FALSE;\n\t\t}\n\t\tcontinue;\n\t }\n\t if (cap->oap->op_type == OP_NOP)\n\t {\n\t\t// Only beep and flush if not moved at all\n\t\tif (n == cap->count1)\n\t\t beep_flush();\n\t }\n\t else\n\t {\n\t\tif (!LINEEMPTY(curwin->w_cursor.lnum))\n\t\t cap->oap->inclusive = TRUE;\n\t }\n\t break;\n\t}\n\telse if (past_line)\n\t{\n\t curwin->w_set_curswant = TRUE;\n\t if (virtual_active())\n\t\toneright();\n\t else\n\t {\n\t\tif (has_mbyte)\n\t\t curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());\n\t\telse\n\t\t ++curwin->w_cursor.col;\n\t }\n\t}\n }\n#ifdef FEAT_FOLDING\n if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped\n\t\t\t\t\t && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Cursor left commands.\n *\n * Returns TRUE when operator end should not be adjusted.\n */\n static void\nnv_left(cmdarg_T *cap)\n{\n long\tn;",
" if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))\n {\n\t// <C-Left> and <S-Left> move a word or WORD left\n\tif (mod_mask & MOD_MASK_CTRL)\n\t cap->arg = 1;\n\tnv_bck_word(cap);\n\treturn;\n }",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n for (n = cap->count1; n > 0; --n)\n {\n\tif (oneleft() == FAIL)\n\t{\n\t // <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'.\n\t //\t\t 'h' wraps to previous line if 'whichwrap' has 'h'.\n\t //\t CURS_LEFT wraps to previous line if 'whichwrap' has '<'.\n\t if ( (((cap->cmdchar == K_BS\n\t\t\t\t|| cap->cmdchar == Ctrl_H)\n\t\t\t && vim_strchr(p_ww, 'b') != NULL)\n\t\t\t|| (cap->cmdchar == 'h'\n\t\t\t && vim_strchr(p_ww, 'h') != NULL)\n\t\t\t|| (cap->cmdchar == K_LEFT\n\t\t\t && vim_strchr(p_ww, '<') != NULL))\n\t\t && curwin->w_cursor.lnum > 1)\n\t {\n\t\t--(curwin->w_cursor.lnum);\n\t\tcoladvance((colnr_T)MAXCOL);\n\t\tcurwin->w_set_curswant = TRUE;",
"\t\t// When the NL before the first char has to be deleted we\n\t\t// put the cursor on the NUL after the previous line.\n\t\t// This is a very special case, be careful!\n\t\t// Don't adjust op_end now, otherwise it won't work.\n\t\tif (\t (cap->oap->op_type == OP_DELETE\n\t\t\t || cap->oap->op_type == OP_CHANGE)\n\t\t\t&& !LINEEMPTY(curwin->w_cursor.lnum))\n\t\t{\n\t\t char_u *cp = ml_get_cursor();",
"\t\t if (*cp != NUL)\n\t\t {\n\t\t\tif (has_mbyte)\n\t\t\t curwin->w_cursor.col += (*mb_ptr2len)(cp);\n\t\t\telse\n\t\t\t ++curwin->w_cursor.col;\n\t\t }\n\t\t cap->retval |= CA_NO_ADJ_OP_END;\n\t\t}\n\t\tcontinue;\n\t }\n\t // Only beep and flush if not moved at all\n\t else if (cap->oap->op_type == OP_NOP && n == cap->count1)\n\t\tbeep_flush();\n\t break;\n\t}\n }\n#ifdef FEAT_FOLDING\n if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped\n\t\t\t\t\t && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Cursor up commands.\n * cap->arg is TRUE for \"-\": Move cursor to first non-blank.\n */\n static void\nnv_up(cmdarg_T *cap)\n{\n if (mod_mask & MOD_MASK_SHIFT)\n {\n\t// <S-Up> is page up\n\tcap->arg = BACKWARD;\n\tnv_page(cap);\n }\n else\n {\n\tcap->oap->motion_type = MLINE;\n\tif (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL)\n\t clearopbeep(cap->oap);\n\telse if (cap->arg)\n\t beginline(BL_WHITE | BL_FIX);\n }\n}",
"/*\n * Cursor down commands.\n * cap->arg is TRUE for CR and \"+\": Move cursor to first non-blank.\n */\n static void\nnv_down(cmdarg_T *cap)\n{\n if (mod_mask & MOD_MASK_SHIFT)\n {\n\t// <S-Down> is page down\n\tcap->arg = FORWARD;\n\tnv_page(cap);\n }\n#if defined(FEAT_QUICKFIX)\n // Quickfix window only: view the result under the cursor.\n else if (bt_quickfix(curbuf) && cap->cmdchar == CAR)\n\tqf_view_result(FALSE);\n#endif\n else\n {\n#ifdef FEAT_CMDWIN\n\t// In the cmdline window a <CR> executes the command.\n\tif (cmdwin_type != 0 && cap->cmdchar == CAR)\n\t cmdwin_result = CAR;\n\telse\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t// In a prompt buffer a <CR> in the last line invokes the callback.\n\tif (bt_prompt(curbuf) && cap->cmdchar == CAR\n\t\t && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count)\n\t{\n\t invoke_prompt_callback();\n\t if (restart_edit == 0)\n\t\trestart_edit = 'a';\n\t}\n\telse\n#endif\n\t{\n\t cap->oap->motion_type = MLINE;\n\t if (cursor_down(cap->count1, cap->oap->op_type == OP_NOP) == FAIL)\n\t\tclearopbeep(cap->oap);\n\t else if (cap->arg)\n\t\tbeginline(BL_WHITE | BL_FIX);\n\t}\n }\n}",
"#ifdef FEAT_SEARCHPATH\n/*\n * Grab the file name under the cursor and edit it.\n */\n static void\nnv_gotofile(cmdarg_T *cap)\n{\n char_u\t*ptr;\n linenr_T\tlnum = -1;",
" if (check_text_locked(cap->oap))\n\treturn;\n if (curbuf_locked())\n {\n\tclearop(cap->oap);\n\treturn;\n }\n#ifdef FEAT_PROP_POPUP\n if (ERROR_IF_TERM_POPUP_WINDOW)\n\treturn;\n#endif",
" ptr = grab_file_name(cap->count1, &lnum);",
" if (ptr != NULL)\n {\n\t// do autowrite if necessary\n\tif (curbufIsChanged() && curbuf->b_nwindows <= 1 && !buf_hide(curbuf))\n\t (void)autowrite(curbuf, FALSE);\n\tsetpcmark();\n\tif (do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,\n\t\t\t\tbuf_hide(curbuf) ? ECMD_HIDE : 0, curwin) == OK\n\t\t&& cap->nchar == 'F' && lnum >= 0)\n\t{\n\t curwin->w_cursor.lnum = lnum;\n\t check_cursor_lnum();\n\t beginline(BL_SOL | BL_FIX);\n\t}\n\tvim_free(ptr);\n }\n else\n\tclearop(cap->oap);\n}\n#endif",
"/*\n * <End> command: to end of current line or last line.\n */\n static void\nnv_end(cmdarg_T *cap)\n{\n if (cap->arg || (mod_mask & MOD_MASK_CTRL))\t// CTRL-END = goto last line\n {\n\tcap->arg = TRUE;\n\tnv_goto(cap);\n\tcap->count1 = 1;\t\t// to end of current line\n }\n nv_dollar(cap);\n}",
"/*\n * Handle the \"$\" command.\n */\n static void\nnv_dollar(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = TRUE;\n // In virtual mode when off the edge of a line and an operator\n // is pending (whew!) keep the cursor where it is.\n // Otherwise, send it to the end of the line.\n if (!virtual_active() || gchar_cursor() != NUL\n\t\t\t\t\t || cap->oap->op_type == OP_NOP)\n\tcurwin->w_curswant = MAXCOL;\t// so we stay at the end\n if (cursor_down((long)(cap->count1 - 1),\n\t\t\t\t\t cap->oap->op_type == OP_NOP) == FAIL)\n\tclearopbeep(cap->oap);\n#ifdef FEAT_FOLDING\n else if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Implementation of '?' and '/' commands.\n * If cap->arg is TRUE don't set PC mark.\n */\n static void\nnv_search(cmdarg_T *cap)\n{\n oparg_T\t*oap = cap->oap;\n pos_T\tsave_cursor = curwin->w_cursor;",
" if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13)\n {\n\t// Translate \"g??\" to \"g?g?\"\n\tcap->cmdchar = 'g';\n\tcap->nchar = '?';\n\tnv_operator(cap);\n\treturn;\n }",
" // When using 'incsearch' the cursor may be moved to set a different search\n // start position.\n cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, 0);",
" if (cap->searchbuf == NULL)\n {\n\tclearop(oap);\n\treturn;\n }",
" (void)normal_search(cap, cap->cmdchar, cap->searchbuf,\n\t\t\t(cap->arg || !EQUAL_POS(save_cursor, curwin->w_cursor))\n\t\t\t\t\t\t ? 0 : SEARCH_MARK, NULL);\n}",
"\n/*\n * Handle \"N\" and \"n\" commands.\n * cap->arg is SEARCH_REV for \"N\", 0 for \"n\".\n */\n static void\nnv_next(cmdarg_T *cap)\n{\n pos_T old = curwin->w_cursor;\n int\t wrapped = FALSE;\n int\t i = normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, &wrapped);",
" if (i == 1 && !wrapped && EQUAL_POS(old, curwin->w_cursor))\n {\n\t// Avoid getting stuck on the current cursor position, which can\n\t// happen when an offset is given and the cursor is on the last char\n\t// in the buffer: Repeat with count + 1.\n\tcap->count1 += 1;\n\t(void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL);\n\tcap->count1 -= 1;\n }",
"#ifdef FEAT_SEARCH_EXTRA\n // Redraw the window to refresh the highlighted matches.\n if (i > 0 && p_hls && !no_hlsearch)\n\tredraw_later(SOME_VALID);\n#endif\n}",
"/*\n * Search for \"pat\" in direction \"dir\" ('/' or '?', 0 for repeat).\n * Uses only cap->count1 and cap->oap from \"cap\".\n * Return 0 for failure, 1 for found, 2 for found and line offset added.\n */\n static int\nnormal_search(\n cmdarg_T\t*cap,\n int\t\tdir,\n char_u\t*pat,\n int\t\topt,\t\t// extra flags for do_search()\n int\t\t*wrapped)\n{\n int\t\ti;\n searchit_arg_T sia;\n#ifdef FEAT_SEARCH_EXTRA\n pos_T\tprev_cursor = curwin->w_cursor;\n#endif",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n cap->oap->use_reg_one = TRUE;\n curwin->w_set_curswant = TRUE;",
" CLEAR_FIELD(sia);\n i = do_search(cap->oap, dir, dir, pat, cap->count1,\n\t\t\t opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);\n if (wrapped != NULL)\n\t*wrapped = sia.sa_wrapped;\n if (i == 0)\n\tclearop(cap->oap);\n else\n {\n\tif (i == 2)\n\t cap->oap->motion_type = MLINE;\n\tcurwin->w_cursor.coladd = 0;\n#ifdef FEAT_FOLDING\n\tif (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)\n\t foldOpenCursor();\n#endif\n }\n#ifdef FEAT_SEARCH_EXTRA\n // Redraw the window to refresh the highlighted matches.\n if (!EQUAL_POS(curwin->w_cursor, prev_cursor) && p_hls && !no_hlsearch)\n\tredraw_later(SOME_VALID);\n#endif",
" // \"/$\" will put the cursor after the end of the line, may need to\n // correct that here\n check_cursor();\n return i;\n}",
"/*\n * Character search commands.\n * cap->arg is BACKWARD for 'F' and 'T', FORWARD for 'f' and 't', TRUE for\n * ',' and FALSE for ';'.\n * cap->nchar is NUL for ',' and ';' (repeat the search)\n */\n static void\nnv_csearch(cmdarg_T *cap)\n{\n int\t\tt_cmd;",
" if (cap->cmdchar == 't' || cap->cmdchar == 'T')\n\tt_cmd = TRUE;\n else\n\tt_cmd = FALSE;",
" cap->oap->motion_type = MCHAR;\n if (IS_SPECIAL(cap->nchar) || searchc(cap, t_cmd) == FAIL)\n\tclearopbeep(cap->oap);\n else\n {\n\tcurwin->w_set_curswant = TRUE;\n\t// Include a Tab for \"tx\" and for \"dfx\".\n\tif (gchar_cursor() == TAB && virtual_active() && cap->arg == FORWARD\n\t\t&& (t_cmd || cap->oap->op_type != OP_NOP))\n\t{\n\t colnr_T\tscol, ecol;",
"\t getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);\n\t curwin->w_cursor.coladd = ecol - scol;\n\t}\n\telse\n\t curwin->w_cursor.coladd = 0;\n\tadjust_for_sel(cap);\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"[{\", \"[(\", \"]}\" or \"])\": go to Nth unclosed '{', '(', '}' or ')'\n * \"[#\", \"]#\": go to start/end of Nth innermost #if..#endif construct.\n * \"[/\", \"[*\", \"]/\", \"]*\": go to Nth comment start/end.\n * \"[m\" or \"]m\" search for prev/next start of (Java) method.\n * \"[M\" or \"]M\" search for prev/next end of (Java) method.\n */\n static void\nnv_bracket_block(cmdarg_T *cap, pos_T *old_pos)\n{\n pos_T\tnew_pos = {0, 0, 0};\n pos_T\t*pos = NULL;\t // init for GCC\n pos_T\tprev_pos;\n long\tn;\n int\t\tfindc;\n int\t\tc;",
" if (cap->nchar == '*')\n\tcap->nchar = '/';\n prev_pos.lnum = 0;\n if (cap->nchar == 'm' || cap->nchar == 'M')\n {\n\tif (cap->cmdchar == '[')\n\t findc = '{';\n\telse\n\t findc = '}';\n\tn = 9999;\n }\n else\n {\n\tfindc = cap->nchar;\n\tn = cap->count1;\n }\n for ( ; n > 0; --n)\n {\n\tif ((pos = findmatchlimit(cap->oap, findc,\n\t\t\t(cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD, 0)) == NULL)\n\t{\n\t if (new_pos.lnum == 0)\t// nothing found\n\t {\n\t\tif (cap->nchar != 'm' && cap->nchar != 'M')\n\t\t clearopbeep(cap->oap);\n\t }\n\t else\n\t\tpos = &new_pos;\t// use last one found\n\t break;\n\t}\n\tprev_pos = new_pos;\n\tcurwin->w_cursor = *pos;\n\tnew_pos = *pos;\n }\n curwin->w_cursor = *old_pos;",
" // Handle \"[m\", \"]m\", \"[M\" and \"[M\". The findmatchlimit() only\n // brought us to the match for \"[m\" and \"]M\" when inside a method.\n // Try finding the '{' or '}' we want to be at.\n // Also repeat for the given count.\n if (cap->nchar == 'm' || cap->nchar == 'M')\n {\n\t// norm is TRUE for \"]M\" and \"[m\"\n\tint\t norm = ((findc == '{') == (cap->nchar == 'm'));",
"\tn = cap->count1;\n\t// found a match: we were inside a method\n\tif (prev_pos.lnum != 0)\n\t{\n\t pos = &prev_pos;\n\t curwin->w_cursor = prev_pos;\n\t if (norm)\n\t\t--n;\n\t}\n\telse\n\t pos = NULL;\n\twhile (n > 0)\n\t{\n\t for (;;)\n\t {\n\t\tif ((findc == '{' ? dec_cursor() : inc_cursor()) < 0)\n\t\t{\n\t\t // if not found anything, that's an error\n\t\t if (pos == NULL)\n\t\t\tclearopbeep(cap->oap);\n\t\t n = 0;\n\t\t break;\n\t\t}\n\t\tc = gchar_cursor();\n\t\tif (c == '{' || c == '}')\n\t\t{\n\t\t // Must have found end/start of class: use it.\n\t\t // Or found the place to be at.\n\t\t if ((c == findc && norm) || (n == 1 && !norm))\n\t\t {\n\t\t\tnew_pos = curwin->w_cursor;\n\t\t\tpos = &new_pos;\n\t\t\tn = 0;\n\t\t }\n\t\t // if no match found at all, we started outside of the\n\t\t // class and we're inside now. Just go on.\n\t\t else if (new_pos.lnum == 0)\n\t\t {\n\t\t\tnew_pos = curwin->w_cursor;\n\t\t\tpos = &new_pos;\n\t\t }\n\t\t // found start/end of other method: go to match\n\t\t else if ((pos = findmatchlimit(cap->oap, findc,\n\t\t\t (cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD,\n\t\t\t\t\t\t\t\t 0)) == NULL)\n\t\t\tn = 0;\n\t\t else\n\t\t\tcurwin->w_cursor = *pos;\n\t\t break;\n\t\t}\n\t }\n\t --n;\n\t}\n\tcurwin->w_cursor = *old_pos;\n\tif (pos == NULL && new_pos.lnum != 0)\n\t clearopbeep(cap->oap);\n }\n if (pos != NULL)\n {\n\tsetpcmark();\n\tcurwin->w_cursor = *pos;\n\tcurwin->w_set_curswant = TRUE;\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_BLOCK) && KeyTyped\n\t\t&& cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"[\" and \"]\" commands.\n * cap->arg is BACKWARD for \"[\" and FORWARD for \"]\".\n */\n static void\nnv_brackets(cmdarg_T *cap)\n{\n pos_T\tprev_pos;\n pos_T\t*pos = NULL;\t // init for GCC\n pos_T\told_pos;\t // cursor position before command\n int\t\tflag;\n long\tn;",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n old_pos = curwin->w_cursor;\n curwin->w_cursor.coladd = 0; // TODO: don't do this for an error.",
"#ifdef FEAT_SEARCHPATH\n // \"[f\" or \"]f\" : Edit file under the cursor (same as \"gf\")\n if (cap->nchar == 'f')\n\tnv_gotofile(cap);\n else\n#endif",
"#ifdef FEAT_FIND_ID\n // Find the occurrence(s) of the identifier or define under cursor\n // in current and included files or jump to the first occurrence.\n //\n //\t\t\tsearch\t list\t jump\n //\t\t fwd bwd fwd\t bwd\t fwd\tbwd\n // identifier \"]i\" \"[i\" \"]I\" \"[I\"\t\"]^I\" \"[^I\"\n // define\t \"]d\" \"[d\" \"]D\" \"[D\"\t\"]^D\" \"[^D\"\n if (vim_strchr((char_u *)\"iI\\011dD\\004\", cap->nchar) != NULL)\n {\n\tchar_u\t*ptr;\n\tint\tlen;",
"\tif ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)\n\t clearop(cap->oap);\n\telse\n\t{",
"\t // Make a copy, if the line was changed it will be freed.\n\t ptr = vim_strnsave(ptr, len);\n\t if (ptr == NULL)\n\t\treturn;\n",
"\t find_pattern_in_path(ptr, 0, len, TRUE,\n\t\tcap->count0 == 0 ? !isupper(cap->nchar) : FALSE,\n\t\t((cap->nchar & 0xf) == ('d' & 0xf)) ? FIND_DEFINE : FIND_ANY,\n\t\tcap->count1,\n\t\tisupper(cap->nchar) ? ACTION_SHOW_ALL :\n\t\t\t islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO,\n\t\tcap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1,\n\t\t(linenr_T)MAXLNUM);",
"\t vim_free(ptr);",
"\t curwin->w_set_curswant = TRUE;\n\t}\n }\n else\n#endif",
" // \"[{\", \"[(\", \"]}\" or \"])\": go to Nth unclosed '{', '(', '}' or ')'\n // \"[#\", \"]#\": go to start/end of Nth innermost #if..#endif construct.\n // \"[/\", \"[*\", \"]/\", \"]*\": go to Nth comment start/end.\n // \"[m\" or \"]m\" search for prev/next start of (Java) method.\n // \"[M\" or \"]M\" search for prev/next end of (Java) method.\n if ( (cap->cmdchar == '['\n\t\t&& vim_strchr((char_u *)\"{(*/#mM\", cap->nchar) != NULL)\n\t || (cap->cmdchar == ']'\n\t\t&& vim_strchr((char_u *)\"})*/#mM\", cap->nchar) != NULL))\n\tnv_bracket_block(cap, &old_pos);",
" // \"[[\", \"[]\", \"]]\" and \"][\": move to start or end of function\n else if (cap->nchar == '[' || cap->nchar == ']')\n {\n\tif (cap->nchar == cap->cmdchar)\t\t // \"]]\" or \"[[\"\n\t flag = '{';\n\telse\n\t flag = '}';\t\t // \"][\" or \"[]\"",
"\tcurwin->w_set_curswant = TRUE;\n\t// Imitate strange Vi behaviour: When using \"]]\" with an operator\n\t// we also stop at '}'.\n\tif (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, flag,\n\t (cap->oap->op_type != OP_NOP\n\t\t\t\t && cap->arg == FORWARD && flag == '{')))\n\t clearopbeep(cap->oap);\n\telse\n\t{\n\t if (cap->oap->op_type == OP_NOP)\n\t\tbeginline(BL_WHITE | BL_FIX);\n#ifdef FEAT_FOLDING\n\t if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t\tfoldOpenCursor();\n#endif\n\t}\n }",
" // \"[p\", \"[P\", \"]P\" and \"]p\": put with indent adjustment\n else if (cap->nchar == 'p' || cap->nchar == 'P')\n {\n\tnv_put_opt(cap, TRUE);\n }",
" // \"['\", \"[`\", \"]'\" and \"]`\": jump to next mark\n else if (cap->nchar == '\\'' || cap->nchar == '`')\n {\n\tpos = &curwin->w_cursor;\n\tfor (n = cap->count1; n > 0; --n)\n\t{\n\t prev_pos = *pos;\n\t pos = getnextmark(pos, cap->cmdchar == '[' ? BACKWARD : FORWARD,\n\t\t\t\t\t\t\t cap->nchar == '\\'');\n\t if (pos == NULL)\n\t\tbreak;\n\t}\n\tif (pos == NULL)\n\t pos = &prev_pos;\n\tnv_cursormark(cap, cap->nchar == '\\'', pos);\n }",
" // [ or ] followed by a middle mouse click: put selected text with\n // indent adjustment. Any other button just does as usual.\n else if (cap->nchar >= K_RIGHTRELEASE && cap->nchar <= K_LEFTMOUSE)\n {\n\t(void)do_mouse(cap->oap, cap->nchar,\n\t\t (cap->cmdchar == ']') ? FORWARD : BACKWARD,\n\t\t cap->count1, PUT_FIXINDENT);\n }",
"#ifdef FEAT_FOLDING\n // \"[z\" and \"]z\": move to start or end of open fold.\n else if (cap->nchar == 'z')\n {\n\tif (foldMoveTo(FALSE, cap->cmdchar == ']' ? FORWARD : BACKWARD,\n\t\t\t\t\t\t\t cap->count1) == FAIL)\n\t clearopbeep(cap->oap);\n }\n#endif",
"#ifdef FEAT_DIFF\n // \"[c\" and \"]c\": move to next or previous diff-change.\n else if (cap->nchar == 'c')\n {\n\tif (diff_move_to(cap->cmdchar == ']' ? FORWARD : BACKWARD,\n\t\t\t\t\t\t\t cap->count1) == FAIL)\n\t clearopbeep(cap->oap);\n }\n#endif",
"#ifdef FEAT_SPELL\n // \"[s\", \"[S\", \"]s\" and \"]S\": move to next spell error.\n else if (cap->nchar == 's' || cap->nchar == 'S')\n {\n\tsetpcmark();\n\tfor (n = 0; n < cap->count1; ++n)\n\t if (spell_move_to(curwin, cap->cmdchar == ']' ? FORWARD : BACKWARD,\n\t\t\t cap->nchar == 's' ? TRUE : FALSE, FALSE, NULL) == 0)\n\t {\n\t\tclearopbeep(cap->oap);\n\t\tbreak;\n\t }\n\t else\n\t\tcurwin->w_set_curswant = TRUE;\n# ifdef FEAT_FOLDING\n\tif (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)\n\t foldOpenCursor();\n# endif\n }\n#endif",
" // Not a valid cap->nchar.\n else\n\tclearopbeep(cap->oap);\n}",
"/*\n * Handle Normal mode \"%\" command.\n */\n static void\nnv_percent(cmdarg_T *cap)\n{\n pos_T\t*pos;\n#if defined(FEAT_FOLDING)\n linenr_T\tlnum = curwin->w_cursor.lnum;\n#endif",
" cap->oap->inclusive = TRUE;\n if (cap->count0)\t // {cnt}% : goto {cnt} percentage in file\n {\n\tif (cap->count0 > 100)\n\t clearopbeep(cap->oap);\n\telse\n\t{\n\t cap->oap->motion_type = MLINE;\n\t setpcmark();\n\t // Round up, so 'normal 100%' always jumps at the line line.\n\t // Beyond 21474836 lines, (ml_line_count * 100 + 99) would\n\t // overflow on 32-bits, so use a formula with less accuracy\n\t // to avoid overflows.\n\t if (curbuf->b_ml.ml_line_count >= 21474836)\n\t\tcurwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L)\n\t\t\t\t\t\t\t / 100L * cap->count0;\n\t else\n\t\tcurwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *\n\t\t\t\t\t\t cap->count0 + 99L) / 100L;\n\t if (curwin->w_cursor.lnum < 1)\n\t\tcurwin->w_cursor.lnum = 1;\n\t if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t\tcurwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t beginline(BL_SOL | BL_FIX);\n\t}\n }\n else\t\t // \"%\" : go to matching paren\n {\n\tcap->oap->motion_type = MCHAR;\n\tcap->oap->use_reg_one = TRUE;\n\tif ((pos = findmatch(cap->oap, NUL)) == NULL)\n\t clearopbeep(cap->oap);\n\telse\n\t{\n\t setpcmark();\n\t curwin->w_cursor = *pos;\n\t curwin->w_set_curswant = TRUE;\n\t curwin->w_cursor.coladd = 0;\n\t adjust_for_sel(cap);\n\t}\n }\n#ifdef FEAT_FOLDING\n if (cap->oap->op_type == OP_NOP\n\t && lnum != curwin->w_cursor.lnum\n\t && (fdo_flags & FDO_PERCENT)\n\t && KeyTyped)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Handle \"(\" and \")\" commands.\n * cap->arg is BACKWARD for \"(\" and FORWARD for \")\".\n */\n static void\nnv_brace(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->use_reg_one = TRUE;\n // The motion used to be inclusive for \"(\", but that is not what Vi does.\n cap->oap->inclusive = FALSE;\n curwin->w_set_curswant = TRUE;",
" if (findsent(cap->arg, cap->count1) == FAIL)\n\tclearopbeep(cap->oap);\n else\n {\n\t// Don't leave the cursor on the NUL past end of line.\n\tadjust_cursor(cap->oap);\n\tcurwin->w_cursor.coladd = 0;\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"m\" command: Mark a position.\n */\n static void\nnv_mark(cmdarg_T *cap)\n{\n if (!checkclearop(cap->oap))\n {\n\tif (setmark(cap->nchar) == FAIL)\n\t clearopbeep(cap->oap);\n }\n}",
"/*\n * \"{\" and \"}\" commands.\n * cmd->arg is BACKWARD for \"{\" and FORWARD for \"}\".\n */\n static void\nnv_findpar(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n cap->oap->use_reg_one = TRUE;\n curwin->w_set_curswant = TRUE;\n if (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, NUL, FALSE))\n\tclearopbeep(cap->oap);\n else\n {\n\tcurwin->w_cursor.coladd = 0;\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * \"u\" command: Undo or make lower case.\n */\n static void\nnv_undo(cmdarg_T *cap)\n{\n if (cap->oap->op_type == OP_LOWER || VIsual_active)\n {\n\t// translate \"<Visual>u\" to \"<Visual>gu\" and \"guu\" to \"gugu\"\n\tcap->cmdchar = 'g';\n\tcap->nchar = 'u';\n\tnv_operator(cap);\n }\n else\n\tnv_kundo(cap);\n}",
"/*\n * <Undo> command.\n */\n static void\nnv_kundo(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n {\n#ifdef FEAT_JOB_CHANNEL\n\tif (bt_prompt(curbuf))\n\t{\n\t clearopbeep(cap->oap);\n\t return;\n\t}\n#endif\n\tu_undo((int)cap->count1);\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * Handle the \"r\" command.\n */\n static void\nnv_replace(cmdarg_T *cap)\n{\n char_u\t*ptr;\n int\t\thad_ctrl_v;\n long\tn;",
" if (checkclearop(cap->oap))\n\treturn;\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }\n#endif",
" // get another character\n if (cap->nchar == Ctrl_V)\n {\n\thad_ctrl_v = Ctrl_V;\n\tcap->nchar = get_literal(FALSE);\n\t// Don't redo a multibyte character with CTRL-V.\n\tif (cap->nchar > DEL)\n\t had_ctrl_v = NUL;\n }\n else\n\thad_ctrl_v = NUL;",
" // Abort if the character is a special key.\n if (IS_SPECIAL(cap->nchar))\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" // Visual mode \"r\"\n if (VIsual_active)\n {\n\tif (got_int)\n\t reset_VIsual();\n\tif (had_ctrl_v)\n\t{\n\t // Use a special (negative) number to make a difference between a\n\t // literal CR or NL and a line break.\n\t if (cap->nchar == CAR)\n\t\tcap->nchar = REPLACE_CR_NCHAR;\n\t else if (cap->nchar == NL)\n\t\tcap->nchar = REPLACE_NL_NCHAR;\n\t}\n\tnv_operator(cap);\n\treturn;\n }",
" // Break tabs, etc.\n if (virtual_active())\n {\n\tif (u_save_cursor() == FAIL)\n\t return;\n\tif (gchar_cursor() == NUL)\n\t{\n\t // Add extra space and put the cursor on the first one.\n\t coladvance_force((colnr_T)(getviscol() + cap->count1));\n\t curwin->w_cursor.col -= cap->count1;\n\t}\n\telse if (gchar_cursor() == TAB)\n\t coladvance_force(getviscol());\n }",
" // Abort if not enough characters to replace.\n ptr = ml_get_cursor();\n if (STRLEN(ptr) < (unsigned)cap->count1\n\t || (has_mbyte && mb_charlen(ptr) < cap->count1))\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" // Replacing with a TAB is done by edit() when it is complicated because\n // 'expandtab' or 'smarttab' is set. CTRL-V TAB inserts a literal TAB.\n // Other characters are done below to avoid problems with things like\n // CTRL-V 048 (for edit() this would be R CTRL-V 0 ESC).\n if (had_ctrl_v != Ctrl_V && cap->nchar == '\\t' && (curbuf->b_p_et || p_sta))\n {\n\tstuffnumReadbuff(cap->count1);\n\tstuffcharReadbuff('R');\n\tstuffcharReadbuff('\\t');\n\tstuffcharReadbuff(ESC);\n\treturn;\n }",
" // save line for undo\n if (u_save_cursor() == FAIL)\n\treturn;",
" if (had_ctrl_v != Ctrl_V && (cap->nchar == '\\r' || cap->nchar == '\\n'))\n {\n\t// Replace character(s) by a single newline.\n\t// Strange vi behaviour: Only one newline is inserted.\n\t// Delete the characters here.\n\t// Insert the newline with an insert command, takes care of\n\t// autoindent.\tThe insert command depends on being on the last\n\t// character of a line or not.\n\t(void)del_chars(cap->count1, FALSE);\t// delete the characters\n\tstuffcharReadbuff('\\r');\n\tstuffcharReadbuff(ESC);",
"\t// Give 'r' to edit(), to get the redo command right.\n\tinvoke_edit(cap, TRUE, 'r', FALSE);\n }\n else\n {\n\tprep_redo(cap->oap->regname, cap->count1,\n\t\t\t\t NUL, 'r', NUL, had_ctrl_v, cap->nchar);",
"\tcurbuf->b_op_start = curwin->w_cursor;\n\tif (has_mbyte)\n\t{\n\t int\t\told_State = State;",
"\t if (cap->ncharC1 != 0)\n\t\tAppendCharToRedobuff(cap->ncharC1);\n\t if (cap->ncharC2 != 0)\n\t\tAppendCharToRedobuff(cap->ncharC2);",
"\t // This is slow, but it handles replacing a single-byte with a\n\t // multi-byte and the other way around. Also handles adding\n\t // composing characters for utf-8.\n\t for (n = cap->count1; n > 0; --n)\n\t {\n\t\tState = MODE_REPLACE;\n\t\tif (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)\n\t\t{\n\t\t int c = ins_copychar(curwin->w_cursor.lnum\n\t\t\t\t\t + (cap->nchar == Ctrl_Y ? -1 : 1));\n\t\t if (c != NUL)\n\t\t\tins_char(c);\n\t\t else\n\t\t\t// will be decremented further down\n\t\t\t++curwin->w_cursor.col;\n\t\t}\n\t\telse\n\t\t ins_char(cap->nchar);\n\t\tState = old_State;\n\t\tif (cap->ncharC1 != 0)\n\t\t ins_char(cap->ncharC1);\n\t\tif (cap->ncharC2 != 0)\n\t\t ins_char(cap->ncharC2);\n\t }\n\t}\n\telse\n\t{\n\t // Replace the characters within one line.\n\t for (n = cap->count1; n > 0; --n)\n\t {\n\t\t// Get ptr again, because u_save and/or showmatch() will have\n\t\t// released the line. This may also happen in ins_copychar().\n\t\t// At the same time we let know that the line will be changed.\n\t\tif (cap->nchar == Ctrl_E || cap->nchar == Ctrl_Y)\n\t\t{\n\t\t int c = ins_copychar(curwin->w_cursor.lnum\n\t\t\t\t\t + (cap->nchar == Ctrl_Y ? -1 : 1));",
"\t\t ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);\n\t\t if (c != NUL)\n\t\t ptr[curwin->w_cursor.col] = c;\n\t\t}\n\t\telse\n\t\t{\n\t\t ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);\n\t\t ptr[curwin->w_cursor.col] = cap->nchar;\n\t\t}\n\t\tif (p_sm && msg_silent == 0)\n\t\t showmatch(cap->nchar);\n\t\t++curwin->w_cursor.col;\n\t }\n#ifdef FEAT_NETBEANS_INTG\n\t if (netbeans_active())\n\t {\n\t\tcolnr_T start = (colnr_T)(curwin->w_cursor.col - cap->count1);",
"\t\tnetbeans_removed(curbuf, curwin->w_cursor.lnum, start,\n\t\t\t\t\t\t\t cap->count1);\n\t\tnetbeans_inserted(curbuf, curwin->w_cursor.lnum, start,\n\t\t\t\t\t &ptr[start], (int)cap->count1);\n\t }\n#endif",
"\t // mark the buffer as changed and prepare for displaying\n\t changed_bytes(curwin->w_cursor.lnum,\n\t\t\t (colnr_T)(curwin->w_cursor.col - cap->count1));\n\t}\n\t--curwin->w_cursor.col;\t // cursor on the last replaced char\n\t// if the character on the left of the current cursor is a multi-byte\n\t// character, move two characters left\n\tif (has_mbyte)\n\t mb_adjust_cursor();\n\tcurbuf->b_op_end = curwin->w_cursor;\n\tcurwin->w_set_curswant = TRUE;\n\tset_last_insert(cap->nchar);\n }\n}",
"/*\n * 'o': Exchange start and end of Visual area.\n * 'O': same, but in block mode exchange left and right corners.\n */\n static void\nv_swap_corners(int cmdchar)\n{\n pos_T\told_cursor;\n colnr_T\tleft, right;",
" if (cmdchar == 'O' && VIsual_mode == Ctrl_V)\n {\n\told_cursor = curwin->w_cursor;\n\tgetvcols(curwin, &old_cursor, &VIsual, &left, &right);\n\tcurwin->w_cursor.lnum = VIsual.lnum;\n\tcoladvance(left);\n\tVIsual = curwin->w_cursor;",
"\tcurwin->w_cursor.lnum = old_cursor.lnum;\n\tcurwin->w_curswant = right;\n\t// 'selection \"exclusive\" and cursor at right-bottom corner: move it\n\t// right one column\n\tif (old_cursor.lnum >= VIsual.lnum && *p_sel == 'e')\n\t ++curwin->w_curswant;\n\tcoladvance(curwin->w_curswant);\n\tif (curwin->w_cursor.col == old_cursor.col\n\t\t&& (!virtual_active()\n\t\t || curwin->w_cursor.coladd == old_cursor.coladd))\n\t{\n\t curwin->w_cursor.lnum = VIsual.lnum;\n\t if (old_cursor.lnum <= VIsual.lnum && *p_sel == 'e')\n\t\t++right;\n\t coladvance(right);\n\t VIsual = curwin->w_cursor;",
"\t curwin->w_cursor.lnum = old_cursor.lnum;\n\t coladvance(left);\n\t curwin->w_curswant = left;\n\t}\n }\n else\n {\n\told_cursor = curwin->w_cursor;\n\tcurwin->w_cursor = VIsual;\n\tVIsual = old_cursor;\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * \"R\" (cap->arg is FALSE) and \"gR\" (cap->arg is TRUE).\n */\n static void\nnv_Replace(cmdarg_T *cap)\n{\n if (VIsual_active)\t\t// \"R\" is replace lines\n {\n\tcap->cmdchar = 'c';\n\tcap->nchar = NUL;\n\tVIsual_mode_orig = VIsual_mode; // remember original area for gv\n\tVIsual_mode = 'V';\n\tnv_operator(cap);\n }\n else if (!checkclearopq(cap->oap))\n {\n\tif (!curbuf->b_p_ma)\n\t emsg(_(e_cannot_make_changes_modifiable_is_off));\n\telse\n\t{\n\t if (virtual_active())\n\t\tcoladvance(getviscol());\n\t invoke_edit(cap, FALSE, cap->arg ? 'V' : 'R', FALSE);\n\t}\n }\n}",
"/*\n * \"gr\".\n */\n static void\nnv_vreplace(cmdarg_T *cap)\n{\n if (VIsual_active)\n {\n\tcap->cmdchar = 'r';\n\tcap->nchar = cap->extra_char;\n\tnv_replace(cap);\t// Do same as \"r\" in Visual mode for now\n }\n else if (!checkclearopq(cap->oap))\n {\n\tif (!curbuf->b_p_ma)\n\t emsg(_(e_cannot_make_changes_modifiable_is_off));\n\telse\n\t{\n\t if (cap->extra_char == Ctrl_V)\t// get another character\n\t\tcap->extra_char = get_literal(FALSE);\n\t stuffcharReadbuff(cap->extra_char);\n\t stuffcharReadbuff(ESC);\n\t if (virtual_active())\n\t\tcoladvance(getviscol());\n\t invoke_edit(cap, TRUE, 'v', FALSE);\n\t}\n }\n}",
"/*\n * Swap case for \"~\" command, when it does not work like an operator.\n */\n static void\nn_swapchar(cmdarg_T *cap)\n{\n long\tn;\n pos_T\tstartpos;\n int\t\tdid_change = 0;\n#ifdef FEAT_NETBEANS_INTG\n pos_T\tpos;\n char_u\t*ptr;\n int\t\tcount;\n#endif",
" if (checkclearopq(cap->oap))\n\treturn;",
" if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL)\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" prep_redo_cmd(cap);",
" if (u_save_cursor() == FAIL)\n\treturn;",
" startpos = curwin->w_cursor;\n#ifdef FEAT_NETBEANS_INTG\n pos = startpos;\n#endif\n for (n = cap->count1; n > 0; --n)\n {\n\tdid_change |= swapchar(cap->oap->op_type, &curwin->w_cursor);\n\tinc_cursor();\n\tif (gchar_cursor() == NUL)\n\t{\n\t if (vim_strchr(p_ww, '~') != NULL\n\t\t && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)\n\t {\n#ifdef FEAT_NETBEANS_INTG\n\t\tif (netbeans_active())\n\t\t{\n\t\t if (did_change)\n\t\t {\n\t\t\tptr = ml_get(pos.lnum);\n\t\t\tcount = (int)STRLEN(ptr) - pos.col;\n\t\t\tnetbeans_removed(curbuf, pos.lnum, pos.col,\n\t\t\t\t\t\t\t\t (long)count);\n\t\t\tnetbeans_inserted(curbuf, pos.lnum, pos.col,\n\t\t\t\t\t\t\t&ptr[pos.col], count);\n\t\t }\n\t\t pos.col = 0;\n\t\t pos.lnum++;\n\t\t}\n#endif\n\t\t++curwin->w_cursor.lnum;\n\t\tcurwin->w_cursor.col = 0;\n\t\tif (n > 1)\n\t\t{\n\t\t if (u_savesub(curwin->w_cursor.lnum) == FAIL)\n\t\t\tbreak;\n\t\t u_clearline();\n\t\t}\n\t }\n\t else\n\t\tbreak;\n\t}\n }\n#ifdef FEAT_NETBEANS_INTG\n if (did_change && netbeans_active())\n {\n\tptr = ml_get(pos.lnum);\n\tcount = curwin->w_cursor.col - pos.col;\n\tnetbeans_removed(curbuf, pos.lnum, pos.col, (long)count);\n\tnetbeans_inserted(curbuf, pos.lnum, pos.col, &ptr[pos.col], count);\n }\n#endif",
"\n check_cursor();\n curwin->w_set_curswant = TRUE;\n if (did_change)\n {\n\tchanged_lines(startpos.lnum, startpos.col, curwin->w_cursor.lnum + 1,\n\t\t\t\t\t\t\t\t\t 0L);\n\tcurbuf->b_op_start = startpos;\n\tcurbuf->b_op_end = curwin->w_cursor;\n\tif (curbuf->b_op_end.col > 0)\n\t --curbuf->b_op_end.col;\n }\n}",
"/*\n * Move cursor to mark.\n */\n static void\nnv_cursormark(cmdarg_T *cap, int flag, pos_T *pos)\n{\n if (check_mark(pos) == FAIL)\n\tclearop(cap->oap);\n else\n {\n\tif (cap->cmdchar == '\\''\n\t\t|| cap->cmdchar == '`'\n\t\t|| cap->cmdchar == '['\n\t\t|| cap->cmdchar == ']')\n\t setpcmark();\n\tcurwin->w_cursor = *pos;\n\tif (flag)\n\t beginline(BL_WHITE | BL_FIX);\n\telse\n\t check_cursor();\n }\n cap->oap->motion_type = flag ? MLINE : MCHAR;\n if (cap->cmdchar == '`')\n\tcap->oap->use_reg_one = TRUE;\n cap->oap->inclusive = FALSE;\t\t// ignored if not MCHAR\n curwin->w_set_curswant = TRUE;\n}",
"/*\n * Handle commands that are operators in Visual mode.\n */\n static void\nv_visop(cmdarg_T *cap)\n{\n static char_u trans[] = \"YyDdCcxdXdAAIIrr\";",
" // Uppercase means linewise, except in block mode, then \"D\" deletes till\n // the end of the line, and \"C\" replaces till EOL\n if (isupper(cap->cmdchar))\n {\n\tif (VIsual_mode != Ctrl_V)\n\t{\n\t VIsual_mode_orig = VIsual_mode;\n\t VIsual_mode = 'V';\n\t}\n\telse if (cap->cmdchar == 'C' || cap->cmdchar == 'D')\n\t curwin->w_curswant = MAXCOL;\n }\n cap->cmdchar = *(vim_strchr(trans, cap->cmdchar) + 1);\n nv_operator(cap);\n}",
"/*\n * \"s\" and \"S\" commands.\n */\n static void\nnv_subst(cmdarg_T *cap)\n{\n#ifdef FEAT_TERMINAL\n // When showing output of term_dumpdiff() swap the top and bottom.\n if (term_swap_diff() == OK)\n\treturn;\n#endif\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }\n#endif\n if (VIsual_active)\t// \"vs\" and \"vS\" are the same as \"vc\"\n {\n\tif (cap->cmdchar == 'S')\n\t{\n\t VIsual_mode_orig = VIsual_mode;\n\t VIsual_mode = 'V';\n\t}\n\tcap->cmdchar = 'c';\n\tnv_operator(cap);\n }\n else\n\tnv_optrans(cap);\n}",
"/*\n * Abbreviated commands.\n */\n static void\nnv_abbrev(cmdarg_T *cap)\n{\n if (cap->cmdchar == K_DEL || cap->cmdchar == K_KDEL)\n\tcap->cmdchar = 'x';\t\t// DEL key behaves like 'x'",
" // in Visual mode these commands are operators\n if (VIsual_active)\n\tv_visop(cap);\n else\n\tnv_optrans(cap);\n}",
"/*\n * Translate a command into another command.\n */\n static void\nnv_optrans(cmdarg_T *cap)\n{\n static char_u *(ar[8]) = {(char_u *)\"dl\", (char_u *)\"dh\",\n\t\t\t (char_u *)\"d$\", (char_u *)\"c$\",\n\t\t\t (char_u *)\"cl\", (char_u *)\"cc\",\n\t\t\t (char_u *)\"yy\", (char_u *)\":s\\r\"};\n static char_u *str = (char_u *)\"xXDCsSY&\";",
" if (!checkclearopq(cap->oap))\n {\n\t// In Vi \"2D\" doesn't delete the next line. Can't translate it\n\t// either, because \"2.\" should also not use the count.\n\tif (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL)\n\t{\n\t cap->oap->start = curwin->w_cursor;\n\t cap->oap->op_type = OP_DELETE;\n#ifdef FEAT_EVAL\n\t set_op_var(OP_DELETE);\n#endif\n\t cap->count1 = 1;\n\t nv_dollar(cap);\n\t finish_op = TRUE;\n\t ResetRedobuff();\n\t AppendCharToRedobuff('D');\n\t}\n\telse\n\t{\n\t if (cap->count0)\n\t\tstuffnumReadbuff(cap->count0);\n\t stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);\n\t}\n }\n cap->opcount = 0;\n}",
"/*\n * \"'\" and \"`\" commands. Also for \"g'\" and \"g`\".\n * cap->arg is TRUE for \"'\" and \"g'\".\n */\n static void\nnv_gomark(cmdarg_T *cap)\n{\n pos_T\t*pos;\n int\t\tc;\n#ifdef FEAT_FOLDING\n pos_T\told_cursor = curwin->w_cursor;\n int\t\told_KeyTyped = KeyTyped; // getting file may reset it\n#endif",
" if (cap->cmdchar == 'g')\n\tc = cap->extra_char;\n else\n\tc = cap->nchar;\n pos = getmark(c, (cap->oap->op_type == OP_NOP));\n if (pos == (pos_T *)-1)\t // jumped to other file\n {\n\tif (cap->arg)\n\t{\n\t check_cursor_lnum();\n\t beginline(BL_WHITE | BL_FIX);\n\t}\n\telse\n\t check_cursor();\n }\n else\n\tnv_cursormark(cap, cap->arg, pos);",
" // May need to clear the coladd that a mark includes.\n if (!virtual_active())\n\tcurwin->w_cursor.coladd = 0;\n check_cursor_col();\n#ifdef FEAT_FOLDING\n if (cap->oap->op_type == OP_NOP\n\t && pos != NULL\n\t && (pos == (pos_T *)-1 || !EQUAL_POS(old_cursor, *pos))\n\t && (fdo_flags & FDO_MARK)\n\t && old_KeyTyped)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Handle CTRL-O, CTRL-I, \"g;\", \"g,\" and \"CTRL-Tab\" commands.\n */\n static void\nnv_pcmark(cmdarg_T *cap)\n{\n pos_T\t*pos;\n#ifdef FEAT_FOLDING\n linenr_T\tlnum = curwin->w_cursor.lnum;\n int\t\told_KeyTyped = KeyTyped; // getting file may reset it\n#endif",
" if (!checkclearopq(cap->oap))\n {\n\tif (cap->cmdchar == TAB && mod_mask == MOD_MASK_CTRL)\n\t{\n\t if (goto_tabpage_lastused() == FAIL)\n\t\tclearopbeep(cap->oap);\n\t return;\n\t}\n\tif (cap->cmdchar == 'g')\n\t pos = movechangelist((int)cap->count1);\n\telse\n\t pos = movemark((int)cap->count1);\n\tif (pos == (pos_T *)-1)\t\t// jump to other file\n\t{\n\t curwin->w_set_curswant = TRUE;\n\t check_cursor();\n\t}\n\telse if (pos != NULL)\t\t // can jump\n\t nv_cursormark(cap, FALSE, pos);\n\telse if (cap->cmdchar == 'g')\n\t{\n\t if (curbuf->b_changelistlen == 0)\n\t\temsg(_(e_changelist_is_empty));\n\t else if (cap->count1 < 0)\n\t\temsg(_(e_at_start_of_changelist));\n\t else\n\t\temsg(_(e_at_end_of_changelist));\n\t}\n\telse\n\t clearopbeep(cap->oap);\n# ifdef FEAT_FOLDING\n\tif (cap->oap->op_type == OP_NOP\n\t\t&& (pos == (pos_T *)-1 || lnum != curwin->w_cursor.lnum)\n\t\t&& (fdo_flags & FDO_MARK)\n\t\t&& old_KeyTyped)\n\t foldOpenCursor();\n# endif\n }\n}",
"/*\n * Handle '\"' command.\n */\n static void\nnv_regname(cmdarg_T *cap)\n{\n if (checkclearop(cap->oap))\n\treturn;\n#ifdef FEAT_EVAL\n if (cap->nchar == '=')\n\tcap->nchar = get_expr_register();\n#endif\n if (cap->nchar != NUL && valid_yank_reg(cap->nchar, FALSE))\n {\n\tcap->oap->regname = cap->nchar;\n\tcap->opcount = cap->count0;\t// remember count before '\"'\n#ifdef FEAT_EVAL\n\tset_reg_var(cap->oap->regname);\n#endif\n }\n else\n\tclearopbeep(cap->oap);\n}",
"/*\n * Handle \"v\", \"V\" and \"CTRL-V\" commands.\n * Also for \"gh\", \"gH\" and \"g^H\" commands: Always start Select mode, cap->arg\n * is TRUE.\n * Handle CTRL-Q just like CTRL-V.\n */\n static void\nnv_visual(cmdarg_T *cap)\n{\n if (cap->cmdchar == Ctrl_Q)\n\tcap->cmdchar = Ctrl_V;",
" // 'v', 'V' and CTRL-V can be used while an operator is pending to make it\n // characterwise, linewise, or blockwise.\n if (cap->oap->op_type != OP_NOP)\n {\n\tmotion_force = cap->oap->motion_force = cap->cmdchar;\n\tfinish_op = FALSE;\t// operator doesn't finish now but later\n\treturn;\n }",
" VIsual_select = cap->arg;\n if (VIsual_active)\t // change Visual mode\n {\n\tif (VIsual_mode == cap->cmdchar) // stop visual mode\n\t end_visual_mode();\n\telse\t\t\t\t // toggle char/block mode\n\t{\t\t\t\t //\t or char/line mode\n\t VIsual_mode = cap->cmdchar;\n\t showmode();\n\t may_trigger_modechanged();\n\t}\n\tredraw_curbuf_later(INVERTED);\t // update the inversion\n }\n else\t\t // start Visual mode\n {\n\tcheck_visual_highlight();\n\tif (cap->count0 > 0 && resel_VIsual_mode != NUL)\n\t{\n\t // use previously selected part\n\t VIsual = curwin->w_cursor;",
"\t VIsual_active = TRUE;\n\t VIsual_reselect = TRUE;\n\t if (!cap->arg)\n\t\t// start Select mode when 'selectmode' contains \"cmd\"\n\t\tmay_start_select('c');\n\t setmouse();\n\t if (p_smd && msg_silent == 0)\n\t\tredraw_cmdline = TRUE;\t // show visual mode later\n\t // For V and ^V, we multiply the number of lines even if there\n\t // was only one -- webb\n\t if (resel_VIsual_mode != 'v' || resel_VIsual_line_count > 1)\n\t {\n\t\tcurwin->w_cursor.lnum +=\n\t\t\t\t resel_VIsual_line_count * cap->count0 - 1;\n\t\tcheck_cursor();\n\t }\n\t VIsual_mode = resel_VIsual_mode;\n\t if (VIsual_mode == 'v')\n\t {\n\t\tif (resel_VIsual_line_count <= 1)\n\t\t{\n\t\t validate_virtcol();\n\t\t curwin->w_curswant = curwin->w_virtcol\n\t\t\t\t\t+ resel_VIsual_vcol * cap->count0 - 1;\n\t\t}\n\t\telse\n\t\t curwin->w_curswant = resel_VIsual_vcol;\n\t\tcoladvance(curwin->w_curswant);\n\t }\n\t if (resel_VIsual_vcol == MAXCOL)\n\t {\n\t\tcurwin->w_curswant = MAXCOL;\n\t\tcoladvance((colnr_T)MAXCOL);\n\t }\n\t else if (VIsual_mode == Ctrl_V)\n\t {\n\t\tvalidate_virtcol();\n\t\tcurwin->w_curswant = curwin->w_virtcol\n\t\t\t\t\t+ resel_VIsual_vcol * cap->count0 - 1;\n\t\tcoladvance(curwin->w_curswant);\n\t }\n\t else\n\t\tcurwin->w_set_curswant = TRUE;\n\t redraw_curbuf_later(INVERTED);\t// show the inversion\n\t}\n\telse\n\t{\n\t if (!cap->arg)\n\t\t// start Select mode when 'selectmode' contains \"cmd\"\n\t\tmay_start_select('c');\n\t n_start_visual_mode(cap->cmdchar);\n\t if (VIsual_mode != 'V' && *p_sel == 'e')\n\t\t++cap->count1; // include one more char\n\t if (cap->count0 > 0 && --cap->count1 > 0)\n\t {\n\t\t// With a count select that many characters or lines.\n\t\tif (VIsual_mode == 'v' || VIsual_mode == Ctrl_V)\n\t\t nv_right(cap);\n\t\telse if (VIsual_mode == 'V')\n\t\t nv_down(cap);\n\t }\n\t}\n }\n}",
"/*\n * Start selection for Shift-movement keys.\n */\n void\nstart_selection(void)\n{\n // if 'selectmode' contains \"key\", start Select mode\n may_start_select('k');\n n_start_visual_mode('v');\n}",
"/*\n * Start Select mode, if \"c\" is in 'selectmode' and not in a mapping or menu.\n * When \"c\" is 'o' (checking for \"mouse\") then also when mapped.\n */\n void\nmay_start_select(int c)\n{\n VIsual_select = (c == 'o' || (stuff_empty() && typebuf_typed()))\n\t\t && vim_strchr(p_slm, c) != NULL;\n}",
"/*\n * Start Visual mode \"c\".\n * Should set VIsual_select before calling this.\n */\n static void\nn_start_visual_mode(int c)\n{\n#ifdef FEAT_CONCEAL\n int cursor_line_was_concealed = curwin->w_p_cole > 0\n\t\t\t\t\t\t&& conceal_cursor_line(curwin);\n#endif",
" VIsual_mode = c;\n VIsual_active = TRUE;\n VIsual_reselect = TRUE;",
" // Corner case: the 0 position in a tab may change when going into\n // virtualedit. Recalculate curwin->w_cursor to avoid bad highlighting.\n if (c == Ctrl_V && (get_ve_flags() & VE_BLOCK) && gchar_cursor() == TAB)\n {\n\tvalidate_virtcol();\n\tcoladvance(curwin->w_virtcol);\n }\n VIsual = curwin->w_cursor;",
"#ifdef FEAT_FOLDING\n foldAdjustVisual();\n#endif",
" may_trigger_modechanged();\n setmouse();\n#ifdef FEAT_CONCEAL\n // Check if redraw is needed after changing the state.\n conceal_check_cursor_line(cursor_line_was_concealed);\n#endif",
" if (p_smd && msg_silent == 0)\n\tredraw_cmdline = TRUE;\t// show visual mode later\n#ifdef FEAT_CLIPBOARD\n // Make sure the clipboard gets updated. Needed because start and\n // end may still be the same, and the selection needs to be owned\n clip_star.vmode = NUL;\n#endif",
" // Only need to redraw this line, unless still need to redraw an old\n // Visual area (when 'lazyredraw' is set).\n if (curwin->w_redr_type < INVERTED)\n {\n\tcurwin->w_old_cursor_lnum = curwin->w_cursor.lnum;\n\tcurwin->w_old_visual_lnum = curwin->w_cursor.lnum;\n }\n}",
"\n/*\n * CTRL-W: Window commands\n */\n static void\nnv_window(cmdarg_T *cap)\n{\n if (cap->nchar == ':')\n {\n\t// \"CTRL-W :\" is the same as typing \":\"; useful in a terminal window\n\tcap->cmdchar = ':';\n\tcap->nchar = NUL;\n\tnv_colon(cap);\n }\n else if (!checkclearop(cap->oap))\n\tdo_window(cap->nchar, cap->count0, NUL); // everything is in window.c\n}",
"/*\n * CTRL-Z: Suspend\n */\n static void\nnv_suspend(cmdarg_T *cap)\n{\n clearop(cap->oap);\n if (VIsual_active)\n\tend_visual_mode();\t\t// stop Visual mode\n do_cmdline_cmd((char_u *)\"stop\");\n}",
"/*\n * \"gv\": Reselect the previous Visual area. If Visual already active,\n * exchange previous and current Visual area.\n */\n static void\nnv_gv_cmd(cmdarg_T *cap)\n{\n pos_T\ttpos;\n int\t\ti;",
" if (checkclearop(cap->oap))\n\treturn;",
" if (curbuf->b_visual.vi_start.lnum == 0\n\t || curbuf->b_visual.vi_start.lnum > curbuf->b_ml.ml_line_count\n\t || curbuf->b_visual.vi_end.lnum == 0)\n {\n\tbeep_flush();\n\treturn;\n }",
" // set w_cursor to the start of the Visual area, tpos to the end\n if (VIsual_active)\n {\n\ti = VIsual_mode;\n\tVIsual_mode = curbuf->b_visual.vi_mode;\n\tcurbuf->b_visual.vi_mode = i;\n# ifdef FEAT_EVAL\n\tcurbuf->b_visual_mode_eval = i;\n# endif\n\ti = curwin->w_curswant;\n\tcurwin->w_curswant = curbuf->b_visual.vi_curswant;\n\tcurbuf->b_visual.vi_curswant = i;",
"\ttpos = curbuf->b_visual.vi_end;\n\tcurbuf->b_visual.vi_end = curwin->w_cursor;\n\tcurwin->w_cursor = curbuf->b_visual.vi_start;\n\tcurbuf->b_visual.vi_start = VIsual;\n }\n else\n {\n\tVIsual_mode = curbuf->b_visual.vi_mode;\n\tcurwin->w_curswant = curbuf->b_visual.vi_curswant;\n\ttpos = curbuf->b_visual.vi_end;\n\tcurwin->w_cursor = curbuf->b_visual.vi_start;\n }",
" VIsual_active = TRUE;\n VIsual_reselect = TRUE;",
" // Set Visual to the start and w_cursor to the end of the Visual\n // area. Make sure they are on an existing character.\n check_cursor();\n VIsual = curwin->w_cursor;\n curwin->w_cursor = tpos;\n check_cursor();\n update_topline();",
" // When called from normal \"g\" command: start Select mode when\n // 'selectmode' contains \"cmd\". When called for K_SELECT, always\n // start Select mode.\n if (cap->arg)\n {\n\tVIsual_select = TRUE;\n\tVIsual_select_reg = 0;\n }\n else\n\tmay_start_select('c');\n setmouse();\n#ifdef FEAT_CLIPBOARD\n // Make sure the clipboard gets updated. Needed because start and\n // end are still the same, and the selection needs to be owned\n clip_star.vmode = NUL;\n#endif\n redraw_curbuf_later(INVERTED);\n showmode();\n}",
"/*\n * \"g0\", \"g^\" : Like \"0\" and \"^\" but for screen lines.\n * \"gm\": middle of \"g0\" and \"g$\".\n */\n static void\nnv_g_home_m_cmd(cmdarg_T *cap)\n{\n int\t\ti;\n int\t\tflag = FALSE;",
" if (cap->nchar == '^')\n\tflag = TRUE;",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n if (curwin->w_p_wrap && curwin->w_width != 0)\n {\n\tint\t\twidth1 = curwin->w_width - curwin_col_off();\n\tint\t\twidth2 = width1 + curwin_col_off2();",
"\tvalidate_virtcol();\n\ti = 0;\n\tif (curwin->w_virtcol >= (colnr_T)width1 && width2 > 0)\n\t i = (curwin->w_virtcol - width1) / width2 * width2 + width1;\n }\n else\n\ti = curwin->w_leftcol;\n // Go to the middle of the screen line. When 'number' or\n // 'relativenumber' is on and lines are wrapping the middle can be more\n // to the left.\n if (cap->nchar == 'm')\n\ti += (curwin->w_width - curwin_col_off()\n\t\t+ ((curwin->w_p_wrap && i > 0)\n\t\t ? curwin_col_off2() : 0)) / 2;\n coladvance((colnr_T)i);\n if (flag)\n {\n\tdo\n\t i = gchar_cursor();\n\twhile (VIM_ISWHITE(i) && oneright() == OK);\n\tcurwin->w_valid &= ~VALID_WCOL;\n }\n curwin->w_set_curswant = TRUE;\n}",
"/*\n * \"g_\": to the last non-blank character in the line or <count> lines\n * downward.\n */\n static void\nnv_g_underscore_cmd(cmdarg_T *cap)\n{\n char_u *ptr;",
" cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = TRUE;\n curwin->w_curswant = MAXCOL;\n if (cursor_down((long)(cap->count1 - 1),\n\t\t\t\t\tcap->oap->op_type == OP_NOP) == FAIL)\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }",
" ptr = ml_get_curline();",
" // In Visual mode we may end up after the line.\n if (curwin->w_cursor.col > 0 && ptr[curwin->w_cursor.col] == NUL)\n\t--curwin->w_cursor.col;",
" // Decrease the cursor column until it's on a non-blank.\n while (curwin->w_cursor.col > 0\n\t && VIM_ISWHITE(ptr[curwin->w_cursor.col]))\n\t--curwin->w_cursor.col;\n curwin->w_set_curswant = TRUE;\n adjust_for_sel(cap);\n}",
"/*\n * \"g$\" : Like \"$\" but for screen lines.\n */\n static void\nnv_g_dollar_cmd(cmdarg_T *cap)\n{\n oparg_T\t*oap = cap->oap;\n int\t\ti;\n int\t\tcol_off = curwin_col_off();",
" oap->motion_type = MCHAR;\n oap->inclusive = TRUE;\n if (curwin->w_p_wrap && curwin->w_width != 0)\n {\n\tcurwin->w_curswant = MAXCOL; // so we stay at the end\n\tif (cap->count1 == 1)\n\t{\n\t int\t\twidth1 = curwin->w_width - col_off;\n\t int\t\twidth2 = width1 + curwin_col_off2();",
"\t validate_virtcol();\n\t i = width1 - 1;\n\t if (curwin->w_virtcol >= (colnr_T)width1)\n\t\ti += ((curwin->w_virtcol - width1) / width2 + 1)\n\t\t * width2;\n\t coladvance((colnr_T)i);",
"\t // Make sure we stick in this column.\n\t validate_virtcol();\n\t curwin->w_curswant = curwin->w_virtcol;\n\t curwin->w_set_curswant = FALSE;\n\t if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)\n\t {\n\t\t// Check for landing on a character that got split at\n\t\t// the end of the line. We do not want to advance to\n\t\t// the next screen line.\n\t\tif (curwin->w_virtcol > (colnr_T)i)\n\t\t --curwin->w_cursor.col;\n\t }\n\t}\n\telse if (nv_screengo(oap, FORWARD, cap->count1 - 1) == FAIL)\n\t clearopbeep(oap);\n }\n else\n {\n\tif (cap->count1 > 1)\n\t // if it fails, let the cursor still move to the last char\n\t (void)cursor_down(cap->count1 - 1, FALSE);",
"\ti = curwin->w_leftcol + curwin->w_width - col_off - 1;\n\tcoladvance((colnr_T)i);",
"\t// if the character doesn't fit move one back\n\tif (curwin->w_cursor.col > 0\n\t\t&& (*mb_ptr2cells)(ml_get_cursor()) > 1)\n\t{\n\t colnr_T vcol;",
"\t getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol);\n\t if (vcol >= curwin->w_leftcol + curwin->w_width - col_off)\n\t\t--curwin->w_cursor.col;\n\t}",
"\t// Make sure we stick in this column.\n\tvalidate_virtcol();\n\tcurwin->w_curswant = curwin->w_virtcol;\n\tcurwin->w_set_curswant = FALSE;\n }\n}",
"/*\n * \"gi\": start Insert at the last position.\n */\n static void\nnv_gi_cmd(cmdarg_T *cap)\n{\n int\t\ti;",
" if (curbuf->b_last_insert.lnum != 0)\n {\n\tcurwin->w_cursor = curbuf->b_last_insert;\n\tcheck_cursor_lnum();\n\ti = (int)STRLEN(ml_get_curline());\n\tif (curwin->w_cursor.col > (colnr_T)i)\n\t{\n\t if (virtual_active())\n\t\tcurwin->w_cursor.coladd += curwin->w_cursor.col - i;\n\t curwin->w_cursor.col = i;\n\t}\n }\n cap->cmdchar = 'i';\n nv_edit(cap);\n}",
"/*\n * Commands starting with \"g\".\n */\n static void\nnv_g_cmd(cmdarg_T *cap)\n{\n oparg_T\t*oap = cap->oap;\n int\t\ti;",
" switch (cap->nchar)\n {\n case Ctrl_A:\n case Ctrl_X:\n#ifdef MEM_PROFILE\n // \"g^A\": dump log of used memory.\n\tif (!VIsual_active && cap->nchar == Ctrl_A)\n\t vim_mem_profile_dump();\n\telse\n#endif\n // \"g^A/g^X\": sequentially increment visually selected region\n\t if (VIsual_active)\n\t{\n\t cap->arg = TRUE;\n\t cap->cmdchar = cap->nchar;\n\t cap->nchar = NUL;\n\t nv_addsub(cap);\n\t}\n\telse\n\t clearopbeep(oap);\n\tbreak;",
" // \"gR\": Enter virtual replace mode.\n case 'R':\n\tcap->arg = TRUE;\n\tnv_Replace(cap);\n\tbreak;",
" case 'r':\n\tnv_vreplace(cap);\n\tbreak;",
" case '&':\n\tdo_cmdline_cmd((char_u *)\"%s//~/&\");\n\tbreak;",
" // \"gv\": Reselect the previous Visual area. If Visual already active,\n // exchange previous and current Visual area.\n case 'v':\n\tnv_gv_cmd(cap);\n\tbreak;",
" // \"gV\": Don't reselect the previous Visual area after a Select mode\n // mapping of menu.\n case 'V':\n\tVIsual_reselect = FALSE;\n\tbreak;",
" // \"gh\": start Select mode.\n // \"gH\": start Select line mode.\n // \"g^H\": start Select block mode.\n case K_BS:\n\tcap->nchar = Ctrl_H;\n\t// FALLTHROUGH\n case 'h':\n case 'H':\n case Ctrl_H:\n\tcap->cmdchar = cap->nchar + ('v' - 'h');\n\tcap->arg = TRUE;\n\tnv_visual(cap);\n\tbreak;",
" // \"gn\", \"gN\" visually select next/previous search match\n // \"gn\" selects next match\n // \"gN\" selects previous match\n case 'N':\n case 'n':\n\tif (!current_search(cap->count1, cap->nchar == 'n'))\n\t clearopbeep(oap);\n\tbreak;",
" // \"gj\" and \"gk\" two new funny movement keys -- up and down\n // movement based on *screen* line rather than *file* line.\n case 'j':\n case K_DOWN:\n\t// with 'nowrap' it works just like the normal \"j\" command.\n\tif (!curwin->w_p_wrap)\n\t{\n\t oap->motion_type = MLINE;\n\t i = cursor_down(cap->count1, oap->op_type == OP_NOP);\n\t}\n\telse\n\t i = nv_screengo(oap, FORWARD, cap->count1);\n\tif (i == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" case 'k':\n case K_UP:\n\t// with 'nowrap' it works just like the normal \"k\" command.\n\tif (!curwin->w_p_wrap)\n\t{\n\t oap->motion_type = MLINE;\n\t i = cursor_up(cap->count1, oap->op_type == OP_NOP);\n\t}\n\telse\n\t i = nv_screengo(oap, BACKWARD, cap->count1);\n\tif (i == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" // \"gJ\": join two lines without inserting a space.\n case 'J':\n\tnv_join(cap);\n\tbreak;",
" // \"g0\", \"g^\" : Like \"0\" and \"^\" but for screen lines.\n // \"gm\": middle of \"g0\" and \"g$\".\n case '^':\n case '0':\n case 'm':\n case K_HOME:\n case K_KHOME:\n\tnv_g_home_m_cmd(cap);\n\tbreak;",
" case 'M':\n\t{\n\t oap->motion_type = MCHAR;\n\t oap->inclusive = FALSE;\n\t i = linetabsize(ml_get_curline());\n\t if (cap->count0 > 0 && cap->count0 <= 100)\n\t\tcoladvance((colnr_T)(i * cap->count0 / 100));\n\t else\n\t\tcoladvance((colnr_T)(i / 2));\n\t curwin->w_set_curswant = TRUE;\n\t}\n\tbreak;",
" // \"g_\": to the last non-blank character in the line or <count> lines\n // downward.\n case '_':\n\tnv_g_underscore_cmd(cap);\n\tbreak;",
" // \"g$\" : Like \"$\" but for screen lines.\n case '$':\n case K_END:\n case K_KEND:\n\tnv_g_dollar_cmd(cap);\n\tbreak;",
" // \"g*\" and \"g#\", like \"*\" and \"#\" but without using \"\\<\" and \"\\>\"\n case '*':\n case '#':\n#if POUND != '#'\n case POUND:\t\t// pound sign (sometimes equal to '#')\n#endif\n case Ctrl_RSB:\t\t// :tag or :tselect for current identifier\n case ']':\t\t\t// :tselect for current identifier\n\tnv_ident(cap);\n\tbreak;",
" // ge and gE: go back to end of word\n case 'e':\n case 'E':\n\toap->motion_type = MCHAR;\n\tcurwin->w_set_curswant = TRUE;\n\toap->inclusive = TRUE;\n\tif (bckend_word(cap->count1, cap->nchar == 'E', FALSE) == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" // \"g CTRL-G\": display info about cursor position\n case Ctrl_G:\n\tcursor_pos_info(NULL);\n\tbreak;",
" // \"gi\": start Insert at the last position.\n case 'i':\n\tnv_gi_cmd(cap);\n\tbreak;",
" // \"gI\": Start insert in column 1.\n case 'I':\n\tbeginline(0);\n\tif (!checkclearopq(oap))\n\t invoke_edit(cap, FALSE, 'g', FALSE);\n\tbreak;",
"#ifdef FEAT_SEARCHPATH\n // \"gf\": goto file, edit file under cursor\n // \"]f\" and \"[f\": can also be used.\n case 'f':\n case 'F':\n\tnv_gotofile(cap);\n\tbreak;\n#endif",
" // \"g'm\" and \"g`m\": jump to mark without setting pcmark\n case '\\'':\n\tcap->arg = TRUE;\n\t// FALLTHROUGH\n case '`':\n\tnv_gomark(cap);\n\tbreak;",
" // \"gs\": Goto sleep.\n case 's':\n\tdo_sleep(cap->count1 * 1000L, FALSE);\n\tbreak;",
" // \"ga\": Display the ascii value of the character under the\n // cursor.\tIt is displayed in decimal, hex, and octal. -- webb\n case 'a':\n\tdo_ascii(NULL);\n\tbreak;",
" // \"g8\": Display the bytes used for the UTF-8 character under the\n // cursor.\tIt is displayed in hex.\n // \"8g8\" finds illegal byte sequence.\n case '8':\n\tif (cap->count0 == 8)\n\t utf_find_illegal();\n\telse\n\t show_utf8();\n\tbreak;",
" // \"g<\": show scrollback text\n case '<':\n\tshow_sb_text();\n\tbreak;",
" // \"gg\": Goto the first line in file. With a count it goes to\n // that line number like for \"G\". -- webb\n case 'g':\n\tcap->arg = FALSE;\n\tnv_goto(cap);\n\tbreak;",
" //\t Two-character operators:\n //\t \"gq\"\t Format text\n //\t \"gw\"\t Format text and keep cursor position\n //\t \"g~\"\t Toggle the case of the text.\n //\t \"gu\"\t Change text to lower case.\n //\t \"gU\"\t Change text to upper case.\n // \"g?\"\t rot13 encoding\n // \"g@\"\t call 'operatorfunc'\n case 'q':\n case 'w':\n\toap->cursor_start = curwin->w_cursor;\n\t// FALLTHROUGH\n case '~':\n case 'u':\n case 'U':\n case '?':\n case '@':\n\tnv_operator(cap);\n\tbreak;",
" // \"gd\": Find first occurrence of pattern under the cursor in the\n //\t current function\n // \"gD\": idem, but in the current file.\n case 'd':\n case 'D':\n\tnv_gd(oap, cap->nchar, (int)cap->count0);\n\tbreak;",
" // g<*Mouse> : <C-*mouse>\n case K_MIDDLEMOUSE:\n case K_MIDDLEDRAG:\n case K_MIDDLERELEASE:\n case K_LEFTMOUSE:\n case K_LEFTDRAG:\n case K_LEFTRELEASE:\n case K_MOUSEMOVE:\n case K_RIGHTMOUSE:\n case K_RIGHTDRAG:\n case K_RIGHTRELEASE:\n case K_X1MOUSE:\n case K_X1DRAG:\n case K_X1RELEASE:\n case K_X2MOUSE:\n case K_X2DRAG:\n case K_X2RELEASE:\n\tmod_mask = MOD_MASK_CTRL;\n\t(void)do_mouse(oap, cap->nchar, BACKWARD, cap->count1, 0);\n\tbreak;",
" case K_IGNORE:\n\tbreak;",
" // \"gP\" and \"gp\": same as \"P\" and \"p\" but leave cursor just after new text\n case 'p':\n case 'P':\n\tnv_put(cap);\n\tbreak;",
"#ifdef FEAT_BYTEOFF\n // \"go\": goto byte count from start of buffer\n case 'o':\n\tgoto_byte(cap->count0);\n\tbreak;\n#endif",
" // \"gQ\": improved Ex mode\n case 'Q':\n\tif (!check_text_locked(cap->oap) && !checkclearopq(oap))\n\t do_exmode(TRUE);\n\tbreak;",
" case ',':\n\tnv_pcmark(cap);\n\tbreak;",
" case ';':\n\tcap->count1 = -cap->count1;\n\tnv_pcmark(cap);\n\tbreak;",
" case 't':\n\tif (!checkclearop(oap))\n\t goto_tabpage((int)cap->count0);\n\tbreak;\n case 'T':\n\tif (!checkclearop(oap))\n\t goto_tabpage(-(int)cap->count1);\n\tbreak;",
" case TAB:\n\tif (!checkclearop(oap) && goto_tabpage_lastused() == FAIL)\n\t clearopbeep(oap);\n\tbreak;",
" case '+':\n case '-': // \"g+\" and \"g-\": undo or redo along the timeline\n\tif (!checkclearopq(oap))\n\t undo_time(cap->nchar == '-' ? -cap->count1 : cap->count1,\n\t\t\t\t\t\t\t FALSE, FALSE, FALSE);\n\tbreak;",
" default:\n\tclearopbeep(oap);\n\tbreak;\n }\n}",
"/*\n * Handle \"o\" and \"O\" commands.\n */\n static void\nn_opencmd(cmdarg_T *cap)\n{\n#ifdef FEAT_CONCEAL\n linenr_T\toldline = curwin->w_cursor.lnum;\n#endif",
" if (!checkclearopq(cap->oap))\n {\n#ifdef FEAT_FOLDING\n\tif (cap->cmdchar == 'O')\n\t // Open above the first line of a folded sequence of lines\n\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\t&curwin->w_cursor.lnum, NULL);\n\telse\n\t // Open below the last line of a folded sequence of lines\n\t (void)hasFolding(curwin->w_cursor.lnum,\n\t\t\t\t\t\tNULL, &curwin->w_cursor.lnum);\n#endif\n\tif (u_save((linenr_T)(curwin->w_cursor.lnum -\n\t\t\t\t\t (cap->cmdchar == 'O' ? 1 : 0)),\n\t\t (linenr_T)(curwin->w_cursor.lnum +\n\t\t\t\t\t (cap->cmdchar == 'o' ? 1 : 0))\n\t\t ) == OK\n\t\t&& open_line(cap->cmdchar == 'O' ? BACKWARD : FORWARD,\n\t\t\t has_format_option(FO_OPEN_COMS) ? OPENLINE_DO_COM : 0,\n\t\t\t\t\t\t\t\t0, NULL) == OK)\n\t{\n#ifdef FEAT_CONCEAL\n\t if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum)\n\t\tredrawWinline(curwin, oldline);\n#endif\n#ifdef FEAT_SYN_HL\n\t if (curwin->w_p_cul)\n\t\t// force redraw of cursorline\n\t\tcurwin->w_valid &= ~VALID_CROW;\n#endif\n\t // When '#' is in 'cpoptions' ignore the count.\n\t if (vim_strchr(p_cpo, CPO_HASH) != NULL)\n\t\tcap->count1 = 1;\n\t invoke_edit(cap, FALSE, cap->cmdchar, TRUE);\n\t}\n }\n}",
"/*\n * \".\" command: redo last change.\n */\n static void\nnv_dot(cmdarg_T *cap)\n{\n if (!checkclearopq(cap->oap))\n {\n\t// If \"restart_edit\" is TRUE, the last but one command is repeated\n\t// instead of the last command (inserting text). This is used for\n\t// CTRL-O <.> in insert mode.\n\tif (start_redo(cap->count0, restart_edit != 0 && !arrow_used) == FAIL)\n\t clearopbeep(cap->oap);\n }\n}",
"/*\n * CTRL-R: undo undo or specify register in select mode\n */\n static void\nnv_redo_or_register(cmdarg_T *cap)\n{\n if (VIsual_select && VIsual_active)\n {\n\tint reg;\n\t// Get register name\n\t++no_mapping;\n\t++allow_keys;\n\treg = plain_vgetc();\n\tLANGMAP_ADJUST(reg, TRUE);\n\t--no_mapping;\n\t--allow_keys;",
"\tif (reg == '\"')\n\t // the unnamed register is 0\n\t reg = 0;",
"\tVIsual_select_reg = valid_yank_reg(reg, TRUE) ? reg : 0;\n\treturn;\n }",
" if (!checkclearopq(cap->oap))\n {\n\tu_redo((int)cap->count1);\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * Handle \"U\" command.\n */\n static void\nnv_Undo(cmdarg_T *cap)\n{\n // In Visual mode and typing \"gUU\" triggers an operator\n if (cap->oap->op_type == OP_UPPER || VIsual_active)\n {\n\t// translate \"gUU\" to \"gUgU\"\n\tcap->cmdchar = 'g';\n\tcap->nchar = 'U';\n\tnv_operator(cap);\n }\n else if (!checkclearopq(cap->oap))\n {\n\tu_undoline();\n\tcurwin->w_set_curswant = TRUE;\n }\n}",
"/*\n * '~' command: If tilde is not an operator and Visual is off: swap case of a\n * single character.\n */\n static void\nnv_tilde(cmdarg_T *cap)\n{\n if (!p_to && !VIsual_active && cap->oap->op_type != OP_TILDE)\n {\n#ifdef FEAT_JOB_CHANNEL\n\tif (bt_prompt(curbuf) && !prompt_curpos_editable())\n\t{\n\t clearopbeep(cap->oap);\n\t return;\n\t}\n#endif\n\tn_swapchar(cap);\n }\n else\n\tnv_operator(cap);\n}",
"/*\n * Handle an operator command.\n * The actual work is done by do_pending_operator().\n */\n static void\nnv_operator(cmdarg_T *cap)\n{\n int\t op_type;",
" op_type = get_op_type(cap->cmdchar, cap->nchar);\n#ifdef FEAT_JOB_CHANNEL\n if (bt_prompt(curbuf) && op_is_change(op_type) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n\treturn;\n }\n#endif",
" if (op_type == cap->oap->op_type)\t // double operator works on lines\n\tnv_lineop(cap);\n else if (!checkclearop(cap->oap))\n {\n\tcap->oap->start = curwin->w_cursor;\n\tcap->oap->op_type = op_type;\n#ifdef FEAT_EVAL\n\tset_op_var(op_type);\n#endif\n }\n}",
"#ifdef FEAT_EVAL\n/*\n * Set v:operator to the characters for \"optype\".\n */\n static void\nset_op_var(int optype)\n{\n char_u\topchars[3];",
" if (optype == OP_NOP)\n\tset_vim_var_string(VV_OP, NULL, 0);\n else\n {\n\topchars[0] = get_op_char(optype);\n\topchars[1] = get_extra_op_char(optype);\n\topchars[2] = NUL;\n\tset_vim_var_string(VV_OP, opchars, -1);\n }\n}\n#endif",
"/*\n * Handle linewise operator \"dd\", \"yy\", etc.\n *\n * \"_\" is is a strange motion command that helps make operators more logical.\n * It is actually implemented, but not documented in the real Vi. This motion\n * command actually refers to \"the current line\". Commands like \"dd\" and \"yy\"\n * are really an alternate form of \"d_\" and \"y_\". It does accept a count, so\n * \"d3_\" works to delete 3 lines.\n */\n static void\nnv_lineop(cmdarg_T *cap)\n{\n cap->oap->motion_type = MLINE;\n if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL)\n\tclearopbeep(cap->oap);\n else if ( (cap->oap->op_type == OP_DELETE // only with linewise motions\n\t\t&& cap->oap->motion_force != 'v'\n\t\t&& cap->oap->motion_force != Ctrl_V)\n\t || cap->oap->op_type == OP_LSHIFT\n\t || cap->oap->op_type == OP_RSHIFT)\n\tbeginline(BL_SOL | BL_FIX);\n else if (cap->oap->op_type != OP_YANK)\t// 'Y' does not move cursor\n\tbeginline(BL_WHITE | BL_FIX);\n}",
"/*\n * <Home> command.\n */\n static void\nnv_home(cmdarg_T *cap)\n{\n // CTRL-HOME is like \"gg\"\n if (mod_mask & MOD_MASK_CTRL)\n\tnv_goto(cap);\n else\n {\n\tcap->count0 = 1;\n\tnv_pipe(cap);\n }\n ins_at_eol = FALSE;\t // Don't move cursor past eol (only necessary in a\n\t\t\t // one-character line).\n}",
"/*\n * \"|\" command.\n */\n static void\nnv_pipe(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n beginline(0);\n if (cap->count0 > 0)\n {\n\tcoladvance((colnr_T)(cap->count0 - 1));\n\tcurwin->w_curswant = (colnr_T)(cap->count0 - 1);\n }\n else\n\tcurwin->w_curswant = 0;\n // keep curswant at the column where we wanted to go, not where\n // we ended; differs if line is too short\n curwin->w_set_curswant = FALSE;\n}",
"/*\n * Handle back-word command \"b\" and \"B\".\n * cap->arg is 1 for \"B\"\n */\n static void\nnv_bck_word(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n curwin->w_set_curswant = TRUE;\n if (bck_word(cap->count1, cap->arg, FALSE) == FAIL)\n\tclearopbeep(cap->oap);\n#ifdef FEAT_FOLDING\n else if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * Handle word motion commands \"e\", \"E\", \"w\" and \"W\".\n * cap->arg is TRUE for \"E\" and \"W\".\n */\n static void\nnv_wordcmd(cmdarg_T *cap)\n{\n int\t\tn;\n int\t\tword_end;\n int\t\tflag = FALSE;\n pos_T\tstartpos = curwin->w_cursor;",
" // Set inclusive for the \"E\" and \"e\" command.\n if (cap->cmdchar == 'e' || cap->cmdchar == 'E')\n\tword_end = TRUE;\n else\n\tword_end = FALSE;\n cap->oap->inclusive = word_end;",
" // \"cw\" and \"cW\" are a special case.\n if (!word_end && cap->oap->op_type == OP_CHANGE)\n {\n\tn = gchar_cursor();\n\tif (n != NUL)\t\t\t// not an empty line\n\t{\n\t if (VIM_ISWHITE(n))\n\t {\n\t\t// Reproduce a funny Vi behaviour: \"cw\" on a blank only\n\t\t// changes one character, not all blanks until the start of\n\t\t// the next word. Only do this when the 'w' flag is included\n\t\t// in 'cpoptions'.\n\t\tif (cap->count1 == 1 && vim_strchr(p_cpo, CPO_CW) != NULL)\n\t\t{\n\t\t cap->oap->inclusive = TRUE;\n\t\t cap->oap->motion_type = MCHAR;\n\t\t return;\n\t\t}\n\t }\n\t else\n\t {\n\t\t// This is a little strange. To match what the real Vi does,\n\t\t// we effectively map 'cw' to 'ce', and 'cW' to 'cE', provided\n\t\t// that we are not on a space or a TAB. This seems impolite\n\t\t// at first, but it's really more what we mean when we say\n\t\t// 'cw'.\n\t\t// Another strangeness: When standing on the end of a word\n\t\t// \"ce\" will change until the end of the next word, but \"cw\"\n\t\t// will change only one character! This is done by setting\n\t\t// flag.\n\t\tcap->oap->inclusive = TRUE;\n\t\tword_end = TRUE;\n\t\tflag = TRUE;\n\t }\n\t}\n }",
" cap->oap->motion_type = MCHAR;\n curwin->w_set_curswant = TRUE;\n if (word_end)\n\tn = end_word(cap->count1, cap->arg, flag, FALSE);\n else\n\tn = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP);",
" // Don't leave the cursor on the NUL past the end of line. Unless we\n // didn't move it forward.\n if (LT_POS(startpos, curwin->w_cursor))\n\tadjust_cursor(cap->oap);",
" if (n == FAIL && cap->oap->op_type == OP_NOP)\n\tclearopbeep(cap->oap);\n else\n {\n\tadjust_for_sel(cap);\n#ifdef FEAT_FOLDING\n\tif ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\t foldOpenCursor();\n#endif\n }\n}",
"/*\n * Used after a movement command: If the cursor ends up on the NUL after the\n * end of the line, may move it back to the last character and make the motion\n * inclusive.\n */\n static void\nadjust_cursor(oparg_T *oap)\n{\n // The cursor cannot remain on the NUL when:\n // - the column is > 0\n // - not in Visual mode or 'selection' is \"o\"\n // - 'virtualedit' is not \"all\" and not \"onemore\".\n if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL\n\t\t&& (!VIsual_active || *p_sel == 'o')\n\t\t&& !virtual_active() && (get_ve_flags() & VE_ONEMORE) == 0)\n {\n\t--curwin->w_cursor.col;\n\t// prevent cursor from moving on the trail byte\n\tif (has_mbyte)\n\t mb_adjust_cursor();\n\toap->inclusive = TRUE;\n }\n}",
"/*\n * \"0\" and \"^\" commands.\n * cap->arg is the argument for beginline().\n */\n static void\nnv_beginline(cmdarg_T *cap)\n{\n cap->oap->motion_type = MCHAR;\n cap->oap->inclusive = FALSE;\n beginline(cap->arg);\n#ifdef FEAT_FOLDING\n if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n ins_at_eol = FALSE;\t // Don't move cursor past eol (only necessary in a\n\t\t\t // one-character line).\n}",
"/*\n * In exclusive Visual mode, may include the last character.\n */\n static void\nadjust_for_sel(cmdarg_T *cap)\n{\n if (VIsual_active && cap->oap->inclusive && *p_sel == 'e'\n\t && gchar_cursor() != NUL && LT_POS(VIsual, curwin->w_cursor))\n {\n\tif (has_mbyte)\n\t inc_cursor();\n\telse\n\t ++curwin->w_cursor.col;\n\tcap->oap->inclusive = FALSE;\n }\n}",
"/*\n * Exclude last character at end of Visual area for 'selection' == \"exclusive\".\n * Should check VIsual_mode before calling this.\n * Returns TRUE when backed up to the previous line.\n */\n int\nunadjust_for_sel(void)\n{\n pos_T\t*pp;",
" if (*p_sel == 'e' && !EQUAL_POS(VIsual, curwin->w_cursor))\n {\n\tif (LT_POS(VIsual, curwin->w_cursor))\n\t pp = &curwin->w_cursor;\n\telse\n\t pp = &VIsual;\n\tif (pp->coladd > 0)\n\t --pp->coladd;\n\telse\n\tif (pp->col > 0)\n\t{\n\t --pp->col;\n\t mb_adjustpos(curbuf, pp);\n\t}\n\telse if (pp->lnum > 1)\n\t{\n\t --pp->lnum;\n\t pp->col = (colnr_T)STRLEN(ml_get(pp->lnum));\n\t return TRUE;\n\t}\n }\n return FALSE;\n}",
"/*\n * SELECT key in Normal or Visual mode: end of Select mode mapping.\n */\n static void\nnv_select(cmdarg_T *cap)\n{\n if (VIsual_active)\n {\n\tVIsual_select = TRUE;\n\tVIsual_select_reg = 0;\n }\n else if (VIsual_reselect)\n {\n\tcap->nchar = 'v';\t // fake \"gv\" command\n\tcap->arg = TRUE;\n\tnv_g_cmd(cap);\n }\n}",
"\n/*\n * \"G\", \"gg\", CTRL-END, CTRL-HOME.\n * cap->arg is TRUE for \"G\".\n */\n static void\nnv_goto(cmdarg_T *cap)\n{\n linenr_T\tlnum;",
" if (cap->arg)\n\tlnum = curbuf->b_ml.ml_line_count;\n else\n\tlnum = 1L;\n cap->oap->motion_type = MLINE;\n setpcmark();",
" // When a count is given, use it instead of the default lnum\n if (cap->count0 != 0)\n\tlnum = cap->count0;\n if (lnum < 1L)\n\tlnum = 1L;\n else if (lnum > curbuf->b_ml.ml_line_count)\n\tlnum = curbuf->b_ml.ml_line_count;\n curwin->w_cursor.lnum = lnum;\n beginline(BL_SOL | BL_FIX);\n#ifdef FEAT_FOLDING\n if ((fdo_flags & FDO_JUMP) && KeyTyped && cap->oap->op_type == OP_NOP)\n\tfoldOpenCursor();\n#endif\n}",
"/*\n * CTRL-\\ in Normal mode.\n */\n static void\nnv_normal(cmdarg_T *cap)\n{\n if (cap->nchar == Ctrl_N || cap->nchar == Ctrl_G)\n {\n\tclearop(cap->oap);\n\tif (restart_edit != 0 && mode_displayed)\n\t clear_cmdline = TRUE;\t\t// unshow mode later\n\trestart_edit = 0;\n#ifdef FEAT_CMDWIN\n\tif (cmdwin_type != 0)\n\t cmdwin_result = Ctrl_C;\n#endif\n\tif (VIsual_active)\n\t{\n\t end_visual_mode();\t\t// stop Visual\n\t redraw_curbuf_later(INVERTED);\n\t}\n\t// CTRL-\\ CTRL-G restarts Insert mode when 'insertmode' is set.\n\tif (cap->nchar == Ctrl_G && p_im)\n\t restart_edit = 'a';\n }\n else\n\tclearopbeep(cap->oap);\n}",
"/*\n * ESC in Normal mode: beep, but don't flush buffers.\n * Don't even beep if we are canceling a command.\n */\n static void\nnv_esc(cmdarg_T *cap)\n{\n int\t\tno_reason;",
" no_reason = (cap->oap->op_type == OP_NOP\n\t\t&& cap->opcount == 0\n\t\t&& cap->count0 == 0\n\t\t&& cap->oap->regname == 0\n\t\t&& !p_im);",
" if (cap->arg)\t\t// TRUE for CTRL-C\n {\n\tif (restart_edit == 0\n#ifdef FEAT_CMDWIN\n\t\t&& cmdwin_type == 0\n#endif\n\t\t&& !VIsual_active\n\t\t&& no_reason)\n\t{\n\t if (anyBufIsChanged())\n\t\tmsg(_(\"Type :qa! and press <Enter> to abandon all changes and exit Vim\"));\n\t else\n\t\tmsg(_(\"Type :qa and press <Enter> to exit Vim\"));\n\t}",
"\t// Don't reset \"restart_edit\" when 'insertmode' is set, it won't be\n\t// set again below when halfway a mapping.\n\tif (!p_im)\n\t restart_edit = 0;\n#ifdef FEAT_CMDWIN\n\tif (cmdwin_type != 0)\n\t{\n\t cmdwin_result = K_IGNORE;\n\t got_int = FALSE;\t// don't stop executing autocommands et al.\n\t return;\n\t}\n#endif\n }\n#ifdef FEAT_CMDWIN\n else if (cmdwin_type != 0 && ex_normal_busy)\n {\n\t// When :normal runs out of characters while in the command line window\n\t// vgetorpeek() will return ESC. Exit the cmdline window to break the\n\t// loop.\n\tcmdwin_result = K_IGNORE;\n\treturn;\n }\n#endif",
" if (VIsual_active)\n {\n\tend_visual_mode();\t// stop Visual\n\tcheck_cursor_col();\t// make sure cursor is not beyond EOL\n\tcurwin->w_set_curswant = TRUE;\n\tredraw_curbuf_later(INVERTED);\n }\n else if (no_reason)\n\tvim_beep(BO_ESC);\n clearop(cap->oap);",
" // A CTRL-C is often used at the start of a menu. When 'insertmode' is\n // set return to Insert mode afterwards.\n if (restart_edit == 0 && goto_im() && ex_normal_busy == 0)\n\trestart_edit = 'a';\n}",
"/*\n * Move the cursor for the \"A\" command.\n */\n void\nset_cursor_for_append_to_line(void)\n{\n curwin->w_set_curswant = TRUE;\n if (get_ve_flags() == VE_ALL)\n {\n\tint save_State = State;",
"\t// Pretend Insert mode here to allow the cursor on the\n\t// character past the end of the line\n\tState = MODE_INSERT;\n\tcoladvance((colnr_T)MAXCOL);\n\tState = save_State;\n }\n else\n\tcurwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor());\n}",
"/*\n * Handle \"A\", \"a\", \"I\", \"i\" and <Insert> commands.\n * Also handle K_PS, start bracketed paste.\n */\n static void\nnv_edit(cmdarg_T *cap)\n{\n // <Insert> is equal to \"i\"\n if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS)\n\tcap->cmdchar = 'i';",
" // in Visual mode \"A\" and \"I\" are an operator\n if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I'))\n {\n#ifdef FEAT_TERMINAL\n\tif (term_in_normal_mode())\n\t{\n\t end_visual_mode();\n\t clearop(cap->oap);\n\t term_enter_job_mode();\n\t return;\n\t}\n#endif\n\tv_visop(cap);\n }",
" // in Visual mode and after an operator \"a\" and \"i\" are for text objects\n else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i')\n\t && (cap->oap->op_type != OP_NOP || VIsual_active))\n {\n#ifdef FEAT_TEXTOBJ\n\tnv_object(cap);\n#else\n\tclearopbeep(cap->oap);\n#endif\n }\n#ifdef FEAT_TERMINAL\n else if (term_in_normal_mode())\n {\n\tclearop(cap->oap);\n\tterm_enter_job_mode();\n\treturn;\n }\n#endif\n else if (!curbuf->b_p_ma && !p_im)\n {\n\t// Only give this error when 'insertmode' is off.\n\temsg(_(e_cannot_make_changes_modifiable_is_off));\n\tclearop(cap->oap);\n\tif (cap->cmdchar == K_PS)\n\t // drop the pasted text\n\t bracketed_paste(PASTE_INSERT, TRUE, NULL);\n }\n else if (cap->cmdchar == K_PS && VIsual_active)\n {\n\tpos_T old_pos = curwin->w_cursor;\n\tpos_T old_visual = VIsual;\n\tint old_visual_mode = VIsual_mode;",
"\t// In Visual mode the selected text is deleted.\n\tif (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum)\n\t{\n\t shift_delete_registers();\n\t cap->oap->regname = '1';\n\t}\n\telse\n\t cap->oap->regname = '-';\n\tcap->cmdchar = 'd';\n\tcap->nchar = NUL;\n\tnv_operator(cap);\n\tdo_pending_operator(cap, 0, FALSE);\n\tcap->cmdchar = K_PS;",
"\tif (*ml_get_cursor() != NUL)\n\t{\n\t if (old_visual_mode == 'V')\n\t {\n\t\t// In linewise Visual mode insert before the beginning of the\n\t\t// next line.\n\t\t// When the last line in the buffer was deleted then create a\n\t\t// new line, otherwise there is not need to move cursor.\n\t\t// Detect this by checking if cursor moved above Visual area.\n\t\tif (curwin->w_cursor.lnum < old_pos.lnum\n\t\t\t\t&& curwin->w_cursor.lnum < old_visual.lnum)\n\t\t{\n\t\t if (u_save_cursor() == OK)\n\t\t {\n\t\t\tml_append(curwin->w_cursor.lnum, (char_u *)\"\", 0,\n\t\t\t\t\t\t\t\t\tFALSE);\n\t\t\tappended_lines(curwin->w_cursor.lnum++, 1L);\n\t\t }\n\t\t}\n\t }\n\t // When the last char in the line was deleted then append.\n\t // Detect this by checking if cursor moved before Visual area.\n\t else if (curwin->w_cursor.col < old_pos.col\n\t\t\t\t&& curwin->w_cursor.col < old_visual.col)\n\t\tinc_cursor();\n\t}",
"\t// Insert to replace the deleted text with the pasted text.\n\tinvoke_edit(cap, FALSE, cap->cmdchar, FALSE);\n }\n else if (!checkclearopq(cap->oap))\n {\n\tswitch (cap->cmdchar)\n\t{\n\t case 'A':\t// \"A\"ppend after the line\n\t\tset_cursor_for_append_to_line();\n\t\tbreak;",
"\t case 'I':\t// \"I\"nsert before the first non-blank\n\t\tif (vim_strchr(p_cpo, CPO_INSEND) == NULL)\n\t\t beginline(BL_WHITE);\n\t\telse\n\t\t beginline(BL_WHITE|BL_FIX);\n\t\tbreak;",
"\t case K_PS:\n\t\t// Bracketed paste works like \"a\"ppend, unless the cursor is in\n\t\t// the first column, then it inserts.\n\t\tif (curwin->w_cursor.col == 0)\n\t\t break;\n\t\t// FALLTHROUGH",
"\t case 'a':\t// \"a\"ppend is like \"i\"nsert on the next character.\n\t\t// increment coladd when in virtual space, increment the\n\t\t// column otherwise, also to append after an unprintable char\n\t\tif (virtual_active()\n\t\t\t&& (curwin->w_cursor.coladd > 0\n\t\t\t || *ml_get_cursor() == NUL\n\t\t\t || *ml_get_cursor() == TAB))\n\t\t curwin->w_cursor.coladd++;\n\t\telse if (*ml_get_cursor() != NUL)\n\t\t inc_cursor();\n\t\tbreak;\n\t}",
"\tif (curwin->w_cursor.coladd && cap->cmdchar != 'A')\n\t{\n\t int save_State = State;",
"\t // Pretend Insert mode here to allow the cursor on the\n\t // character past the end of the line\n\t State = MODE_INSERT;\n\t coladvance(getviscol());\n\t State = save_State;\n\t}",
"\tinvoke_edit(cap, FALSE, cap->cmdchar, FALSE);\n }\n else if (cap->cmdchar == K_PS)\n\t// drop the pasted text\n\tbracketed_paste(PASTE_INSERT, TRUE, NULL);\n}",
"/*\n * Invoke edit() and take care of \"restart_edit\" and the return value.\n */\n static void\ninvoke_edit(\n cmdarg_T\t*cap,\n int\t\trepl,\t\t// \"r\" or \"gr\" command\n int\t\tcmd,\n int\t\tstartln)\n{\n int\t\trestart_edit_save = 0;",
" // Complicated: When the user types \"a<C-O>a\" we don't want to do Insert\n // mode recursively. But when doing \"a<C-O>.\" or \"a<C-O>rx\" we do allow\n // it.\n if (repl || !stuff_empty())\n\trestart_edit_save = restart_edit;\n else\n\trestart_edit_save = 0;",
" // Always reset \"restart_edit\", this is not a restarted edit.\n restart_edit = 0;",
" if (edit(cmd, startln, cap->count1))\n\tcap->retval |= CA_COMMAND_BUSY;",
" if (restart_edit == 0)\n\trestart_edit = restart_edit_save;\n}",
"#ifdef FEAT_TEXTOBJ\n/*\n * \"a\" or \"i\" while an operator is pending or in Visual mode: object motion.\n */\n static void\nnv_object(\n cmdarg_T\t*cap)\n{\n int\t\tflag;\n int\t\tinclude;\n char_u\t*mps_save;",
" if (cap->cmdchar == 'i')\n\tinclude = FALSE; // \"ix\" = inner object: exclude white space\n else\n\tinclude = TRUE;\t // \"ax\" = an object: include white space",
" // Make sure (), [], {} and <> are in 'matchpairs'\n mps_save = curbuf->b_p_mps;\n curbuf->b_p_mps = (char_u *)\"(:),{:},[:],<:>\";",
" switch (cap->nchar)\n {\n\tcase 'w': // \"aw\" = a word\n\t\tflag = current_word(cap->oap, cap->count1, include, FALSE);\n\t\tbreak;\n\tcase 'W': // \"aW\" = a WORD\n\t\tflag = current_word(cap->oap, cap->count1, include, TRUE);\n\t\tbreak;\n\tcase 'b': // \"ab\" = a braces block\n\tcase '(':\n\tcase ')':\n\t\tflag = current_block(cap->oap, cap->count1, include, '(', ')');\n\t\tbreak;\n\tcase 'B': // \"aB\" = a Brackets block\n\tcase '{':\n\tcase '}':\n\t\tflag = current_block(cap->oap, cap->count1, include, '{', '}');\n\t\tbreak;\n\tcase '[': // \"a[\" = a [] block\n\tcase ']':\n\t\tflag = current_block(cap->oap, cap->count1, include, '[', ']');\n\t\tbreak;\n\tcase '<': // \"a<\" = a <> block\n\tcase '>':\n\t\tflag = current_block(cap->oap, cap->count1, include, '<', '>');\n\t\tbreak;\n\tcase 't': // \"at\" = a tag block (xml and html)\n\t\t// Do not adjust oap->end in do_pending_operator()\n\t\t// otherwise there are different results for 'dit'\n\t\t// (note leading whitespace in last line):\n\t\t// 1) <b> 2) <b>\n\t\t// foobar foobar\n\t\t// </b> </b>\n\t\tcap->retval |= CA_NO_ADJ_OP_END;\n\t\tflag = current_tagblock(cap->oap, cap->count1, include);\n\t\tbreak;\n\tcase 'p': // \"ap\" = a paragraph\n\t\tflag = current_par(cap->oap, cap->count1, include, 'p');\n\t\tbreak;\n\tcase 's': // \"as\" = a sentence\n\t\tflag = current_sent(cap->oap, cap->count1, include);\n\t\tbreak;\n\tcase '\"': // \"a\"\" = a double quoted string\n\tcase '\\'': // \"a'\" = a single quoted string\n\tcase '`': // \"a`\" = a backtick quoted string\n\t\tflag = current_quote(cap->oap, cap->count1, include,\n\t\t\t\t\t\t\t\t cap->nchar);\n\t\tbreak;\n#if 0\t// TODO\n\tcase 'S': // \"aS\" = a section\n\tcase 'f': // \"af\" = a filename\n\tcase 'u': // \"au\" = a URL\n#endif\n\tdefault:\n\t\tflag = FAIL;\n\t\tbreak;\n }",
" curbuf->b_p_mps = mps_save;\n if (flag == FAIL)\n\tclearopbeep(cap->oap);\n adjust_cursor_col();\n curwin->w_set_curswant = TRUE;\n}\n#endif",
"/*\n * \"q\" command: Start/stop recording.\n * \"q:\", \"q/\", \"q?\": edit command-line in command-line window.\n */\n static void\nnv_record(cmdarg_T *cap)\n{\n if (cap->oap->op_type == OP_FORMAT)\n {\n\t// \"gqq\" is the same as \"gqgq\": format line\n\tcap->cmdchar = 'g';\n\tcap->nchar = 'q';\n\tnv_operator(cap);\n }\n else if (!checkclearop(cap->oap))\n {\n#ifdef FEAT_CMDWIN\n\tif (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?')\n\t{\n\t stuffcharReadbuff(cap->nchar);\n\t stuffcharReadbuff(K_CMDWIN);\n\t}\n\telse\n#endif\n\t // (stop) recording into a named register, unless executing a\n\t // register\n\t if (reg_executing == 0 && do_record(cap->nchar) == FAIL)\n\t\tclearopbeep(cap->oap);\n }\n}",
"/*\n * Handle the \"@r\" command.\n */\n static void\nnv_at(cmdarg_T *cap)\n{\n if (checkclearop(cap->oap))\n\treturn;\n#ifdef FEAT_EVAL\n if (cap->nchar == '=')\n {\n\tif (get_expr_register() == NUL)\n\t return;\n }\n#endif\n while (cap->count1-- && !got_int)\n {\n\tif (do_execreg(cap->nchar, FALSE, FALSE, FALSE) == FAIL)\n\t{\n\t clearopbeep(cap->oap);\n\t break;\n\t}\n\tline_breakcheck();\n }\n}",
"/*\n * Handle the CTRL-U and CTRL-D commands.\n */\n static void\nnv_halfpage(cmdarg_T *cap)\n{\n if ((cap->cmdchar == Ctrl_U && curwin->w_cursor.lnum == 1)\n\t || (cap->cmdchar == Ctrl_D\n\t\t&& curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count))\n\tclearopbeep(cap->oap);\n else if (!checkclearop(cap->oap))\n\thalfpage(cap->cmdchar == Ctrl_D, cap->count0);\n}",
"/*\n * Handle \"J\" or \"gJ\" command.\n */\n static void\nnv_join(cmdarg_T *cap)\n{\n if (VIsual_active)\t// join the visual lines\n\tnv_operator(cap);\n else if (!checkclearop(cap->oap))\n {\n\tif (cap->count0 <= 1)\n\t cap->count0 = 2;\t // default for join is two lines!\n\tif (curwin->w_cursor.lnum + cap->count0 - 1 >\n\t\t\t\t\t\t curbuf->b_ml.ml_line_count)\n\t{\n\t // can't join when on the last line\n\t if (cap->count0 <= 2)\n\t {\n\t\tclearopbeep(cap->oap);\n\t\treturn;\n\t }\n\t cap->count0 = curbuf->b_ml.ml_line_count\n\t\t\t\t\t\t - curwin->w_cursor.lnum + 1;\n\t}",
"\tprep_redo(cap->oap->regname, cap->count0,\n\t\t\t\t NUL, cap->cmdchar, NUL, NUL, cap->nchar);\n\t(void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);\n }\n}",
"/*\n * \"P\", \"gP\", \"p\" and \"gp\" commands.\n */\n static void\nnv_put(cmdarg_T *cap)\n{\n nv_put_opt(cap, FALSE);\n}",
"/*\n * \"P\", \"gP\", \"p\" and \"gp\" commands.\n * \"fix_indent\" is TRUE for \"[p\", \"[P\", \"]p\" and \"]P\".\n */\n static void\nnv_put_opt(cmdarg_T *cap, int fix_indent)\n{\n int\t\tregname = 0;\n void\t*reg1 = NULL, *reg2 = NULL;\n int\t\tempty = FALSE;\n int\t\twas_visual = FALSE;\n int\t\tdir;\n int\t\tflags = 0;\n int\t\tkeep_registers = FALSE;",
" if (cap->oap->op_type != OP_NOP)\n {\n#ifdef FEAT_DIFF\n\t// \"dp\" is \":diffput\"\n\tif (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p')\n\t{\n\t clearop(cap->oap);\n\t nv_diffgetput(TRUE, cap->opcount);\n\t}\n\telse\n#endif\n\tclearopbeep(cap->oap);\n }\n#ifdef FEAT_JOB_CHANNEL\n else if (bt_prompt(curbuf) && !prompt_curpos_editable())\n {\n\tclearopbeep(cap->oap);\n }\n#endif\n else\n {\n\tif (fix_indent)\n\t{\n\t dir = (cap->cmdchar == ']' && cap->nchar == 'p')\n\t\t\t\t\t\t\t ? FORWARD : BACKWARD;\n\t flags |= PUT_FIXINDENT;\n\t}\n\telse\n\t dir = (cap->cmdchar == 'P'\n\t\t || ((cap->cmdchar == 'g' || cap->cmdchar == 'z')\n\t\t\t&& cap->nchar == 'P')) ? BACKWARD : FORWARD;\n\tprep_redo_cmd(cap);\n\tif (cap->cmdchar == 'g')\n\t flags |= PUT_CURSEND;\n\telse if (cap->cmdchar == 'z')\n\t flags |= PUT_BLOCK_INNER;",
"\tif (VIsual_active)\n\t{\n\t // Putting in Visual mode: The put text replaces the selected\n\t // text. First delete the selected text, then put the new text.\n\t // Need to save and restore the registers that the delete\n\t // overwrites if the old contents is being put.\n\t was_visual = TRUE;\n\t regname = cap->oap->regname;\n\t keep_registers = cap->cmdchar == 'P';\n#ifdef FEAT_CLIPBOARD\n\t adjust_clip_reg(®name);\n#endif\n\t if (regname == 0 || regname == '\"'\n\t\t\t\t || VIM_ISDIGIT(regname) || regname == '-'\n#ifdef FEAT_CLIPBOARD\n\t\t || (clip_unnamed && (regname == '*' || regname == '+'))\n#endif",
"\t\t )\n\t {\n\t\t// The delete is going to overwrite the register we want to\n\t\t// put, save it first.\n\t\treg1 = get_register(regname, TRUE);\n\t }",
"\t // Now delete the selected text. Avoid messages here.\n\t cap->cmdchar = 'd';\n\t cap->nchar = NUL;\n\t cap->oap->regname = keep_registers ? '_' : NUL;\n\t ++msg_silent;\n\t nv_operator(cap);\n\t do_pending_operator(cap, 0, FALSE);\n\t empty = (curbuf->b_ml.ml_flags & ML_EMPTY);\n\t --msg_silent;",
"\t // delete PUT_LINE_BACKWARD;\n\t cap->oap->regname = regname;",
"\t if (reg1 != NULL)\n\t {\n\t\t// Delete probably changed the register we want to put, save\n\t\t// it first. Then put back what was there before the delete.\n\t\treg2 = get_register(regname, FALSE);\n\t\tput_register(regname, reg1);\n\t }",
"\t // When deleted a linewise Visual area, put the register as\n\t // lines to avoid it joined with the next line. When deletion was\n\t // characterwise, split a line when putting lines.\n\t if (VIsual_mode == 'V')\n\t\tflags |= PUT_LINE;\n\t else if (VIsual_mode == 'v')\n\t\tflags |= PUT_LINE_SPLIT;\n\t if (VIsual_mode == Ctrl_V && dir == FORWARD)\n\t\tflags |= PUT_LINE_FORWARD;\n\t dir = BACKWARD;\n\t if ((VIsual_mode != 'V'\n\t\t\t&& curwin->w_cursor.col < curbuf->b_op_start.col)\n\t\t || (VIsual_mode == 'V'\n\t\t\t&& curwin->w_cursor.lnum < curbuf->b_op_start.lnum))\n\t\t// cursor is at the end of the line or end of file, put\n\t\t// forward.\n\t\tdir = FORWARD;\n\t // May have been reset in do_put().\n\t VIsual_active = TRUE;\n\t}\n\tdo_put(cap->oap->regname, NULL, dir, cap->count1, flags);",
"\t// If a register was saved, put it back now.\n\tif (reg2 != NULL)\n\t put_register(regname, reg2);",
"\t// What to reselect with \"gv\"? Selecting the just put text seems to\n\t// be the most useful, since the original text was removed.\n\tif (was_visual)\n\t{\n\t curbuf->b_visual.vi_start = curbuf->b_op_start;\n\t curbuf->b_visual.vi_end = curbuf->b_op_end;\n\t // need to adjust cursor position\n\t if (*p_sel == 'e')\n\t\tinc(&curbuf->b_visual.vi_end);\n\t}",
"\t// When all lines were selected and deleted do_put() leaves an empty\n\t// line that needs to be deleted now.\n\tif (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL)\n\t{\n\t ml_delete_flags(curbuf->b_ml.ml_line_count, ML_DEL_MESSAGE);\n\t deleted_lines(curbuf->b_ml.ml_line_count + 1, 1);",
"\t // If the cursor was in that line, move it to the end of the last\n\t // line.\n\t if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t {\n\t\tcurwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t\tcoladvance((colnr_T)MAXCOL);\n\t }\n\t}\n\tauto_format(FALSE, TRUE);\n }\n}",
"/*\n * \"o\" and \"O\" commands.\n */\n static void\nnv_open(cmdarg_T *cap)\n{\n#ifdef FEAT_DIFF\n // \"do\" is \":diffget\"\n if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o')\n {\n\tclearop(cap->oap);\n\tnv_diffgetput(FALSE, cap->opcount);\n }\n else\n#endif\n if (VIsual_active) // switch start and end of visual\n\tv_swap_corners(cap->cmdchar);\n#ifdef FEAT_JOB_CHANNEL\n else if (bt_prompt(curbuf))\n\tclearopbeep(cap->oap);\n#endif\n else\n\tn_opencmd(cap);\n}",
"#ifdef FEAT_NETBEANS_INTG\n static void\nnv_nbcmd(cmdarg_T *cap)\n{\n netbeans_keycommand(cap->nchar);\n}\n#endif",
"#ifdef FEAT_DND\n static void\nnv_drop(cmdarg_T *cap UNUSED)\n{\n do_put('~', NULL, BACKWARD, 1L, PUT_CURSEND);\n}\n#endif",
"/*\n * Trigger CursorHold event.\n * When waiting for a character for 'updatetime' K_CURSORHOLD is put in the\n * input buffer. \"did_cursorhold\" is set to avoid retriggering.\n */\n static void\nnv_cursorhold(cmdarg_T *cap)\n{\n apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);\n did_cursorhold = TRUE;\n cap->retval |= CA_COMMAND_BUSY;\t// don't call edit() now\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [4474, 1400, 736], "buggy_code_start_loc": [4466, 1400, 736], "filenames": ["src/normal.c", "src/testdir/test_tagjump.vim", "src/version.c"], "fixing_code_end_loc": [4481, 1407, 739], "fixing_code_start_loc": [4467, 1401, 737], "message": "Use After Free in GitHub repository vim/vim prior to 8.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "C9328925-FDFF-4283-A085-666EB6616272", "versionEndExcluding": "8.2.5024", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*", "matchCriteriaId": "71E032AD-F827-4944-9699-BB1E6D4233FC", "versionEndExcluding": "13.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use After Free in GitHub repository vim/vim prior to 8.2."}, {"lang": "es", "value": "Un Uso de Memoria Previamente Liberada en el repositorio de GitHub vim/vim versiones anteriores a 8.2"}], "evaluatorComment": null, "id": "CVE-2022-1898", "lastModified": "2023-05-03T12:15:36.347", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-05-27T09:15:08.030", "references": [{"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/28"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/41"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/45aad635-c2f1-47ca-a4f9-db5b25979cea"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00014.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZSLFIKFYU5Y2KM5EJKQNYHWRUBDQ4GJ/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMFHBC5OQXDPV2SDYA2JUQGVCPYASTJB/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TYNK6SDCMOLQJOI3B4AOE66P2G2IH4ZM/"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/202208-32"}, {"source": "security@huntr.dev", "tags": null, "url": "https://security.gentoo.org/glsa/202305-16"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://support.apple.com/kb/HT213488"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, "type": "CWE-416"}
| 103
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"\" Tests for tagjump (tags and special searches)",
"source check.vim\nsource screendump.vim",
"\" SEGV occurs in older versions. (At least 7.4.1748 or older)\nfunc Test_ptag_with_notagstack()\n CheckFeature quickfix",
" set notagstack\n call assert_fails('ptag does_not_exist_tag_name', 'E433:')\n set tagstack&vim\nendfunc",
"func Test_ptjump()\n CheckFeature quickfix",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"one\\tXfile\\t1\",\n \\ \"three\\tXfile\\t3\",\n \\ \"two\\tXfile\\t2\"],\n \\ 'Xtags')\n call writefile(['one', 'two', 'three'], 'Xfile')",
" %bw!\n ptjump two\n call assert_equal(2, winnr())\n wincmd p\n call assert_equal(1, &previewwindow)\n call assert_equal('Xfile', expand(\"%:p:t\"))\n call assert_equal(2, line('.'))\n call assert_equal(2, winnr('$'))\n call assert_equal(1, winnr())\n close\n call setline(1, ['one', 'two', 'three'])\n exe \"normal 3G\\<C-W>g}\"\n call assert_equal(2, winnr())\n wincmd p\n call assert_equal(1, &previewwindow)\n call assert_equal('Xfile', expand(\"%:p:t\"))\n call assert_equal(3, line('.'))\n call assert_equal(2, winnr('$'))\n call assert_equal(1, winnr())\n close\n exe \"normal 3G5\\<C-W>\\<C-G>}\"\n wincmd p\n call assert_equal(5, winheight(0))\n close",
" call delete('Xtags')\n call delete('Xfile')\n set tags&\nendfunc",
"func Test_cancel_ptjump()\n CheckFeature quickfix",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"word\\tfile1\\tcmd1\",\n \\ \"word\\tfile2\\tcmd2\"],\n \\ 'Xtags')",
" only!\n call feedkeys(\":ptjump word\\<CR>\\<CR>\", \"xt\")\n help\n call assert_equal(2, winnr('$'))",
" call delete('Xtags')\n set tags&\n quit\nendfunc",
"func Test_static_tagjump()\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"one\\tXfile1\\t/^one/;\\\"\\tf\\tfile:\\tsignature:(void)\",\n \\ \"word\\tXfile2\\tcmd2\"],\n \\ 'Xtags')\n new Xfile1\n call setline(1, ['empty', 'one()', 'empty'])\n write\n tag one\n call assert_equal(2, line('.'))",
" bwipe!\n set tags&\n call delete('Xtags')\n call delete('Xfile1')\nendfunc",
"func Test_duplicate_tagjump()\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"thesame\\tXfile1\\t1;\\\"\\td\\tfile:\",\n \\ \"thesame\\tXfile1\\t2;\\\"\\td\\tfile:\",\n \\ \"thesame\\tXfile1\\t3;\\\"\\td\\tfile:\",\n \\ ],\n \\ 'Xtags')\n new Xfile1\n call setline(1, ['thesame one', 'thesame two', 'thesame three'])\n write\n tag thesame\n call assert_equal(1, line('.'))\n tnext\n call assert_equal(2, line('.'))\n tnext\n call assert_equal(3, line('.'))",
" bwipe!\n set tags&\n call delete('Xtags')\n call delete('Xfile1')\nendfunc",
"func Test_tagjump_switchbuf()\n CheckFeature quickfix",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"second\\tXfile1\\t2\",\n \\ \"third\\tXfile1\\t3\",],\n \\ 'Xtags')\n call writefile(['first', 'second', 'third'], 'Xfile1')",
" enew | only\n set switchbuf=\n stag second\n call assert_equal(2, winnr('$'))\n call assert_equal(2, line('.'))\n stag third\n call assert_equal(3, winnr('$'))\n call assert_equal(3, line('.'))",
" enew | only\n set switchbuf=useopen\n stag second\n call assert_equal(2, winnr('$'))\n call assert_equal(2, line('.'))\n stag third\n call assert_equal(2, winnr('$'))\n call assert_equal(3, line('.'))",
" enew | only\n set switchbuf=usetab\n tab stag second\n call assert_equal(2, tabpagenr('$'))\n call assert_equal(2, line('.'))\n 1tabnext | stag third\n call assert_equal(2, tabpagenr('$'))\n call assert_equal(3, line('.'))",
" tabclose!\n enew | only\n call delete('Xfile1')\n call delete('Xtags')\n set tags&\n set switchbuf&vim\nendfunc",
"\" Tests for [ CTRL-I and CTRL-W CTRL-I commands\nfunction Test_keyword_jump()\n call writefile([\"#include Xinclude\", \"\",\n\t \\ \"\",\n\t \\ \"/* test text test tex start here\",\n\t \\ \"\t\tsome text\",\n\t \\ \"\t\ttest text\",\n\t \\ \"\t\tstart OK if found this line\",\n\t \\ \"\tstart found wrong line\",\n\t \\ \"test text\"], 'Xtestfile')\n call writefile([\"/* test text test tex start here\",\n\t \\ \"\t\tsome text\",\n\t \\ \"\t\ttest text\",\n\t \\ \"\t\tstart OK if found this line\",\n\t \\ \"\tstart found wrong line\",\n\t \\ \"test text\"], 'Xinclude')\n new Xtestfile\n call cursor(1,1)\n call search(\"start\")\n exe \"normal! 5[\\<C-I>\"\n call assert_equal(\"\t\tstart OK if found this line\", getline('.'))\n call cursor(1,1)\n call search(\"start\")\n exe \"normal! 5\\<C-W>\\<C-I>\"\n call assert_equal(\"\t\tstart OK if found this line\", getline('.'))",
" \" invalid tag search pattern\n call assert_fails('tag /\\%(/', 'E426:')",
" enew! | only\n call delete('Xtestfile')\n call delete('Xinclude')\nendfunction",
"\" Test for jumping to a tag with 'hidden' set, with symbolic link in path of\n\" tag. This only works for Unix, because of the symbolic link.\nfunc Test_tag_symbolic()\n CheckUnix",
" set hidden\n call delete(\"Xtest.dir\", \"rf\")\n call system(\"ln -s . Xtest.dir\")\n \" Create a tags file with the current directory name inserted.\n call writefile([\n \\ \"SECTION_OFF\t\" . getcwd() . \"/Xtest.dir/Xtest.c\t/^#define SECTION_OFF 3$/\",\n \\ '',\n \\ ], 'Xtags')\n call writefile(['#define SECTION_OFF 3',\n \\ '#define NUM_SECTIONS 3'], 'Xtest.c')",
" \" Try jumping to a tag, but with a path that contains a symbolic link. When\n \" wrong, this will give the ATTENTION message. The next space will then be\n \" eaten by hit-return, instead of moving the cursor to 'd'.\n set tags=Xtags\n enew!\n call append(0, 'SECTION_OFF')\n call cursor(1,1)\n exe \"normal \\<C-]> \"\n call assert_equal('Xtest.c', expand('%:t'))\n call assert_equal(2, col('.'))",
" set hidden&\n set tags&\n enew!\n call delete('Xtags')\n call delete('Xtest.c')\n call delete(\"Xtest.dir\", \"rf\")\n %bwipe!\nendfunc",
"\" Tests for tag search with !_TAG_FILE_ENCODING.\nfunc Test_tag_file_encoding()\n if has('vms')\n throw 'Skipped: does not work on VMS'\n endif",
" if !has('iconv') || iconv(\"\\x82\\x60\", \"cp932\", \"utf-8\") != \"\\uff21\"\n throw 'Skipped: iconv does not work'\n endif",
" let save_enc = &encoding\n set encoding=utf8",
" let content = ['text for tags1', 'abcdefghijklmnopqrs']\n call writefile(content, 'Xtags1.txt')\n let content = ['text for tags2', 'ABC']\n call writefile(content, 'Xtags2.txt')\n let content = ['text for tags3', 'ABC']\n call writefile(content, 'Xtags3.txt')\n let content = ['!_TAG_FILE_ENCODING\tutf-8\t//', 'abcdefghijklmnopqrs\tXtags1.txt\t/abcdefghijklmnopqrs']\n call writefile(content, 'Xtags1')",
" \" case1:\n new\n set tags=Xtags1\n tag abcdefghijklmnopqrs\n call assert_equal('Xtags1.txt', expand('%:t'))\n call assert_equal('abcdefghijklmnopqrs', getline('.'))\n close",
" \" case2:\n new\n let content = ['!_TAG_FILE_ENCODING\tcp932\t//',\n \\ \"\\x82`\\x82a\\x82b\tXtags2.txt\t/\\x82`\\x82a\\x82b\"]\n call writefile(content, 'Xtags')\n set tags=Xtags\n tag /.BC\n call assert_equal('Xtags2.txt', expand('%:t'))\n call assert_equal('ABC', getline('.'))\n call delete('Xtags')\n close",
" \" case3:\n new\n let contents = [\n \\ \"!_TAG_FILE_SORTED\t1\t//\",\n \\ \"!_TAG_FILE_ENCODING\tcp932\t//\"]\n for i in range(1, 100)\n call add(contents, 'abc' .. i\n \\ .. \"\tXtags3.txt\t/\\x82`\\x82a\\x82b\")\n endfor\n call writefile(contents, 'Xtags')\n set tags=Xtags\n tag abc50\n call assert_equal('Xtags3.txt', expand('%:t'))\n call assert_equal('ABC', getline('.'))\n call delete('Xtags')\n close",
" set tags&\n let &encoding = save_enc\n call delete('Xtags1.txt')\n call delete('Xtags2.txt')\n call delete('Xtags3.txt')\n call delete('Xtags1')\nendfunc",
"\" Test for emacs-style tags file (TAGS)\nfunc Test_tagjump_etags()\n CheckFeature emacs_tags",
" call writefile([\n \\ \"void foo() {}\",\n \\ \"int main(int argc, char **argv)\",\n \\ \"{\",\n \\ \"\\tfoo();\",\n \\ \"\\treturn 0;\",\n \\ \"}\",\n \\ ], 'Xmain.c')",
" call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x011,0\",\n \\ \"int main(int argc, char **argv)\\x7fmain\\x012,14\",\n\t\\ ], 'Xtags')\n set tags=Xtags\n ta foo\n call assert_equal('void foo() {}', getline('.'))",
" \" Test for including another tags file\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x011,0\",\n \\ \"\\x0c\",\n \\ \"Xnonexisting,include\",\n \\ \"\\x0c\",\n \\ \"Xtags2,include\"\n \\ ], 'Xtags')\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"int main(int argc, char **argv)\\x7fmain\\x012,14\",\n \\ ], 'Xtags2')\n tag main\n call assert_equal(2, line('.'))\n call assert_fails('tag bar', 'E426:')",
" \" corrupted tag line\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,8\",\n \\ \"int main\"\n \\ ], 'Xtags', 'b')\n call assert_fails('tag foo', 'E426:')",
" \" invalid line number\n call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x0abc,0\",\n\t\\ ], 'Xtags')\n call assert_fails('tag foo', 'E426:')",
" \" invalid tag name\n call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \";;;;\\x7f1,0\",\n\t\\ ], 'Xtags')\n call assert_fails('tag foo', 'E431:')",
" \" end of file after a CTRL-L line\n call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x011,0\",\n\t\\ \"\\x0c\",\n\t\\ ], 'Xtags')\n call assert_fails('tag main', 'E426:')",
" \" error in an included tags file\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xtags2,include\"\n \\ ], 'Xtags')\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\",\n \\ ], 'Xtags2')\n call assert_fails('tag foo', 'E431:')",
" call delete('Xtags')\n call delete('Xtags2')\n call delete('Xmain.c')\n set tags&\n bwipe!\nendfunc",
"\" Test for getting and modifying the tag stack\nfunc Test_getsettagstack()\n call writefile(['line1', 'line2', 'line3'], 'Xfile1')\n call writefile(['line1', 'line2', 'line3'], 'Xfile2')\n call writefile(['line1', 'line2', 'line3'], 'Xfile3')",
" enew | only\n call settagstack(1, {'items' : []})\n call assert_equal(0, gettagstack(1).length)\n call assert_equal([], 1->gettagstack().items)\n \" Error cases\n call assert_equal({}, gettagstack(100))\n call assert_equal(-1, settagstack(100, {'items' : []}))\n call assert_fails('call settagstack(1, [1, 10])', 'E715:')\n call assert_fails(\"call settagstack(1, {'items' : 10})\", 'E714:')\n call assert_fails(\"call settagstack(1, {'items' : []}, 10)\", 'E928:')\n call assert_fails(\"call settagstack(1, {'items' : []}, 'b')\", 'E962:')\n call assert_equal(-1, settagstack(0, test_null_dict()))",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"one\\tXfile1\\t1\",\n \\ \"three\\tXfile3\\t3\",\n \\ \"two\\tXfile2\\t2\"],\n \\ 'Xtags')",
" let stk = []\n call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one',\n\t\\ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})\n tag one\n call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'two',\n\t\\ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})\n tag two\n call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'three',\n\t\\ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})\n tag three\n call assert_equal(3, gettagstack(1).length)\n call assert_equal(stk, gettagstack(1).items)\n \" Check for default - current window\n call assert_equal(3, gettagstack().length)\n call assert_equal(stk, gettagstack().items)",
" \" Try to set current index to invalid values\n call settagstack(1, {'curidx' : -1})\n call assert_equal(1, gettagstack().curidx)\n eval {'curidx' : 50}->settagstack(1)\n call assert_equal(4, gettagstack().curidx)",
" \" Try pushing invalid items onto the stack\n call settagstack(1, {'items' : []})\n call settagstack(1, {'items' : [\"plate\"]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)\n call settagstack(1, {'items' : [{\"tagname\" : \"abc\"}]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)\n call settagstack(1, {'items' : [{\"from\" : 100}]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)\n call settagstack(1, {'items' : [{\"from\" : [2, 1, 0, 0]}]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)",
" \" Push one item at a time to the stack\n call settagstack(1, {'items' : []})\n call settagstack(1, {'items' : [stk[0]]}, 'a')\n call settagstack(1, {'items' : [stk[1]]}, 'a')\n call settagstack(1, {'items' : [stk[2]]}, 'a')\n call settagstack(1, {'curidx' : 4})\n call assert_equal({'length' : 3, 'curidx' : 4, 'items' : stk},\n \\ gettagstack(1))",
" \" Try pushing items onto a full stack\n for i in range(7)\n call settagstack(1, {'items' : stk}, 'a')\n endfor\n call assert_equal(20, gettagstack().length)\n call settagstack(1,\n \\ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 'a')\n call assert_equal('abc', gettagstack().items[19].tagname)",
" \" truncate the tag stack\n call settagstack(1,\n \\ {'curidx' : 9,\n \\ 'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')\n let t = gettagstack()\n call assert_equal(9, t.length)\n call assert_equal(10, t.curidx)",
" \" truncate the tag stack without pushing any new items\n call settagstack(1, {'curidx' : 5}, 't')\n let t = gettagstack()\n call assert_equal(4, t.length)\n call assert_equal(5, t.curidx)",
" \" truncate an empty tag stack and push new items\n call settagstack(1, {'items' : []})\n call settagstack(1,\n \\ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')\n let t = gettagstack()\n call assert_equal(1, t.length)\n call assert_equal(2, t.curidx)",
" \" Tag with multiple matches\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"two\\tXfile1\\t1\",\n \\ \"two\\tXfile2\\t3\",\n \\ \"two\\tXfile3\\t2\"],\n \\ 'Xtags')\n call settagstack(1, {'items' : []})\n tag two\n tnext\n tnext\n call assert_equal(1, gettagstack().length)\n call assert_equal(3, gettagstack().items[0].matchnr)",
" \" Memory allocation failures\n call test_alloc_fail(GetAllocId('tagstack_items'), 0, 0)\n call assert_fails('call gettagstack()', 'E342:')\n call test_alloc_fail(GetAllocId('tagstack_from'), 0, 0)\n call assert_fails('call gettagstack()', 'E342:')\n call test_alloc_fail(GetAllocId('tagstack_details'), 0, 0)\n call assert_fails('call gettagstack()', 'E342:')",
" call settagstack(1, {'items' : []})\n call delete('Xfile1')\n call delete('Xfile2')\n call delete('Xfile3')\n call delete('Xtags')\n set tags&\nendfunc",
"func Test_tag_with_count()\n call writefile([\n\t\\ 'test\tXtest.h\t/^void test();$/;\"\tp\ttyperef:typename:void\tsignature:()',\n\t\\ ], 'Xtags')\n call writefile([\n\t\\ 'main\tXtest.c\t/^int main()$/;\"\tf\ttyperef:typename:int\tsignature:()',\n\t\\ 'test\tXtest.c\t/^void test()$/;\"\tf\ttyperef:typename:void\tsignature:()',\n\t\\ ], 'Ytags')\n cal writefile([\n\t\\ 'int main()',\n\t\\ 'void test()',\n\t\\ ], 'Xtest.c')\n cal writefile([\n\t\\ 'void test();',\n\t\\ ], 'Xtest.h')\n set tags=Xtags,Ytags",
" new Xtest.c\n let tl = taglist('test', 'Xtest.c')\n call assert_equal(tl[0].filename, 'Xtest.c')\n call assert_equal(tl[1].filename, 'Xtest.h')",
" tag test\n call assert_equal(bufname('%'), 'Xtest.c')\n 1tag test\n call assert_equal(bufname('%'), 'Xtest.c')\n 2tag test\n call assert_equal(bufname('%'), 'Xtest.h')",
" set tags&\n call delete('Xtags')\n call delete('Ytags')\n bwipe Xtest.h\n bwipe Xtest.c\n call delete('Xtest.h')\n call delete('Xtest.c')\nendfunc",
"func Test_tagnr_recall()\n call writefile([\n\t\\ 'test\tXtest.h\t/^void test();$/;\"\tp',\n\t\\ 'main\tXtest.c\t/^int main()$/;\"\tf',\n\t\\ 'test\tXtest.c\t/^void test()$/;\"\tf',\n\t\\ ], 'Xtags')\n cal writefile([\n\t\\ 'int main()',\n\t\\ 'void test()',\n\t\\ ], 'Xtest.c')\n cal writefile([\n\t\\ 'void test();',\n\t\\ ], 'Xtest.h')\n set tags=Xtags",
" new Xtest.c\n let tl = taglist('test', 'Xtest.c')\n call assert_equal(tl[0].filename, 'Xtest.c')\n call assert_equal(tl[1].filename, 'Xtest.h')",
" 2tag test\n call assert_equal(bufname('%'), 'Xtest.h')\n pop\n call assert_equal(bufname('%'), 'Xtest.c')\n tag\n call assert_equal(bufname('%'), 'Xtest.h')",
" set tags&\n call delete('Xtags')\n bwipe Xtest.h\n bwipe Xtest.c\n call delete('Xtest.h')\n call delete('Xtest.c')\nendfunc",
"func Test_tag_line_toolong()\n call writefile([\n\t\\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678\tdjango/contrib/admin/templates/admin/edit_inline/stacked.html\t16;\"\tj\tline:16\tlanguage:HTML'\n\t\\ ], 'Xtags')\n set tags=Xtags\n let old_vbs = &verbose\n set verbose=5\n \" \":tjump\" should give \"tag not found\" not \"Format error in tags file\"\n call assert_fails('tj /foo', 'E426:')\n try\n tj /foo\n catch /^Vim\\%((\\a\\+)\\)\\=:E431/\n call assert_report(v:exception)\n catch /.*/\n endtry\n call assert_equal('Searching tags file Xtags', split(execute('messages'), '\\n')[-1])",
" call writefile([\n\t\\ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\tdjango/contrib/admin/templates/admin/edit_inline/stacked.html\t16;\"\tj\tline:16\tlanguage:HTML'\n\t\\ ], 'Xtags')\n call assert_fails('tj /foo', 'E426:')\n try\n tj /foo\n catch /^Vim\\%((\\a\\+)\\)\\=:E431/\n call assert_report(v:exception)\n catch /.*/\n endtry\n call assert_equal('Searching tags file Xtags', split(execute('messages'), '\\n')[-1])",
" \" binary search works in file with long line\n call writefile([\n \\ 'asdfasfd\tnowhere\t16',\n\t\\ 'foobar\tXsomewhere\t3; \" 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567',\n \\ 'zasdfasfd\tnowhere\t16',\n\t\\ ], 'Xtags')\n call writefile([\n \\ 'one',\n \\ 'two',\n \\ 'trhee',\n \\ 'four',\n \\ ], 'Xsomewhere')\n tag foobar\n call assert_equal('Xsomewhere', expand('%'))\n call assert_equal(3, getcurpos()[1])",
" \" expansion on command line works with long lines when &wildoptions contains\n \" 'tagfile'\n set wildoptions=tagfile\n call writefile([\n\t\\ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\tfile\t/^pattern$/;\"\tf'\n\t\\ ], 'Xtags')\n call feedkeys(\":tag \\<Tab>\", 'tx')\n \" Should not crash\n call assert_true(v:true)",
" call delete('Xtags')\n call delete('Xsomewhere')\n set tags&\n let &verbose = old_vbs\nendfunc",
"\" Check that using :tselect does not run into the hit-enter prompt.\n\" Requires a terminal to trigger that prompt.\nfunc Test_tselect()\n CheckScreendump",
" call writefile([\n\t\\ 'main\tXtest.h\t/^void test();$/;\"\tf',\n\t\\ 'main\tXtest.c\t/^int main()$/;\"\tf',\n\t\\ 'main\tXtest.x\t/^void test()$/;\"\tf',\n\t\\ ], 'Xtags')\n cal writefile([\n\t\\ 'int main()',\n\t\\ 'void test()',\n\t\\ ], 'Xtest.c')",
" let lines =<< trim [SCRIPT]\n set tags=Xtags\n [SCRIPT]\n call writefile(lines, 'XTest_tselect')\n let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})",
" call TermWait(buf, 50)\n call term_sendkeys(buf, \":tselect main\\<CR>2\\<CR>\")\n call VerifyScreenDump(buf, 'Test_tselect_1', {})",
" call StopVimInTerminal(buf)\n call delete('Xtags')\n call delete('Xtest.c')\n call delete('XTest_tselect')\nendfunc",
"func Test_tagline()\n call writefile([\n\t\\ 'provision\tXtest.py\t/^ def provision(self, **kwargs):$/;\"\tm\tline:1\tlanguage:Python class:Foo',\n\t\\ 'provision\tXtest.py\t/^ def provision(self, **kwargs):$/;\"\tm\tline:3\tlanguage:Python class:Bar',\n\t\\], 'Xtags')\n call writefile([\n\t\\ ' def provision(self, **kwargs):',\n\t\\ ' pass',\n\t\\ ' def provision(self, **kwargs):',\n\t\\ ' pass',\n\t\\], 'Xtest.py')",
" set tags=Xtags",
" 1tag provision\n call assert_equal(line('.'), 1)\n 2tag provision\n call assert_equal(line('.'), 3)",
" call delete('Xtags')\n call delete('Xtest.py')\n set tags&\nendfunc",
"\" Test for expanding environment variable in a tag file name\nfunc Test_tag_envvar()\n call writefile([\"Func1\\t$FOO\\t/^Func1/\"], 'Xtags')\n set tags=Xtags",
" let $FOO='TagTestEnv'",
" let caught_exception = v:false\n try\n tag Func1\n catch /E429:/\n call assert_match('E429:.*\"TagTestEnv\".*', v:exception)\n let caught_exception = v:true\n endtry\n call assert_true(caught_exception)",
" set tags&\n call delete('Xtags')\n unlet $FOO\nendfunc",
"\" Test for :ptag\nfunc Test_tag_preview()\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"second\\tXfile1\\t2\",\n \\ \"third\\tXfile1\\t3\",],\n \\ 'Xtags')\n set tags=Xtags\n call writefile(['first', 'second', 'third'], 'Xfile1')",
" enew | only\n ptag third\n call assert_equal(2, winnr())\n call assert_equal(2, winnr('$'))\n call assert_equal(1, getwinvar(1, '&previewwindow'))\n call assert_equal(0, getwinvar(2, '&previewwindow'))\n wincmd P\n call assert_equal(3, line('.'))",
" \" jump to the tag again\n wincmd w\n ptag third\n wincmd P\n call assert_equal(3, line('.'))",
" \" jump to the newer tag\n wincmd w\n ptag\n wincmd P\n call assert_equal(3, line('.'))",
" \" close the preview window\n pclose\n call assert_equal(1, winnr('$'))",
" call delete('Xfile1')\n call delete('Xtags')\n set tags&\nendfunc",
"\" Tests for guessing the tag location\nfunc Test_tag_guess()\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"func1\\tXfoo\\t/^int func1(int x)/\",\n \\ \"func2\\tXfoo\\t/^int func2(int y)/\",\n \\ \"func3\\tXfoo\\t/^func3/\",\n \\ \"func4\\tXfoo\\t/^func4/\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]",
" int FUNC1 (int x) { }\n int \n func2 (int y) { }\n int * func3 () { }",
" [CODE]\n call writefile(code, 'Xfoo')",
" let v:statusmsg = ''\n ta func1\n call assert_match('E435:', v:statusmsg)\n call assert_equal(2, line('.'))\n let v:statusmsg = ''\n ta func2\n call assert_match('E435:', v:statusmsg)\n call assert_equal(4, line('.'))\n let v:statusmsg = ''\n ta func3\n call assert_match('E435:', v:statusmsg)\n call assert_equal(5, line('.'))\n call assert_fails('ta func4', 'E434:')",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\nendfunc",
"\" Test for an unsorted tags file\nfunc Test_tag_sort()\n let l = [\n \\ \"first\\tXfoo\\t1\",\n \\ \"ten\\tXfoo\\t3\",\n \\ \"six\\tXfoo\\t2\"]\n call writefile(l, 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int six() {}\n int ten() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" call assert_fails('tag first', 'E432:')",
" \" When multiple tag files are not sorted, then message should be displayed\n \" multiple times\n call writefile(l, 'Xtags2')\n set tags=Xtags,Xtags2\n call assert_fails('tag first', ['E432:', 'E432:'])",
" call delete('Xtags')\n call delete('Xtags2')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for an unsorted tags file\nfunc Test_tag_fold()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t2\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"second\\tXfoo\\t2\",\n \\ \"third\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n tag second\n call assert_equal('Xfoo', bufname(''))\n call assert_equal(2, line('.'))",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for the :ltag command\nfunc Test_ltag()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"second\\tXfoo\\t/^int second() {}$/\",\n \\ \"third\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n call setloclist(0, [], 'f')\n ltag third\n call assert_equal('Xfoo', bufname(''))\n call assert_equal(3, line('.'))\n call assert_equal([{'lnum': 3, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'),\n \\ 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0,\n \\ 'nr': 0, 'type': '', 'module': '', 'text': 'third'}], getloclist(0))",
" ltag second\n call assert_equal(2, line('.'))\n call assert_equal([{'lnum': 0, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'),\n \\ 'col': 0, 'end_col': 0, 'pattern': '^\\Vint second() {}\\$',\n \\ 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'module': '',\n \\ 'text': 'second'}], getloclist(0))",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for setting the last search pattern to the tag search pattern\n\" when cpoptions has 't'\nfunc Test_tag_last_search_pat()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t/^int first() {}/\",\n \\ \"second\\tXfoo\\t/^int second() {}/\",\n \\ \"third\\tXfoo\\t/^int third() {}/\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n let save_cpo = &cpo\n set cpo+=t\n let @/ = ''\n tag second\n call assert_equal('^int second() {}', @/)\n let &cpo = save_cpo",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Tag stack tests\nfunc Test_tag_stack()\n let l = []\n for i in range(10, 31)\n let l += [\"var\" .. i .. \"\\tXfoo\\t/^int var\" .. i .. \";$/\"]\n endfor\n call writefile(l, 'Xtags')\n set tags=Xtags",
" let l = []\n for i in range(10, 31)\n let l += [\"int var\" .. i .. \";\"]\n endfor\n call writefile(l, 'Xfoo')",
" \" Jump to a tag when the tag stack is full. Oldest entry should be removed.\n enew\n for i in range(10, 30)\n exe \"tag var\" .. i\n endfor\n let l = gettagstack()\n call assert_equal(20, l.length)\n call assert_equal('var11', l.items[0].tagname)\n tag var31\n let l = gettagstack()\n call assert_equal('var12', l.items[0].tagname)\n call assert_equal('var31', l.items[19].tagname)",
" \" Use tnext with a single match\n call assert_fails('tnext', 'E427:')",
" \" Jump to newest entry from the top of the stack\n call assert_fails('tag', 'E556:')",
" \" Pop with zero count from the top of the stack\n call assert_fails('0pop', 'E556:')",
" \" Pop from an unsaved buffer\n enew!\n call append(1, \"sample text\")\n call assert_fails('pop', 'E37:')\n call assert_equal(21, gettagstack().curidx)\n enew!",
" \" Pop all the entries in the tag stack\n call assert_fails('30pop', 'E555:')",
" \" Pop with a count when already at the bottom of the stack\n call assert_fails('exe \"normal 4\\<C-T>\"', 'E555:')\n call assert_equal(1, gettagstack().curidx)",
" \" Jump to newest entry from the bottom of the stack with zero count\n call assert_fails('0tag', 'E555:')",
" \" Pop the tag stack when it is empty\n call settagstack(1, {'items' : []})\n call assert_fails('pop', 'E73:')",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for browsing multiple matching tags\nfunc Test_tag_multimatch()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"first\\tXfoo\\t2\",\n \\ \"first\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int first() {}\n int first() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" call settagstack(1, {'items' : []})\n tag first\n tlast\n call assert_equal(3, line('.'))\n call assert_fails('tnext', 'E428:')\n tfirst\n call assert_equal(1, line('.'))\n call assert_fails('tprev', 'E425:')",
" tlast\n call feedkeys(\"5\\<CR>\", 't')\n tselect first\n call assert_equal(2, gettagstack().curidx)",
" set ignorecase\n tag FIRST\n tnext\n call assert_equal(2, line('.'))\n tlast\n tprev\n call assert_equal(2, line('.'))\n tNext\n call assert_equal(1, line('.'))\n set ignorecase&",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for previewing multiple matching tags\nfunc Test_preview_tag_multimatch()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"first\\tXfoo\\t2\",\n \\ \"first\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int first() {}\n int first() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew | only\n ptag first\n ptlast\n wincmd P\n call assert_equal(3, line('.'))\n wincmd w\n call assert_fails('ptnext', 'E428:')\n ptprev\n wincmd P\n call assert_equal(2, line('.'))\n wincmd w\n ptfirst\n wincmd P\n call assert_equal(1, line('.'))\n wincmd w\n call assert_fails('ptprev', 'E425:')\n ptnext\n wincmd P\n call assert_equal(2, line('.'))\n wincmd w\n ptlast\n call feedkeys(\"5\\<CR>\", 't')\n ptselect first\n wincmd P\n call assert_equal(3, line('.'))",
" pclose",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for jumping to multiple matching tags across multiple :tags commands\nfunc Test_tnext_multimatch()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo1\\t1\",\n \\ \"first\\tXfoo2\\t1\",\n \\ \"first\\tXfoo3\\t1\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n [CODE]\n call writefile(code, 'Xfoo1')\n call writefile(code, 'Xfoo2')\n call writefile(code, 'Xfoo3')",
" tag first\n tag first\n pop\n tnext\n tnext\n call assert_fails('tnext', 'E428:')",
" call delete('Xtags')\n call delete('Xfoo1')\n call delete('Xfoo2')\n call delete('Xfoo3')\n set tags&\n %bwipe\nendfunc",
"\" Test for jumping to multiple matching tags in non-existing files\nfunc Test_multimatch_non_existing_files()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo1\\t1\",\n \\ \"first\\tXfoo2\\t1\",\n \\ \"first\\tXfoo3\\t1\"],\n \\ 'Xtags')\n set tags=Xtags",
" call settagstack(1, {'items' : []})\n call assert_fails('tag first', 'E429:')\n call assert_equal(3, gettagstack().items[0].matchnr)",
" call delete('Xtags')\n set tags&\n %bwipe\nendfunc",
"func Test_tselect_listing()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\" .. ';\"' .. \"\\tv\\ttyperef:typename:int\\tfile:\",\n \\ \"first\\tXfoo\\t2\" .. ';\"' .. \"\\tkind:v\\ttyperef:typename:char\\tfile:\"],\n \\ 'Xtags')\n set tags=Xtags",
" let code =<< trim [CODE]\n static int first;\n static char first;\n [CODE]\n call writefile(code, 'Xfoo')",
" call feedkeys(\"\\<CR>\", \"t\")\n let l = split(execute(\"tselect first\"), \"\\n\")\n let expected =<< [DATA]\n # pri kind tag file\n 1 FS v first Xfoo\n typeref:typename:int \n 1\n 2 FS v first Xfoo\n typeref:typename:char \n 2\nType number and <Enter> (q or empty cancels): \n[DATA]\n call assert_equal(expected, l)",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for :isearch, :ilist, :ijump and :isplit commands\n\" Test for [i, ]i, [I, ]I, [ CTRL-I, ] CTRL-I and CTRL-W i commands\nfunc Test_inc_search()\n new\n call setline(1, ['1:foo', '2:foo', 'foo', '3:foo', '4:foo', '==='])\n call cursor(3, 1)",
" \" Test for [i and ]i\n call assert_equal('1:foo', execute('normal [i'))\n call assert_equal('2:foo', execute('normal 2[i'))\n call assert_fails('normal 3[i', 'E387:')\n call assert_equal('3:foo', execute('normal ]i'))\n call assert_equal('4:foo', execute('normal 2]i'))\n call assert_fails('normal 3]i', 'E389:')\n call assert_fails('normal G]i', 'E349:')\n call assert_fails('normal [i', 'E349:')\n call cursor(3, 1)",
" \" Test for :isearch\n call assert_equal('1:foo', execute('isearch foo'))\n call assert_equal('3:foo', execute('isearch 4 /foo/'))\n call assert_fails('isearch 3 foo', 'E387:')\n call assert_equal('3:foo', execute('+1,$isearch foo'))\n call assert_fails('1,.-1isearch 3 foo', 'E389:')\n call assert_fails('isearch bar', 'E389:')\n call assert_fails('isearch /foo/3', 'E488:')",
" \" Test for [I and ]I\n call assert_equal([\n \\ ' 1: 1 1:foo',\n \\ ' 2: 2 2:foo',\n \\ ' 3: 3 foo',\n \\ ' 4: 4 3:foo',\n \\ ' 5: 5 4:foo'], split(execute('normal [I'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 3:foo',\n \\ ' 2: 5 4:foo'], split(execute('normal ]I'), \"\\n\"))\n call assert_fails('normal G]I', 'E349:')\n call assert_fails('normal [I', 'E349:')\n call cursor(3, 1)",
" \" Test for :ilist\n call assert_equal([\n \\ ' 1: 1 1:foo',\n \\ ' 2: 2 2:foo',\n \\ ' 3: 3 foo',\n \\ ' 4: 4 3:foo',\n \\ ' 5: 5 4:foo'], split(execute('ilist foo'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 3:foo',\n \\ ' 2: 5 4:foo'], split(execute('+1,$ilist /foo/'), \"\\n\"))\n call assert_fails('ilist bar', 'E389:')",
" \" Test for [ CTRL-I and ] CTRL-I\n exe \"normal [\\t\"\n call assert_equal([1, 3], [line('.'), col('.')])\n exe \"normal 2j4[\\t\"\n call assert_equal([4, 3], [line('.'), col('.')])\n call assert_fails(\"normal k3[\\t\", 'E387:')\n call assert_fails(\"normal 6[\\t\", 'E389:')\n exe \"normal ]\\t\"\n call assert_equal([4, 3], [line('.'), col('.')])\n exe \"normal k2]\\t\"\n call assert_equal([5, 3], [line('.'), col('.')])\n call assert_fails(\"normal 2k3]\\t\", 'E389:')\n call assert_fails(\"normal G[\\t\", 'E349:')\n call assert_fails(\"normal ]\\t\", 'E349:')\n call cursor(3, 1)",
" \" Test for :ijump\n call cursor(3, 1)\n ijump foo\n call assert_equal([1, 3], [line('.'), col('.')])\n call cursor(3, 1)\n ijump 4 /foo/\n call assert_equal([4, 3], [line('.'), col('.')])\n call cursor(3, 1)\n call assert_fails('ijump 3 foo', 'E387:')\n +,$ijump 2 foo\n call assert_equal([5, 3], [line('.'), col('.')])\n call assert_fails('ijump bar', 'E389:')",
" \" Test for CTRL-W i\n call cursor(3, 1)\n wincmd i\n call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n 5wincmd i\n call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('3wincmd i', 'E387:')\n call assert_fails('6wincmd i', 'E389:')\n call assert_fails(\"normal G\\<C-W>i\", 'E349:')\n call cursor(3, 1)",
" \" Test for :isplit\n isplit foo\n call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n isplit 5 /foo/\n call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('isplit 3 foo', 'E387:')\n call assert_fails('isplit 6 foo', 'E389:')\n call assert_fails('isplit bar', 'E389:')",
" close!\nendfunc",
"\" Test for :dsearch, :dlist, :djump and :dsplit commands\n\" Test for [d, ]d, [D, ]D, [ CTRL-D, ] CTRL-D and CTRL-W d commands\nfunc Test_macro_search()\n new\n call setline(1, ['#define FOO 1', '#define FOO 2', '#define FOO 3',\n \\ '#define FOO 4', '#define FOO 5'])\n call cursor(3, 9)",
" \" Test for [d and ]d\n call assert_equal('#define FOO 1', execute('normal [d'))\n call assert_equal('#define FOO 2', execute('normal 2[d'))\n call assert_fails('normal 3[d', 'E387:')\n call assert_equal('#define FOO 4', execute('normal ]d'))\n call assert_equal('#define FOO 5', execute('normal 2]d'))\n call assert_fails('normal 3]d', 'E388:')",
" \" Test for :dsearch\n call assert_equal('#define FOO 1', execute('dsearch FOO'))\n call assert_equal('#define FOO 5', execute('dsearch 5 /FOO/'))\n call assert_fails('dsearch 3 FOO', 'E387:')\n call assert_equal('#define FOO 4', execute('+1,$dsearch FOO'))\n call assert_fails('1,.-1dsearch 3 FOO', 'E388:')\n call assert_fails('dsearch BAR', 'E388:')",
" \" Test for [D and ]D\n call assert_equal([\n \\ ' 1: 1 #define FOO 1',\n \\ ' 2: 2 #define FOO 2',\n \\ ' 3: 3 #define FOO 3',\n \\ ' 4: 4 #define FOO 4',\n \\ ' 5: 5 #define FOO 5'], split(execute('normal [D'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 #define FOO 4',\n \\ ' 2: 5 #define FOO 5'], split(execute('normal ]D'), \"\\n\"))",
" \" Test for :dlist\n call assert_equal([\n \\ ' 1: 1 #define FOO 1',\n \\ ' 2: 2 #define FOO 2',\n \\ ' 3: 3 #define FOO 3',\n \\ ' 4: 4 #define FOO 4',\n \\ ' 5: 5 #define FOO 5'], split(execute('dlist FOO'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 #define FOO 4',\n \\ ' 2: 5 #define FOO 5'], split(execute('+1,$dlist /FOO/'), \"\\n\"))\n call assert_fails('dlist BAR', 'E388:')",
" \" Test for [ CTRL-D and ] CTRL-D\n exe \"normal [\\<C-D>\"\n call assert_equal([1, 9], [line('.'), col('.')])\n exe \"normal 2j4[\\<C-D>\"\n call assert_equal([4, 9], [line('.'), col('.')])\n call assert_fails(\"normal k3[\\<C-D>\", 'E387:')\n call assert_fails(\"normal 6[\\<C-D>\", 'E388:')\n exe \"normal ]\\<C-D>\"\n call assert_equal([4, 9], [line('.'), col('.')])\n exe \"normal k2]\\<C-D>\"\n call assert_equal([5, 9], [line('.'), col('.')])\n call assert_fails(\"normal 2k3]\\<C-D>\", 'E388:')",
" \" Test for :djump\n call cursor(3, 9)\n djump FOO\n call assert_equal([1, 9], [line('.'), col('.')])\n call cursor(3, 9)\n djump 4 /FOO/\n call assert_equal([4, 9], [line('.'), col('.')])\n call cursor(3, 9)\n call assert_fails('djump 3 FOO', 'E387:')\n +,$djump 2 FOO\n call assert_equal([5, 9], [line('.'), col('.')])\n call assert_fails('djump BAR', 'E388:')",
" \" Test for CTRL-W d\n call cursor(3, 9)\n wincmd d\n call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n 5wincmd d\n call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('3wincmd d', 'E387:')\n call assert_fails('6wincmd d', 'E388:')\n new\n call assert_fails(\"normal \\<C-W>d\", 'E349:')\n call assert_fails(\"normal \\<C-W>\\<C-D>\", 'E349:')\n close",
" \" Test for :dsplit\n dsplit FOO\n call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n dsplit 5 /FOO/\n call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('dsplit 3 FOO', 'E387:')\n call assert_fails('dsplit 6 FOO', 'E388:')\n call assert_fails('dsplit BAR', 'E388:')",
" close!\nendfunc",
"func Test_define_search()\n \" this was accessing freed memory\n new\n call setline(1, ['first line', '', '#define something 0'])\n sil norm o0\n sil! norm \u0017\u0004",
"",
" bwipe!\nendfunc",
"\" Test for [*, [/, ]* and ]/\nfunc Test_comment_search()\n new\n call setline(1, ['', '/*', ' *', ' *', ' */'])\n normal! 4gg[/\n call assert_equal([2, 1], [line('.'), col('.')])\n normal! 3gg[*\n call assert_equal([2, 1], [line('.'), col('.')])\n normal! 3gg]/\n call assert_equal([5, 3], [line('.'), col('.')])\n normal! 3gg]*\n call assert_equal([5, 3], [line('.'), col('.')])\n %d\n call setline(1, ['', '/*', ' *', ' *'])\n call assert_beeps('normal! 3gg]/')\n %d\n call setline(1, ['', ' *', ' *', ' */'])\n call assert_beeps('normal! 4gg[/')\n %d\n call setline(1, ' /* comment */')\n normal! 15|[/\n call assert_equal(9, col('.'))\n normal! 15|]/\n call assert_equal(21, col('.'))\n call setline(1, ' comment */')\n call assert_beeps('normal! 15|[/')\n call setline(1, ' /* comment')\n call assert_beeps('normal! 15|]/')\n close!\nendfunc",
"\" Test for the 'taglength' option\nfunc Test_tag_length()\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"tame\\tXfile1\\t1;\",\n \\ \"tape\\tXfile2\\t1;\"], 'Xtags')\n call writefile(['tame'], 'Xfile1')\n call writefile(['tape'], 'Xfile2')",
" \" Jumping to the tag 'tape', should instead jump to 'tame'\n new\n set taglength=2\n tag tape\n call assert_equal('Xfile1', @%)\n \" Tag search should jump to the right tag\n enew\n tag /^tape$\n call assert_equal('Xfile2', @%)",
" call delete('Xtags')\n call delete('Xfile1')\n call delete('Xfile2')\n set tags& taglength&\nendfunc",
"\" Tests for errors in a tags file\nfunc Test_tagfile_errors()\n set tags=Xtags",
" \" missing search pattern or line number for a tag\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo\\tXfile\\t\"], 'Xtags', 'b')\n call writefile(['foo'], 'Xfile')",
" enew\n tag foo\n call assert_equal('', @%)\n let caught_431 = v:false\n try\n eval taglist('.*')\n catch /:E431:/\n let caught_431 = v:true\n endtry\n call assert_equal(v:true, caught_431)",
" \" tag name and file name are not separated by a tab\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo Xfile 1\"], 'Xtags')\n call assert_fails('tag foo', 'E431:')",
" \" file name and search pattern are not separated by a tab\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo\\tXfile 1;\"], 'Xtags')\n call assert_fails('tag foo', 'E431:')",
" call delete('Xtags')\n call delete('Xfile')\n set tags&\nendfunc",
"\" When :stag fails to open the file, should close the new window\nfunc Test_stag_close_window_on_error()\n new | only\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo\\tXfile\\t1\"], 'Xtags')\n call writefile(['foo'], 'Xfile')\n call writefile([], '.Xfile.swp')\n \" Remove the catch-all that runtest.vim adds\n au! SwapExists\n augroup StagTest\n au!\n autocmd SwapExists Xfile let v:swapchoice='q'\n augroup END",
" stag foo\n call assert_equal(1, winnr('$'))\n call assert_equal('', @%)",
" augroup StagTest\n au!\n augroup END\n call delete('Xfile')\n call delete('.Xfile.swp')\n set tags&\nendfunc",
"\" Test for 'tagbsearch' (binary search)\nfunc Test_tagbsearch()\n \" If a tags file header says the tags are sorted, but the tags are actually\n \" unsorted, then binary search should fail and linear search should work.\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t1\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"third\\tXfoo\\t3\",\n \\ \"second\\tXfoo\\t2\",\n \\ \"first\\tXfoo\\t1\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n set tagbsearch\n call assert_fails('tag first', 'E426:')\n call assert_equal('', bufname())\n call assert_fails('tag second', 'E426:')\n call assert_equal('', bufname())\n tag third\n call assert_equal('Xfoo', bufname())\n call assert_equal(3, line('.'))\n %bw!",
" set notagbsearch\n tag first\n call assert_equal('Xfoo', bufname())\n call assert_equal(1, line('.'))\n enew\n tag second\n call assert_equal('Xfoo', bufname())\n call assert_equal(2, line('.'))\n enew\n tag third\n call assert_equal('Xfoo', bufname())\n call assert_equal(3, line('.'))\n %bw!",
" \" If a tags file header says the tags are unsorted, but the tags are\n \" actually sorted, then binary search should work.\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t0\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"second\\tXfoo\\t2\",\n \\ \"third\\tXfoo\\t3\"],\n \\ 'Xtags')",
" set tagbsearch\n tag first\n call assert_equal('Xfoo', bufname())\n call assert_equal(1, line('.'))\n enew\n tag second\n call assert_equal('Xfoo', bufname())\n call assert_equal(2, line('.'))\n enew\n tag third\n call assert_equal('Xfoo', bufname())\n call assert_equal(3, line('.'))\n %bw!",
" \" Binary search fails on EOF\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t1\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"bar\\tXfoo\\t1\",\n \\ \"foo\\tXfoo\\t2\"],\n \\ 'Xtags')\n call assert_fails('tag bbb', 'E426:')",
" call delete('Xtags')\n call delete('Xfoo')\n set tags& tagbsearch&\nendfunc",
"\" vim: shiftwidth=2 sts=2 expandtab"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [4474, 1400, 736], "buggy_code_start_loc": [4466, 1400, 736], "filenames": ["src/normal.c", "src/testdir/test_tagjump.vim", "src/version.c"], "fixing_code_end_loc": [4481, 1407, 739], "fixing_code_start_loc": [4467, 1401, 737], "message": "Use After Free in GitHub repository vim/vim prior to 8.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "C9328925-FDFF-4283-A085-666EB6616272", "versionEndExcluding": "8.2.5024", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*", "matchCriteriaId": "71E032AD-F827-4944-9699-BB1E6D4233FC", "versionEndExcluding": "13.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use After Free in GitHub repository vim/vim prior to 8.2."}, {"lang": "es", "value": "Un Uso de Memoria Previamente Liberada en el repositorio de GitHub vim/vim versiones anteriores a 8.2"}], "evaluatorComment": null, "id": "CVE-2022-1898", "lastModified": "2023-05-03T12:15:36.347", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-05-27T09:15:08.030", "references": [{"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/28"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/41"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/45aad635-c2f1-47ca-a4f9-db5b25979cea"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00014.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZSLFIKFYU5Y2KM5EJKQNYHWRUBDQ4GJ/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMFHBC5OQXDPV2SDYA2JUQGVCPYASTJB/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TYNK6SDCMOLQJOI3B4AOE66P2G2IH4ZM/"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/202208-32"}, {"source": "security@huntr.dev", "tags": null, "url": "https://security.gentoo.org/glsa/202305-16"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://support.apple.com/kb/HT213488"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, "type": "CWE-416"}
| 103
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"\" Tests for tagjump (tags and special searches)",
"source check.vim\nsource screendump.vim",
"\" SEGV occurs in older versions. (At least 7.4.1748 or older)\nfunc Test_ptag_with_notagstack()\n CheckFeature quickfix",
" set notagstack\n call assert_fails('ptag does_not_exist_tag_name', 'E433:')\n set tagstack&vim\nendfunc",
"func Test_ptjump()\n CheckFeature quickfix",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"one\\tXfile\\t1\",\n \\ \"three\\tXfile\\t3\",\n \\ \"two\\tXfile\\t2\"],\n \\ 'Xtags')\n call writefile(['one', 'two', 'three'], 'Xfile')",
" %bw!\n ptjump two\n call assert_equal(2, winnr())\n wincmd p\n call assert_equal(1, &previewwindow)\n call assert_equal('Xfile', expand(\"%:p:t\"))\n call assert_equal(2, line('.'))\n call assert_equal(2, winnr('$'))\n call assert_equal(1, winnr())\n close\n call setline(1, ['one', 'two', 'three'])\n exe \"normal 3G\\<C-W>g}\"\n call assert_equal(2, winnr())\n wincmd p\n call assert_equal(1, &previewwindow)\n call assert_equal('Xfile', expand(\"%:p:t\"))\n call assert_equal(3, line('.'))\n call assert_equal(2, winnr('$'))\n call assert_equal(1, winnr())\n close\n exe \"normal 3G5\\<C-W>\\<C-G>}\"\n wincmd p\n call assert_equal(5, winheight(0))\n close",
" call delete('Xtags')\n call delete('Xfile')\n set tags&\nendfunc",
"func Test_cancel_ptjump()\n CheckFeature quickfix",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"word\\tfile1\\tcmd1\",\n \\ \"word\\tfile2\\tcmd2\"],\n \\ 'Xtags')",
" only!\n call feedkeys(\":ptjump word\\<CR>\\<CR>\", \"xt\")\n help\n call assert_equal(2, winnr('$'))",
" call delete('Xtags')\n set tags&\n quit\nendfunc",
"func Test_static_tagjump()\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"one\\tXfile1\\t/^one/;\\\"\\tf\\tfile:\\tsignature:(void)\",\n \\ \"word\\tXfile2\\tcmd2\"],\n \\ 'Xtags')\n new Xfile1\n call setline(1, ['empty', 'one()', 'empty'])\n write\n tag one\n call assert_equal(2, line('.'))",
" bwipe!\n set tags&\n call delete('Xtags')\n call delete('Xfile1')\nendfunc",
"func Test_duplicate_tagjump()\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"thesame\\tXfile1\\t1;\\\"\\td\\tfile:\",\n \\ \"thesame\\tXfile1\\t2;\\\"\\td\\tfile:\",\n \\ \"thesame\\tXfile1\\t3;\\\"\\td\\tfile:\",\n \\ ],\n \\ 'Xtags')\n new Xfile1\n call setline(1, ['thesame one', 'thesame two', 'thesame three'])\n write\n tag thesame\n call assert_equal(1, line('.'))\n tnext\n call assert_equal(2, line('.'))\n tnext\n call assert_equal(3, line('.'))",
" bwipe!\n set tags&\n call delete('Xtags')\n call delete('Xfile1')\nendfunc",
"func Test_tagjump_switchbuf()\n CheckFeature quickfix",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"second\\tXfile1\\t2\",\n \\ \"third\\tXfile1\\t3\",],\n \\ 'Xtags')\n call writefile(['first', 'second', 'third'], 'Xfile1')",
" enew | only\n set switchbuf=\n stag second\n call assert_equal(2, winnr('$'))\n call assert_equal(2, line('.'))\n stag third\n call assert_equal(3, winnr('$'))\n call assert_equal(3, line('.'))",
" enew | only\n set switchbuf=useopen\n stag second\n call assert_equal(2, winnr('$'))\n call assert_equal(2, line('.'))\n stag third\n call assert_equal(2, winnr('$'))\n call assert_equal(3, line('.'))",
" enew | only\n set switchbuf=usetab\n tab stag second\n call assert_equal(2, tabpagenr('$'))\n call assert_equal(2, line('.'))\n 1tabnext | stag third\n call assert_equal(2, tabpagenr('$'))\n call assert_equal(3, line('.'))",
" tabclose!\n enew | only\n call delete('Xfile1')\n call delete('Xtags')\n set tags&\n set switchbuf&vim\nendfunc",
"\" Tests for [ CTRL-I and CTRL-W CTRL-I commands\nfunction Test_keyword_jump()\n call writefile([\"#include Xinclude\", \"\",\n\t \\ \"\",\n\t \\ \"/* test text test tex start here\",\n\t \\ \"\t\tsome text\",\n\t \\ \"\t\ttest text\",\n\t \\ \"\t\tstart OK if found this line\",\n\t \\ \"\tstart found wrong line\",\n\t \\ \"test text\"], 'Xtestfile')\n call writefile([\"/* test text test tex start here\",\n\t \\ \"\t\tsome text\",\n\t \\ \"\t\ttest text\",\n\t \\ \"\t\tstart OK if found this line\",\n\t \\ \"\tstart found wrong line\",\n\t \\ \"test text\"], 'Xinclude')\n new Xtestfile\n call cursor(1,1)\n call search(\"start\")\n exe \"normal! 5[\\<C-I>\"\n call assert_equal(\"\t\tstart OK if found this line\", getline('.'))\n call cursor(1,1)\n call search(\"start\")\n exe \"normal! 5\\<C-W>\\<C-I>\"\n call assert_equal(\"\t\tstart OK if found this line\", getline('.'))",
" \" invalid tag search pattern\n call assert_fails('tag /\\%(/', 'E426:')",
" enew! | only\n call delete('Xtestfile')\n call delete('Xinclude')\nendfunction",
"\" Test for jumping to a tag with 'hidden' set, with symbolic link in path of\n\" tag. This only works for Unix, because of the symbolic link.\nfunc Test_tag_symbolic()\n CheckUnix",
" set hidden\n call delete(\"Xtest.dir\", \"rf\")\n call system(\"ln -s . Xtest.dir\")\n \" Create a tags file with the current directory name inserted.\n call writefile([\n \\ \"SECTION_OFF\t\" . getcwd() . \"/Xtest.dir/Xtest.c\t/^#define SECTION_OFF 3$/\",\n \\ '',\n \\ ], 'Xtags')\n call writefile(['#define SECTION_OFF 3',\n \\ '#define NUM_SECTIONS 3'], 'Xtest.c')",
" \" Try jumping to a tag, but with a path that contains a symbolic link. When\n \" wrong, this will give the ATTENTION message. The next space will then be\n \" eaten by hit-return, instead of moving the cursor to 'd'.\n set tags=Xtags\n enew!\n call append(0, 'SECTION_OFF')\n call cursor(1,1)\n exe \"normal \\<C-]> \"\n call assert_equal('Xtest.c', expand('%:t'))\n call assert_equal(2, col('.'))",
" set hidden&\n set tags&\n enew!\n call delete('Xtags')\n call delete('Xtest.c')\n call delete(\"Xtest.dir\", \"rf\")\n %bwipe!\nendfunc",
"\" Tests for tag search with !_TAG_FILE_ENCODING.\nfunc Test_tag_file_encoding()\n if has('vms')\n throw 'Skipped: does not work on VMS'\n endif",
" if !has('iconv') || iconv(\"\\x82\\x60\", \"cp932\", \"utf-8\") != \"\\uff21\"\n throw 'Skipped: iconv does not work'\n endif",
" let save_enc = &encoding\n set encoding=utf8",
" let content = ['text for tags1', 'abcdefghijklmnopqrs']\n call writefile(content, 'Xtags1.txt')\n let content = ['text for tags2', 'ABC']\n call writefile(content, 'Xtags2.txt')\n let content = ['text for tags3', 'ABC']\n call writefile(content, 'Xtags3.txt')\n let content = ['!_TAG_FILE_ENCODING\tutf-8\t//', 'abcdefghijklmnopqrs\tXtags1.txt\t/abcdefghijklmnopqrs']\n call writefile(content, 'Xtags1')",
" \" case1:\n new\n set tags=Xtags1\n tag abcdefghijklmnopqrs\n call assert_equal('Xtags1.txt', expand('%:t'))\n call assert_equal('abcdefghijklmnopqrs', getline('.'))\n close",
" \" case2:\n new\n let content = ['!_TAG_FILE_ENCODING\tcp932\t//',\n \\ \"\\x82`\\x82a\\x82b\tXtags2.txt\t/\\x82`\\x82a\\x82b\"]\n call writefile(content, 'Xtags')\n set tags=Xtags\n tag /.BC\n call assert_equal('Xtags2.txt', expand('%:t'))\n call assert_equal('ABC', getline('.'))\n call delete('Xtags')\n close",
" \" case3:\n new\n let contents = [\n \\ \"!_TAG_FILE_SORTED\t1\t//\",\n \\ \"!_TAG_FILE_ENCODING\tcp932\t//\"]\n for i in range(1, 100)\n call add(contents, 'abc' .. i\n \\ .. \"\tXtags3.txt\t/\\x82`\\x82a\\x82b\")\n endfor\n call writefile(contents, 'Xtags')\n set tags=Xtags\n tag abc50\n call assert_equal('Xtags3.txt', expand('%:t'))\n call assert_equal('ABC', getline('.'))\n call delete('Xtags')\n close",
" set tags&\n let &encoding = save_enc\n call delete('Xtags1.txt')\n call delete('Xtags2.txt')\n call delete('Xtags3.txt')\n call delete('Xtags1')\nendfunc",
"\" Test for emacs-style tags file (TAGS)\nfunc Test_tagjump_etags()\n CheckFeature emacs_tags",
" call writefile([\n \\ \"void foo() {}\",\n \\ \"int main(int argc, char **argv)\",\n \\ \"{\",\n \\ \"\\tfoo();\",\n \\ \"\\treturn 0;\",\n \\ \"}\",\n \\ ], 'Xmain.c')",
" call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x011,0\",\n \\ \"int main(int argc, char **argv)\\x7fmain\\x012,14\",\n\t\\ ], 'Xtags')\n set tags=Xtags\n ta foo\n call assert_equal('void foo() {}', getline('.'))",
" \" Test for including another tags file\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x011,0\",\n \\ \"\\x0c\",\n \\ \"Xnonexisting,include\",\n \\ \"\\x0c\",\n \\ \"Xtags2,include\"\n \\ ], 'Xtags')\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"int main(int argc, char **argv)\\x7fmain\\x012,14\",\n \\ ], 'Xtags2')\n tag main\n call assert_equal(2, line('.'))\n call assert_fails('tag bar', 'E426:')",
" \" corrupted tag line\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,8\",\n \\ \"int main\"\n \\ ], 'Xtags', 'b')\n call assert_fails('tag foo', 'E426:')",
" \" invalid line number\n call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x0abc,0\",\n\t\\ ], 'Xtags')\n call assert_fails('tag foo', 'E426:')",
" \" invalid tag name\n call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \";;;;\\x7f1,0\",\n\t\\ ], 'Xtags')\n call assert_fails('tag foo', 'E431:')",
" \" end of file after a CTRL-L line\n call writefile([\n\t\\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\\x7ffoo\\x011,0\",\n\t\\ \"\\x0c\",\n\t\\ ], 'Xtags')\n call assert_fails('tag main', 'E426:')",
" \" error in an included tags file\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xtags2,include\"\n \\ ], 'Xtags')\n call writefile([\n \\ \"\\x0c\",\n \\ \"Xmain.c,64\",\n \\ \"void foo() {}\",\n \\ ], 'Xtags2')\n call assert_fails('tag foo', 'E431:')",
" call delete('Xtags')\n call delete('Xtags2')\n call delete('Xmain.c')\n set tags&\n bwipe!\nendfunc",
"\" Test for getting and modifying the tag stack\nfunc Test_getsettagstack()\n call writefile(['line1', 'line2', 'line3'], 'Xfile1')\n call writefile(['line1', 'line2', 'line3'], 'Xfile2')\n call writefile(['line1', 'line2', 'line3'], 'Xfile3')",
" enew | only\n call settagstack(1, {'items' : []})\n call assert_equal(0, gettagstack(1).length)\n call assert_equal([], 1->gettagstack().items)\n \" Error cases\n call assert_equal({}, gettagstack(100))\n call assert_equal(-1, settagstack(100, {'items' : []}))\n call assert_fails('call settagstack(1, [1, 10])', 'E715:')\n call assert_fails(\"call settagstack(1, {'items' : 10})\", 'E714:')\n call assert_fails(\"call settagstack(1, {'items' : []}, 10)\", 'E928:')\n call assert_fails(\"call settagstack(1, {'items' : []}, 'b')\", 'E962:')\n call assert_equal(-1, settagstack(0, test_null_dict()))",
" set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"one\\tXfile1\\t1\",\n \\ \"three\\tXfile3\\t3\",\n \\ \"two\\tXfile2\\t2\"],\n \\ 'Xtags')",
" let stk = []\n call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'one',\n\t\\ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})\n tag one\n call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'two',\n\t\\ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})\n tag two\n call add(stk, {'bufnr' : bufnr('%'), 'tagname' : 'three',\n\t\\ 'from' : [bufnr('%'), line('.'), col('.'), 0], 'matchnr' : 1})\n tag three\n call assert_equal(3, gettagstack(1).length)\n call assert_equal(stk, gettagstack(1).items)\n \" Check for default - current window\n call assert_equal(3, gettagstack().length)\n call assert_equal(stk, gettagstack().items)",
" \" Try to set current index to invalid values\n call settagstack(1, {'curidx' : -1})\n call assert_equal(1, gettagstack().curidx)\n eval {'curidx' : 50}->settagstack(1)\n call assert_equal(4, gettagstack().curidx)",
" \" Try pushing invalid items onto the stack\n call settagstack(1, {'items' : []})\n call settagstack(1, {'items' : [\"plate\"]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)\n call settagstack(1, {'items' : [{\"tagname\" : \"abc\"}]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)\n call settagstack(1, {'items' : [{\"from\" : 100}]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)\n call settagstack(1, {'items' : [{\"from\" : [2, 1, 0, 0]}]}, 'a')\n call assert_equal(0, gettagstack().length)\n call assert_equal([], gettagstack().items)",
" \" Push one item at a time to the stack\n call settagstack(1, {'items' : []})\n call settagstack(1, {'items' : [stk[0]]}, 'a')\n call settagstack(1, {'items' : [stk[1]]}, 'a')\n call settagstack(1, {'items' : [stk[2]]}, 'a')\n call settagstack(1, {'curidx' : 4})\n call assert_equal({'length' : 3, 'curidx' : 4, 'items' : stk},\n \\ gettagstack(1))",
" \" Try pushing items onto a full stack\n for i in range(7)\n call settagstack(1, {'items' : stk}, 'a')\n endfor\n call assert_equal(20, gettagstack().length)\n call settagstack(1,\n \\ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 'a')\n call assert_equal('abc', gettagstack().items[19].tagname)",
" \" truncate the tag stack\n call settagstack(1,\n \\ {'curidx' : 9,\n \\ 'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')\n let t = gettagstack()\n call assert_equal(9, t.length)\n call assert_equal(10, t.curidx)",
" \" truncate the tag stack without pushing any new items\n call settagstack(1, {'curidx' : 5}, 't')\n let t = gettagstack()\n call assert_equal(4, t.length)\n call assert_equal(5, t.curidx)",
" \" truncate an empty tag stack and push new items\n call settagstack(1, {'items' : []})\n call settagstack(1,\n \\ {'items' : [{'tagname' : 'abc', 'from' : [1, 10, 1, 0]}]}, 't')\n let t = gettagstack()\n call assert_equal(1, t.length)\n call assert_equal(2, t.curidx)",
" \" Tag with multiple matches\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"two\\tXfile1\\t1\",\n \\ \"two\\tXfile2\\t3\",\n \\ \"two\\tXfile3\\t2\"],\n \\ 'Xtags')\n call settagstack(1, {'items' : []})\n tag two\n tnext\n tnext\n call assert_equal(1, gettagstack().length)\n call assert_equal(3, gettagstack().items[0].matchnr)",
" \" Memory allocation failures\n call test_alloc_fail(GetAllocId('tagstack_items'), 0, 0)\n call assert_fails('call gettagstack()', 'E342:')\n call test_alloc_fail(GetAllocId('tagstack_from'), 0, 0)\n call assert_fails('call gettagstack()', 'E342:')\n call test_alloc_fail(GetAllocId('tagstack_details'), 0, 0)\n call assert_fails('call gettagstack()', 'E342:')",
" call settagstack(1, {'items' : []})\n call delete('Xfile1')\n call delete('Xfile2')\n call delete('Xfile3')\n call delete('Xtags')\n set tags&\nendfunc",
"func Test_tag_with_count()\n call writefile([\n\t\\ 'test\tXtest.h\t/^void test();$/;\"\tp\ttyperef:typename:void\tsignature:()',\n\t\\ ], 'Xtags')\n call writefile([\n\t\\ 'main\tXtest.c\t/^int main()$/;\"\tf\ttyperef:typename:int\tsignature:()',\n\t\\ 'test\tXtest.c\t/^void test()$/;\"\tf\ttyperef:typename:void\tsignature:()',\n\t\\ ], 'Ytags')\n cal writefile([\n\t\\ 'int main()',\n\t\\ 'void test()',\n\t\\ ], 'Xtest.c')\n cal writefile([\n\t\\ 'void test();',\n\t\\ ], 'Xtest.h')\n set tags=Xtags,Ytags",
" new Xtest.c\n let tl = taglist('test', 'Xtest.c')\n call assert_equal(tl[0].filename, 'Xtest.c')\n call assert_equal(tl[1].filename, 'Xtest.h')",
" tag test\n call assert_equal(bufname('%'), 'Xtest.c')\n 1tag test\n call assert_equal(bufname('%'), 'Xtest.c')\n 2tag test\n call assert_equal(bufname('%'), 'Xtest.h')",
" set tags&\n call delete('Xtags')\n call delete('Ytags')\n bwipe Xtest.h\n bwipe Xtest.c\n call delete('Xtest.h')\n call delete('Xtest.c')\nendfunc",
"func Test_tagnr_recall()\n call writefile([\n\t\\ 'test\tXtest.h\t/^void test();$/;\"\tp',\n\t\\ 'main\tXtest.c\t/^int main()$/;\"\tf',\n\t\\ 'test\tXtest.c\t/^void test()$/;\"\tf',\n\t\\ ], 'Xtags')\n cal writefile([\n\t\\ 'int main()',\n\t\\ 'void test()',\n\t\\ ], 'Xtest.c')\n cal writefile([\n\t\\ 'void test();',\n\t\\ ], 'Xtest.h')\n set tags=Xtags",
" new Xtest.c\n let tl = taglist('test', 'Xtest.c')\n call assert_equal(tl[0].filename, 'Xtest.c')\n call assert_equal(tl[1].filename, 'Xtest.h')",
" 2tag test\n call assert_equal(bufname('%'), 'Xtest.h')\n pop\n call assert_equal(bufname('%'), 'Xtest.c')\n tag\n call assert_equal(bufname('%'), 'Xtest.h')",
" set tags&\n call delete('Xtags')\n bwipe Xtest.h\n bwipe Xtest.c\n call delete('Xtest.h')\n call delete('Xtest.c')\nendfunc",
"func Test_tag_line_toolong()\n call writefile([\n\t\\ '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678\tdjango/contrib/admin/templates/admin/edit_inline/stacked.html\t16;\"\tj\tline:16\tlanguage:HTML'\n\t\\ ], 'Xtags')\n set tags=Xtags\n let old_vbs = &verbose\n set verbose=5\n \" \":tjump\" should give \"tag not found\" not \"Format error in tags file\"\n call assert_fails('tj /foo', 'E426:')\n try\n tj /foo\n catch /^Vim\\%((\\a\\+)\\)\\=:E431/\n call assert_report(v:exception)\n catch /.*/\n endtry\n call assert_equal('Searching tags file Xtags', split(execute('messages'), '\\n')[-1])",
" call writefile([\n\t\\ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\tdjango/contrib/admin/templates/admin/edit_inline/stacked.html\t16;\"\tj\tline:16\tlanguage:HTML'\n\t\\ ], 'Xtags')\n call assert_fails('tj /foo', 'E426:')\n try\n tj /foo\n catch /^Vim\\%((\\a\\+)\\)\\=:E431/\n call assert_report(v:exception)\n catch /.*/\n endtry\n call assert_equal('Searching tags file Xtags', split(execute('messages'), '\\n')[-1])",
" \" binary search works in file with long line\n call writefile([\n \\ 'asdfasfd\tnowhere\t16',\n\t\\ 'foobar\tXsomewhere\t3; \" 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567',\n \\ 'zasdfasfd\tnowhere\t16',\n\t\\ ], 'Xtags')\n call writefile([\n \\ 'one',\n \\ 'two',\n \\ 'trhee',\n \\ 'four',\n \\ ], 'Xsomewhere')\n tag foobar\n call assert_equal('Xsomewhere', expand('%'))\n call assert_equal(3, getcurpos()[1])",
" \" expansion on command line works with long lines when &wildoptions contains\n \" 'tagfile'\n set wildoptions=tagfile\n call writefile([\n\t\\ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\tfile\t/^pattern$/;\"\tf'\n\t\\ ], 'Xtags')\n call feedkeys(\":tag \\<Tab>\", 'tx')\n \" Should not crash\n call assert_true(v:true)",
" call delete('Xtags')\n call delete('Xsomewhere')\n set tags&\n let &verbose = old_vbs\nendfunc",
"\" Check that using :tselect does not run into the hit-enter prompt.\n\" Requires a terminal to trigger that prompt.\nfunc Test_tselect()\n CheckScreendump",
" call writefile([\n\t\\ 'main\tXtest.h\t/^void test();$/;\"\tf',\n\t\\ 'main\tXtest.c\t/^int main()$/;\"\tf',\n\t\\ 'main\tXtest.x\t/^void test()$/;\"\tf',\n\t\\ ], 'Xtags')\n cal writefile([\n\t\\ 'int main()',\n\t\\ 'void test()',\n\t\\ ], 'Xtest.c')",
" let lines =<< trim [SCRIPT]\n set tags=Xtags\n [SCRIPT]\n call writefile(lines, 'XTest_tselect')\n let buf = RunVimInTerminal('-S XTest_tselect', {'rows': 10, 'cols': 50})",
" call TermWait(buf, 50)\n call term_sendkeys(buf, \":tselect main\\<CR>2\\<CR>\")\n call VerifyScreenDump(buf, 'Test_tselect_1', {})",
" call StopVimInTerminal(buf)\n call delete('Xtags')\n call delete('Xtest.c')\n call delete('XTest_tselect')\nendfunc",
"func Test_tagline()\n call writefile([\n\t\\ 'provision\tXtest.py\t/^ def provision(self, **kwargs):$/;\"\tm\tline:1\tlanguage:Python class:Foo',\n\t\\ 'provision\tXtest.py\t/^ def provision(self, **kwargs):$/;\"\tm\tline:3\tlanguage:Python class:Bar',\n\t\\], 'Xtags')\n call writefile([\n\t\\ ' def provision(self, **kwargs):',\n\t\\ ' pass',\n\t\\ ' def provision(self, **kwargs):',\n\t\\ ' pass',\n\t\\], 'Xtest.py')",
" set tags=Xtags",
" 1tag provision\n call assert_equal(line('.'), 1)\n 2tag provision\n call assert_equal(line('.'), 3)",
" call delete('Xtags')\n call delete('Xtest.py')\n set tags&\nendfunc",
"\" Test for expanding environment variable in a tag file name\nfunc Test_tag_envvar()\n call writefile([\"Func1\\t$FOO\\t/^Func1/\"], 'Xtags')\n set tags=Xtags",
" let $FOO='TagTestEnv'",
" let caught_exception = v:false\n try\n tag Func1\n catch /E429:/\n call assert_match('E429:.*\"TagTestEnv\".*', v:exception)\n let caught_exception = v:true\n endtry\n call assert_true(caught_exception)",
" set tags&\n call delete('Xtags')\n unlet $FOO\nendfunc",
"\" Test for :ptag\nfunc Test_tag_preview()\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"second\\tXfile1\\t2\",\n \\ \"third\\tXfile1\\t3\",],\n \\ 'Xtags')\n set tags=Xtags\n call writefile(['first', 'second', 'third'], 'Xfile1')",
" enew | only\n ptag third\n call assert_equal(2, winnr())\n call assert_equal(2, winnr('$'))\n call assert_equal(1, getwinvar(1, '&previewwindow'))\n call assert_equal(0, getwinvar(2, '&previewwindow'))\n wincmd P\n call assert_equal(3, line('.'))",
" \" jump to the tag again\n wincmd w\n ptag third\n wincmd P\n call assert_equal(3, line('.'))",
" \" jump to the newer tag\n wincmd w\n ptag\n wincmd P\n call assert_equal(3, line('.'))",
" \" close the preview window\n pclose\n call assert_equal(1, winnr('$'))",
" call delete('Xfile1')\n call delete('Xtags')\n set tags&\nendfunc",
"\" Tests for guessing the tag location\nfunc Test_tag_guess()\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"func1\\tXfoo\\t/^int func1(int x)/\",\n \\ \"func2\\tXfoo\\t/^int func2(int y)/\",\n \\ \"func3\\tXfoo\\t/^func3/\",\n \\ \"func4\\tXfoo\\t/^func4/\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]",
" int FUNC1 (int x) { }\n int \n func2 (int y) { }\n int * func3 () { }",
" [CODE]\n call writefile(code, 'Xfoo')",
" let v:statusmsg = ''\n ta func1\n call assert_match('E435:', v:statusmsg)\n call assert_equal(2, line('.'))\n let v:statusmsg = ''\n ta func2\n call assert_match('E435:', v:statusmsg)\n call assert_equal(4, line('.'))\n let v:statusmsg = ''\n ta func3\n call assert_match('E435:', v:statusmsg)\n call assert_equal(5, line('.'))\n call assert_fails('ta func4', 'E434:')",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\nendfunc",
"\" Test for an unsorted tags file\nfunc Test_tag_sort()\n let l = [\n \\ \"first\\tXfoo\\t1\",\n \\ \"ten\\tXfoo\\t3\",\n \\ \"six\\tXfoo\\t2\"]\n call writefile(l, 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int six() {}\n int ten() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" call assert_fails('tag first', 'E432:')",
" \" When multiple tag files are not sorted, then message should be displayed\n \" multiple times\n call writefile(l, 'Xtags2')\n set tags=Xtags,Xtags2\n call assert_fails('tag first', ['E432:', 'E432:'])",
" call delete('Xtags')\n call delete('Xtags2')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for an unsorted tags file\nfunc Test_tag_fold()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t2\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"second\\tXfoo\\t2\",\n \\ \"third\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n tag second\n call assert_equal('Xfoo', bufname(''))\n call assert_equal(2, line('.'))",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for the :ltag command\nfunc Test_ltag()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"second\\tXfoo\\t/^int second() {}$/\",\n \\ \"third\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n call setloclist(0, [], 'f')\n ltag third\n call assert_equal('Xfoo', bufname(''))\n call assert_equal(3, line('.'))\n call assert_equal([{'lnum': 3, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'),\n \\ 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0,\n \\ 'nr': 0, 'type': '', 'module': '', 'text': 'third'}], getloclist(0))",
" ltag second\n call assert_equal(2, line('.'))\n call assert_equal([{'lnum': 0, 'end_lnum': 0, 'bufnr': bufnr('Xfoo'),\n \\ 'col': 0, 'end_col': 0, 'pattern': '^\\Vint second() {}\\$',\n \\ 'valid': 1, 'vcol': 0, 'nr': 0, 'type': '', 'module': '',\n \\ 'text': 'second'}], getloclist(0))",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for setting the last search pattern to the tag search pattern\n\" when cpoptions has 't'\nfunc Test_tag_last_search_pat()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t/^int first() {}/\",\n \\ \"second\\tXfoo\\t/^int second() {}/\",\n \\ \"third\\tXfoo\\t/^int third() {}/\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n let save_cpo = &cpo\n set cpo+=t\n let @/ = ''\n tag second\n call assert_equal('^int second() {}', @/)\n let &cpo = save_cpo",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Tag stack tests\nfunc Test_tag_stack()\n let l = []\n for i in range(10, 31)\n let l += [\"var\" .. i .. \"\\tXfoo\\t/^int var\" .. i .. \";$/\"]\n endfor\n call writefile(l, 'Xtags')\n set tags=Xtags",
" let l = []\n for i in range(10, 31)\n let l += [\"int var\" .. i .. \";\"]\n endfor\n call writefile(l, 'Xfoo')",
" \" Jump to a tag when the tag stack is full. Oldest entry should be removed.\n enew\n for i in range(10, 30)\n exe \"tag var\" .. i\n endfor\n let l = gettagstack()\n call assert_equal(20, l.length)\n call assert_equal('var11', l.items[0].tagname)\n tag var31\n let l = gettagstack()\n call assert_equal('var12', l.items[0].tagname)\n call assert_equal('var31', l.items[19].tagname)",
" \" Use tnext with a single match\n call assert_fails('tnext', 'E427:')",
" \" Jump to newest entry from the top of the stack\n call assert_fails('tag', 'E556:')",
" \" Pop with zero count from the top of the stack\n call assert_fails('0pop', 'E556:')",
" \" Pop from an unsaved buffer\n enew!\n call append(1, \"sample text\")\n call assert_fails('pop', 'E37:')\n call assert_equal(21, gettagstack().curidx)\n enew!",
" \" Pop all the entries in the tag stack\n call assert_fails('30pop', 'E555:')",
" \" Pop with a count when already at the bottom of the stack\n call assert_fails('exe \"normal 4\\<C-T>\"', 'E555:')\n call assert_equal(1, gettagstack().curidx)",
" \" Jump to newest entry from the bottom of the stack with zero count\n call assert_fails('0tag', 'E555:')",
" \" Pop the tag stack when it is empty\n call settagstack(1, {'items' : []})\n call assert_fails('pop', 'E73:')",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for browsing multiple matching tags\nfunc Test_tag_multimatch()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"first\\tXfoo\\t2\",\n \\ \"first\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int first() {}\n int first() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" call settagstack(1, {'items' : []})\n tag first\n tlast\n call assert_equal(3, line('.'))\n call assert_fails('tnext', 'E428:')\n tfirst\n call assert_equal(1, line('.'))\n call assert_fails('tprev', 'E425:')",
" tlast\n call feedkeys(\"5\\<CR>\", 't')\n tselect first\n call assert_equal(2, gettagstack().curidx)",
" set ignorecase\n tag FIRST\n tnext\n call assert_equal(2, line('.'))\n tlast\n tprev\n call assert_equal(2, line('.'))\n tNext\n call assert_equal(1, line('.'))\n set ignorecase&",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for previewing multiple matching tags\nfunc Test_preview_tag_multimatch()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"first\\tXfoo\\t2\",\n \\ \"first\\tXfoo\\t3\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int first() {}\n int first() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew | only\n ptag first\n ptlast\n wincmd P\n call assert_equal(3, line('.'))\n wincmd w\n call assert_fails('ptnext', 'E428:')\n ptprev\n wincmd P\n call assert_equal(2, line('.'))\n wincmd w\n ptfirst\n wincmd P\n call assert_equal(1, line('.'))\n wincmd w\n call assert_fails('ptprev', 'E425:')\n ptnext\n wincmd P\n call assert_equal(2, line('.'))\n wincmd w\n ptlast\n call feedkeys(\"5\\<CR>\", 't')\n ptselect first\n wincmd P\n call assert_equal(3, line('.'))",
" pclose",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for jumping to multiple matching tags across multiple :tags commands\nfunc Test_tnext_multimatch()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo1\\t1\",\n \\ \"first\\tXfoo2\\t1\",\n \\ \"first\\tXfoo3\\t1\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n [CODE]\n call writefile(code, 'Xfoo1')\n call writefile(code, 'Xfoo2')\n call writefile(code, 'Xfoo3')",
" tag first\n tag first\n pop\n tnext\n tnext\n call assert_fails('tnext', 'E428:')",
" call delete('Xtags')\n call delete('Xfoo1')\n call delete('Xfoo2')\n call delete('Xfoo3')\n set tags&\n %bwipe\nendfunc",
"\" Test for jumping to multiple matching tags in non-existing files\nfunc Test_multimatch_non_existing_files()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo1\\t1\",\n \\ \"first\\tXfoo2\\t1\",\n \\ \"first\\tXfoo3\\t1\"],\n \\ 'Xtags')\n set tags=Xtags",
" call settagstack(1, {'items' : []})\n call assert_fails('tag first', 'E429:')\n call assert_equal(3, gettagstack().items[0].matchnr)",
" call delete('Xtags')\n set tags&\n %bwipe\nendfunc",
"func Test_tselect_listing()\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"first\\tXfoo\\t1\" .. ';\"' .. \"\\tv\\ttyperef:typename:int\\tfile:\",\n \\ \"first\\tXfoo\\t2\" .. ';\"' .. \"\\tkind:v\\ttyperef:typename:char\\tfile:\"],\n \\ 'Xtags')\n set tags=Xtags",
" let code =<< trim [CODE]\n static int first;\n static char first;\n [CODE]\n call writefile(code, 'Xfoo')",
" call feedkeys(\"\\<CR>\", \"t\")\n let l = split(execute(\"tselect first\"), \"\\n\")\n let expected =<< [DATA]\n # pri kind tag file\n 1 FS v first Xfoo\n typeref:typename:int \n 1\n 2 FS v first Xfoo\n typeref:typename:char \n 2\nType number and <Enter> (q or empty cancels): \n[DATA]\n call assert_equal(expected, l)",
" call delete('Xtags')\n call delete('Xfoo')\n set tags&\n %bwipe\nendfunc",
"\" Test for :isearch, :ilist, :ijump and :isplit commands\n\" Test for [i, ]i, [I, ]I, [ CTRL-I, ] CTRL-I and CTRL-W i commands\nfunc Test_inc_search()\n new\n call setline(1, ['1:foo', '2:foo', 'foo', '3:foo', '4:foo', '==='])\n call cursor(3, 1)",
" \" Test for [i and ]i\n call assert_equal('1:foo', execute('normal [i'))\n call assert_equal('2:foo', execute('normal 2[i'))\n call assert_fails('normal 3[i', 'E387:')\n call assert_equal('3:foo', execute('normal ]i'))\n call assert_equal('4:foo', execute('normal 2]i'))\n call assert_fails('normal 3]i', 'E389:')\n call assert_fails('normal G]i', 'E349:')\n call assert_fails('normal [i', 'E349:')\n call cursor(3, 1)",
" \" Test for :isearch\n call assert_equal('1:foo', execute('isearch foo'))\n call assert_equal('3:foo', execute('isearch 4 /foo/'))\n call assert_fails('isearch 3 foo', 'E387:')\n call assert_equal('3:foo', execute('+1,$isearch foo'))\n call assert_fails('1,.-1isearch 3 foo', 'E389:')\n call assert_fails('isearch bar', 'E389:')\n call assert_fails('isearch /foo/3', 'E488:')",
" \" Test for [I and ]I\n call assert_equal([\n \\ ' 1: 1 1:foo',\n \\ ' 2: 2 2:foo',\n \\ ' 3: 3 foo',\n \\ ' 4: 4 3:foo',\n \\ ' 5: 5 4:foo'], split(execute('normal [I'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 3:foo',\n \\ ' 2: 5 4:foo'], split(execute('normal ]I'), \"\\n\"))\n call assert_fails('normal G]I', 'E349:')\n call assert_fails('normal [I', 'E349:')\n call cursor(3, 1)",
" \" Test for :ilist\n call assert_equal([\n \\ ' 1: 1 1:foo',\n \\ ' 2: 2 2:foo',\n \\ ' 3: 3 foo',\n \\ ' 4: 4 3:foo',\n \\ ' 5: 5 4:foo'], split(execute('ilist foo'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 3:foo',\n \\ ' 2: 5 4:foo'], split(execute('+1,$ilist /foo/'), \"\\n\"))\n call assert_fails('ilist bar', 'E389:')",
" \" Test for [ CTRL-I and ] CTRL-I\n exe \"normal [\\t\"\n call assert_equal([1, 3], [line('.'), col('.')])\n exe \"normal 2j4[\\t\"\n call assert_equal([4, 3], [line('.'), col('.')])\n call assert_fails(\"normal k3[\\t\", 'E387:')\n call assert_fails(\"normal 6[\\t\", 'E389:')\n exe \"normal ]\\t\"\n call assert_equal([4, 3], [line('.'), col('.')])\n exe \"normal k2]\\t\"\n call assert_equal([5, 3], [line('.'), col('.')])\n call assert_fails(\"normal 2k3]\\t\", 'E389:')\n call assert_fails(\"normal G[\\t\", 'E349:')\n call assert_fails(\"normal ]\\t\", 'E349:')\n call cursor(3, 1)",
" \" Test for :ijump\n call cursor(3, 1)\n ijump foo\n call assert_equal([1, 3], [line('.'), col('.')])\n call cursor(3, 1)\n ijump 4 /foo/\n call assert_equal([4, 3], [line('.'), col('.')])\n call cursor(3, 1)\n call assert_fails('ijump 3 foo', 'E387:')\n +,$ijump 2 foo\n call assert_equal([5, 3], [line('.'), col('.')])\n call assert_fails('ijump bar', 'E389:')",
" \" Test for CTRL-W i\n call cursor(3, 1)\n wincmd i\n call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n 5wincmd i\n call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('3wincmd i', 'E387:')\n call assert_fails('6wincmd i', 'E389:')\n call assert_fails(\"normal G\\<C-W>i\", 'E349:')\n call cursor(3, 1)",
" \" Test for :isplit\n isplit foo\n call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n isplit 5 /foo/\n call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('isplit 3 foo', 'E387:')\n call assert_fails('isplit 6 foo', 'E389:')\n call assert_fails('isplit bar', 'E389:')",
" close!\nendfunc",
"\" Test for :dsearch, :dlist, :djump and :dsplit commands\n\" Test for [d, ]d, [D, ]D, [ CTRL-D, ] CTRL-D and CTRL-W d commands\nfunc Test_macro_search()\n new\n call setline(1, ['#define FOO 1', '#define FOO 2', '#define FOO 3',\n \\ '#define FOO 4', '#define FOO 5'])\n call cursor(3, 9)",
" \" Test for [d and ]d\n call assert_equal('#define FOO 1', execute('normal [d'))\n call assert_equal('#define FOO 2', execute('normal 2[d'))\n call assert_fails('normal 3[d', 'E387:')\n call assert_equal('#define FOO 4', execute('normal ]d'))\n call assert_equal('#define FOO 5', execute('normal 2]d'))\n call assert_fails('normal 3]d', 'E388:')",
" \" Test for :dsearch\n call assert_equal('#define FOO 1', execute('dsearch FOO'))\n call assert_equal('#define FOO 5', execute('dsearch 5 /FOO/'))\n call assert_fails('dsearch 3 FOO', 'E387:')\n call assert_equal('#define FOO 4', execute('+1,$dsearch FOO'))\n call assert_fails('1,.-1dsearch 3 FOO', 'E388:')\n call assert_fails('dsearch BAR', 'E388:')",
" \" Test for [D and ]D\n call assert_equal([\n \\ ' 1: 1 #define FOO 1',\n \\ ' 2: 2 #define FOO 2',\n \\ ' 3: 3 #define FOO 3',\n \\ ' 4: 4 #define FOO 4',\n \\ ' 5: 5 #define FOO 5'], split(execute('normal [D'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 #define FOO 4',\n \\ ' 2: 5 #define FOO 5'], split(execute('normal ]D'), \"\\n\"))",
" \" Test for :dlist\n call assert_equal([\n \\ ' 1: 1 #define FOO 1',\n \\ ' 2: 2 #define FOO 2',\n \\ ' 3: 3 #define FOO 3',\n \\ ' 4: 4 #define FOO 4',\n \\ ' 5: 5 #define FOO 5'], split(execute('dlist FOO'), \"\\n\"))\n call assert_equal([\n \\ ' 1: 4 #define FOO 4',\n \\ ' 2: 5 #define FOO 5'], split(execute('+1,$dlist /FOO/'), \"\\n\"))\n call assert_fails('dlist BAR', 'E388:')",
" \" Test for [ CTRL-D and ] CTRL-D\n exe \"normal [\\<C-D>\"\n call assert_equal([1, 9], [line('.'), col('.')])\n exe \"normal 2j4[\\<C-D>\"\n call assert_equal([4, 9], [line('.'), col('.')])\n call assert_fails(\"normal k3[\\<C-D>\", 'E387:')\n call assert_fails(\"normal 6[\\<C-D>\", 'E388:')\n exe \"normal ]\\<C-D>\"\n call assert_equal([4, 9], [line('.'), col('.')])\n exe \"normal k2]\\<C-D>\"\n call assert_equal([5, 9], [line('.'), col('.')])\n call assert_fails(\"normal 2k3]\\<C-D>\", 'E388:')",
" \" Test for :djump\n call cursor(3, 9)\n djump FOO\n call assert_equal([1, 9], [line('.'), col('.')])\n call cursor(3, 9)\n djump 4 /FOO/\n call assert_equal([4, 9], [line('.'), col('.')])\n call cursor(3, 9)\n call assert_fails('djump 3 FOO', 'E387:')\n +,$djump 2 FOO\n call assert_equal([5, 9], [line('.'), col('.')])\n call assert_fails('djump BAR', 'E388:')",
" \" Test for CTRL-W d\n call cursor(3, 9)\n wincmd d\n call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n 5wincmd d\n call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('3wincmd d', 'E387:')\n call assert_fails('6wincmd d', 'E388:')\n new\n call assert_fails(\"normal \\<C-W>d\", 'E349:')\n call assert_fails(\"normal \\<C-W>\\<C-D>\", 'E349:')\n close",
" \" Test for :dsplit\n dsplit FOO\n call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n dsplit 5 /FOO/\n call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])\n close\n call assert_fails('dsplit 3 FOO', 'E387:')\n call assert_fails('dsplit 6 FOO', 'E388:')\n call assert_fails('dsplit BAR', 'E388:')",
" close!\nendfunc",
"func Test_define_search()\n \" this was accessing freed memory\n new\n call setline(1, ['first line', '', '#define something 0'])\n sil norm o0\n sil! norm \u0017\u0004",
" bwipe!",
" new somefile\n call setline(1, ['first line', '', '#define something 0'])\n sil norm 0o0\n sil! norm ]d",
" bwipe!\nendfunc",
"\" Test for [*, [/, ]* and ]/\nfunc Test_comment_search()\n new\n call setline(1, ['', '/*', ' *', ' *', ' */'])\n normal! 4gg[/\n call assert_equal([2, 1], [line('.'), col('.')])\n normal! 3gg[*\n call assert_equal([2, 1], [line('.'), col('.')])\n normal! 3gg]/\n call assert_equal([5, 3], [line('.'), col('.')])\n normal! 3gg]*\n call assert_equal([5, 3], [line('.'), col('.')])\n %d\n call setline(1, ['', '/*', ' *', ' *'])\n call assert_beeps('normal! 3gg]/')\n %d\n call setline(1, ['', ' *', ' *', ' */'])\n call assert_beeps('normal! 4gg[/')\n %d\n call setline(1, ' /* comment */')\n normal! 15|[/\n call assert_equal(9, col('.'))\n normal! 15|]/\n call assert_equal(21, col('.'))\n call setline(1, ' comment */')\n call assert_beeps('normal! 15|[/')\n call setline(1, ' /* comment')\n call assert_beeps('normal! 15|]/')\n close!\nendfunc",
"\" Test for the 'taglength' option\nfunc Test_tag_length()\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"tame\\tXfile1\\t1;\",\n \\ \"tape\\tXfile2\\t1;\"], 'Xtags')\n call writefile(['tame'], 'Xfile1')\n call writefile(['tape'], 'Xfile2')",
" \" Jumping to the tag 'tape', should instead jump to 'tame'\n new\n set taglength=2\n tag tape\n call assert_equal('Xfile1', @%)\n \" Tag search should jump to the right tag\n enew\n tag /^tape$\n call assert_equal('Xfile2', @%)",
" call delete('Xtags')\n call delete('Xfile1')\n call delete('Xfile2')\n set tags& taglength&\nendfunc",
"\" Tests for errors in a tags file\nfunc Test_tagfile_errors()\n set tags=Xtags",
" \" missing search pattern or line number for a tag\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo\\tXfile\\t\"], 'Xtags', 'b')\n call writefile(['foo'], 'Xfile')",
" enew\n tag foo\n call assert_equal('', @%)\n let caught_431 = v:false\n try\n eval taglist('.*')\n catch /:E431:/\n let caught_431 = v:true\n endtry\n call assert_equal(v:true, caught_431)",
" \" tag name and file name are not separated by a tab\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo Xfile 1\"], 'Xtags')\n call assert_fails('tag foo', 'E431:')",
" \" file name and search pattern are not separated by a tab\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo\\tXfile 1;\"], 'Xtags')\n call assert_fails('tag foo', 'E431:')",
" call delete('Xtags')\n call delete('Xfile')\n set tags&\nendfunc",
"\" When :stag fails to open the file, should close the new window\nfunc Test_stag_close_window_on_error()\n new | only\n set tags=Xtags\n call writefile([\"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"foo\\tXfile\\t1\"], 'Xtags')\n call writefile(['foo'], 'Xfile')\n call writefile([], '.Xfile.swp')\n \" Remove the catch-all that runtest.vim adds\n au! SwapExists\n augroup StagTest\n au!\n autocmd SwapExists Xfile let v:swapchoice='q'\n augroup END",
" stag foo\n call assert_equal(1, winnr('$'))\n call assert_equal('', @%)",
" augroup StagTest\n au!\n augroup END\n call delete('Xfile')\n call delete('.Xfile.swp')\n set tags&\nendfunc",
"\" Test for 'tagbsearch' (binary search)\nfunc Test_tagbsearch()\n \" If a tags file header says the tags are sorted, but the tags are actually\n \" unsorted, then binary search should fail and linear search should work.\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t1\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"third\\tXfoo\\t3\",\n \\ \"second\\tXfoo\\t2\",\n \\ \"first\\tXfoo\\t1\"],\n \\ 'Xtags')\n set tags=Xtags\n let code =<< trim [CODE]\n int first() {}\n int second() {}\n int third() {}\n [CODE]\n call writefile(code, 'Xfoo')",
" enew\n set tagbsearch\n call assert_fails('tag first', 'E426:')\n call assert_equal('', bufname())\n call assert_fails('tag second', 'E426:')\n call assert_equal('', bufname())\n tag third\n call assert_equal('Xfoo', bufname())\n call assert_equal(3, line('.'))\n %bw!",
" set notagbsearch\n tag first\n call assert_equal('Xfoo', bufname())\n call assert_equal(1, line('.'))\n enew\n tag second\n call assert_equal('Xfoo', bufname())\n call assert_equal(2, line('.'))\n enew\n tag third\n call assert_equal('Xfoo', bufname())\n call assert_equal(3, line('.'))\n %bw!",
" \" If a tags file header says the tags are unsorted, but the tags are\n \" actually sorted, then binary search should work.\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t0\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"first\\tXfoo\\t1\",\n \\ \"second\\tXfoo\\t2\",\n \\ \"third\\tXfoo\\t3\"],\n \\ 'Xtags')",
" set tagbsearch\n tag first\n call assert_equal('Xfoo', bufname())\n call assert_equal(1, line('.'))\n enew\n tag second\n call assert_equal('Xfoo', bufname())\n call assert_equal(2, line('.'))\n enew\n tag third\n call assert_equal('Xfoo', bufname())\n call assert_equal(3, line('.'))\n %bw!",
" \" Binary search fails on EOF\n call writefile([\n \\ \"!_TAG_FILE_ENCODING\\tutf-8\\t//\",\n \\ \"!_TAG_FILE_SORTED\\t1\\t/0=unsorted, 1=sorted, 2=foldcase/\",\n \\ \"bar\\tXfoo\\t1\",\n \\ \"foo\\tXfoo\\t2\"],\n \\ 'Xtags')\n call assert_fails('tag bbb', 'E426:')",
" call delete('Xtags')\n call delete('Xfoo')\n set tags& tagbsearch&\nendfunc",
"\" vim: shiftwidth=2 sts=2 expandtab"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [4474, 1400, 736], "buggy_code_start_loc": [4466, 1400, 736], "filenames": ["src/normal.c", "src/testdir/test_tagjump.vim", "src/version.c"], "fixing_code_end_loc": [4481, 1407, 739], "fixing_code_start_loc": [4467, 1401, 737], "message": "Use After Free in GitHub repository vim/vim prior to 8.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "C9328925-FDFF-4283-A085-666EB6616272", "versionEndExcluding": "8.2.5024", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*", "matchCriteriaId": "71E032AD-F827-4944-9699-BB1E6D4233FC", "versionEndExcluding": "13.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use After Free in GitHub repository vim/vim prior to 8.2."}, {"lang": "es", "value": "Un Uso de Memoria Previamente Liberada en el repositorio de GitHub vim/vim versiones anteriores a 8.2"}], "evaluatorComment": null, "id": "CVE-2022-1898", "lastModified": "2023-05-03T12:15:36.347", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-05-27T09:15:08.030", "references": [{"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/28"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/41"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/45aad635-c2f1-47ca-a4f9-db5b25979cea"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00014.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZSLFIKFYU5Y2KM5EJKQNYHWRUBDQ4GJ/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMFHBC5OQXDPV2SDYA2JUQGVCPYASTJB/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TYNK6SDCMOLQJOI3B4AOE66P2G2IH4ZM/"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/202208-32"}, {"source": "security@huntr.dev", "tags": null, "url": "https://security.gentoo.org/glsa/202305-16"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://support.apple.com/kb/HT213488"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, "type": "CWE-416"}
| 103
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\t\tby Bram Moolenaar\n *\n * Do \":help uganda\" in Vim to read copying and usage conditions.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */",
"#include \"vim.h\"",
"/*\n * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)\n * It has been changed beyond recognition since then.\n *\n * Differences between version 7.4 and 8.x can be found with \":help version8\".\n * Differences between version 6.4 and 7.x can be found with \":help version7\".\n * Differences between version 5.8 and 6.x can be found with \":help version6\".\n * Differences between version 4.x and 5.x can be found with \":help version5\".\n * Differences between version 3.0 and 4.x can be found with \":help version4\".\n * All the remarks about older versions have been removed, they are not very\n * interesting.\n */",
"#include \"version.h\"",
"char\t\t*Version = VIM_VERSION_SHORT;\nstatic char\t*mediumVersion = VIM_VERSION_MEDIUM;",
"#if defined(HAVE_DATE_TIME) || defined(PROTO)\n# if (defined(VMS) && defined(VAXC)) || defined(PROTO)\nchar\tlongVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)\n\t\t\t\t\t\t + sizeof(__TIME__) + 3];",
" void\ninit_longVersion(void)\n{\n /*\n * Construct the long version string. Necessary because\n * VAX C can't concatenate strings in the preprocessor.\n */\n strcpy(longVersion, VIM_VERSION_LONG_DATE);\n#ifdef BUILD_DATE\n strcat(longVersion, BUILD_DATE);\n#else\n strcat(longVersion, __DATE__);\n strcat(longVersion, \" \");\n strcat(longVersion, __TIME__);\n#endif\n strcat(longVersion, \")\");\n}",
"# else\nchar\t*longVersion = NULL;",
" void\ninit_longVersion(void)\n{\n if (longVersion == NULL)\n {\n#ifdef BUILD_DATE\n\tchar *date_time = BUILD_DATE;\n#else\n\tchar *date_time = __DATE__ \" \" __TIME__;\n#endif\n\tchar *msg = _(\"%s (%s, compiled %s)\");\n\tsize_t len = strlen(msg)\n\t\t + strlen(VIM_VERSION_LONG_ONLY)\n\t\t + strlen(VIM_VERSION_DATE_ONLY)\n\t\t + strlen(date_time);",
"\tlongVersion = alloc(len);\n\tif (longVersion == NULL)\n\t longVersion = VIM_VERSION_LONG;\n\telse\n\t vim_snprintf(longVersion, len, msg,\n\t\t VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);\n }\n}\n# endif\n#else\nchar\t*longVersion = VIM_VERSION_LONG;",
" void\ninit_longVersion(void)\n{\n // nothing to do\n}\n#endif",
"static char *(features[]) =\n{\n#ifdef HAVE_ACL\n\t\"+acl\",\n#else\n\t\"-acl\",\n#endif\n#ifdef AMIGA\t\t// only for Amiga systems\n# ifdef FEAT_ARP\n\t\"+ARP\",\n# else\n\t\"-ARP\",\n# endif\n#endif\n#ifdef FEAT_ARABIC\n\t\"+arabic\",\n#else\n\t\"-arabic\",\n#endif\n\t\"+autocmd\",\n#ifdef FEAT_AUTOCHDIR\n \"+autochdir\",\n#else\n \"-autochdir\",\n#endif\n#ifdef FEAT_AUTOSERVERNAME\n\t\"+autoservername\",\n#else\n\t\"-autoservername\",\n#endif\n#ifdef FEAT_BEVAL_GUI\n\t\"+balloon_eval\",\n#else\n\t\"-balloon_eval\",\n#endif\n#ifdef FEAT_BEVAL_TERM\n\t\"+balloon_eval_term\",\n#else\n\t\"-balloon_eval_term\",\n#endif\n#ifdef FEAT_BROWSE\n\t\"+browse\",\n#else\n\t\"-browse\",\n#endif\n#ifdef NO_BUILTIN_TCAPS\n\t\"-builtin_terms\",\n#endif\n#ifdef SOME_BUILTIN_TCAPS\n\t\"+builtin_terms\",\n#endif\n#ifdef ALL_BUILTIN_TCAPS\n\t\"++builtin_terms\",\n#endif\n#ifdef FEAT_BYTEOFF\n\t\"+byte_offset\",\n#else\n\t\"-byte_offset\",\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t\"+channel\",\n#else\n\t\"-channel\",\n#endif\n\t\"+cindent\",\n#ifdef FEAT_CLIENTSERVER\n\t\"+clientserver\",\n#else\n\t\"-clientserver\",\n#endif\n#ifdef FEAT_CLIPBOARD\n\t\"+clipboard\",\n#else\n\t\"-clipboard\",\n#endif\n\t\"+cmdline_compl\",\n\t\"+cmdline_hist\",\n#ifdef FEAT_CMDL_INFO\n\t\"+cmdline_info\",\n#else\n\t\"-cmdline_info\",\n#endif\n\t\"+comments\",\n#ifdef FEAT_CONCEAL\n\t\"+conceal\",\n#else\n\t\"-conceal\",\n#endif\n#ifdef FEAT_CRYPT\n\t\"+cryptv\",\n#else\n\t\"-cryptv\",\n#endif\n#ifdef FEAT_CSCOPE\n\t\"+cscope\",\n#else\n\t\"-cscope\",\n#endif\n\t\"+cursorbind\",\n#ifdef CURSOR_SHAPE\n\t\"+cursorshape\",\n#else\n\t\"-cursorshape\",\n#endif\n#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)\n\t\"+dialog_con_gui\",\n#else\n# if defined(FEAT_CON_DIALOG)\n\t\"+dialog_con\",\n# else\n# if defined(FEAT_GUI_DIALOG)\n\t\"+dialog_gui\",\n# else\n\t\"-dialog\",\n# endif\n# endif\n#endif\n#ifdef FEAT_DIFF\n\t\"+diff\",\n#else\n\t\"-diff\",\n#endif\n#ifdef FEAT_DIGRAPHS\n\t\"+digraphs\",\n#else\n\t\"-digraphs\",\n#endif\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_DIRECTX\n\t\"+directx\",\n# else\n\t\"-directx\",\n# endif\n#endif\n#ifdef FEAT_DND\n\t\"+dnd\",\n#else\n\t\"-dnd\",\n#endif\n\t\"-ebcdic\",\n#ifdef FEAT_EMACS_TAGS\n\t\"+emacs_tags\",\n#else\n\t\"-emacs_tags\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+eval\",\n#else\n\t\"-eval\",\n#endif\n\t\"+ex_extra\",\n#ifdef FEAT_SEARCH_EXTRA\n\t\"+extra_search\",\n#else\n\t\"-extra_search\",\n#endif\n\t\"-farsi\",\n#ifdef FEAT_SEARCHPATH\n\t\"+file_in_path\",\n#else\n\t\"-file_in_path\",\n#endif\n#ifdef FEAT_FIND_ID\n\t\"+find_in_path\",\n#else\n\t\"-find_in_path\",\n#endif\n#ifdef FEAT_FLOAT\n\t\"+float\",\n#else\n\t\"-float\",\n#endif\n#ifdef FEAT_FOLDING\n\t\"+folding\",\n#else\n\t\"-folding\",\n#endif\n#ifdef FEAT_FOOTER\n\t\"+footer\",\n#else\n\t\"-footer\",\n#endif\n\t // only interesting on Unix systems\n#if !defined(USE_SYSTEM) && defined(UNIX)\n\t\"+fork()\",\n#endif\n#ifdef FEAT_GETTEXT\n# ifdef DYNAMIC_GETTEXT\n\t\"+gettext/dyn\",\n# else\n\t\"+gettext\",\n# endif\n#else\n\t\"-gettext\",\n#endif\n\t\"-hangul_input\",\n#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)\n# ifdef DYNAMIC_ICONV\n\t\"+iconv/dyn\",\n# else\n\t\"+iconv\",\n# endif\n#else\n\t\"-iconv\",\n#endif\n\t\"+insert_expand\",\n#ifdef FEAT_IPV6\n\t\"+ipv6\",\n#else\n\t\"-ipv6\",\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t\"+job\",\n#else\n\t\"-job\",\n#endif\n\t\"+jumplist\",\n#ifdef FEAT_KEYMAP\n\t\"+keymap\",\n#else\n\t\"-keymap\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+lambda\",\n#else\n\t\"-lambda\",\n#endif\n#ifdef FEAT_LANGMAP\n\t\"+langmap\",\n#else\n\t\"-langmap\",\n#endif\n#ifdef FEAT_LIBCALL\n\t\"+libcall\",\n#else\n\t\"-libcall\",\n#endif\n#ifdef FEAT_LINEBREAK\n\t\"+linebreak\",\n#else\n\t\"-linebreak\",\n#endif\n\t\"+lispindent\",\n\t\"+listcmds\",\n\t\"+localmap\",\n#ifdef FEAT_LUA\n# ifdef DYNAMIC_LUA\n\t\"+lua/dyn\",\n# else\n\t\"+lua\",\n# endif\n#else\n\t\"-lua\",\n#endif\n#ifdef FEAT_MENU\n\t\"+menu\",\n#else\n\t\"-menu\",\n#endif\n#ifdef FEAT_SESSION\n\t\"+mksession\",\n#else\n\t\"-mksession\",\n#endif\n\t\"+modify_fname\",\n\t\"+mouse\",\n#ifdef FEAT_MOUSESHAPE\n\t\"+mouseshape\",\n#else\n\t\"-mouseshape\",\n#endif",
"#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_MOUSE_DEC\n\t\"+mouse_dec\",\n# else\n\t\"-mouse_dec\",\n# endif\n# ifdef FEAT_MOUSE_GPM\n# ifdef DYNAMIC_GPM\n\t\"+mouse_gpm/dyn\",\n# else\n\t\"+mouse_gpm\",\n# endif\n# else\n\t\"-mouse_gpm\",\n# endif\n# ifdef FEAT_MOUSE_JSB\n\t\"+mouse_jsbterm\",\n# else\n\t\"-mouse_jsbterm\",\n# endif\n# ifdef FEAT_MOUSE_NET\n\t\"+mouse_netterm\",\n# else\n\t\"-mouse_netterm\",\n# endif\n#endif",
"#ifdef __QNX__\n# ifdef FEAT_MOUSE_PTERM\n\t\"+mouse_pterm\",\n# else\n\t\"-mouse_pterm\",\n# endif\n#endif",
"#if defined(UNIX) || defined(VMS)\n\t\"+mouse_sgr\",\n# ifdef FEAT_SYSMOUSE\n\t\"+mouse_sysmouse\",\n# else\n\t\"-mouse_sysmouse\",\n# endif\n# ifdef FEAT_MOUSE_URXVT\n\t\"+mouse_urxvt\",\n# else\n\t\"-mouse_urxvt\",\n# endif\n\t\"+mouse_xterm\",\n#endif",
"#ifdef FEAT_MBYTE_IME\n# ifdef DYNAMIC_IME\n\t\"+multi_byte_ime/dyn\",\n# else\n\t\"+multi_byte_ime\",\n# endif\n#else\n\t\"+multi_byte\",\n#endif\n#ifdef FEAT_MULTI_LANG\n\t\"+multi_lang\",\n#else\n\t\"-multi_lang\",\n#endif\n#ifdef FEAT_MZSCHEME\n# ifdef DYNAMIC_MZSCHEME\n\t\"+mzscheme/dyn\",\n# else\n\t\"+mzscheme\",\n# endif\n#else\n\t\"-mzscheme\",\n#endif\n#ifdef FEAT_NETBEANS_INTG\n\t\"+netbeans_intg\",\n#else\n\t\"-netbeans_intg\",\n#endif\n\t\"+num64\",\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_OLE\n\t\"+ole\",\n# else\n\t\"-ole\",\n# endif\n#endif\n#ifdef FEAT_EVAL\n\t\"+packages\",\n#else\n\t\"-packages\",\n#endif\n#ifdef FEAT_PATH_EXTRA\n\t\"+path_extra\",\n#else\n\t\"-path_extra\",\n#endif\n#ifdef FEAT_PERL\n# ifdef DYNAMIC_PERL\n\t\"+perl/dyn\",\n# else\n\t\"+perl\",\n# endif\n#else\n\t\"-perl\",\n#endif\n#ifdef FEAT_PERSISTENT_UNDO\n\t\"+persistent_undo\",\n#else\n\t\"-persistent_undo\",\n#endif\n#ifdef FEAT_PROP_POPUP\n\t\"+popupwin\",\n#else\n\t\"-popupwin\",\n#endif\n#ifdef FEAT_PRINTER\n# ifdef FEAT_POSTSCRIPT\n\t\"+postscript\",\n# else\n\t\"-postscript\",\n# endif\n\t\"+printer\",\n#else\n\t\"-printer\",\n#endif\n#ifdef FEAT_PROFILE\n\t\"+profile\",\n#else\n\t\"-profile\",\n#endif\n#ifdef FEAT_PYTHON\n# ifdef DYNAMIC_PYTHON\n\t\"+python/dyn\",\n# else\n\t\"+python\",\n# endif\n#else\n\t\"-python\",\n#endif\n#ifdef FEAT_PYTHON3\n# ifdef DYNAMIC_PYTHON3\n\t\"+python3/dyn\",\n# else\n\t\"+python3\",\n# endif\n#else\n\t\"-python3\",\n#endif\n#ifdef FEAT_QUICKFIX\n\t\"+quickfix\",\n#else\n\t\"-quickfix\",\n#endif\n#ifdef FEAT_RELTIME\n\t\"+reltime\",\n#else\n\t\"-reltime\",\n#endif\n#ifdef FEAT_RIGHTLEFT\n\t\"+rightleft\",\n#else\n\t\"-rightleft\",\n#endif\n#ifdef FEAT_RUBY\n# ifdef DYNAMIC_RUBY\n\t\"+ruby/dyn\",\n# else\n\t\"+ruby\",\n# endif\n#else\n\t\"-ruby\",\n#endif\n\t\"+scrollbind\",\n#ifdef FEAT_SIGNS\n\t\"+signs\",\n#else\n\t\"-signs\",\n#endif\n\t\"+smartindent\",\n#ifdef FEAT_SODIUM\n# ifdef DYNAMIC_SODIUM\n\t\"+sodium/dyn\",\n# else\n\t\"+sodium\",\n# endif\n#else\n\t\"-sodium\",\n#endif\n#ifdef FEAT_SOUND\n\t\"+sound\",\n#else\n\t\"-sound\",\n#endif\n#ifdef FEAT_SPELL\n\t\"+spell\",\n#else\n\t\"-spell\",\n#endif\n#ifdef STARTUPTIME\n\t\"+startuptime\",\n#else\n\t\"-startuptime\",\n#endif\n#ifdef FEAT_STL_OPT\n\t\"+statusline\",\n#else\n\t\"-statusline\",\n#endif\n\t\"-sun_workshop\",\n#ifdef FEAT_SYN_HL\n\t\"+syntax\",\n#else\n\t\"-syntax\",\n#endif\n\t // only interesting on Unix systems\n#if defined(USE_SYSTEM) && defined(UNIX)\n\t\"+system()\",\n#endif\n\t\"+tag_binary\",\n\t\"-tag_old_static\",\n\t\"-tag_any_white\",\n#ifdef FEAT_TCL\n# ifdef DYNAMIC_TCL\n\t\"+tcl/dyn\",\n# else\n\t\"+tcl\",\n# endif\n#else\n\t\"-tcl\",\n#endif\n#ifdef FEAT_TERMGUICOLORS\n\t\"+termguicolors\",\n#else\n\t\"-termguicolors\",\n#endif\n#ifdef FEAT_TERMINAL\n\t\"+terminal\",\n#else\n\t\"-terminal\",\n#endif\n#if defined(UNIX)\n// only Unix can have terminfo instead of termcap\n# ifdef TERMINFO\n\t\"+terminfo\",\n# else\n\t\"-terminfo\",\n# endif\n#endif\n#ifdef FEAT_TERMRESPONSE\n\t\"+termresponse\",\n#else\n\t\"-termresponse\",\n#endif\n#ifdef FEAT_TEXTOBJ\n\t\"+textobjects\",\n#else\n\t\"-textobjects\",\n#endif\n#ifdef FEAT_PROP_POPUP\n\t\"+textprop\",\n#else\n\t\"-textprop\",\n#endif\n#if !defined(UNIX)\n// unix always includes termcap support\n# ifdef HAVE_TGETENT\n\t\"+tgetent\",\n# else\n\t\"-tgetent\",\n# endif\n#endif\n#ifdef FEAT_TIMERS\n\t\"+timers\",\n#else\n\t\"-timers\",\n#endif\n\t\"+title\",\n#ifdef FEAT_TOOLBAR\n\t\"+toolbar\",\n#else\n\t\"-toolbar\",\n#endif\n\t\"+user_commands\",\n#ifdef FEAT_VARTABS\n\t\"+vartabs\",\n#else\n\t\"-vartabs\",\n#endif\n\t\"+vertsplit\",\n\t\"+vim9script\",\n#ifdef FEAT_VIMINFO\n\t\"+viminfo\",\n#else\n\t\"-viminfo\",\n#endif\n\t\"+virtualedit\",\n\t\"+visual\",\n\t\"+visualextra\",\n\t\"+vreplace\",\n#ifdef MSWIN\n# ifdef FEAT_VTP\n\t\"+vtp\",\n# else\n\t\"-vtp\",\n# endif\n#endif\n#ifdef FEAT_WILDIGN\n\t\"+wildignore\",\n#else\n\t\"-wildignore\",\n#endif\n#ifdef FEAT_WILDMENU\n\t\"+wildmenu\",\n#else\n\t\"-wildmenu\",\n#endif\n\t\"+windows\",\n#ifdef FEAT_WRITEBACKUP\n\t\"+writebackup\",\n#else\n\t\"-writebackup\",\n#endif\n#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_X11\n\t\"+X11\",\n# else\n\t\"-X11\",\n# endif\n#endif\n#ifdef FEAT_XFONTSET\n\t\"+xfontset\",\n#else\n\t\"-xfontset\",\n#endif\n#ifdef FEAT_XIM\n\t\"+xim\",\n#else\n\t\"-xim\",\n#endif\n#if defined(MSWIN)\n# ifdef FEAT_XPM_W32\n\t\"+xpm_w32\",\n# else\n\t\"-xpm_w32\",\n# endif\n#elif defined(HAVE_XPM)\n\t\"+xpm\",\n#else\n\t\"-xpm\",\n#endif\n#if defined(UNIX) || defined(VMS)\n# if defined(USE_XSMP_INTERACT)\n\t\"+xsmp_interact\",\n# elif defined(USE_XSMP)\n\t\"+xsmp\",\n# else\n\t\"-xsmp\",\n# endif\n# ifdef FEAT_XCLIPBOARD\n\t\"+xterm_clipboard\",\n# else\n\t\"-xterm_clipboard\",\n# endif\n#endif\n#ifdef FEAT_XTERM_SAVE\n\t\"+xterm_save\",\n#else\n\t\"-xterm_save\",\n#endif\n\tNULL\n};",
"static int included_patches[] =\n{ /* Add new patch number below this line */",
"",
"/**/\n 5023,\n/**/\n 5022,\n/**/\n 5021,\n/**/\n 5020,\n/**/\n 5019,\n/**/\n 5018,\n/**/\n 5017,\n/**/\n 5016,\n/**/\n 5015,\n/**/\n 5014,\n/**/\n 5013,\n/**/\n 5012,\n/**/\n 5011,\n/**/\n 5010,\n/**/\n 5009,\n/**/\n 5008,\n/**/\n 5007,\n/**/\n 5006,\n/**/\n 5005,\n/**/\n 5004,\n/**/\n 5003,\n/**/\n 5002,\n/**/\n 5001,\n/**/\n 5000,\n/**/\n 4999,\n/**/\n 4998,\n/**/\n 4997,\n/**/\n 4996,\n/**/\n 4995,\n/**/\n 4994,\n/**/\n 4993,\n/**/\n 4992,\n/**/\n 4991,\n/**/\n 4990,\n/**/\n 4989,\n/**/\n 4988,\n/**/\n 4987,\n/**/\n 4986,\n/**/\n 4985,\n/**/\n 4984,\n/**/\n 4983,\n/**/\n 4982,\n/**/\n 4981,\n/**/\n 4980,\n/**/\n 4979,\n/**/\n 4978,\n/**/\n 4977,\n/**/\n 4976,\n/**/\n 4975,\n/**/\n 4974,\n/**/\n 4973,\n/**/\n 4972,\n/**/\n 4971,\n/**/\n 4970,\n/**/\n 4969,\n/**/\n 4968,\n/**/\n 4967,\n/**/\n 4966,\n/**/\n 4965,\n/**/\n 4964,\n/**/\n 4963,\n/**/\n 4962,\n/**/\n 4961,\n/**/\n 4960,\n/**/\n 4959,\n/**/\n 4958,\n/**/\n 4957,\n/**/\n 4956,\n/**/\n 4955,\n/**/\n 4954,\n/**/\n 4953,\n/**/\n 4952,\n/**/\n 4951,\n/**/\n 4950,\n/**/\n 4949,\n/**/\n 4948,\n/**/\n 4947,\n/**/\n 4946,\n/**/\n 4945,\n/**/\n 4944,\n/**/\n 4943,\n/**/\n 4942,\n/**/\n 4941,\n/**/\n 4940,\n/**/\n 4939,\n/**/\n 4938,\n/**/\n 4937,\n/**/\n 4936,\n/**/\n 4935,\n/**/\n 4934,\n/**/\n 4933,\n/**/\n 4932,\n/**/\n 4931,\n/**/\n 4930,\n/**/\n 4929,\n/**/\n 4928,\n/**/\n 4927,\n/**/\n 4926,\n/**/\n 4925,\n/**/\n 4924,\n/**/\n 4923,\n/**/\n 4922,\n/**/\n 4921,\n/**/\n 4920,\n/**/\n 4919,\n/**/\n 4918,\n/**/\n 4917,\n/**/\n 4916,\n/**/\n 4915,\n/**/\n 4914,\n/**/\n 4913,\n/**/\n 4912,\n/**/\n 4911,\n/**/\n 4910,\n/**/\n 4909,\n/**/\n 4908,\n/**/\n 4907,\n/**/\n 4906,\n/**/\n 4905,\n/**/\n 4904,\n/**/\n 4903,\n/**/\n 4902,\n/**/\n 4901,\n/**/\n 4900,\n/**/\n 4899,\n/**/\n 4898,\n/**/\n 4897,\n/**/\n 4896,\n/**/\n 4895,\n/**/\n 4894,\n/**/\n 4893,\n/**/\n 4892,\n/**/\n 4891,\n/**/\n 4890,\n/**/\n 4889,\n/**/\n 4888,\n/**/\n 4887,\n/**/\n 4886,\n/**/\n 4885,\n/**/\n 4884,\n/**/\n 4883,\n/**/\n 4882,\n/**/\n 4881,\n/**/\n 4880,\n/**/\n 4879,\n/**/\n 4878,\n/**/\n 4877,\n/**/\n 4876,\n/**/\n 4875,\n/**/\n 4874,\n/**/\n 4873,\n/**/\n 4872,\n/**/\n 4871,\n/**/\n 4870,\n/**/\n 4869,\n/**/\n 4868,\n/**/\n 4867,\n/**/\n 4866,\n/**/\n 4865,\n/**/\n 4864,\n/**/\n 4863,\n/**/\n 4862,\n/**/\n 4861,\n/**/\n 4860,\n/**/\n 4859,\n/**/\n 4858,\n/**/\n 4857,\n/**/\n 4856,\n/**/\n 4855,\n/**/\n 4854,\n/**/\n 4853,\n/**/\n 4852,\n/**/\n 4851,\n/**/\n 4850,\n/**/\n 4849,\n/**/\n 4848,\n/**/\n 4847,\n/**/\n 4846,\n/**/\n 4845,\n/**/\n 4844,\n/**/\n 4843,\n/**/\n 4842,\n/**/\n 4841,\n/**/\n 4840,\n/**/\n 4839,\n/**/\n 4838,\n/**/\n 4837,\n/**/\n 4836,\n/**/\n 4835,\n/**/\n 4834,\n/**/\n 4833,\n/**/\n 4832,\n/**/\n 4831,\n/**/\n 4830,\n/**/\n 4829,\n/**/\n 4828,\n/**/\n 4827,\n/**/\n 4826,\n/**/\n 4825,\n/**/\n 4824,\n/**/\n 4823,\n/**/\n 4822,\n/**/\n 4821,\n/**/\n 4820,\n/**/\n 4819,\n/**/\n 4818,\n/**/\n 4817,\n/**/\n 4816,\n/**/\n 4815,\n/**/\n 4814,\n/**/\n 4813,\n/**/\n 4812,\n/**/\n 4811,\n/**/\n 4810,\n/**/\n 4809,\n/**/\n 4808,\n/**/\n 4807,\n/**/\n 4806,\n/**/\n 4805,\n/**/\n 4804,\n/**/\n 4803,\n/**/\n 4802,\n/**/\n 4801,\n/**/\n 4800,\n/**/\n 4799,\n/**/\n 4798,\n/**/\n 4797,\n/**/\n 4796,\n/**/\n 4795,\n/**/\n 4794,\n/**/\n 4793,\n/**/\n 4792,\n/**/\n 4791,\n/**/\n 4790,\n/**/\n 4789,\n/**/\n 4788,\n/**/\n 4787,\n/**/\n 4786,\n/**/\n 4785,\n/**/\n 4784,\n/**/\n 4783,\n/**/\n 4782,\n/**/\n 4781,\n/**/\n 4780,\n/**/\n 4779,\n/**/\n 4778,\n/**/\n 4777,\n/**/\n 4776,\n/**/\n 4775,\n/**/\n 4774,\n/**/\n 4773,\n/**/\n 4772,\n/**/\n 4771,\n/**/\n 4770,\n/**/\n 4769,\n/**/\n 4768,\n/**/\n 4767,\n/**/\n 4766,\n/**/\n 4765,\n/**/\n 4764,\n/**/\n 4763,\n/**/\n 4762,\n/**/\n 4761,\n/**/\n 4760,\n/**/\n 4759,\n/**/\n 4758,\n/**/\n 4757,\n/**/\n 4756,\n/**/\n 4755,\n/**/\n 4754,\n/**/\n 4753,\n/**/\n 4752,\n/**/\n 4751,\n/**/\n 4750,\n/**/\n 4749,\n/**/\n 4748,\n/**/\n 4747,\n/**/\n 4746,\n/**/\n 4745,\n/**/\n 4744,\n/**/\n 4743,\n/**/\n 4742,\n/**/\n 4741,\n/**/\n 4740,\n/**/\n 4739,\n/**/\n 4738,\n/**/\n 4737,\n/**/\n 4736,\n/**/\n 4735,\n/**/\n 4734,\n/**/\n 4733,\n/**/\n 4732,\n/**/\n 4731,\n/**/\n 4730,\n/**/\n 4729,\n/**/\n 4728,\n/**/\n 4727,\n/**/\n 4726,\n/**/\n 4725,\n/**/\n 4724,\n/**/\n 4723,\n/**/\n 4722,\n/**/\n 4721,\n/**/\n 4720,\n/**/\n 4719,\n/**/\n 4718,\n/**/\n 4717,\n/**/\n 4716,\n/**/\n 4715,\n/**/\n 4714,\n/**/\n 4713,\n/**/\n 4712,\n/**/\n 4711,\n/**/\n 4710,\n/**/\n 4709,\n/**/\n 4708,\n/**/\n 4707,\n/**/\n 4706,\n/**/\n 4705,\n/**/\n 4704,\n/**/\n 4703,\n/**/\n 4702,\n/**/\n 4701,\n/**/\n 4700,\n/**/\n 4699,\n/**/\n 4698,\n/**/\n 4697,\n/**/\n 4696,\n/**/\n 4695,\n/**/\n 4694,\n/**/\n 4693,\n/**/\n 4692,\n/**/\n 4691,\n/**/\n 4690,\n/**/\n 4689,\n/**/\n 4688,\n/**/\n 4687,\n/**/\n 4686,\n/**/\n 4685,\n/**/\n 4684,\n/**/\n 4683,\n/**/\n 4682,\n/**/\n 4681,\n/**/\n 4680,\n/**/\n 4679,\n/**/\n 4678,\n/**/\n 4677,\n/**/\n 4676,\n/**/\n 4675,\n/**/\n 4674,\n/**/\n 4673,\n/**/\n 4672,\n/**/\n 4671,\n/**/\n 4670,\n/**/\n 4669,\n/**/\n 4668,\n/**/\n 4667,\n/**/\n 4666,\n/**/\n 4665,\n/**/\n 4664,\n/**/\n 4663,\n/**/\n 4662,\n/**/\n 4661,\n/**/\n 4660,\n/**/\n 4659,\n/**/\n 4658,\n/**/\n 4657,\n/**/\n 4656,\n/**/\n 4655,\n/**/\n 4654,\n/**/\n 4653,\n/**/\n 4652,\n/**/\n 4651,\n/**/\n 4650,\n/**/\n 4649,\n/**/\n 4648,\n/**/\n 4647,\n/**/\n 4646,\n/**/\n 4645,\n/**/\n 4644,\n/**/\n 4643,\n/**/\n 4642,\n/**/\n 4641,\n/**/\n 4640,\n/**/\n 4639,\n/**/\n 4638,\n/**/\n 4637,\n/**/\n 4636,\n/**/\n 4635,\n/**/\n 4634,\n/**/\n 4633,\n/**/\n 4632,\n/**/\n 4631,\n/**/\n 4630,\n/**/\n 4629,\n/**/\n 4628,\n/**/\n 4627,\n/**/\n 4626,\n/**/\n 4625,\n/**/\n 4624,\n/**/\n 4623,\n/**/\n 4622,\n/**/\n 4621,\n/**/\n 4620,\n/**/\n 4619,\n/**/\n 4618,\n/**/\n 4617,\n/**/\n 4616,\n/**/\n 4615,\n/**/\n 4614,\n/**/\n 4613,\n/**/\n 4612,\n/**/\n 4611,\n/**/\n 4610,\n/**/\n 4609,\n/**/\n 4608,\n/**/\n 4607,\n/**/\n 4606,\n/**/\n 4605,\n/**/\n 4604,\n/**/\n 4603,\n/**/\n 4602,\n/**/\n 4601,\n/**/\n 4600,\n/**/\n 4599,\n/**/\n 4598,\n/**/\n 4597,\n/**/\n 4596,\n/**/\n 4595,\n/**/\n 4594,\n/**/\n 4593,\n/**/\n 4592,\n/**/\n 4591,\n/**/\n 4590,\n/**/\n 4589,\n/**/\n 4588,\n/**/\n 4587,\n/**/\n 4586,\n/**/\n 4585,\n/**/\n 4584,\n/**/\n 4583,\n/**/\n 4582,\n/**/\n 4581,\n/**/\n 4580,\n/**/\n 4579,\n/**/\n 4578,\n/**/\n 4577,\n/**/\n 4576,\n/**/\n 4575,\n/**/\n 4574,\n/**/\n 4573,\n/**/\n 4572,\n/**/\n 4571,\n/**/\n 4570,\n/**/\n 4569,\n/**/\n 4568,\n/**/\n 4567,\n/**/\n 4566,\n/**/\n 4565,\n/**/\n 4564,\n/**/\n 4563,\n/**/\n 4562,\n/**/\n 4561,\n/**/\n 4560,\n/**/\n 4559,\n/**/\n 4558,\n/**/\n 4557,\n/**/\n 4556,\n/**/\n 4555,\n/**/\n 4554,\n/**/\n 4553,\n/**/\n 4552,\n/**/\n 4551,\n/**/\n 4550,\n/**/\n 4549,\n/**/\n 4548,\n/**/\n 4547,\n/**/\n 4546,\n/**/\n 4545,\n/**/\n 4544,\n/**/\n 4543,\n/**/\n 4542,\n/**/\n 4541,\n/**/\n 4540,\n/**/\n 4539,\n/**/\n 4538,\n/**/\n 4537,\n/**/\n 4536,\n/**/\n 4535,\n/**/\n 4534,\n/**/\n 4533,\n/**/\n 4532,\n/**/\n 4531,\n/**/\n 4530,\n/**/\n 4529,\n/**/\n 4528,\n/**/\n 4527,\n/**/\n 4526,\n/**/\n 4525,\n/**/\n 4524,\n/**/\n 4523,\n/**/\n 4522,\n/**/\n 4521,\n/**/\n 4520,\n/**/\n 4519,\n/**/\n 4518,\n/**/\n 4517,\n/**/\n 4516,\n/**/\n 4515,\n/**/\n 4514,\n/**/\n 4513,\n/**/\n 4512,\n/**/\n 4511,\n/**/\n 4510,\n/**/\n 4509,\n/**/\n 4508,\n/**/\n 4507,\n/**/\n 4506,\n/**/\n 4505,\n/**/\n 4504,\n/**/\n 4503,\n/**/\n 4502,\n/**/\n 4501,\n/**/\n 4500,\n/**/\n 4499,\n/**/\n 4498,\n/**/\n 4497,\n/**/\n 4496,\n/**/\n 4495,\n/**/\n 4494,\n/**/\n 4493,\n/**/\n 4492,\n/**/\n 4491,\n/**/\n 4490,\n/**/\n 4489,\n/**/\n 4488,\n/**/\n 4487,\n/**/\n 4486,\n/**/\n 4485,\n/**/\n 4484,\n/**/\n 4483,\n/**/\n 4482,\n/**/\n 4481,\n/**/\n 4480,\n/**/\n 4479,\n/**/\n 4478,\n/**/\n 4477,\n/**/\n 4476,\n/**/\n 4475,\n/**/\n 4474,\n/**/\n 4473,\n/**/\n 4472,\n/**/\n 4471,\n/**/\n 4470,\n/**/\n 4469,\n/**/\n 4468,\n/**/\n 4467,\n/**/\n 4466,\n/**/\n 4465,\n/**/\n 4464,\n/**/\n 4463,\n/**/\n 4462,\n/**/\n 4461,\n/**/\n 4460,\n/**/\n 4459,\n/**/\n 4458,\n/**/\n 4457,\n/**/\n 4456,\n/**/\n 4455,\n/**/\n 4454,\n/**/\n 4453,\n/**/\n 4452,\n/**/\n 4451,\n/**/\n 4450,\n/**/\n 4449,\n/**/\n 4448,\n/**/\n 4447,\n/**/\n 4446,\n/**/\n 4445,\n/**/\n 4444,\n/**/\n 4443,\n/**/\n 4442,\n/**/\n 4441,\n/**/\n 4440,\n/**/\n 4439,\n/**/\n 4438,\n/**/\n 4437,\n/**/\n 4436,\n/**/\n 4435,\n/**/\n 4434,\n/**/\n 4433,\n/**/\n 4432,\n/**/\n 4431,\n/**/\n 4430,\n/**/\n 4429,\n/**/\n 4428,\n/**/\n 4427,\n/**/\n 4426,\n/**/\n 4425,\n/**/\n 4424,\n/**/\n 4423,\n/**/\n 4422,\n/**/\n 4421,\n/**/\n 4420,\n/**/\n 4419,\n/**/\n 4418,\n/**/\n 4417,\n/**/\n 4416,\n/**/\n 4415,\n/**/\n 4414,\n/**/\n 4413,\n/**/\n 4412,\n/**/\n 4411,\n/**/\n 4410,\n/**/\n 4409,\n/**/\n 4408,\n/**/\n 4407,\n/**/\n 4406,\n/**/\n 4405,\n/**/\n 4404,\n/**/\n 4403,\n/**/\n 4402,\n/**/\n 4401,\n/**/\n 4400,\n/**/\n 4399,\n/**/\n 4398,\n/**/\n 4397,\n/**/\n 4396,\n/**/\n 4395,\n/**/\n 4394,\n/**/\n 4393,\n/**/\n 4392,\n/**/\n 4391,\n/**/\n 4390,\n/**/\n 4389,\n/**/\n 4388,\n/**/\n 4387,\n/**/\n 4386,\n/**/\n 4385,\n/**/\n 4384,\n/**/\n 4383,\n/**/\n 4382,\n/**/\n 4381,\n/**/\n 4380,\n/**/\n 4379,\n/**/\n 4378,\n/**/\n 4377,\n/**/\n 4376,\n/**/\n 4375,\n/**/\n 4374,\n/**/\n 4373,\n/**/\n 4372,\n/**/\n 4371,\n/**/\n 4370,\n/**/\n 4369,\n/**/\n 4368,\n/**/\n 4367,\n/**/\n 4366,\n/**/\n 4365,\n/**/\n 4364,\n/**/\n 4363,\n/**/\n 4362,\n/**/\n 4361,\n/**/\n 4360,\n/**/\n 4359,\n/**/\n 4358,\n/**/\n 4357,\n/**/\n 4356,\n/**/\n 4355,\n/**/\n 4354,\n/**/\n 4353,\n/**/\n 4352,\n/**/\n 4351,\n/**/\n 4350,\n/**/\n 4349,\n/**/\n 4348,\n/**/\n 4347,\n/**/\n 4346,\n/**/\n 4345,\n/**/\n 4344,\n/**/\n 4343,\n/**/\n 4342,\n/**/\n 4341,\n/**/\n 4340,\n/**/\n 4339,\n/**/\n 4338,\n/**/\n 4337,\n/**/\n 4336,\n/**/\n 4335,\n/**/\n 4334,\n/**/\n 4333,\n/**/\n 4332,\n/**/\n 4331,\n/**/\n 4330,\n/**/\n 4329,\n/**/\n 4328,\n/**/\n 4327,\n/**/\n 4326,\n/**/\n 4325,\n/**/\n 4324,\n/**/\n 4323,\n/**/\n 4322,\n/**/\n 4321,\n/**/\n 4320,\n/**/\n 4319,\n/**/\n 4318,\n/**/\n 4317,\n/**/\n 4316,\n/**/\n 4315,\n/**/\n 4314,\n/**/\n 4313,\n/**/\n 4312,\n/**/\n 4311,\n/**/\n 4310,\n/**/\n 4309,\n/**/\n 4308,\n/**/\n 4307,\n/**/\n 4306,\n/**/\n 4305,\n/**/\n 4304,\n/**/\n 4303,\n/**/\n 4302,\n/**/\n 4301,\n/**/\n 4300,\n/**/\n 4299,\n/**/\n 4298,\n/**/\n 4297,\n/**/\n 4296,\n/**/\n 4295,\n/**/\n 4294,\n/**/\n 4293,\n/**/\n 4292,\n/**/\n 4291,\n/**/\n 4290,\n/**/\n 4289,\n/**/\n 4288,\n/**/\n 4287,\n/**/\n 4286,\n/**/\n 4285,\n/**/\n 4284,\n/**/\n 4283,\n/**/\n 4282,\n/**/\n 4281,\n/**/\n 4280,\n/**/\n 4279,\n/**/\n 4278,\n/**/\n 4277,\n/**/\n 4276,\n/**/\n 4275,\n/**/\n 4274,\n/**/\n 4273,\n/**/\n 4272,\n/**/\n 4271,\n/**/\n 4270,\n/**/\n 4269,\n/**/\n 4268,\n/**/\n 4267,\n/**/\n 4266,\n/**/\n 4265,\n/**/\n 4264,\n/**/\n 4263,\n/**/\n 4262,\n/**/\n 4261,\n/**/\n 4260,\n/**/\n 4259,\n/**/\n 4258,\n/**/\n 4257,\n/**/\n 4256,\n/**/\n 4255,\n/**/\n 4254,\n/**/\n 4253,\n/**/\n 4252,\n/**/\n 4251,\n/**/\n 4250,\n/**/\n 4249,\n/**/\n 4248,\n/**/\n 4247,\n/**/\n 4246,\n/**/\n 4245,\n/**/\n 4244,\n/**/\n 4243,\n/**/\n 4242,\n/**/\n 4241,\n/**/\n 4240,\n/**/\n 4239,\n/**/\n 4238,\n/**/\n 4237,\n/**/\n 4236,\n/**/\n 4235,\n/**/\n 4234,\n/**/\n 4233,\n/**/\n 4232,\n/**/\n 4231,\n/**/\n 4230,\n/**/\n 4229,\n/**/\n 4228,\n/**/\n 4227,\n/**/\n 4226,\n/**/\n 4225,\n/**/\n 4224,\n/**/\n 4223,\n/**/\n 4222,\n/**/\n 4221,\n/**/\n 4220,\n/**/\n 4219,\n/**/\n 4218,\n/**/\n 4217,\n/**/\n 4216,\n/**/\n 4215,\n/**/\n 4214,\n/**/\n 4213,\n/**/\n 4212,\n/**/\n 4211,\n/**/\n 4210,\n/**/\n 4209,\n/**/\n 4208,\n/**/\n 4207,\n/**/\n 4206,\n/**/\n 4205,\n/**/\n 4204,\n/**/\n 4203,\n/**/\n 4202,\n/**/\n 4201,\n/**/\n 4200,\n/**/\n 4199,\n/**/\n 4198,\n/**/\n 4197,\n/**/\n 4196,\n/**/\n 4195,\n/**/\n 4194,\n/**/\n 4193,\n/**/\n 4192,\n/**/\n 4191,\n/**/\n 4190,\n/**/\n 4189,\n/**/\n 4188,\n/**/\n 4187,\n/**/\n 4186,\n/**/\n 4185,\n/**/\n 4184,\n/**/\n 4183,\n/**/\n 4182,\n/**/\n 4181,\n/**/\n 4180,\n/**/\n 4179,\n/**/\n 4178,\n/**/\n 4177,\n/**/\n 4176,\n/**/\n 4175,\n/**/\n 4174,\n/**/\n 4173,\n/**/\n 4172,\n/**/\n 4171,\n/**/\n 4170,\n/**/\n 4169,\n/**/\n 4168,\n/**/\n 4167,\n/**/\n 4166,\n/**/\n 4165,\n/**/\n 4164,\n/**/\n 4163,\n/**/\n 4162,\n/**/\n 4161,\n/**/\n 4160,\n/**/\n 4159,\n/**/\n 4158,\n/**/\n 4157,\n/**/\n 4156,\n/**/\n 4155,\n/**/\n 4154,\n/**/\n 4153,\n/**/\n 4152,\n/**/\n 4151,\n/**/\n 4150,\n/**/\n 4149,\n/**/\n 4148,\n/**/\n 4147,\n/**/\n 4146,\n/**/\n 4145,\n/**/\n 4144,\n/**/\n 4143,\n/**/\n 4142,\n/**/\n 4141,\n/**/\n 4140,\n/**/\n 4139,\n/**/\n 4138,\n/**/\n 4137,\n/**/\n 4136,\n/**/\n 4135,\n/**/\n 4134,\n/**/\n 4133,\n/**/\n 4132,\n/**/\n 4131,\n/**/\n 4130,\n/**/\n 4129,\n/**/\n 4128,\n/**/\n 4127,\n/**/\n 4126,\n/**/\n 4125,\n/**/\n 4124,\n/**/\n 4123,\n/**/\n 4122,\n/**/\n 4121,\n/**/\n 4120,\n/**/\n 4119,\n/**/\n 4118,\n/**/\n 4117,\n/**/\n 4116,\n/**/\n 4115,\n/**/\n 4114,\n/**/\n 4113,\n/**/\n 4112,\n/**/\n 4111,\n/**/\n 4110,\n/**/\n 4109,\n/**/\n 4108,\n/**/\n 4107,\n/**/\n 4106,\n/**/\n 4105,\n/**/\n 4104,\n/**/\n 4103,\n/**/\n 4102,\n/**/\n 4101,\n/**/\n 4100,\n/**/\n 4099,\n/**/\n 4098,\n/**/\n 4097,\n/**/\n 4096,\n/**/\n 4095,\n/**/\n 4094,\n/**/\n 4093,\n/**/\n 4092,\n/**/\n 4091,\n/**/\n 4090,\n/**/\n 4089,\n/**/\n 4088,\n/**/\n 4087,\n/**/\n 4086,\n/**/\n 4085,\n/**/\n 4084,\n/**/\n 4083,\n/**/\n 4082,\n/**/\n 4081,\n/**/\n 4080,\n/**/\n 4079,\n/**/\n 4078,\n/**/\n 4077,\n/**/\n 4076,\n/**/\n 4075,\n/**/\n 4074,\n/**/\n 4073,\n/**/\n 4072,\n/**/\n 4071,\n/**/\n 4070,\n/**/\n 4069,\n/**/\n 4068,\n/**/\n 4067,\n/**/\n 4066,\n/**/\n 4065,\n/**/\n 4064,\n/**/\n 4063,\n/**/\n 4062,\n/**/\n 4061,\n/**/\n 4060,\n/**/\n 4059,\n/**/\n 4058,\n/**/\n 4057,\n/**/\n 4056,\n/**/\n 4055,\n/**/\n 4054,\n/**/\n 4053,\n/**/\n 4052,\n/**/\n 4051,\n/**/\n 4050,\n/**/\n 4049,\n/**/\n 4048,\n/**/\n 4047,\n/**/\n 4046,\n/**/\n 4045,\n/**/\n 4044,\n/**/\n 4043,\n/**/\n 4042,\n/**/\n 4041,\n/**/\n 4040,\n/**/\n 4039,\n/**/\n 4038,\n/**/\n 4037,\n/**/\n 4036,\n/**/\n 4035,\n/**/\n 4034,\n/**/\n 4033,\n/**/\n 4032,\n/**/\n 4031,\n/**/\n 4030,\n/**/\n 4029,\n/**/\n 4028,\n/**/\n 4027,\n/**/\n 4026,\n/**/\n 4025,\n/**/\n 4024,\n/**/\n 4023,\n/**/\n 4022,\n/**/\n 4021,\n/**/\n 4020,\n/**/\n 4019,\n/**/\n 4018,\n/**/\n 4017,\n/**/\n 4016,\n/**/\n 4015,\n/**/\n 4014,\n/**/\n 4013,\n/**/\n 4012,\n/**/\n 4011,\n/**/\n 4010,\n/**/\n 4009,\n/**/\n 4008,\n/**/\n 4007,\n/**/\n 4006,\n/**/\n 4005,\n/**/\n 4004,\n/**/\n 4003,\n/**/\n 4002,\n/**/\n 4001,\n/**/\n 4000,\n/**/\n 3999,\n/**/\n 3998,\n/**/\n 3997,\n/**/\n 3996,\n/**/\n 3995,\n/**/\n 3994,\n/**/\n 3993,\n/**/\n 3992,\n/**/\n 3991,\n/**/\n 3990,\n/**/\n 3989,\n/**/\n 3988,\n/**/\n 3987,\n/**/\n 3986,\n/**/\n 3985,\n/**/\n 3984,\n/**/\n 3983,\n/**/\n 3982,\n/**/\n 3981,\n/**/\n 3980,\n/**/\n 3979,\n/**/\n 3978,\n/**/\n 3977,\n/**/\n 3976,\n/**/\n 3975,\n/**/\n 3974,\n/**/\n 3973,\n/**/\n 3972,\n/**/\n 3971,\n/**/\n 3970,\n/**/\n 3969,\n/**/\n 3968,\n/**/\n 3967,\n/**/\n 3966,\n/**/\n 3965,\n/**/\n 3964,\n/**/\n 3963,\n/**/\n 3962,\n/**/\n 3961,\n/**/\n 3960,\n/**/\n 3959,\n/**/\n 3958,\n/**/\n 3957,\n/**/\n 3956,\n/**/\n 3955,\n/**/\n 3954,\n/**/\n 3953,\n/**/\n 3952,\n/**/\n 3951,\n/**/\n 3950,\n/**/\n 3949,\n/**/\n 3948,\n/**/\n 3947,\n/**/\n 3946,\n/**/\n 3945,\n/**/\n 3944,\n/**/\n 3943,\n/**/\n 3942,\n/**/\n 3941,\n/**/\n 3940,\n/**/\n 3939,\n/**/\n 3938,\n/**/\n 3937,\n/**/\n 3936,\n/**/\n 3935,\n/**/\n 3934,\n/**/\n 3933,\n/**/\n 3932,\n/**/\n 3931,\n/**/\n 3930,\n/**/\n 3929,\n/**/\n 3928,\n/**/\n 3927,\n/**/\n 3926,\n/**/\n 3925,\n/**/\n 3924,\n/**/\n 3923,\n/**/\n 3922,\n/**/\n 3921,\n/**/\n 3920,\n/**/\n 3919,\n/**/\n 3918,\n/**/\n 3917,\n/**/\n 3916,\n/**/\n 3915,\n/**/\n 3914,\n/**/\n 3913,\n/**/\n 3912,\n/**/\n 3911,\n/**/\n 3910,\n/**/\n 3909,\n/**/\n 3908,\n/**/\n 3907,\n/**/\n 3906,\n/**/\n 3905,\n/**/\n 3904,\n/**/\n 3903,\n/**/\n 3902,\n/**/\n 3901,\n/**/\n 3900,\n/**/\n 3899,\n/**/\n 3898,\n/**/\n 3897,\n/**/\n 3896,\n/**/\n 3895,\n/**/\n 3894,\n/**/\n 3893,\n/**/\n 3892,\n/**/\n 3891,\n/**/\n 3890,\n/**/\n 3889,\n/**/\n 3888,\n/**/\n 3887,\n/**/\n 3886,\n/**/\n 3885,\n/**/\n 3884,\n/**/\n 3883,\n/**/\n 3882,\n/**/\n 3881,\n/**/\n 3880,\n/**/\n 3879,\n/**/\n 3878,\n/**/\n 3877,\n/**/\n 3876,\n/**/\n 3875,\n/**/\n 3874,\n/**/\n 3873,\n/**/\n 3872,\n/**/\n 3871,\n/**/\n 3870,\n/**/\n 3869,\n/**/\n 3868,\n/**/\n 3867,\n/**/\n 3866,\n/**/\n 3865,\n/**/\n 3864,\n/**/\n 3863,\n/**/\n 3862,\n/**/\n 3861,\n/**/\n 3860,\n/**/\n 3859,\n/**/\n 3858,\n/**/\n 3857,\n/**/\n 3856,\n/**/\n 3855,\n/**/\n 3854,\n/**/\n 3853,\n/**/\n 3852,\n/**/\n 3851,\n/**/\n 3850,\n/**/\n 3849,\n/**/\n 3848,\n/**/\n 3847,\n/**/\n 3846,\n/**/\n 3845,\n/**/\n 3844,\n/**/\n 3843,\n/**/\n 3842,\n/**/\n 3841,\n/**/\n 3840,\n/**/\n 3839,\n/**/\n 3838,\n/**/\n 3837,\n/**/\n 3836,\n/**/\n 3835,\n/**/\n 3834,\n/**/\n 3833,\n/**/\n 3832,\n/**/\n 3831,\n/**/\n 3830,\n/**/\n 3829,\n/**/\n 3828,\n/**/\n 3827,\n/**/\n 3826,\n/**/\n 3825,\n/**/\n 3824,\n/**/\n 3823,\n/**/\n 3822,\n/**/\n 3821,\n/**/\n 3820,\n/**/\n 3819,\n/**/\n 3818,\n/**/\n 3817,\n/**/\n 3816,\n/**/\n 3815,\n/**/\n 3814,\n/**/\n 3813,\n/**/\n 3812,\n/**/\n 3811,\n/**/\n 3810,\n/**/\n 3809,\n/**/\n 3808,\n/**/\n 3807,\n/**/\n 3806,\n/**/\n 3805,\n/**/\n 3804,\n/**/\n 3803,\n/**/\n 3802,\n/**/\n 3801,\n/**/\n 3800,\n/**/\n 3799,\n/**/\n 3798,\n/**/\n 3797,\n/**/\n 3796,\n/**/\n 3795,\n/**/\n 3794,\n/**/\n 3793,\n/**/\n 3792,\n/**/\n 3791,\n/**/\n 3790,\n/**/\n 3789,\n/**/\n 3788,\n/**/\n 3787,\n/**/\n 3786,\n/**/\n 3785,\n/**/\n 3784,\n/**/\n 3783,\n/**/\n 3782,\n/**/\n 3781,\n/**/\n 3780,\n/**/\n 3779,\n/**/\n 3778,\n/**/\n 3777,\n/**/\n 3776,\n/**/\n 3775,\n/**/\n 3774,\n/**/\n 3773,\n/**/\n 3772,\n/**/\n 3771,\n/**/\n 3770,\n/**/\n 3769,\n/**/\n 3768,\n/**/\n 3767,\n/**/\n 3766,\n/**/\n 3765,\n/**/\n 3764,\n/**/\n 3763,\n/**/\n 3762,\n/**/\n 3761,\n/**/\n 3760,\n/**/\n 3759,\n/**/\n 3758,\n/**/\n 3757,\n/**/\n 3756,\n/**/\n 3755,\n/**/\n 3754,\n/**/\n 3753,\n/**/\n 3752,\n/**/\n 3751,\n/**/\n 3750,\n/**/\n 3749,\n/**/\n 3748,\n/**/\n 3747,\n/**/\n 3746,\n/**/\n 3745,\n/**/\n 3744,\n/**/\n 3743,\n/**/\n 3742,\n/**/\n 3741,\n/**/\n 3740,\n/**/\n 3739,\n/**/\n 3738,\n/**/\n 3737,\n/**/\n 3736,\n/**/\n 3735,\n/**/\n 3734,\n/**/\n 3733,\n/**/\n 3732,\n/**/\n 3731,\n/**/\n 3730,\n/**/\n 3729,\n/**/\n 3728,\n/**/\n 3727,\n/**/\n 3726,\n/**/\n 3725,\n/**/\n 3724,\n/**/\n 3723,\n/**/\n 3722,\n/**/\n 3721,\n/**/\n 3720,\n/**/\n 3719,\n/**/\n 3718,\n/**/\n 3717,\n/**/\n 3716,\n/**/\n 3715,\n/**/\n 3714,\n/**/\n 3713,\n/**/\n 3712,\n/**/\n 3711,\n/**/\n 3710,\n/**/\n 3709,\n/**/\n 3708,\n/**/\n 3707,\n/**/\n 3706,\n/**/\n 3705,\n/**/\n 3704,\n/**/\n 3703,\n/**/\n 3702,\n/**/\n 3701,\n/**/\n 3700,\n/**/\n 3699,\n/**/\n 3698,\n/**/\n 3697,\n/**/\n 3696,\n/**/\n 3695,\n/**/\n 3694,\n/**/\n 3693,\n/**/\n 3692,\n/**/\n 3691,\n/**/\n 3690,\n/**/\n 3689,\n/**/\n 3688,\n/**/\n 3687,\n/**/\n 3686,\n/**/\n 3685,\n/**/\n 3684,\n/**/\n 3683,\n/**/\n 3682,\n/**/\n 3681,\n/**/\n 3680,\n/**/\n 3679,\n/**/\n 3678,\n/**/\n 3677,\n/**/\n 3676,\n/**/\n 3675,\n/**/\n 3674,\n/**/\n 3673,\n/**/\n 3672,\n/**/\n 3671,\n/**/\n 3670,\n/**/\n 3669,\n/**/\n 3668,\n/**/\n 3667,\n/**/\n 3666,\n/**/\n 3665,\n/**/\n 3664,\n/**/\n 3663,\n/**/\n 3662,\n/**/\n 3661,\n/**/\n 3660,\n/**/\n 3659,\n/**/\n 3658,\n/**/\n 3657,\n/**/\n 3656,\n/**/\n 3655,\n/**/\n 3654,\n/**/\n 3653,\n/**/\n 3652,\n/**/\n 3651,\n/**/\n 3650,\n/**/\n 3649,\n/**/\n 3648,\n/**/\n 3647,\n/**/\n 3646,\n/**/\n 3645,\n/**/\n 3644,\n/**/\n 3643,\n/**/\n 3642,\n/**/\n 3641,\n/**/\n 3640,\n/**/\n 3639,\n/**/\n 3638,\n/**/\n 3637,\n/**/\n 3636,\n/**/\n 3635,\n/**/\n 3634,\n/**/\n 3633,\n/**/\n 3632,\n/**/\n 3631,\n/**/\n 3630,\n/**/\n 3629,\n/**/\n 3628,\n/**/\n 3627,\n/**/\n 3626,\n/**/\n 3625,\n/**/\n 3624,\n/**/\n 3623,\n/**/\n 3622,\n/**/\n 3621,\n/**/\n 3620,\n/**/\n 3619,\n/**/\n 3618,\n/**/\n 3617,\n/**/\n 3616,\n/**/\n 3615,\n/**/\n 3614,\n/**/\n 3613,\n/**/\n 3612,\n/**/\n 3611,\n/**/\n 3610,\n/**/\n 3609,\n/**/\n 3608,\n/**/\n 3607,\n/**/\n 3606,\n/**/\n 3605,\n/**/\n 3604,\n/**/\n 3603,\n/**/\n 3602,\n/**/\n 3601,\n/**/\n 3600,\n/**/\n 3599,\n/**/\n 3598,\n/**/\n 3597,\n/**/\n 3596,\n/**/\n 3595,\n/**/\n 3594,\n/**/\n 3593,\n/**/\n 3592,\n/**/\n 3591,\n/**/\n 3590,\n/**/\n 3589,\n/**/\n 3588,\n/**/\n 3587,\n/**/\n 3586,\n/**/\n 3585,\n/**/\n 3584,\n/**/\n 3583,\n/**/\n 3582,\n/**/\n 3581,\n/**/\n 3580,\n/**/\n 3579,\n/**/\n 3578,\n/**/\n 3577,\n/**/\n 3576,\n/**/\n 3575,\n/**/\n 3574,\n/**/\n 3573,\n/**/\n 3572,\n/**/\n 3571,\n/**/\n 3570,\n/**/\n 3569,\n/**/\n 3568,\n/**/\n 3567,\n/**/\n 3566,\n/**/\n 3565,\n/**/\n 3564,\n/**/\n 3563,\n/**/\n 3562,\n/**/\n 3561,\n/**/\n 3560,\n/**/\n 3559,\n/**/\n 3558,\n/**/\n 3557,\n/**/\n 3556,\n/**/\n 3555,\n/**/\n 3554,\n/**/\n 3553,\n/**/\n 3552,\n/**/\n 3551,\n/**/\n 3550,\n/**/\n 3549,\n/**/\n 3548,\n/**/\n 3547,\n/**/\n 3546,\n/**/\n 3545,\n/**/\n 3544,\n/**/\n 3543,\n/**/\n 3542,\n/**/\n 3541,\n/**/\n 3540,\n/**/\n 3539,\n/**/\n 3538,\n/**/\n 3537,\n/**/\n 3536,\n/**/\n 3535,\n/**/\n 3534,\n/**/\n 3533,\n/**/\n 3532,\n/**/\n 3531,\n/**/\n 3530,\n/**/\n 3529,\n/**/\n 3528,\n/**/\n 3527,\n/**/\n 3526,\n/**/\n 3525,\n/**/\n 3524,\n/**/\n 3523,\n/**/\n 3522,\n/**/\n 3521,\n/**/\n 3520,\n/**/\n 3519,\n/**/\n 3518,\n/**/\n 3517,\n/**/\n 3516,\n/**/\n 3515,\n/**/\n 3514,\n/**/\n 3513,\n/**/\n 3512,\n/**/\n 3511,\n/**/\n 3510,\n/**/\n 3509,\n/**/\n 3508,\n/**/\n 3507,\n/**/\n 3506,\n/**/\n 3505,\n/**/\n 3504,\n/**/\n 3503,\n/**/\n 3502,\n/**/\n 3501,\n/**/\n 3500,\n/**/\n 3499,\n/**/\n 3498,\n/**/\n 3497,\n/**/\n 3496,\n/**/\n 3495,\n/**/\n 3494,\n/**/\n 3493,\n/**/\n 3492,\n/**/\n 3491,\n/**/\n 3490,\n/**/\n 3489,\n/**/\n 3488,\n/**/\n 3487,\n/**/\n 3486,\n/**/\n 3485,\n/**/\n 3484,\n/**/\n 3483,\n/**/\n 3482,\n/**/\n 3481,\n/**/\n 3480,\n/**/\n 3479,\n/**/\n 3478,\n/**/\n 3477,\n/**/\n 3476,\n/**/\n 3475,\n/**/\n 3474,\n/**/\n 3473,\n/**/\n 3472,\n/**/\n 3471,\n/**/\n 3470,\n/**/\n 3469,\n/**/\n 3468,\n/**/\n 3467,\n/**/\n 3466,\n/**/\n 3465,\n/**/\n 3464,\n/**/\n 3463,\n/**/\n 3462,\n/**/\n 3461,\n/**/\n 3460,\n/**/\n 3459,\n/**/\n 3458,\n/**/\n 3457,\n/**/\n 3456,\n/**/\n 3455,\n/**/\n 3454,\n/**/\n 3453,\n/**/\n 3452,\n/**/\n 3451,\n/**/\n 3450,\n/**/\n 3449,\n/**/\n 3448,\n/**/\n 3447,\n/**/\n 3446,\n/**/\n 3445,\n/**/\n 3444,\n/**/\n 3443,\n/**/\n 3442,\n/**/\n 3441,\n/**/\n 3440,\n/**/\n 3439,\n/**/\n 3438,\n/**/\n 3437,\n/**/\n 3436,\n/**/\n 3435,\n/**/\n 3434,\n/**/\n 3433,\n/**/\n 3432,\n/**/\n 3431,\n/**/\n 3430,\n/**/\n 3429,\n/**/\n 3428,\n/**/\n 3427,\n/**/\n 3426,\n/**/\n 3425,\n/**/\n 3424,\n/**/\n 3423,\n/**/\n 3422,\n/**/\n 3421,\n/**/\n 3420,\n/**/\n 3419,\n/**/\n 3418,\n/**/\n 3417,\n/**/\n 3416,\n/**/\n 3415,\n/**/\n 3414,\n/**/\n 3413,\n/**/\n 3412,\n/**/\n 3411,\n/**/\n 3410,\n/**/\n 3409,\n/**/\n 3408,\n/**/\n 3407,\n/**/\n 3406,\n/**/\n 3405,\n/**/\n 3404,\n/**/\n 3403,\n/**/\n 3402,\n/**/\n 3401,\n/**/\n 3400,\n/**/\n 3399,\n/**/\n 3398,\n/**/\n 3397,\n/**/\n 3396,\n/**/\n 3395,\n/**/\n 3394,\n/**/\n 3393,\n/**/\n 3392,\n/**/\n 3391,\n/**/\n 3390,\n/**/\n 3389,\n/**/\n 3388,\n/**/\n 3387,\n/**/\n 3386,\n/**/\n 3385,\n/**/\n 3384,\n/**/\n 3383,\n/**/\n 3382,\n/**/\n 3381,\n/**/\n 3380,\n/**/\n 3379,\n/**/\n 3378,\n/**/\n 3377,\n/**/\n 3376,\n/**/\n 3375,\n/**/\n 3374,\n/**/\n 3373,\n/**/\n 3372,\n/**/\n 3371,\n/**/\n 3370,\n/**/\n 3369,\n/**/\n 3368,\n/**/\n 3367,\n/**/\n 3366,\n/**/\n 3365,\n/**/\n 3364,\n/**/\n 3363,\n/**/\n 3362,\n/**/\n 3361,\n/**/\n 3360,\n/**/\n 3359,\n/**/\n 3358,\n/**/\n 3357,\n/**/\n 3356,\n/**/\n 3355,\n/**/\n 3354,\n/**/\n 3353,\n/**/\n 3352,\n/**/\n 3351,\n/**/\n 3350,\n/**/\n 3349,\n/**/\n 3348,\n/**/\n 3347,\n/**/\n 3346,\n/**/\n 3345,\n/**/\n 3344,\n/**/\n 3343,\n/**/\n 3342,\n/**/\n 3341,\n/**/\n 3340,\n/**/\n 3339,\n/**/\n 3338,\n/**/\n 3337,\n/**/\n 3336,\n/**/\n 3335,\n/**/\n 3334,\n/**/\n 3333,\n/**/\n 3332,\n/**/\n 3331,\n/**/\n 3330,\n/**/\n 3329,\n/**/\n 3328,\n/**/\n 3327,\n/**/\n 3326,\n/**/\n 3325,\n/**/\n 3324,\n/**/\n 3323,\n/**/\n 3322,\n/**/\n 3321,\n/**/\n 3320,\n/**/\n 3319,\n/**/\n 3318,\n/**/\n 3317,\n/**/\n 3316,\n/**/\n 3315,\n/**/\n 3314,\n/**/\n 3313,\n/**/\n 3312,\n/**/\n 3311,\n/**/\n 3310,\n/**/\n 3309,\n/**/\n 3308,\n/**/\n 3307,\n/**/\n 3306,\n/**/\n 3305,\n/**/\n 3304,\n/**/\n 3303,\n/**/\n 3302,\n/**/\n 3301,\n/**/\n 3300,\n/**/\n 3299,\n/**/\n 3298,\n/**/\n 3297,\n/**/\n 3296,\n/**/\n 3295,\n/**/\n 3294,\n/**/\n 3293,\n/**/\n 3292,\n/**/\n 3291,\n/**/\n 3290,\n/**/\n 3289,\n/**/\n 3288,\n/**/\n 3287,\n/**/\n 3286,\n/**/\n 3285,\n/**/\n 3284,\n/**/\n 3283,\n/**/\n 3282,\n/**/\n 3281,\n/**/\n 3280,\n/**/\n 3279,\n/**/\n 3278,\n/**/\n 3277,\n/**/\n 3276,\n/**/\n 3275,\n/**/\n 3274,\n/**/\n 3273,\n/**/\n 3272,\n/**/\n 3271,\n/**/\n 3270,\n/**/\n 3269,\n/**/\n 3268,\n/**/\n 3267,\n/**/\n 3266,\n/**/\n 3265,\n/**/\n 3264,\n/**/\n 3263,\n/**/\n 3262,\n/**/\n 3261,\n/**/\n 3260,\n/**/\n 3259,\n/**/\n 3258,\n/**/\n 3257,\n/**/\n 3256,\n/**/\n 3255,\n/**/\n 3254,\n/**/\n 3253,\n/**/\n 3252,\n/**/\n 3251,\n/**/\n 3250,\n/**/\n 3249,\n/**/\n 3248,\n/**/\n 3247,\n/**/\n 3246,\n/**/\n 3245,\n/**/\n 3244,\n/**/\n 3243,\n/**/\n 3242,\n/**/\n 3241,\n/**/\n 3240,\n/**/\n 3239,\n/**/\n 3238,\n/**/\n 3237,\n/**/\n 3236,\n/**/\n 3235,\n/**/\n 3234,\n/**/\n 3233,\n/**/\n 3232,\n/**/\n 3231,\n/**/\n 3230,\n/**/\n 3229,\n/**/\n 3228,\n/**/\n 3227,\n/**/\n 3226,\n/**/\n 3225,\n/**/\n 3224,\n/**/\n 3223,\n/**/\n 3222,\n/**/\n 3221,\n/**/\n 3220,\n/**/\n 3219,\n/**/\n 3218,\n/**/\n 3217,\n/**/\n 3216,\n/**/\n 3215,\n/**/\n 3214,\n/**/\n 3213,\n/**/\n 3212,\n/**/\n 3211,\n/**/\n 3210,\n/**/\n 3209,\n/**/\n 3208,\n/**/\n 3207,\n/**/\n 3206,\n/**/\n 3205,\n/**/\n 3204,\n/**/\n 3203,\n/**/\n 3202,\n/**/\n 3201,\n/**/\n 3200,\n/**/\n 3199,\n/**/\n 3198,\n/**/\n 3197,\n/**/\n 3196,\n/**/\n 3195,\n/**/\n 3194,\n/**/\n 3193,\n/**/\n 3192,\n/**/\n 3191,\n/**/\n 3190,\n/**/\n 3189,\n/**/\n 3188,\n/**/\n 3187,\n/**/\n 3186,\n/**/\n 3185,\n/**/\n 3184,\n/**/\n 3183,\n/**/\n 3182,\n/**/\n 3181,\n/**/\n 3180,\n/**/\n 3179,\n/**/\n 3178,\n/**/\n 3177,\n/**/\n 3176,\n/**/\n 3175,\n/**/\n 3174,\n/**/\n 3173,\n/**/\n 3172,\n/**/\n 3171,\n/**/\n 3170,\n/**/\n 3169,\n/**/\n 3168,\n/**/\n 3167,\n/**/\n 3166,\n/**/\n 3165,\n/**/\n 3164,\n/**/\n 3163,\n/**/\n 3162,\n/**/\n 3161,\n/**/\n 3160,\n/**/\n 3159,\n/**/\n 3158,\n/**/\n 3157,\n/**/\n 3156,\n/**/\n 3155,\n/**/\n 3154,\n/**/\n 3153,\n/**/\n 3152,\n/**/\n 3151,\n/**/\n 3150,\n/**/\n 3149,\n/**/\n 3148,\n/**/\n 3147,\n/**/\n 3146,\n/**/\n 3145,\n/**/\n 3144,\n/**/\n 3143,\n/**/\n 3142,\n/**/\n 3141,\n/**/\n 3140,\n/**/\n 3139,\n/**/\n 3138,\n/**/\n 3137,\n/**/\n 3136,\n/**/\n 3135,\n/**/\n 3134,\n/**/\n 3133,\n/**/\n 3132,\n/**/\n 3131,\n/**/\n 3130,\n/**/\n 3129,\n/**/\n 3128,\n/**/\n 3127,\n/**/\n 3126,\n/**/\n 3125,\n/**/\n 3124,\n/**/\n 3123,\n/**/\n 3122,\n/**/\n 3121,\n/**/\n 3120,\n/**/\n 3119,\n/**/\n 3118,\n/**/\n 3117,\n/**/\n 3116,\n/**/\n 3115,\n/**/\n 3114,\n/**/\n 3113,\n/**/\n 3112,\n/**/\n 3111,\n/**/\n 3110,\n/**/\n 3109,\n/**/\n 3108,\n/**/\n 3107,\n/**/\n 3106,\n/**/\n 3105,\n/**/\n 3104,\n/**/\n 3103,\n/**/\n 3102,\n/**/\n 3101,\n/**/\n 3100,\n/**/\n 3099,\n/**/\n 3098,\n/**/\n 3097,\n/**/\n 3096,\n/**/\n 3095,\n/**/\n 3094,\n/**/\n 3093,\n/**/\n 3092,\n/**/\n 3091,\n/**/\n 3090,\n/**/\n 3089,\n/**/\n 3088,\n/**/\n 3087,\n/**/\n 3086,\n/**/\n 3085,\n/**/\n 3084,\n/**/\n 3083,\n/**/\n 3082,\n/**/\n 3081,\n/**/\n 3080,\n/**/\n 3079,\n/**/\n 3078,\n/**/\n 3077,\n/**/\n 3076,\n/**/\n 3075,\n/**/\n 3074,\n/**/\n 3073,\n/**/\n 3072,\n/**/\n 3071,\n/**/\n 3070,\n/**/\n 3069,\n/**/\n 3068,\n/**/\n 3067,\n/**/\n 3066,\n/**/\n 3065,\n/**/\n 3064,\n/**/\n 3063,\n/**/\n 3062,\n/**/\n 3061,\n/**/\n 3060,\n/**/\n 3059,\n/**/\n 3058,\n/**/\n 3057,\n/**/\n 3056,\n/**/\n 3055,\n/**/\n 3054,\n/**/\n 3053,\n/**/\n 3052,\n/**/\n 3051,\n/**/\n 3050,\n/**/\n 3049,\n/**/\n 3048,\n/**/\n 3047,\n/**/\n 3046,\n/**/\n 3045,\n/**/\n 3044,\n/**/\n 3043,\n/**/\n 3042,\n/**/\n 3041,\n/**/\n 3040,\n/**/\n 3039,\n/**/\n 3038,\n/**/\n 3037,\n/**/\n 3036,\n/**/\n 3035,\n/**/\n 3034,\n/**/\n 3033,\n/**/\n 3032,\n/**/\n 3031,\n/**/\n 3030,\n/**/\n 3029,\n/**/\n 3028,\n/**/\n 3027,\n/**/\n 3026,\n/**/\n 3025,\n/**/\n 3024,\n/**/\n 3023,\n/**/\n 3022,\n/**/\n 3021,\n/**/\n 3020,\n/**/\n 3019,\n/**/\n 3018,\n/**/\n 3017,\n/**/\n 3016,\n/**/\n 3015,\n/**/\n 3014,\n/**/\n 3013,\n/**/\n 3012,\n/**/\n 3011,\n/**/\n 3010,\n/**/\n 3009,\n/**/\n 3008,\n/**/\n 3007,\n/**/\n 3006,\n/**/\n 3005,\n/**/\n 3004,\n/**/\n 3003,\n/**/\n 3002,\n/**/\n 3001,\n/**/\n 3000,\n/**/\n 2999,\n/**/\n 2998,\n/**/\n 2997,\n/**/\n 2996,\n/**/\n 2995,\n/**/\n 2994,\n/**/\n 2993,\n/**/\n 2992,\n/**/\n 2991,\n/**/\n 2990,\n/**/\n 2989,\n/**/\n 2988,\n/**/\n 2987,\n/**/\n 2986,\n/**/\n 2985,\n/**/\n 2984,\n/**/\n 2983,\n/**/\n 2982,\n/**/\n 2981,\n/**/\n 2980,\n/**/\n 2979,\n/**/\n 2978,\n/**/\n 2977,\n/**/\n 2976,\n/**/\n 2975,\n/**/\n 2974,\n/**/\n 2973,\n/**/\n 2972,\n/**/\n 2971,\n/**/\n 2970,\n/**/\n 2969,\n/**/\n 2968,\n/**/\n 2967,\n/**/\n 2966,\n/**/\n 2965,\n/**/\n 2964,\n/**/\n 2963,\n/**/\n 2962,\n/**/\n 2961,\n/**/\n 2960,\n/**/\n 2959,\n/**/\n 2958,\n/**/\n 2957,\n/**/\n 2956,\n/**/\n 2955,\n/**/\n 2954,\n/**/\n 2953,\n/**/\n 2952,\n/**/\n 2951,\n/**/\n 2950,\n/**/\n 2949,\n/**/\n 2948,\n/**/\n 2947,\n/**/\n 2946,\n/**/\n 2945,\n/**/\n 2944,\n/**/\n 2943,\n/**/\n 2942,\n/**/\n 2941,\n/**/\n 2940,\n/**/\n 2939,\n/**/\n 2938,\n/**/\n 2937,\n/**/\n 2936,\n/**/\n 2935,\n/**/\n 2934,\n/**/\n 2933,\n/**/\n 2932,\n/**/\n 2931,\n/**/\n 2930,\n/**/\n 2929,\n/**/\n 2928,\n/**/\n 2927,\n/**/\n 2926,\n/**/\n 2925,\n/**/\n 2924,\n/**/\n 2923,\n/**/\n 2922,\n/**/\n 2921,\n/**/\n 2920,\n/**/\n 2919,\n/**/\n 2918,\n/**/\n 2917,\n/**/\n 2916,\n/**/\n 2915,\n/**/\n 2914,\n/**/\n 2913,\n/**/\n 2912,\n/**/\n 2911,\n/**/\n 2910,\n/**/\n 2909,\n/**/\n 2908,\n/**/\n 2907,\n/**/\n 2906,\n/**/\n 2905,\n/**/\n 2904,\n/**/\n 2903,\n/**/\n 2902,\n/**/\n 2901,\n/**/\n 2900,\n/**/\n 2899,\n/**/\n 2898,\n/**/\n 2897,\n/**/\n 2896,\n/**/\n 2895,\n/**/\n 2894,\n/**/\n 2893,\n/**/\n 2892,\n/**/\n 2891,\n/**/\n 2890,\n/**/\n 2889,\n/**/\n 2888,\n/**/\n 2887,\n/**/\n 2886,\n/**/\n 2885,\n/**/\n 2884,\n/**/\n 2883,\n/**/\n 2882,\n/**/\n 2881,\n/**/\n 2880,\n/**/\n 2879,\n/**/\n 2878,\n/**/\n 2877,\n/**/\n 2876,\n/**/\n 2875,\n/**/\n 2874,\n/**/\n 2873,\n/**/\n 2872,\n/**/\n 2871,\n/**/\n 2870,\n/**/\n 2869,\n/**/\n 2868,\n/**/\n 2867,\n/**/\n 2866,\n/**/\n 2865,\n/**/\n 2864,\n/**/\n 2863,\n/**/\n 2862,\n/**/\n 2861,\n/**/\n 2860,\n/**/\n 2859,\n/**/\n 2858,\n/**/\n 2857,\n/**/\n 2856,\n/**/\n 2855,\n/**/\n 2854,\n/**/\n 2853,\n/**/\n 2852,\n/**/\n 2851,\n/**/\n 2850,\n/**/\n 2849,\n/**/\n 2848,\n/**/\n 2847,\n/**/\n 2846,\n/**/\n 2845,\n/**/\n 2844,\n/**/\n 2843,\n/**/\n 2842,\n/**/\n 2841,\n/**/\n 2840,\n/**/\n 2839,\n/**/\n 2838,\n/**/\n 2837,\n/**/\n 2836,\n/**/\n 2835,\n/**/\n 2834,\n/**/\n 2833,\n/**/\n 2832,\n/**/\n 2831,\n/**/\n 2830,\n/**/\n 2829,\n/**/\n 2828,\n/**/\n 2827,\n/**/\n 2826,\n/**/\n 2825,\n/**/\n 2824,\n/**/\n 2823,\n/**/\n 2822,\n/**/\n 2821,\n/**/\n 2820,\n/**/\n 2819,\n/**/\n 2818,\n/**/\n 2817,\n/**/\n 2816,\n/**/\n 2815,\n/**/\n 2814,\n/**/\n 2813,\n/**/\n 2812,\n/**/\n 2811,\n/**/\n 2810,\n/**/\n 2809,\n/**/\n 2808,\n/**/\n 2807,\n/**/\n 2806,\n/**/\n 2805,\n/**/\n 2804,\n/**/\n 2803,\n/**/\n 2802,\n/**/\n 2801,\n/**/\n 2800,\n/**/\n 2799,\n/**/\n 2798,\n/**/\n 2797,\n/**/\n 2796,\n/**/\n 2795,\n/**/\n 2794,\n/**/\n 2793,\n/**/\n 2792,\n/**/\n 2791,\n/**/\n 2790,\n/**/\n 2789,\n/**/\n 2788,\n/**/\n 2787,\n/**/\n 2786,\n/**/\n 2785,\n/**/\n 2784,\n/**/\n 2783,\n/**/\n 2782,\n/**/\n 2781,\n/**/\n 2780,\n/**/\n 2779,\n/**/\n 2778,\n/**/\n 2777,\n/**/\n 2776,\n/**/\n 2775,\n/**/\n 2774,\n/**/\n 2773,\n/**/\n 2772,\n/**/\n 2771,\n/**/\n 2770,\n/**/\n 2769,\n/**/\n 2768,\n/**/\n 2767,\n/**/\n 2766,\n/**/\n 2765,\n/**/\n 2764,\n/**/\n 2763,\n/**/\n 2762,\n/**/\n 2761,\n/**/\n 2760,\n/**/\n 2759,\n/**/\n 2758,\n/**/\n 2757,\n/**/\n 2756,\n/**/\n 2755,\n/**/\n 2754,\n/**/\n 2753,\n/**/\n 2752,\n/**/\n 2751,\n/**/\n 2750,\n/**/\n 2749,\n/**/\n 2748,\n/**/\n 2747,\n/**/\n 2746,\n/**/\n 2745,\n/**/\n 2744,\n/**/\n 2743,\n/**/\n 2742,\n/**/\n 2741,\n/**/\n 2740,\n/**/\n 2739,\n/**/\n 2738,\n/**/\n 2737,\n/**/\n 2736,\n/**/\n 2735,\n/**/\n 2734,\n/**/\n 2733,\n/**/\n 2732,\n/**/\n 2731,\n/**/\n 2730,\n/**/\n 2729,\n/**/\n 2728,\n/**/\n 2727,\n/**/\n 2726,\n/**/\n 2725,\n/**/\n 2724,\n/**/\n 2723,\n/**/\n 2722,\n/**/\n 2721,\n/**/\n 2720,\n/**/\n 2719,\n/**/\n 2718,\n/**/\n 2717,\n/**/\n 2716,\n/**/\n 2715,\n/**/\n 2714,\n/**/\n 2713,\n/**/\n 2712,\n/**/\n 2711,\n/**/\n 2710,\n/**/\n 2709,\n/**/\n 2708,\n/**/\n 2707,\n/**/\n 2706,\n/**/\n 2705,\n/**/\n 2704,\n/**/\n 2703,\n/**/\n 2702,\n/**/\n 2701,\n/**/\n 2700,\n/**/\n 2699,\n/**/\n 2698,\n/**/\n 2697,\n/**/\n 2696,\n/**/\n 2695,\n/**/\n 2694,\n/**/\n 2693,\n/**/\n 2692,\n/**/\n 2691,\n/**/\n 2690,\n/**/\n 2689,\n/**/\n 2688,\n/**/\n 2687,\n/**/\n 2686,\n/**/\n 2685,\n/**/\n 2684,\n/**/\n 2683,\n/**/\n 2682,\n/**/\n 2681,\n/**/\n 2680,\n/**/\n 2679,\n/**/\n 2678,\n/**/\n 2677,\n/**/\n 2676,\n/**/\n 2675,\n/**/\n 2674,\n/**/\n 2673,\n/**/\n 2672,\n/**/\n 2671,\n/**/\n 2670,\n/**/\n 2669,\n/**/\n 2668,\n/**/\n 2667,\n/**/\n 2666,\n/**/\n 2665,\n/**/\n 2664,\n/**/\n 2663,\n/**/\n 2662,\n/**/\n 2661,\n/**/\n 2660,\n/**/\n 2659,\n/**/\n 2658,\n/**/\n 2657,\n/**/\n 2656,\n/**/\n 2655,\n/**/\n 2654,\n/**/\n 2653,\n/**/\n 2652,\n/**/\n 2651,\n/**/\n 2650,\n/**/\n 2649,\n/**/\n 2648,\n/**/\n 2647,\n/**/\n 2646,\n/**/\n 2645,\n/**/\n 2644,\n/**/\n 2643,\n/**/\n 2642,\n/**/\n 2641,\n/**/\n 2640,\n/**/\n 2639,\n/**/\n 2638,\n/**/\n 2637,\n/**/\n 2636,\n/**/\n 2635,\n/**/\n 2634,\n/**/\n 2633,\n/**/\n 2632,\n/**/\n 2631,\n/**/\n 2630,\n/**/\n 2629,\n/**/\n 2628,\n/**/\n 2627,\n/**/\n 2626,\n/**/\n 2625,\n/**/\n 2624,\n/**/\n 2623,\n/**/\n 2622,\n/**/\n 2621,\n/**/\n 2620,\n/**/\n 2619,\n/**/\n 2618,\n/**/\n 2617,\n/**/\n 2616,\n/**/\n 2615,\n/**/\n 2614,\n/**/\n 2613,\n/**/\n 2612,\n/**/\n 2611,\n/**/\n 2610,\n/**/\n 2609,\n/**/\n 2608,\n/**/\n 2607,\n/**/\n 2606,\n/**/\n 2605,\n/**/\n 2604,\n/**/\n 2603,\n/**/\n 2602,\n/**/\n 2601,\n/**/\n 2600,\n/**/\n 2599,\n/**/\n 2598,\n/**/\n 2597,\n/**/\n 2596,\n/**/\n 2595,\n/**/\n 2594,\n/**/\n 2593,\n/**/\n 2592,\n/**/\n 2591,\n/**/\n 2590,\n/**/\n 2589,\n/**/\n 2588,\n/**/\n 2587,\n/**/\n 2586,\n/**/\n 2585,\n/**/\n 2584,\n/**/\n 2583,\n/**/\n 2582,\n/**/\n 2581,\n/**/\n 2580,\n/**/\n 2579,\n/**/\n 2578,\n/**/\n 2577,\n/**/\n 2576,\n/**/\n 2575,\n/**/\n 2574,\n/**/\n 2573,\n/**/\n 2572,\n/**/\n 2571,\n/**/\n 2570,\n/**/\n 2569,\n/**/\n 2568,\n/**/\n 2567,\n/**/\n 2566,\n/**/\n 2565,\n/**/\n 2564,\n/**/\n 2563,\n/**/\n 2562,\n/**/\n 2561,\n/**/\n 2560,\n/**/\n 2559,\n/**/\n 2558,\n/**/\n 2557,\n/**/\n 2556,\n/**/\n 2555,\n/**/\n 2554,\n/**/\n 2553,\n/**/\n 2552,\n/**/\n 2551,\n/**/\n 2550,\n/**/\n 2549,\n/**/\n 2548,\n/**/\n 2547,\n/**/\n 2546,\n/**/\n 2545,\n/**/\n 2544,\n/**/\n 2543,\n/**/\n 2542,\n/**/\n 2541,\n/**/\n 2540,\n/**/\n 2539,\n/**/\n 2538,\n/**/\n 2537,\n/**/\n 2536,\n/**/\n 2535,\n/**/\n 2534,\n/**/\n 2533,\n/**/\n 2532,\n/**/\n 2531,\n/**/\n 2530,\n/**/\n 2529,\n/**/\n 2528,\n/**/\n 2527,\n/**/\n 2526,\n/**/\n 2525,\n/**/\n 2524,\n/**/\n 2523,\n/**/\n 2522,\n/**/\n 2521,\n/**/\n 2520,\n/**/\n 2519,\n/**/\n 2518,\n/**/\n 2517,\n/**/\n 2516,\n/**/\n 2515,\n/**/\n 2514,\n/**/\n 2513,\n/**/\n 2512,\n/**/\n 2511,\n/**/\n 2510,\n/**/\n 2509,\n/**/\n 2508,\n/**/\n 2507,\n/**/\n 2506,\n/**/\n 2505,\n/**/\n 2504,\n/**/\n 2503,\n/**/\n 2502,\n/**/\n 2501,\n/**/\n 2500,\n/**/\n 2499,\n/**/\n 2498,\n/**/\n 2497,\n/**/\n 2496,\n/**/\n 2495,\n/**/\n 2494,\n/**/\n 2493,\n/**/\n 2492,\n/**/\n 2491,\n/**/\n 2490,\n/**/\n 2489,\n/**/\n 2488,\n/**/\n 2487,\n/**/\n 2486,\n/**/\n 2485,\n/**/\n 2484,\n/**/\n 2483,\n/**/\n 2482,\n/**/\n 2481,\n/**/\n 2480,\n/**/\n 2479,\n/**/\n 2478,\n/**/\n 2477,\n/**/\n 2476,\n/**/\n 2475,\n/**/\n 2474,\n/**/\n 2473,\n/**/\n 2472,\n/**/\n 2471,\n/**/\n 2470,\n/**/\n 2469,\n/**/\n 2468,\n/**/\n 2467,\n/**/\n 2466,\n/**/\n 2465,\n/**/\n 2464,\n/**/\n 2463,\n/**/\n 2462,\n/**/\n 2461,\n/**/\n 2460,\n/**/\n 2459,\n/**/\n 2458,\n/**/\n 2457,\n/**/\n 2456,\n/**/\n 2455,\n/**/\n 2454,\n/**/\n 2453,\n/**/\n 2452,\n/**/\n 2451,\n/**/\n 2450,\n/**/\n 2449,\n/**/\n 2448,\n/**/\n 2447,\n/**/\n 2446,\n/**/\n 2445,\n/**/\n 2444,\n/**/\n 2443,\n/**/\n 2442,\n/**/\n 2441,\n/**/\n 2440,\n/**/\n 2439,\n/**/\n 2438,\n/**/\n 2437,\n/**/\n 2436,\n/**/\n 2435,\n/**/\n 2434,\n/**/\n 2433,\n/**/\n 2432,\n/**/\n 2431,\n/**/\n 2430,\n/**/\n 2429,\n/**/\n 2428,\n/**/\n 2427,\n/**/\n 2426,\n/**/\n 2425,\n/**/\n 2424,\n/**/\n 2423,\n/**/\n 2422,\n/**/\n 2421,\n/**/\n 2420,\n/**/\n 2419,\n/**/\n 2418,\n/**/\n 2417,\n/**/\n 2416,\n/**/\n 2415,\n/**/\n 2414,\n/**/\n 2413,\n/**/\n 2412,\n/**/\n 2411,\n/**/\n 2410,\n/**/\n 2409,\n/**/\n 2408,\n/**/\n 2407,\n/**/\n 2406,\n/**/\n 2405,\n/**/\n 2404,\n/**/\n 2403,\n/**/\n 2402,\n/**/\n 2401,\n/**/\n 2400,\n/**/\n 2399,\n/**/\n 2398,\n/**/\n 2397,\n/**/\n 2396,\n/**/\n 2395,\n/**/\n 2394,\n/**/\n 2393,\n/**/\n 2392,\n/**/\n 2391,\n/**/\n 2390,\n/**/\n 2389,\n/**/\n 2388,\n/**/\n 2387,\n/**/\n 2386,\n/**/\n 2385,\n/**/\n 2384,\n/**/\n 2383,\n/**/\n 2382,\n/**/\n 2381,\n/**/\n 2380,\n/**/\n 2379,\n/**/\n 2378,\n/**/\n 2377,\n/**/\n 2376,\n/**/\n 2375,\n/**/\n 2374,\n/**/\n 2373,\n/**/\n 2372,\n/**/\n 2371,\n/**/\n 2370,\n/**/\n 2369,\n/**/\n 2368,\n/**/\n 2367,\n/**/\n 2366,\n/**/\n 2365,\n/**/\n 2364,\n/**/\n 2363,\n/**/\n 2362,\n/**/\n 2361,\n/**/\n 2360,\n/**/\n 2359,\n/**/\n 2358,\n/**/\n 2357,\n/**/\n 2356,\n/**/\n 2355,\n/**/\n 2354,\n/**/\n 2353,\n/**/\n 2352,\n/**/\n 2351,\n/**/\n 2350,\n/**/\n 2349,\n/**/\n 2348,\n/**/\n 2347,\n/**/\n 2346,\n/**/\n 2345,\n/**/\n 2344,\n/**/\n 2343,\n/**/\n 2342,\n/**/\n 2341,\n/**/\n 2340,\n/**/\n 2339,\n/**/\n 2338,\n/**/\n 2337,\n/**/\n 2336,\n/**/\n 2335,\n/**/\n 2334,\n/**/\n 2333,\n/**/\n 2332,\n/**/\n 2331,\n/**/\n 2330,\n/**/\n 2329,\n/**/\n 2328,\n/**/\n 2327,\n/**/\n 2326,\n/**/\n 2325,\n/**/\n 2324,\n/**/\n 2323,\n/**/\n 2322,\n/**/\n 2321,\n/**/\n 2320,\n/**/\n 2319,\n/**/\n 2318,\n/**/\n 2317,\n/**/\n 2316,\n/**/\n 2315,\n/**/\n 2314,\n/**/\n 2313,\n/**/\n 2312,\n/**/\n 2311,\n/**/\n 2310,\n/**/\n 2309,\n/**/\n 2308,\n/**/\n 2307,\n/**/\n 2306,\n/**/\n 2305,\n/**/\n 2304,\n/**/\n 2303,\n/**/\n 2302,\n/**/\n 2301,\n/**/\n 2300,\n/**/\n 2299,\n/**/\n 2298,\n/**/\n 2297,\n/**/\n 2296,\n/**/\n 2295,\n/**/\n 2294,\n/**/\n 2293,\n/**/\n 2292,\n/**/\n 2291,\n/**/\n 2290,\n/**/\n 2289,\n/**/\n 2288,\n/**/\n 2287,\n/**/\n 2286,\n/**/\n 2285,\n/**/\n 2284,\n/**/\n 2283,\n/**/\n 2282,\n/**/\n 2281,\n/**/\n 2280,\n/**/\n 2279,\n/**/\n 2278,\n/**/\n 2277,\n/**/\n 2276,\n/**/\n 2275,\n/**/\n 2274,\n/**/\n 2273,\n/**/\n 2272,\n/**/\n 2271,\n/**/\n 2270,\n/**/\n 2269,\n/**/\n 2268,\n/**/\n 2267,\n/**/\n 2266,\n/**/\n 2265,\n/**/\n 2264,\n/**/\n 2263,\n/**/\n 2262,\n/**/\n 2261,\n/**/\n 2260,\n/**/\n 2259,\n/**/\n 2258,\n/**/\n 2257,\n/**/\n 2256,\n/**/\n 2255,\n/**/\n 2254,\n/**/\n 2253,\n/**/\n 2252,\n/**/\n 2251,\n/**/\n 2250,\n/**/\n 2249,\n/**/\n 2248,\n/**/\n 2247,\n/**/\n 2246,\n/**/\n 2245,\n/**/\n 2244,\n/**/\n 2243,\n/**/\n 2242,\n/**/\n 2241,\n/**/\n 2240,\n/**/\n 2239,\n/**/\n 2238,\n/**/\n 2237,\n/**/\n 2236,\n/**/\n 2235,\n/**/\n 2234,\n/**/\n 2233,\n/**/\n 2232,\n/**/\n 2231,\n/**/\n 2230,\n/**/\n 2229,\n/**/\n 2228,\n/**/\n 2227,\n/**/\n 2226,\n/**/\n 2225,\n/**/\n 2224,\n/**/\n 2223,\n/**/\n 2222,\n/**/\n 2221,\n/**/\n 2220,\n/**/\n 2219,\n/**/\n 2218,\n/**/\n 2217,\n/**/\n 2216,\n/**/\n 2215,\n/**/\n 2214,\n/**/\n 2213,\n/**/\n 2212,\n/**/\n 2211,\n/**/\n 2210,\n/**/\n 2209,\n/**/\n 2208,\n/**/\n 2207,\n/**/\n 2206,\n/**/\n 2205,\n/**/\n 2204,\n/**/\n 2203,\n/**/\n 2202,\n/**/\n 2201,\n/**/\n 2200,\n/**/\n 2199,\n/**/\n 2198,\n/**/\n 2197,\n/**/\n 2196,\n/**/\n 2195,\n/**/\n 2194,\n/**/\n 2193,\n/**/\n 2192,\n/**/\n 2191,\n/**/\n 2190,\n/**/\n 2189,\n/**/\n 2188,\n/**/\n 2187,\n/**/\n 2186,\n/**/\n 2185,\n/**/\n 2184,\n/**/\n 2183,\n/**/\n 2182,\n/**/\n 2181,\n/**/\n 2180,\n/**/\n 2179,\n/**/\n 2178,\n/**/\n 2177,\n/**/\n 2176,\n/**/\n 2175,\n/**/\n 2174,\n/**/\n 2173,\n/**/\n 2172,\n/**/\n 2171,\n/**/\n 2170,\n/**/\n 2169,\n/**/\n 2168,\n/**/\n 2167,\n/**/\n 2166,\n/**/\n 2165,\n/**/\n 2164,\n/**/\n 2163,\n/**/\n 2162,\n/**/\n 2161,\n/**/\n 2160,\n/**/\n 2159,\n/**/\n 2158,\n/**/\n 2157,\n/**/\n 2156,\n/**/\n 2155,\n/**/\n 2154,\n/**/\n 2153,\n/**/\n 2152,\n/**/\n 2151,\n/**/\n 2150,\n/**/\n 2149,\n/**/\n 2148,\n/**/\n 2147,\n/**/\n 2146,\n/**/\n 2145,\n/**/\n 2144,\n/**/\n 2143,\n/**/\n 2142,\n/**/\n 2141,\n/**/\n 2140,\n/**/\n 2139,\n/**/\n 2138,\n/**/\n 2137,\n/**/\n 2136,\n/**/\n 2135,\n/**/\n 2134,\n/**/\n 2133,\n/**/\n 2132,\n/**/\n 2131,\n/**/\n 2130,\n/**/\n 2129,\n/**/\n 2128,\n/**/\n 2127,\n/**/\n 2126,\n/**/\n 2125,\n/**/\n 2124,\n/**/\n 2123,\n/**/\n 2122,\n/**/\n 2121,\n/**/\n 2120,\n/**/\n 2119,\n/**/\n 2118,\n/**/\n 2117,\n/**/\n 2116,\n/**/\n 2115,\n/**/\n 2114,\n/**/\n 2113,\n/**/\n 2112,\n/**/\n 2111,\n/**/\n 2110,\n/**/\n 2109,\n/**/\n 2108,\n/**/\n 2107,\n/**/\n 2106,\n/**/\n 2105,\n/**/\n 2104,\n/**/\n 2103,\n/**/\n 2102,\n/**/\n 2101,\n/**/\n 2100,\n/**/\n 2099,\n/**/\n 2098,\n/**/\n 2097,\n/**/\n 2096,\n/**/\n 2095,\n/**/\n 2094,\n/**/\n 2093,\n/**/\n 2092,\n/**/\n 2091,\n/**/\n 2090,\n/**/\n 2089,\n/**/\n 2088,\n/**/\n 2087,\n/**/\n 2086,\n/**/\n 2085,\n/**/\n 2084,\n/**/\n 2083,\n/**/\n 2082,\n/**/\n 2081,\n/**/\n 2080,\n/**/\n 2079,\n/**/\n 2078,\n/**/\n 2077,\n/**/\n 2076,\n/**/\n 2075,\n/**/\n 2074,\n/**/\n 2073,\n/**/\n 2072,\n/**/\n 2071,\n/**/\n 2070,\n/**/\n 2069,\n/**/\n 2068,\n/**/\n 2067,\n/**/\n 2066,\n/**/\n 2065,\n/**/\n 2064,\n/**/\n 2063,\n/**/\n 2062,\n/**/\n 2061,\n/**/\n 2060,\n/**/\n 2059,\n/**/\n 2058,\n/**/\n 2057,\n/**/\n 2056,\n/**/\n 2055,\n/**/\n 2054,\n/**/\n 2053,\n/**/\n 2052,\n/**/\n 2051,\n/**/\n 2050,\n/**/\n 2049,\n/**/\n 2048,\n/**/\n 2047,\n/**/\n 2046,\n/**/\n 2045,\n/**/\n 2044,\n/**/\n 2043,\n/**/\n 2042,\n/**/\n 2041,\n/**/\n 2040,\n/**/\n 2039,\n/**/\n 2038,\n/**/\n 2037,\n/**/\n 2036,\n/**/\n 2035,\n/**/\n 2034,\n/**/\n 2033,\n/**/\n 2032,\n/**/\n 2031,\n/**/\n 2030,\n/**/\n 2029,\n/**/\n 2028,\n/**/\n 2027,\n/**/\n 2026,\n/**/\n 2025,\n/**/\n 2024,\n/**/\n 2023,\n/**/\n 2022,\n/**/\n 2021,\n/**/\n 2020,\n/**/\n 2019,\n/**/\n 2018,\n/**/\n 2017,\n/**/\n 2016,\n/**/\n 2015,\n/**/\n 2014,\n/**/\n 2013,\n/**/\n 2012,\n/**/\n 2011,\n/**/\n 2010,\n/**/\n 2009,\n/**/\n 2008,\n/**/\n 2007,\n/**/\n 2006,\n/**/\n 2005,\n/**/\n 2004,\n/**/\n 2003,\n/**/\n 2002,\n/**/\n 2001,\n/**/\n 2000,\n/**/\n 1999,\n/**/\n 1998,\n/**/\n 1997,\n/**/\n 1996,\n/**/\n 1995,\n/**/\n 1994,\n/**/\n 1993,\n/**/\n 1992,\n/**/\n 1991,\n/**/\n 1990,\n/**/\n 1989,\n/**/\n 1988,\n/**/\n 1987,\n/**/\n 1986,\n/**/\n 1985,\n/**/\n 1984,\n/**/\n 1983,\n/**/\n 1982,\n/**/\n 1981,\n/**/\n 1980,\n/**/\n 1979,\n/**/\n 1978,\n/**/\n 1977,\n/**/\n 1976,\n/**/\n 1975,\n/**/\n 1974,\n/**/\n 1973,\n/**/\n 1972,\n/**/\n 1971,\n/**/\n 1970,\n/**/\n 1969,\n/**/\n 1968,\n/**/\n 1967,\n/**/\n 1966,\n/**/\n 1965,\n/**/\n 1964,\n/**/\n 1963,\n/**/\n 1962,\n/**/\n 1961,\n/**/\n 1960,\n/**/\n 1959,\n/**/\n 1958,\n/**/\n 1957,\n/**/\n 1956,\n/**/\n 1955,\n/**/\n 1954,\n/**/\n 1953,\n/**/\n 1952,\n/**/\n 1951,\n/**/\n 1950,\n/**/\n 1949,\n/**/\n 1948,\n/**/\n 1947,\n/**/\n 1946,\n/**/\n 1945,\n/**/\n 1944,\n/**/\n 1943,\n/**/\n 1942,\n/**/\n 1941,\n/**/\n 1940,\n/**/\n 1939,\n/**/\n 1938,\n/**/\n 1937,\n/**/\n 1936,\n/**/\n 1935,\n/**/\n 1934,\n/**/\n 1933,\n/**/\n 1932,\n/**/\n 1931,\n/**/\n 1930,\n/**/\n 1929,\n/**/\n 1928,\n/**/\n 1927,\n/**/\n 1926,\n/**/\n 1925,\n/**/\n 1924,\n/**/\n 1923,\n/**/\n 1922,\n/**/\n 1921,\n/**/\n 1920,\n/**/\n 1919,\n/**/\n 1918,\n/**/\n 1917,\n/**/\n 1916,\n/**/\n 1915,\n/**/\n 1914,\n/**/\n 1913,\n/**/\n 1912,\n/**/\n 1911,\n/**/\n 1910,\n/**/\n 1909,\n/**/\n 1908,\n/**/\n 1907,\n/**/\n 1906,\n/**/\n 1905,\n/**/\n 1904,\n/**/\n 1903,\n/**/\n 1902,\n/**/\n 1901,\n/**/\n 1900,\n/**/\n 1899,\n/**/\n 1898,\n/**/\n 1897,\n/**/\n 1896,\n/**/\n 1895,\n/**/\n 1894,\n/**/\n 1893,\n/**/\n 1892,\n/**/\n 1891,\n/**/\n 1890,\n/**/\n 1889,\n/**/\n 1888,\n/**/\n 1887,\n/**/\n 1886,\n/**/\n 1885,\n/**/\n 1884,\n/**/\n 1883,\n/**/\n 1882,\n/**/\n 1881,\n/**/\n 1880,\n/**/\n 1879,\n/**/\n 1878,\n/**/\n 1877,\n/**/\n 1876,\n/**/\n 1875,\n/**/\n 1874,\n/**/\n 1873,\n/**/\n 1872,\n/**/\n 1871,\n/**/\n 1870,\n/**/\n 1869,\n/**/\n 1868,\n/**/\n 1867,\n/**/\n 1866,\n/**/\n 1865,\n/**/\n 1864,\n/**/\n 1863,\n/**/\n 1862,\n/**/\n 1861,\n/**/\n 1860,\n/**/\n 1859,\n/**/\n 1858,\n/**/\n 1857,\n/**/\n 1856,\n/**/\n 1855,\n/**/\n 1854,\n/**/\n 1853,\n/**/\n 1852,\n/**/\n 1851,\n/**/\n 1850,\n/**/\n 1849,\n/**/\n 1848,\n/**/\n 1847,\n/**/\n 1846,\n/**/\n 1845,\n/**/\n 1844,\n/**/\n 1843,\n/**/\n 1842,\n/**/\n 1841,\n/**/\n 1840,\n/**/\n 1839,\n/**/\n 1838,\n/**/\n 1837,\n/**/\n 1836,\n/**/\n 1835,\n/**/\n 1834,\n/**/\n 1833,\n/**/\n 1832,\n/**/\n 1831,\n/**/\n 1830,\n/**/\n 1829,\n/**/\n 1828,\n/**/\n 1827,\n/**/\n 1826,\n/**/\n 1825,\n/**/\n 1824,\n/**/\n 1823,\n/**/\n 1822,\n/**/\n 1821,\n/**/\n 1820,\n/**/\n 1819,\n/**/\n 1818,\n/**/\n 1817,\n/**/\n 1816,\n/**/\n 1815,\n/**/\n 1814,\n/**/\n 1813,\n/**/\n 1812,\n/**/\n 1811,\n/**/\n 1810,\n/**/\n 1809,\n/**/\n 1808,\n/**/\n 1807,\n/**/\n 1806,\n/**/\n 1805,\n/**/\n 1804,\n/**/\n 1803,\n/**/\n 1802,\n/**/\n 1801,\n/**/\n 1800,\n/**/\n 1799,\n/**/\n 1798,\n/**/\n 1797,\n/**/\n 1796,\n/**/\n 1795,\n/**/\n 1794,\n/**/\n 1793,\n/**/\n 1792,\n/**/\n 1791,\n/**/\n 1790,\n/**/\n 1789,\n/**/\n 1788,\n/**/\n 1787,\n/**/\n 1786,\n/**/\n 1785,\n/**/\n 1784,\n/**/\n 1783,\n/**/\n 1782,\n/**/\n 1781,\n/**/\n 1780,\n/**/\n 1779,\n/**/\n 1778,\n/**/\n 1777,\n/**/\n 1776,\n/**/\n 1775,\n/**/\n 1774,\n/**/\n 1773,\n/**/\n 1772,\n/**/\n 1771,\n/**/\n 1770,\n/**/\n 1769,\n/**/\n 1768,\n/**/\n 1767,\n/**/\n 1766,\n/**/\n 1765,\n/**/\n 1764,\n/**/\n 1763,\n/**/\n 1762,\n/**/\n 1761,\n/**/\n 1760,\n/**/\n 1759,\n/**/\n 1758,\n/**/\n 1757,\n/**/\n 1756,\n/**/\n 1755,\n/**/\n 1754,\n/**/\n 1753,\n/**/\n 1752,\n/**/\n 1751,\n/**/\n 1750,\n/**/\n 1749,\n/**/\n 1748,\n/**/\n 1747,\n/**/\n 1746,\n/**/\n 1745,\n/**/\n 1744,\n/**/\n 1743,\n/**/\n 1742,\n/**/\n 1741,\n/**/\n 1740,\n/**/\n 1739,\n/**/\n 1738,\n/**/\n 1737,\n/**/\n 1736,\n/**/\n 1735,\n/**/\n 1734,\n/**/\n 1733,\n/**/\n 1732,\n/**/\n 1731,\n/**/\n 1730,\n/**/\n 1729,\n/**/\n 1728,\n/**/\n 1727,\n/**/\n 1726,\n/**/\n 1725,\n/**/\n 1724,\n/**/\n 1723,\n/**/\n 1722,\n/**/\n 1721,\n/**/\n 1720,\n/**/\n 1719,\n/**/\n 1718,\n/**/\n 1717,\n/**/\n 1716,\n/**/\n 1715,\n/**/\n 1714,\n/**/\n 1713,\n/**/\n 1712,\n/**/\n 1711,\n/**/\n 1710,\n/**/\n 1709,\n/**/\n 1708,\n/**/\n 1707,\n/**/\n 1706,\n/**/\n 1705,\n/**/\n 1704,\n/**/\n 1703,\n/**/\n 1702,\n/**/\n 1701,\n/**/\n 1700,\n/**/\n 1699,\n/**/\n 1698,\n/**/\n 1697,\n/**/\n 1696,\n/**/\n 1695,\n/**/\n 1694,\n/**/\n 1693,\n/**/\n 1692,\n/**/\n 1691,\n/**/\n 1690,\n/**/\n 1689,\n/**/\n 1688,\n/**/\n 1687,\n/**/\n 1686,\n/**/\n 1685,\n/**/\n 1684,\n/**/\n 1683,\n/**/\n 1682,\n/**/\n 1681,\n/**/\n 1680,\n/**/\n 1679,\n/**/\n 1678,\n/**/\n 1677,\n/**/\n 1676,\n/**/\n 1675,\n/**/\n 1674,\n/**/\n 1673,\n/**/\n 1672,\n/**/\n 1671,\n/**/\n 1670,\n/**/\n 1669,\n/**/\n 1668,\n/**/\n 1667,\n/**/\n 1666,\n/**/\n 1665,\n/**/\n 1664,\n/**/\n 1663,\n/**/\n 1662,\n/**/\n 1661,\n/**/\n 1660,\n/**/\n 1659,\n/**/\n 1658,\n/**/\n 1657,\n/**/\n 1656,\n/**/\n 1655,\n/**/\n 1654,\n/**/\n 1653,\n/**/\n 1652,\n/**/\n 1651,\n/**/\n 1650,\n/**/\n 1649,\n/**/\n 1648,\n/**/\n 1647,\n/**/\n 1646,\n/**/\n 1645,\n/**/\n 1644,\n/**/\n 1643,\n/**/\n 1642,\n/**/\n 1641,\n/**/\n 1640,\n/**/\n 1639,\n/**/\n 1638,\n/**/\n 1637,\n/**/\n 1636,\n/**/\n 1635,\n/**/\n 1634,\n/**/\n 1633,\n/**/\n 1632,\n/**/\n 1631,\n/**/\n 1630,\n/**/\n 1629,\n/**/\n 1628,\n/**/\n 1627,\n/**/\n 1626,\n/**/\n 1625,\n/**/\n 1624,\n/**/\n 1623,\n/**/\n 1622,\n/**/\n 1621,\n/**/\n 1620,\n/**/\n 1619,\n/**/\n 1618,\n/**/\n 1617,\n/**/\n 1616,\n/**/\n 1615,\n/**/\n 1614,\n/**/\n 1613,\n/**/\n 1612,\n/**/\n 1611,\n/**/\n 1610,\n/**/\n 1609,\n/**/\n 1608,\n/**/\n 1607,\n/**/\n 1606,\n/**/\n 1605,\n/**/\n 1604,\n/**/\n 1603,\n/**/\n 1602,\n/**/\n 1601,\n/**/\n 1600,\n/**/\n 1599,\n/**/\n 1598,\n/**/\n 1597,\n/**/\n 1596,\n/**/\n 1595,\n/**/\n 1594,\n/**/\n 1593,\n/**/\n 1592,\n/**/\n 1591,\n/**/\n 1590,\n/**/\n 1589,\n/**/\n 1588,\n/**/\n 1587,\n/**/\n 1586,\n/**/\n 1585,\n/**/\n 1584,\n/**/\n 1583,\n/**/\n 1582,\n/**/\n 1581,\n/**/\n 1580,\n/**/\n 1579,\n/**/\n 1578,\n/**/\n 1577,\n/**/\n 1576,\n/**/\n 1575,\n/**/\n 1574,\n/**/\n 1573,\n/**/\n 1572,\n/**/\n 1571,\n/**/\n 1570,\n/**/\n 1569,\n/**/\n 1568,\n/**/\n 1567,\n/**/\n 1566,\n/**/\n 1565,\n/**/\n 1564,\n/**/\n 1563,\n/**/\n 1562,\n/**/\n 1561,\n/**/\n 1560,\n/**/\n 1559,\n/**/\n 1558,\n/**/\n 1557,\n/**/\n 1556,\n/**/\n 1555,\n/**/\n 1554,\n/**/\n 1553,\n/**/\n 1552,\n/**/\n 1551,\n/**/\n 1550,\n/**/\n 1549,\n/**/\n 1548,\n/**/\n 1547,\n/**/\n 1546,\n/**/\n 1545,\n/**/\n 1544,\n/**/\n 1543,\n/**/\n 1542,\n/**/\n 1541,\n/**/\n 1540,\n/**/\n 1539,\n/**/\n 1538,\n/**/\n 1537,\n/**/\n 1536,\n/**/\n 1535,\n/**/\n 1534,\n/**/\n 1533,\n/**/\n 1532,\n/**/\n 1531,\n/**/\n 1530,\n/**/\n 1529,\n/**/\n 1528,\n/**/\n 1527,\n/**/\n 1526,\n/**/\n 1525,\n/**/\n 1524,\n/**/\n 1523,\n/**/\n 1522,\n/**/\n 1521,\n/**/\n 1520,\n/**/\n 1519,\n/**/\n 1518,\n/**/\n 1517,\n/**/\n 1516,\n/**/\n 1515,\n/**/\n 1514,\n/**/\n 1513,\n/**/\n 1512,\n/**/\n 1511,\n/**/\n 1510,\n/**/\n 1509,\n/**/\n 1508,\n/**/\n 1507,\n/**/\n 1506,\n/**/\n 1505,\n/**/\n 1504,\n/**/\n 1503,\n/**/\n 1502,\n/**/\n 1501,\n/**/\n 1500,\n/**/\n 1499,\n/**/\n 1498,\n/**/\n 1497,\n/**/\n 1496,\n/**/\n 1495,\n/**/\n 1494,\n/**/\n 1493,\n/**/\n 1492,\n/**/\n 1491,\n/**/\n 1490,\n/**/\n 1489,\n/**/\n 1488,\n/**/\n 1487,\n/**/\n 1486,\n/**/\n 1485,\n/**/\n 1484,\n/**/\n 1483,\n/**/\n 1482,\n/**/\n 1481,\n/**/\n 1480,\n/**/\n 1479,\n/**/\n 1478,\n/**/\n 1477,\n/**/\n 1476,\n/**/\n 1475,\n/**/\n 1474,\n/**/\n 1473,\n/**/\n 1472,\n/**/\n 1471,\n/**/\n 1470,\n/**/\n 1469,\n/**/\n 1468,\n/**/\n 1467,\n/**/\n 1466,\n/**/\n 1465,\n/**/\n 1464,\n/**/\n 1463,\n/**/\n 1462,\n/**/\n 1461,\n/**/\n 1460,\n/**/\n 1459,\n/**/\n 1458,\n/**/\n 1457,\n/**/\n 1456,\n/**/\n 1455,\n/**/\n 1454,\n/**/\n 1453,\n/**/\n 1452,\n/**/\n 1451,\n/**/\n 1450,\n/**/\n 1449,\n/**/\n 1448,\n/**/\n 1447,\n/**/\n 1446,\n/**/\n 1445,\n/**/\n 1444,\n/**/\n 1443,\n/**/\n 1442,\n/**/\n 1441,\n/**/\n 1440,\n/**/\n 1439,\n/**/\n 1438,\n/**/\n 1437,\n/**/\n 1436,\n/**/\n 1435,\n/**/\n 1434,\n/**/\n 1433,\n/**/\n 1432,\n/**/\n 1431,\n/**/\n 1430,\n/**/\n 1429,\n/**/\n 1428,\n/**/\n 1427,\n/**/\n 1426,\n/**/\n 1425,\n/**/\n 1424,\n/**/\n 1423,\n/**/\n 1422,\n/**/\n 1421,\n/**/\n 1420,\n/**/\n 1419,\n/**/\n 1418,\n/**/\n 1417,\n/**/\n 1416,\n/**/\n 1415,\n/**/\n 1414,\n/**/\n 1413,\n/**/\n 1412,\n/**/\n 1411,\n/**/\n 1410,\n/**/\n 1409,\n/**/\n 1408,\n/**/\n 1407,\n/**/\n 1406,\n/**/\n 1405,\n/**/\n 1404,\n/**/\n 1403,\n/**/\n 1402,\n/**/\n 1401,\n/**/\n 1400,\n/**/\n 1399,\n/**/\n 1398,\n/**/\n 1397,\n/**/\n 1396,\n/**/\n 1395,\n/**/\n 1394,\n/**/\n 1393,\n/**/\n 1392,\n/**/\n 1391,\n/**/\n 1390,\n/**/\n 1389,\n/**/\n 1388,\n/**/\n 1387,\n/**/\n 1386,\n/**/\n 1385,\n/**/\n 1384,\n/**/\n 1383,\n/**/\n 1382,\n/**/\n 1381,\n/**/\n 1380,\n/**/\n 1379,\n/**/\n 1378,\n/**/\n 1377,\n/**/\n 1376,\n/**/\n 1375,\n/**/\n 1374,\n/**/\n 1373,\n/**/\n 1372,\n/**/\n 1371,\n/**/\n 1370,\n/**/\n 1369,\n/**/\n 1368,\n/**/\n 1367,\n/**/\n 1366,\n/**/\n 1365,\n/**/\n 1364,\n/**/\n 1363,\n/**/\n 1362,\n/**/\n 1361,\n/**/\n 1360,\n/**/\n 1359,\n/**/\n 1358,\n/**/\n 1357,\n/**/\n 1356,\n/**/\n 1355,\n/**/\n 1354,\n/**/\n 1353,\n/**/\n 1352,\n/**/\n 1351,\n/**/\n 1350,\n/**/\n 1349,\n/**/\n 1348,\n/**/\n 1347,\n/**/\n 1346,\n/**/\n 1345,\n/**/\n 1344,\n/**/\n 1343,\n/**/\n 1342,\n/**/\n 1341,\n/**/\n 1340,\n/**/\n 1339,\n/**/\n 1338,\n/**/\n 1337,\n/**/\n 1336,\n/**/\n 1335,\n/**/\n 1334,\n/**/\n 1333,\n/**/\n 1332,\n/**/\n 1331,\n/**/\n 1330,\n/**/\n 1329,\n/**/\n 1328,\n/**/\n 1327,\n/**/\n 1326,\n/**/\n 1325,\n/**/\n 1324,\n/**/\n 1323,\n/**/\n 1322,\n/**/\n 1321,\n/**/\n 1320,\n/**/\n 1319,\n/**/\n 1318,\n/**/\n 1317,\n/**/\n 1316,\n/**/\n 1315,\n/**/\n 1314,\n/**/\n 1313,\n/**/\n 1312,\n/**/\n 1311,\n/**/\n 1310,\n/**/\n 1309,\n/**/\n 1308,\n/**/\n 1307,\n/**/\n 1306,\n/**/\n 1305,\n/**/\n 1304,\n/**/\n 1303,\n/**/\n 1302,\n/**/\n 1301,\n/**/\n 1300,\n/**/\n 1299,\n/**/\n 1298,\n/**/\n 1297,\n/**/\n 1296,\n/**/\n 1295,\n/**/\n 1294,\n/**/\n 1293,\n/**/\n 1292,\n/**/\n 1291,\n/**/\n 1290,\n/**/\n 1289,\n/**/\n 1288,\n/**/\n 1287,\n/**/\n 1286,\n/**/\n 1285,\n/**/\n 1284,\n/**/\n 1283,\n/**/\n 1282,\n/**/\n 1281,\n/**/\n 1280,\n/**/\n 1279,\n/**/\n 1278,\n/**/\n 1277,\n/**/\n 1276,\n/**/\n 1275,\n/**/\n 1274,\n/**/\n 1273,\n/**/\n 1272,\n/**/\n 1271,\n/**/\n 1270,\n/**/\n 1269,\n/**/\n 1268,\n/**/\n 1267,\n/**/\n 1266,\n/**/\n 1265,\n/**/\n 1264,\n/**/\n 1263,\n/**/\n 1262,\n/**/\n 1261,\n/**/\n 1260,\n/**/\n 1259,\n/**/\n 1258,\n/**/\n 1257,\n/**/\n 1256,\n/**/\n 1255,\n/**/\n 1254,\n/**/\n 1253,\n/**/\n 1252,\n/**/\n 1251,\n/**/\n 1250,\n/**/\n 1249,\n/**/\n 1248,\n/**/\n 1247,\n/**/\n 1246,\n/**/\n 1245,\n/**/\n 1244,\n/**/\n 1243,\n/**/\n 1242,\n/**/\n 1241,\n/**/\n 1240,\n/**/\n 1239,\n/**/\n 1238,\n/**/\n 1237,\n/**/\n 1236,\n/**/\n 1235,\n/**/\n 1234,\n/**/\n 1233,\n/**/\n 1232,\n/**/\n 1231,\n/**/\n 1230,\n/**/\n 1229,\n/**/\n 1228,\n/**/\n 1227,\n/**/\n 1226,\n/**/\n 1225,\n/**/\n 1224,\n/**/\n 1223,\n/**/\n 1222,\n/**/\n 1221,\n/**/\n 1220,\n/**/\n 1219,\n/**/\n 1218,\n/**/\n 1217,\n/**/\n 1216,\n/**/\n 1215,\n/**/\n 1214,\n/**/\n 1213,\n/**/\n 1212,\n/**/\n 1211,\n/**/\n 1210,\n/**/\n 1209,\n/**/\n 1208,\n/**/\n 1207,\n/**/\n 1206,\n/**/\n 1205,\n/**/\n 1204,\n/**/\n 1203,\n/**/\n 1202,\n/**/\n 1201,\n/**/\n 1200,\n/**/\n 1199,\n/**/\n 1198,\n/**/\n 1197,\n/**/\n 1196,\n/**/\n 1195,\n/**/\n 1194,\n/**/\n 1193,\n/**/\n 1192,\n/**/\n 1191,\n/**/\n 1190,\n/**/\n 1189,\n/**/\n 1188,\n/**/\n 1187,\n/**/\n 1186,\n/**/\n 1185,\n/**/\n 1184,\n/**/\n 1183,\n/**/\n 1182,\n/**/\n 1181,\n/**/\n 1180,\n/**/\n 1179,\n/**/\n 1178,\n/**/\n 1177,\n/**/\n 1176,\n/**/\n 1175,\n/**/\n 1174,\n/**/\n 1173,\n/**/\n 1172,\n/**/\n 1171,\n/**/\n 1170,\n/**/\n 1169,\n/**/\n 1168,\n/**/\n 1167,\n/**/\n 1166,\n/**/\n 1165,\n/**/\n 1164,\n/**/\n 1163,\n/**/\n 1162,\n/**/\n 1161,\n/**/\n 1160,\n/**/\n 1159,\n/**/\n 1158,\n/**/\n 1157,\n/**/\n 1156,\n/**/\n 1155,\n/**/\n 1154,\n/**/\n 1153,\n/**/\n 1152,\n/**/\n 1151,\n/**/\n 1150,\n/**/\n 1149,\n/**/\n 1148,\n/**/\n 1147,\n/**/\n 1146,\n/**/\n 1145,\n/**/\n 1144,\n/**/\n 1143,\n/**/\n 1142,\n/**/\n 1141,\n/**/\n 1140,\n/**/\n 1139,\n/**/\n 1138,\n/**/\n 1137,\n/**/\n 1136,\n/**/\n 1135,\n/**/\n 1134,\n/**/\n 1133,\n/**/\n 1132,\n/**/\n 1131,\n/**/\n 1130,\n/**/\n 1129,\n/**/\n 1128,\n/**/\n 1127,\n/**/\n 1126,\n/**/\n 1125,\n/**/\n 1124,\n/**/\n 1123,\n/**/\n 1122,\n/**/\n 1121,\n/**/\n 1120,\n/**/\n 1119,\n/**/\n 1118,\n/**/\n 1117,\n/**/\n 1116,\n/**/\n 1115,\n/**/\n 1114,\n/**/\n 1113,\n/**/\n 1112,\n/**/\n 1111,\n/**/\n 1110,\n/**/\n 1109,\n/**/\n 1108,\n/**/\n 1107,\n/**/\n 1106,\n/**/\n 1105,\n/**/\n 1104,\n/**/\n 1103,\n/**/\n 1102,\n/**/\n 1101,\n/**/\n 1100,\n/**/\n 1099,\n/**/\n 1098,\n/**/\n 1097,\n/**/\n 1096,\n/**/\n 1095,\n/**/\n 1094,\n/**/\n 1093,\n/**/\n 1092,\n/**/\n 1091,\n/**/\n 1090,\n/**/\n 1089,\n/**/\n 1088,\n/**/\n 1087,\n/**/\n 1086,\n/**/\n 1085,\n/**/\n 1084,\n/**/\n 1083,\n/**/\n 1082,\n/**/\n 1081,\n/**/\n 1080,\n/**/\n 1079,\n/**/\n 1078,\n/**/\n 1077,\n/**/\n 1076,\n/**/\n 1075,\n/**/\n 1074,\n/**/\n 1073,\n/**/\n 1072,\n/**/\n 1071,\n/**/\n 1070,\n/**/\n 1069,\n/**/\n 1068,\n/**/\n 1067,\n/**/\n 1066,\n/**/\n 1065,\n/**/\n 1064,\n/**/\n 1063,\n/**/\n 1062,\n/**/\n 1061,\n/**/\n 1060,\n/**/\n 1059,\n/**/\n 1058,\n/**/\n 1057,\n/**/\n 1056,\n/**/\n 1055,\n/**/\n 1054,\n/**/\n 1053,\n/**/\n 1052,\n/**/\n 1051,\n/**/\n 1050,\n/**/\n 1049,\n/**/\n 1048,\n/**/\n 1047,\n/**/\n 1046,\n/**/\n 1045,\n/**/\n 1044,\n/**/\n 1043,\n/**/\n 1042,\n/**/\n 1041,\n/**/\n 1040,\n/**/\n 1039,\n/**/\n 1038,\n/**/\n 1037,\n/**/\n 1036,\n/**/\n 1035,\n/**/\n 1034,\n/**/\n 1033,\n/**/\n 1032,\n/**/\n 1031,\n/**/\n 1030,\n/**/\n 1029,\n/**/\n 1028,\n/**/\n 1027,\n/**/\n 1026,\n/**/\n 1025,\n/**/\n 1024,\n/**/\n 1023,\n/**/\n 1022,\n/**/\n 1021,\n/**/\n 1020,\n/**/\n 1019,\n/**/\n 1018,\n/**/\n 1017,\n/**/\n 1016,\n/**/\n 1015,\n/**/\n 1014,\n/**/\n 1013,\n/**/\n 1012,\n/**/\n 1011,\n/**/\n 1010,\n/**/\n 1009,\n/**/\n 1008,\n/**/\n 1007,\n/**/\n 1006,\n/**/\n 1005,\n/**/\n 1004,\n/**/\n 1003,\n/**/\n 1002,\n/**/\n 1001,\n/**/\n 1000,\n/**/\n 999,\n/**/\n 998,\n/**/\n 997,\n/**/\n 996,\n/**/\n 995,\n/**/\n 994,\n/**/\n 993,\n/**/\n 992,\n/**/\n 991,\n/**/\n 990,\n/**/\n 989,\n/**/\n 988,\n/**/\n 987,\n/**/\n 986,\n/**/\n 985,\n/**/\n 984,\n/**/\n 983,\n/**/\n 982,\n/**/\n 981,\n/**/\n 980,\n/**/\n 979,\n/**/\n 978,\n/**/\n 977,\n/**/\n 976,\n/**/\n 975,\n/**/\n 974,\n/**/\n 973,\n/**/\n 972,\n/**/\n 971,\n/**/\n 970,\n/**/\n 969,\n/**/\n 968,\n/**/\n 967,\n/**/\n 966,\n/**/\n 965,\n/**/\n 964,\n/**/\n 963,\n/**/\n 962,\n/**/\n 961,\n/**/\n 960,\n/**/\n 959,\n/**/\n 958,\n/**/\n 957,\n/**/\n 956,\n/**/\n 955,\n/**/\n 954,\n/**/\n 953,\n/**/\n 952,\n/**/\n 951,\n/**/\n 950,\n/**/\n 949,\n/**/\n 948,\n/**/\n 947,\n/**/\n 946,\n/**/\n 945,\n/**/\n 944,\n/**/\n 943,\n/**/\n 942,\n/**/\n 941,\n/**/\n 940,\n/**/\n 939,\n/**/\n 938,\n/**/\n 937,\n/**/\n 936,\n/**/\n 935,\n/**/\n 934,\n/**/\n 933,\n/**/\n 932,\n/**/\n 931,\n/**/\n 930,\n/**/\n 929,\n/**/\n 928,\n/**/\n 927,\n/**/\n 926,\n/**/\n 925,\n/**/\n 924,\n/**/\n 923,\n/**/\n 922,\n/**/\n 921,\n/**/\n 920,\n/**/\n 919,\n/**/\n 918,\n/**/\n 917,\n/**/\n 916,\n/**/\n 915,\n/**/\n 914,\n/**/\n 913,\n/**/\n 912,\n/**/\n 911,\n/**/\n 910,\n/**/\n 909,\n/**/\n 908,\n/**/\n 907,\n/**/\n 906,\n/**/\n 905,\n/**/\n 904,\n/**/\n 903,\n/**/\n 902,\n/**/\n 901,\n/**/\n 900,\n/**/\n 899,\n/**/\n 898,\n/**/\n 897,\n/**/\n 896,\n/**/\n 895,\n/**/\n 894,\n/**/\n 893,\n/**/\n 892,\n/**/\n 891,\n/**/\n 890,\n/**/\n 889,\n/**/\n 888,\n/**/\n 887,\n/**/\n 886,\n/**/\n 885,\n/**/\n 884,\n/**/\n 883,\n/**/\n 882,\n/**/\n 881,\n/**/\n 880,\n/**/\n 879,\n/**/\n 878,\n/**/\n 877,\n/**/\n 876,\n/**/\n 875,\n/**/\n 874,\n/**/\n 873,\n/**/\n 872,\n/**/\n 871,\n/**/\n 870,\n/**/\n 869,\n/**/\n 868,\n/**/\n 867,\n/**/\n 866,\n/**/\n 865,\n/**/\n 864,\n/**/\n 863,\n/**/\n 862,\n/**/\n 861,\n/**/\n 860,\n/**/\n 859,\n/**/\n 858,\n/**/\n 857,\n/**/\n 856,\n/**/\n 855,\n/**/\n 854,\n/**/\n 853,\n/**/\n 852,\n/**/\n 851,\n/**/\n 850,\n/**/\n 849,\n/**/\n 848,\n/**/\n 847,\n/**/\n 846,\n/**/\n 845,\n/**/\n 844,\n/**/\n 843,\n/**/\n 842,\n/**/\n 841,\n/**/\n 840,\n/**/\n 839,\n/**/\n 838,\n/**/\n 837,\n/**/\n 836,\n/**/\n 835,\n/**/\n 834,\n/**/\n 833,\n/**/\n 832,\n/**/\n 831,\n/**/\n 830,\n/**/\n 829,\n/**/\n 828,\n/**/\n 827,\n/**/\n 826,\n/**/\n 825,\n/**/\n 824,\n/**/\n 823,\n/**/\n 822,\n/**/\n 821,\n/**/\n 820,\n/**/\n 819,\n/**/\n 818,\n/**/\n 817,\n/**/\n 816,\n/**/\n 815,\n/**/\n 814,\n/**/\n 813,\n/**/\n 812,\n/**/\n 811,\n/**/\n 810,\n/**/\n 809,\n/**/\n 808,\n/**/\n 807,\n/**/\n 806,\n/**/\n 805,\n/**/\n 804,\n/**/\n 803,\n/**/\n 802,\n/**/\n 801,\n/**/\n 800,\n/**/\n 799,\n/**/\n 798,\n/**/\n 797,\n/**/\n 796,\n/**/\n 795,\n/**/\n 794,\n/**/\n 793,\n/**/\n 792,\n/**/\n 791,\n/**/\n 790,\n/**/\n 789,\n/**/\n 788,\n/**/\n 787,\n/**/\n 786,\n/**/\n 785,\n/**/\n 784,\n/**/\n 783,\n/**/\n 782,\n/**/\n 781,\n/**/\n 780,\n/**/\n 779,\n/**/\n 778,\n/**/\n 777,\n/**/\n 776,\n/**/\n 775,\n/**/\n 774,\n/**/\n 773,\n/**/\n 772,\n/**/\n 771,\n/**/\n 770,\n/**/\n 769,\n/**/\n 768,\n/**/\n 767,\n/**/\n 766,\n/**/\n 765,\n/**/\n 764,\n/**/\n 763,\n/**/\n 762,\n/**/\n 761,\n/**/\n 760,\n/**/\n 759,\n/**/\n 758,\n/**/\n 757,\n/**/\n 756,\n/**/\n 755,\n/**/\n 754,\n/**/\n 753,\n/**/\n 752,\n/**/\n 751,\n/**/\n 750,\n/**/\n 749,\n/**/\n 748,\n/**/\n 747,\n/**/\n 746,\n/**/\n 745,\n/**/\n 744,\n/**/\n 743,\n/**/\n 742,\n/**/\n 741,\n/**/\n 740,\n/**/\n 739,\n/**/\n 738,\n/**/\n 737,\n/**/\n 736,\n/**/\n 735,\n/**/\n 734,\n/**/\n 733,\n/**/\n 732,\n/**/\n 731,\n/**/\n 730,\n/**/\n 729,\n/**/\n 728,\n/**/\n 727,\n/**/\n 726,\n/**/\n 725,\n/**/\n 724,\n/**/\n 723,\n/**/\n 722,\n/**/\n 721,\n/**/\n 720,\n/**/\n 719,\n/**/\n 718,\n/**/\n 717,\n/**/\n 716,\n/**/\n 715,\n/**/\n 714,\n/**/\n 713,\n/**/\n 712,\n/**/\n 711,\n/**/\n 710,\n/**/\n 709,\n/**/\n 708,\n/**/\n 707,\n/**/\n 706,\n/**/\n 705,\n/**/\n 704,\n/**/\n 703,\n/**/\n 702,\n/**/\n 701,\n/**/\n 700,\n/**/\n 699,\n/**/\n 698,\n/**/\n 697,\n/**/\n 696,\n/**/\n 695,\n/**/\n 694,\n/**/\n 693,\n/**/\n 692,\n/**/\n 691,\n/**/\n 690,\n/**/\n 689,\n/**/\n 688,\n/**/\n 687,\n/**/\n 686,\n/**/\n 685,\n/**/\n 684,\n/**/\n 683,\n/**/\n 682,\n/**/\n 681,\n/**/\n 680,\n/**/\n 679,\n/**/\n 678,\n/**/\n 677,\n/**/\n 676,\n/**/\n 675,\n/**/\n 674,\n/**/\n 673,\n/**/\n 672,\n/**/\n 671,\n/**/\n 670,\n/**/\n 669,\n/**/\n 668,\n/**/\n 667,\n/**/\n 666,\n/**/\n 665,\n/**/\n 664,\n/**/\n 663,\n/**/\n 662,\n/**/\n 661,\n/**/\n 660,\n/**/\n 659,\n/**/\n 658,\n/**/\n 657,\n/**/\n 656,\n/**/\n 655,\n/**/\n 654,\n/**/\n 653,\n/**/\n 652,\n/**/\n 651,\n/**/\n 650,\n/**/\n 649,\n/**/\n 648,\n/**/\n 647,\n/**/\n 646,\n/**/\n 645,\n/**/\n 644,\n/**/\n 643,\n/**/\n 642,\n/**/\n 641,\n/**/\n 640,\n/**/\n 639,\n/**/\n 638,\n/**/\n 637,\n/**/\n 636,\n/**/\n 635,\n/**/\n 634,\n/**/\n 633,\n/**/\n 632,\n/**/\n 631,\n/**/\n 630,\n/**/\n 629,\n/**/\n 628,\n/**/\n 627,\n/**/\n 626,\n/**/\n 625,\n/**/\n 624,\n/**/\n 623,\n/**/\n 622,\n/**/\n 621,\n/**/\n 620,\n/**/\n 619,\n/**/\n 618,\n/**/\n 617,\n/**/\n 616,\n/**/\n 615,\n/**/\n 614,\n/**/\n 613,\n/**/\n 612,\n/**/\n 611,\n/**/\n 610,\n/**/\n 609,\n/**/\n 608,\n/**/\n 607,\n/**/\n 606,\n/**/\n 605,\n/**/\n 604,\n/**/\n 603,\n/**/\n 602,\n/**/\n 601,\n/**/\n 600,\n/**/\n 599,\n/**/\n 598,\n/**/\n 597,\n/**/\n 596,\n/**/\n 595,\n/**/\n 594,\n/**/\n 593,\n/**/\n 592,\n/**/\n 591,\n/**/\n 590,\n/**/\n 589,\n/**/\n 588,\n/**/\n 587,\n/**/\n 586,\n/**/\n 585,\n/**/\n 584,\n/**/\n 583,\n/**/\n 582,\n/**/\n 581,\n/**/\n 580,\n/**/\n 579,\n/**/\n 578,\n/**/\n 577,\n/**/\n 576,\n/**/\n 575,\n/**/\n 574,\n/**/\n 573,\n/**/\n 572,\n/**/\n 571,\n/**/\n 570,\n/**/\n 569,\n/**/\n 568,\n/**/\n 567,\n/**/\n 566,\n/**/\n 565,\n/**/\n 564,\n/**/\n 563,\n/**/\n 562,\n/**/\n 561,\n/**/\n 560,\n/**/\n 559,\n/**/\n 558,\n/**/\n 557,\n/**/\n 556,\n/**/\n 555,\n/**/\n 554,\n/**/\n 553,\n/**/\n 552,\n/**/\n 551,\n/**/\n 550,\n/**/\n 549,\n/**/\n 548,\n/**/\n 547,\n/**/\n 546,\n/**/\n 545,\n/**/\n 544,\n/**/\n 543,\n/**/\n 542,\n/**/\n 541,\n/**/\n 540,\n/**/\n 539,\n/**/\n 538,\n/**/\n 537,\n/**/\n 536,\n/**/\n 535,\n/**/\n 534,\n/**/\n 533,\n/**/\n 532,\n/**/\n 531,\n/**/\n 530,\n/**/\n 529,\n/**/\n 528,\n/**/\n 527,\n/**/\n 526,\n/**/\n 525,\n/**/\n 524,\n/**/\n 523,\n/**/\n 522,\n/**/\n 521,\n/**/\n 520,\n/**/\n 519,\n/**/\n 518,\n/**/\n 517,\n/**/\n 516,\n/**/\n 515,\n/**/\n 514,\n/**/\n 513,\n/**/\n 512,\n/**/\n 511,\n/**/\n 510,\n/**/\n 509,\n/**/\n 508,\n/**/\n 507,\n/**/\n 506,\n/**/\n 505,\n/**/\n 504,\n/**/\n 503,\n/**/\n 502,\n/**/\n 501,\n/**/\n 500,\n/**/\n 499,\n/**/\n 498,\n/**/\n 497,\n/**/\n 496,\n/**/\n 495,\n/**/\n 494,\n/**/\n 493,\n/**/\n 492,\n/**/\n 491,\n/**/\n 490,\n/**/\n 489,\n/**/\n 488,\n/**/\n 487,\n/**/\n 486,\n/**/\n 485,\n/**/\n 484,\n/**/\n 483,\n/**/\n 482,\n/**/\n 481,\n/**/\n 480,\n/**/\n 479,\n/**/\n 478,\n/**/\n 477,\n/**/\n 476,\n/**/\n 475,\n/**/\n 474,\n/**/\n 473,\n/**/\n 472,\n/**/\n 471,\n/**/\n 470,\n/**/\n 469,\n/**/\n 468,\n/**/\n 467,\n/**/\n 466,\n/**/\n 465,\n/**/\n 464,\n/**/\n 463,\n/**/\n 462,\n/**/\n 461,\n/**/\n 460,\n/**/\n 459,\n/**/\n 458,\n/**/\n 457,\n/**/\n 456,\n/**/\n 455,\n/**/\n 454,\n/**/\n 453,\n/**/\n 452,\n/**/\n 451,\n/**/\n 450,\n/**/\n 449,\n/**/\n 448,\n/**/\n 447,\n/**/\n 446,\n/**/\n 445,\n/**/\n 444,\n/**/\n 443,\n/**/\n 442,\n/**/\n 441,\n/**/\n 440,\n/**/\n 439,\n/**/\n 438,\n/**/\n 437,\n/**/\n 436,\n/**/\n 435,\n/**/\n 434,\n/**/\n 433,\n/**/\n 432,\n/**/\n 431,\n/**/\n 430,\n/**/\n 429,\n/**/\n 428,\n/**/\n 427,\n/**/\n 426,\n/**/\n 425,\n/**/\n 424,\n/**/\n 423,\n/**/\n 422,\n/**/\n 421,\n/**/\n 420,\n/**/\n 419,\n/**/\n 418,\n/**/\n 417,\n/**/\n 416,\n/**/\n 415,\n/**/\n 414,\n/**/\n 413,\n/**/\n 412,\n/**/\n 411,\n/**/\n 410,\n/**/\n 409,\n/**/\n 408,\n/**/\n 407,\n/**/\n 406,\n/**/\n 405,\n/**/\n 404,\n/**/\n 403,\n/**/\n 402,\n/**/\n 401,\n/**/\n 400,\n/**/\n 399,\n/**/\n 398,\n/**/\n 397,\n/**/\n 396,\n/**/\n 395,\n/**/\n 394,\n/**/\n 393,\n/**/\n 392,\n/**/\n 391,\n/**/\n 390,\n/**/\n 389,\n/**/\n 388,\n/**/\n 387,\n/**/\n 386,\n/**/\n 385,\n/**/\n 384,\n/**/\n 383,\n/**/\n 382,\n/**/\n 381,\n/**/\n 380,\n/**/\n 379,\n/**/\n 378,\n/**/\n 377,\n/**/\n 376,\n/**/\n 375,\n/**/\n 374,\n/**/\n 373,\n/**/\n 372,\n/**/\n 371,\n/**/\n 370,\n/**/\n 369,\n/**/\n 368,\n/**/\n 367,\n/**/\n 366,\n/**/\n 365,\n/**/\n 364,\n/**/\n 363,\n/**/\n 362,\n/**/\n 361,\n/**/\n 360,\n/**/\n 359,\n/**/\n 358,\n/**/\n 357,\n/**/\n 356,\n/**/\n 355,\n/**/\n 354,\n/**/\n 353,\n/**/\n 352,\n/**/\n 351,\n/**/\n 350,\n/**/\n 349,\n/**/\n 348,\n/**/\n 347,\n/**/\n 346,\n/**/\n 345,\n/**/\n 344,\n/**/\n 343,\n/**/\n 342,\n/**/\n 341,\n/**/\n 340,\n/**/\n 339,\n/**/\n 338,\n/**/\n 337,\n/**/\n 336,\n/**/\n 335,\n/**/\n 334,\n/**/\n 333,\n/**/\n 332,\n/**/\n 331,\n/**/\n 330,\n/**/\n 329,\n/**/\n 328,\n/**/\n 327,\n/**/\n 326,\n/**/\n 325,\n/**/\n 324,\n/**/\n 323,\n/**/\n 322,\n/**/\n 321,\n/**/\n 320,\n/**/\n 319,\n/**/\n 318,\n/**/\n 317,\n/**/\n 316,\n/**/\n 315,\n/**/\n 314,\n/**/\n 313,\n/**/\n 312,\n/**/\n 311,\n/**/\n 310,\n/**/\n 309,\n/**/\n 308,\n/**/\n 307,\n/**/\n 306,\n/**/\n 305,\n/**/\n 304,\n/**/\n 303,\n/**/\n 302,\n/**/\n 301,\n/**/\n 300,\n/**/\n 299,\n/**/\n 298,\n/**/\n 297,\n/**/\n 296,\n/**/\n 295,\n/**/\n 294,\n/**/\n 293,\n/**/\n 292,\n/**/\n 291,\n/**/\n 290,\n/**/\n 289,\n/**/\n 288,\n/**/\n 287,\n/**/\n 286,\n/**/\n 285,\n/**/\n 284,\n/**/\n 283,\n/**/\n 282,\n/**/\n 281,\n/**/\n 280,\n/**/\n 279,\n/**/\n 278,\n/**/\n 277,\n/**/\n 276,\n/**/\n 275,\n/**/\n 274,\n/**/\n 273,\n/**/\n 272,\n/**/\n 271,\n/**/\n 270,\n/**/\n 269,\n/**/\n 268,\n/**/\n 267,\n/**/\n 266,\n/**/\n 265,\n/**/\n 264,\n/**/\n 263,\n/**/\n 262,\n/**/\n 261,\n/**/\n 260,\n/**/\n 259,\n/**/\n 258,\n/**/\n 257,\n/**/\n 256,\n/**/\n 255,\n/**/\n 254,\n/**/\n 253,\n/**/\n 252,\n/**/\n 251,\n/**/\n 250,\n/**/\n 249,\n/**/\n 248,\n/**/\n 247,\n/**/\n 246,\n/**/\n 245,\n/**/\n 244,\n/**/\n 243,\n/**/\n 242,\n/**/\n 241,\n/**/\n 240,\n/**/\n 239,\n/**/\n 238,\n/**/\n 237,\n/**/\n 236,\n/**/\n 235,\n/**/\n 234,\n/**/\n 233,\n/**/\n 232,\n/**/\n 231,\n/**/\n 230,\n/**/\n 229,\n/**/\n 228,\n/**/\n 227,\n/**/\n 226,\n/**/\n 225,\n/**/\n 224,\n/**/\n 223,\n/**/\n 222,\n/**/\n 221,\n/**/\n 220,\n/**/\n 219,\n/**/\n 218,\n/**/\n 217,\n/**/\n 216,\n/**/\n 215,\n/**/\n 214,\n/**/\n 213,\n/**/\n 212,\n/**/\n 211,\n/**/\n 210,\n/**/\n 209,\n/**/\n 208,\n/**/\n 207,\n/**/\n 206,\n/**/\n 205,\n/**/\n 204,\n/**/\n 203,\n/**/\n 202,\n/**/\n 201,\n/**/\n 200,\n/**/\n 199,\n/**/\n 198,\n/**/\n 197,\n/**/\n 196,\n/**/\n 195,\n/**/\n 194,\n/**/\n 193,\n/**/\n 192,\n/**/\n 191,\n/**/\n 190,\n/**/\n 189,\n/**/\n 188,\n/**/\n 187,\n/**/\n 186,\n/**/\n 185,\n/**/\n 184,\n/**/\n 183,\n/**/\n 182,\n/**/\n 181,\n/**/\n 180,\n/**/\n 179,\n/**/\n 178,\n/**/\n 177,\n/**/\n 176,\n/**/\n 175,\n/**/\n 174,\n/**/\n 173,\n/**/\n 172,\n/**/\n 171,\n/**/\n 170,\n/**/\n 169,\n/**/\n 168,\n/**/\n 167,\n/**/\n 166,\n/**/\n 165,\n/**/\n 164,\n/**/\n 163,\n/**/\n 162,\n/**/\n 161,\n/**/\n 160,\n/**/\n 159,\n/**/\n 158,\n/**/\n 157,\n/**/\n 156,\n/**/\n 155,\n/**/\n 154,\n/**/\n 153,\n/**/\n 152,\n/**/\n 151,\n/**/\n 150,\n/**/\n 149,\n/**/\n 148,\n/**/\n 147,\n/**/\n 146,\n/**/\n 145,\n/**/\n 144,\n/**/\n 143,\n/**/\n 142,\n/**/\n 141,\n/**/\n 140,\n/**/\n 139,\n/**/\n 138,\n/**/\n 137,\n/**/\n 136,\n/**/\n 135,\n/**/\n 134,\n/**/\n 133,\n/**/\n 132,\n/**/\n 131,\n/**/\n 130,\n/**/\n 129,\n/**/\n 128,\n/**/\n 127,\n/**/\n 126,\n/**/\n 125,\n/**/\n 124,\n/**/\n 123,\n/**/\n 122,\n/**/\n 121,\n/**/\n 120,\n/**/\n 119,\n/**/\n 118,\n/**/\n 117,\n/**/\n 116,\n/**/\n 115,\n/**/\n 114,\n/**/\n 113,\n/**/\n 112,\n/**/\n 111,\n/**/\n 110,\n/**/\n 109,\n/**/\n 108,\n/**/\n 107,\n/**/\n 106,\n/**/\n 105,\n/**/\n 104,\n/**/\n 103,\n/**/\n 102,\n/**/\n 101,\n/**/\n 100,\n/**/\n 99,\n/**/\n 98,\n/**/\n 97,\n/**/\n 96,\n/**/\n 95,\n/**/\n 94,\n/**/\n 93,\n/**/\n 92,\n/**/\n 91,\n/**/\n 90,\n/**/\n 89,\n/**/\n 88,\n/**/\n 87,\n/**/\n 86,\n/**/\n 85,\n/**/\n 84,\n/**/\n 83,\n/**/\n 82,\n/**/\n 81,\n/**/\n 80,\n/**/\n 79,\n/**/\n 78,\n/**/\n 77,\n/**/\n 76,\n/**/\n 75,\n/**/\n 74,\n/**/\n 73,\n/**/\n 72,\n/**/\n 71,\n/**/\n 70,\n/**/\n 69,\n/**/\n 68,\n/**/\n 67,\n/**/\n 66,\n/**/\n 65,\n/**/\n 64,\n/**/\n 63,\n/**/\n 62,\n/**/\n 61,\n/**/\n 60,\n/**/\n 59,\n/**/\n 58,\n/**/\n 57,\n/**/\n 56,\n/**/\n 55,\n/**/\n 54,\n/**/\n 53,\n/**/\n 52,\n/**/\n 51,\n/**/\n 50,\n/**/\n 49,\n/**/\n 48,\n/**/\n 47,\n/**/\n 46,\n/**/\n 45,\n/**/\n 44,\n/**/\n 43,\n/**/\n 42,\n/**/\n 41,\n/**/\n 40,\n/**/\n 39,\n/**/\n 38,\n/**/\n 37,\n/**/\n 36,\n/**/\n 35,\n/**/\n 34,\n/**/\n 33,\n/**/\n 32,\n/**/\n 31,\n/**/\n 30,\n/**/\n 29,\n/**/\n 28,\n/**/\n 27,\n/**/\n 26,\n/**/\n 25,\n/**/\n 24,\n/**/\n 23,\n/**/\n 22,\n/**/\n 21,\n/**/\n 20,\n/**/\n 19,\n/**/\n 18,\n/**/\n 17,\n/**/\n 16,\n/**/\n 15,\n/**/\n 14,\n/**/\n 13,\n/**/\n 12,\n/**/\n 11,\n/**/\n 10,\n/**/\n 9,\n/**/\n 8,\n/**/\n 7,\n/**/\n 6,\n/**/\n 5,\n/**/\n 4,\n/**/\n 3,\n/**/\n 2,\n/**/\n 1,\n/**/\n 0\n};",
"/*\n * Place to put a short description when adding a feature with a patch.\n * Keep it short, e.g.,: \"relative numbers\", \"persistent undo\".\n * Also add a comment marker to separate the lines.\n * See the official Vim patches for the diff format: It must use a context of\n * one line only. Create it by hand or use \"diff -C2\" and edit the patch.\n */\nstatic char *(extra_patches[]) =\n{ /* Add your patch description below this line */\n/**/\n NULL\n};",
" int\nhighest_patch(void)\n{\n // this relies on the highest patch number to be the first entry\n return included_patches[0];\n}",
"#if defined(FEAT_EVAL) || defined(PROTO)\n/*\n * Return TRUE if patch \"n\" has been included.\n */\n int\nhas_patch(int n)\n{\n int\t\th, m, l;",
" // Perform a binary search.\n l = 0;\n h = (int)ARRAY_LENGTH(included_patches) - 1;\n while (l < h)\n {\n\tm = (l + h) / 2;\n\tif (included_patches[m] == n)\n\t return TRUE;\n\tif (included_patches[m] < n)\n\t h = m;\n\telse\n\t l = m + 1;\n }\n return FALSE;\n}\n#endif",
" void\nex_version(exarg_T *eap)\n{\n /*\n * Ignore a \":version 9.99\" command.\n */\n if (*eap->arg == NUL)\n {\n\tmsg_putchar('\\n');\n\tlist_version();\n }\n}",
"/*\n * Output a string for the version message. If it's going to wrap, output a\n * newline, unless the message is too long to fit on the screen anyway.\n * When \"wrap\" is TRUE wrap the string in [].\n */\n static void\nversion_msg_wrap(char_u *s, int wrap)\n{\n int\t\tlen = vim_strsize(s) + (wrap ? 2 : 0);",
" if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns\n\t\t\t\t\t\t\t\t&& *s != '\\n')\n\tmsg_putchar('\\n');\n if (!got_int)\n {\n\tif (wrap)\n\t msg_puts(\"[\");\n\tmsg_puts((char *)s);\n\tif (wrap)\n\t msg_puts(\"]\");\n }\n}",
" static void\nversion_msg(char *s)\n{\n version_msg_wrap((char_u *)s, FALSE);\n}",
"/*\n * List all features aligned in columns, dictionary style.\n */\n static void\nlist_features(void)\n{\n list_in_columns((char_u **)features, -1, -1);\n}",
"/*\n * List string items nicely aligned in columns.\n * When \"size\" is < 0 then the last entry is marked with NULL.\n * The entry with index \"current\" is inclosed in [].\n */\n void\nlist_in_columns(char_u **items, int size, int current)\n{\n int\t\ti;\n int\t\tncol;\n int\t\tnrow;\n int\t\tcur_row = 1;\n int\t\titem_count = 0;\n int\t\twidth = 0;\n#ifdef FEAT_SYN_HL\n int\t\tuse_highlight = (items == (char_u **)features);\n#endif",
" // Find the length of the longest item, use that + 1 as the column\n // width.\n for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)\n {\n\tint l = vim_strsize(items[i]) + (i == current ? 2 : 0);",
"\tif (l > width)\n\t width = l;\n\t++item_count;\n }\n width += 1;",
" if (Columns < width)\n {\n\t// Not enough screen columns - show one per line\n\tfor (i = 0; i < item_count; ++i)\n\t{\n\t version_msg_wrap(items[i], i == current);\n\t if (msg_col > 0 && i < item_count - 1)\n\t\tmsg_putchar('\\n');\n\t}\n\treturn;\n }",
" // The rightmost column doesn't need a separator.\n // Sacrifice it to fit in one more column if possible.\n ncol = (int) (Columns + 1) / width;\n nrow = item_count / ncol + ((item_count % ncol) ? 1 : 0);",
" // \"i\" counts columns then rows. \"idx\" counts rows then columns.\n for (i = 0; !got_int && i < nrow * ncol; ++i)\n {\n\tint idx = (i / ncol) + (i % ncol) * nrow;",
"\tif (idx < item_count)\n\t{\n\t int last_col = (i + 1) % ncol == 0;",
"\t if (idx == current)\n\t\tmsg_putchar('[');\n#ifdef FEAT_SYN_HL\n\t if (use_highlight && items[idx][0] == '-')\n\t\tmsg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));\n\t else\n#endif\n\t\tmsg_puts((char *)items[idx]);\n\t if (idx == current)\n\t\tmsg_putchar(']');\n\t if (last_col)\n\t {\n\t\tif (msg_col > 0 && cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t else\n\t {\n\t\twhile (msg_col % width)\n\t\t msg_putchar(' ');\n\t }\n\t}\n\telse\n\t{\n\t // this row is out of items, thus at the end of the row\n\t if (msg_col > 0)\n\t {\n\t\tif (cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t}\n }\n}",
" void\nlist_version(void)\n{\n int\t\ti;\n int\t\tfirst;\n char\t*s = \"\";",
" /*\n * When adding features here, don't forget to update the list of\n * internal variables in eval.c!\n */\n init_longVersion();\n msg(longVersion);\n#ifdef MSWIN\n# ifdef FEAT_GUI_MSWIN\n# ifdef VIMDLL\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI/console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI/console version\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI version\"));\n# endif\n# endif\n# ifdef FEAT_OLE\n msg_puts(_(\" with OLE support\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit console version\"));\n# endif\n# endif\n#endif\n#if defined(MACOS_X)\n# if defined(MACOS_X_DARWIN)\n msg_puts(_(\"\\nmacOS version\"));\n# else\n msg_puts(_(\"\\nmacOS version w/o darwin feat.\"));\n# endif\n# if defined(__arm64__)\n msg_puts(\" - arm64\");\n# elif defined(__x86_64__)\n msg_puts(\" - x86_64\");\n# endif\n#endif",
"#ifdef VMS\n msg_puts(_(\"\\nOpenVMS version\"));\n# ifdef HAVE_PATHDEF\n if (*compiled_arch != NUL)\n {\n\tmsg_puts(\" - \");\n\tmsg_puts((char *)compiled_arch);\n }\n# endif",
"#endif",
" // Print the list of patch numbers if there is at least one.\n // Print a range when patches are consecutive: \"1-10, 12, 15-40, 42-45\"\n if (included_patches[0] != 0)\n {\n\tmsg_puts(_(\"\\nIncluded patches: \"));\n\tfirst = -1;\n\ti = (int)ARRAY_LENGTH(included_patches) - 1;\n\twhile (--i >= 0)\n\t{\n\t if (first < 0)\n\t\tfirst = included_patches[i];\n\t if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)\n\t {\n\t\tmsg_puts(s);\n\t\ts = \", \";\n\t\tmsg_outnum((long)first);\n\t\tif (first != included_patches[i])\n\t\t{\n\t\t msg_puts(\"-\");\n\t\t msg_outnum((long)included_patches[i]);\n\t\t}\n\t\tfirst = -1;\n\t }\n\t}\n }",
" // Print the list of extra patch descriptions if there is at least one.\n if (extra_patches[0] != NULL)\n {\n\tmsg_puts(_(\"\\nExtra patches: \"));\n\ts = \"\";\n\tfor (i = 0; extra_patches[i] != NULL; ++i)\n\t{\n\t msg_puts(s);\n\t s = \", \";\n\t msg_puts(extra_patches[i]);\n\t}\n }",
"#ifdef MODIFIED_BY\n msg_puts(\"\\n\");\n msg_puts(_(\"Modified by \"));\n msg_puts(MODIFIED_BY);\n#endif",
"#ifdef HAVE_PATHDEF\n if (*compiled_user != NUL || *compiled_sys != NUL)\n {\n\tmsg_puts(_(\"\\nCompiled \"));\n\tif (*compiled_user != NUL)\n\t{\n\t msg_puts(_(\"by \"));\n\t msg_puts((char *)compiled_user);\n\t}\n\tif (*compiled_sys != NUL)\n\t{\n\t msg_puts(\"@\");\n\t msg_puts((char *)compiled_sys);\n\t}\n }\n#endif",
"#if defined(FEAT_HUGE)\n msg_puts(_(\"\\nHuge version \"));\n#elif defined(FEAT_BIG)\n msg_puts(_(\"\\nBig version \"));\n#elif defined(FEAT_NORMAL)\n msg_puts(_(\"\\nNormal version \"));\n#elif defined(FEAT_SMALL)\n msg_puts(_(\"\\nSmall version \"));\n#else\n msg_puts(_(\"\\nTiny version \"));\n#endif\n#if !defined(FEAT_GUI)\n msg_puts(_(\"without GUI.\"));\n#elif defined(FEAT_GUI_GTK)\n# if defined(USE_GTK3)\n msg_puts(_(\"with GTK3 GUI.\"));\n# elif defined(FEAT_GUI_GNOME)\n msg_puts(_(\"with GTK2-GNOME GUI.\"));\n# else\n msg_puts(_(\"with GTK2 GUI.\"));\n# endif\n#elif defined(FEAT_GUI_MOTIF)\n msg_puts(_(\"with X11-Motif GUI.\"));\n#elif defined(FEAT_GUI_HAIKU)\n msg_puts(_(\"with Haiku GUI.\"));\n#elif defined(FEAT_GUI_PHOTON)\n msg_puts(_(\"with Photon GUI.\"));\n#elif defined(MSWIN)\n msg_puts(_(\"with GUI.\"));\n#endif\n version_msg(_(\" Features included (+) or not (-):\\n\"));",
" list_features();\n if (msg_col > 0)\n\tmsg_putchar('\\n');",
"#ifdef SYS_VIMRC_FILE\n version_msg(_(\" system vimrc file: \\\"\"));\n version_msg(SYS_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE\n version_msg(_(\" user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE2\n version_msg(_(\" 2nd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE3\n version_msg(_(\" 3rd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE\n version_msg(_(\" user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE2\n version_msg(_(\" 2nd user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef FEAT_GUI\n# ifdef SYS_GVIMRC_FILE\n version_msg(_(\" system gvimrc file: \\\"\"));\n version_msg(SYS_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n version_msg(_(\" user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# ifdef USR_GVIMRC_FILE2\n version_msg(_(\"2nd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n# endif\n# ifdef USR_GVIMRC_FILE3\n version_msg(_(\"3rd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n version_msg(_(\" defaults file: \\\"\"));\n version_msg(VIM_DEFAULTS_FILE);\n version_msg(\"\\\"\\n\");\n#ifdef FEAT_GUI\n# ifdef SYS_MENU_FILE\n version_msg(_(\" system menu file: \\\"\"));\n version_msg(SYS_MENU_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n#ifdef HAVE_PATHDEF\n if (*default_vim_dir != NUL)\n {\n\tversion_msg(_(\" fall-back for $VIM: \\\"\"));\n\tversion_msg((char *)default_vim_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n if (*default_vimruntime_dir != NUL)\n {\n\tversion_msg(_(\" f-b for $VIMRUNTIME: \\\"\"));\n\tversion_msg((char *)default_vimruntime_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n version_msg(_(\"Compilation: \"));\n version_msg((char *)all_cflags);\n version_msg(\"\\n\");\n#ifdef VMS\n if (*compiler_version != NUL)\n {\n\tversion_msg(_(\"Compiler: \"));\n\tversion_msg((char *)compiler_version);\n\tversion_msg(\"\\n\");\n }\n#endif\n version_msg(_(\"Linking: \"));\n version_msg((char *)all_lflags);\n#endif\n#ifdef DEBUG\n version_msg(\"\\n\");\n version_msg(_(\" DEBUG BUILD\"));\n#endif\n}",
"static void do_intro_line(int row, char_u *mesg, int add_version, int attr);\nstatic void intro_message(int colon);",
"/*\n * Show the intro message when not editing a file.\n */\n void\nmaybe_intro_message(void)\n{\n if (BUFEMPTY()\n\t && curbuf->b_fname == NULL\n\t && firstwin->w_next == NULL\n\t && vim_strchr(p_shm, SHM_INTRO) == NULL)\n\tintro_message(FALSE);\n}",
"/*\n * Give an introductory message about Vim.\n * Only used when starting Vim on an empty file, without a file name.\n * Or with the \":intro\" command (for Sven :-).\n */\n static void\nintro_message(\n int\t\tcolon)\t\t// TRUE for \":intro\"\n{\n int\t\ti;\n int\t\trow;\n int\t\tblanklines;\n int\t\tsponsor;\n char\t*p;\n static char\t*(lines[]) =\n {\n\tN_(\"VIM - Vi IMproved\"),\n\t\"\",\n\tN_(\"version \"),\n\tN_(\"by Bram Moolenaar et al.\"),\n#ifdef MODIFIED_BY\n\t\" \",\n#endif\n\tN_(\"Vim is open source and freely distributable\"),\n\t\"\",\n\tN_(\"Help poor children in Uganda!\"),\n\tN_(\"type :help iccf<Enter> for information \"),\n\t\"\",\n\tN_(\"type :q<Enter> to exit \"),\n\tN_(\"type :help<Enter> or <F1> for on-line help\"),\n\tN_(\"type :help version8<Enter> for version info\"),\n\tNULL,\n\t\"\",\n\tN_(\"Running in Vi compatible mode\"),\n\tN_(\"type :set nocp<Enter> for Vim defaults\"),\n\tN_(\"type :help cp-default<Enter> for info on this\"),\n };\n#ifdef FEAT_GUI\n static char\t*(gui_lines[]) =\n {\n\tNULL,\n\tNULL,\n\tNULL,\n\tNULL,\n#ifdef MODIFIED_BY\n\tNULL,\n#endif\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Help->Orphans for information \"),\n\tNULL,\n\tN_(\"Running modeless, typed text is inserted\"),\n\tN_(\"menu Edit->Global Settings->Toggle Insert Mode \"),\n\tN_(\" for two modes \"),\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Edit->Global Settings->Toggle Vi Compatible\"),\n\tN_(\" for Vim defaults \"),\n };\n#endif",
" // blanklines = screen height - # message lines\n blanklines = (int)Rows - (ARRAY_LENGTH(lines) - 1);\n if (!p_cp)\n\tblanklines += 4; // add 4 for not showing \"Vi compatible\" message",
" // Don't overwrite a statusline. Depends on 'cmdheight'.\n if (p_ls > 1)\n\tblanklines -= Rows - topframe->fr_height;\n if (blanklines < 0)\n\tblanklines = 0;",
" // Show the sponsor and register message one out of four times, the Uganda\n // message two out of four times.\n sponsor = (int)time(NULL);\n sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);",
" // start displaying the message lines after half of the blank lines\n row = blanklines / 2;\n if ((row >= 2 && Columns >= 50) || colon)\n {\n\tfor (i = 0; i < (int)ARRAY_LENGTH(lines); ++i)\n\t{\n\t p = lines[i];\n#ifdef FEAT_GUI\n\t if (p_im && gui.in_use && gui_lines[i] != NULL)\n\t\tp = gui_lines[i];\n#endif\n\t if (p == NULL)\n\t {\n\t\tif (!p_cp)\n\t\t break;\n\t\tcontinue;\n\t }\n\t if (sponsor != 0)\n\t {\n\t\tif (strstr(p, \"children\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"Sponsor Vim development!\")\n\t\t\t: N_(\"Become a registered Vim user!\");\n\t\telse if (strstr(p, \"iccf\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"type :help sponsor<Enter> for information \")\n\t\t\t: N_(\"type :help register<Enter> for information \");\n\t\telse if (strstr(p, \"Orphans\") != NULL)\n\t\t p = N_(\"menu Help->Sponsor/Register for information \");\n\t }\n\t if (*p != NUL)\n\t\tdo_intro_line(row, (char_u *)_(p), i == 2, 0);\n\t ++row;\n\t}\n }",
" // Make the wait-return message appear just below the text.\n if (colon)\n\tmsg_row = row;\n}",
" static void\ndo_intro_line(\n int\t\trow,\n char_u\t*mesg,\n int\t\tadd_version,\n int\t\tattr)\n{\n char_u\tvers[20];\n int\t\tcol;\n char_u\t*p;\n int\t\tl;\n int\t\tclen;\n#ifdef MODIFIED_BY\n# define MODBY_LEN 150\n char_u\tmodby[MODBY_LEN];",
" if (*mesg == ' ')\n {\n\tvim_strncpy(modby, (char_u *)_(\"Modified by \"), MODBY_LEN - 1);\n\tl = (int)STRLEN(modby);\n\tvim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);\n\tmesg = modby;\n }\n#endif",
" // Center the message horizontally.\n col = vim_strsize(mesg);\n if (add_version)\n {\n\tSTRCPY(vers, mediumVersion);\n\tif (highest_patch())\n\t{\n\t // Check for 9.9x or 9.9xx, alpha/beta version\n\t if (isalpha((int)vers[3]))\n\t {\n\t\tint len = (isalpha((int)vers[4])) ? 5 : 4;\n\t\tsprintf((char *)vers + len, \".%d%s\", highest_patch(),\n\t\t\t\t\t\t\t mediumVersion + len);\n\t }\n\t else\n\t\tsprintf((char *)vers + 3, \".%d\", highest_patch());\n\t}\n\tcol += (int)STRLEN(vers);\n }\n col = (Columns - col) / 2;\n if (col < 0)\n\tcol = 0;",
" // Split up in parts to highlight <> items differently.\n for (p = mesg; *p != NUL; p += l)\n {\n\tclen = 0;\n\tfor (l = 0; p[l] != NUL\n\t\t\t && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)\n\t{\n\t if (has_mbyte)\n\t {\n\t\tclen += ptr2cells(p + l);\n\t\tl += (*mb_ptr2len)(p + l) - 1;\n\t }\n\t else\n\t\tclen += byte2cells(p[l]);\n\t}\n\tscreen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);\n\tcol += clen;\n }",
" // Add the version number to the version line.\n if (add_version)\n\tscreen_puts(vers, row, col, 0);\n}",
"/*\n * \":intro\": clear screen, display intro screen and wait for return.\n */\n void\nex_intro(exarg_T *eap UNUSED)\n{\n screenclear();\n intro_message(TRUE);\n wait_return(TRUE);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [4474, 1400, 736], "buggy_code_start_loc": [4466, 1400, 736], "filenames": ["src/normal.c", "src/testdir/test_tagjump.vim", "src/version.c"], "fixing_code_end_loc": [4481, 1407, 739], "fixing_code_start_loc": [4467, 1401, 737], "message": "Use After Free in GitHub repository vim/vim prior to 8.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "C9328925-FDFF-4283-A085-666EB6616272", "versionEndExcluding": "8.2.5024", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*", "matchCriteriaId": "71E032AD-F827-4944-9699-BB1E6D4233FC", "versionEndExcluding": "13.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use After Free in GitHub repository vim/vim prior to 8.2."}, {"lang": "es", "value": "Un Uso de Memoria Previamente Liberada en el repositorio de GitHub vim/vim versiones anteriores a 8.2"}], "evaluatorComment": null, "id": "CVE-2022-1898", "lastModified": "2023-05-03T12:15:36.347", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-05-27T09:15:08.030", "references": [{"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/28"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/41"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/45aad635-c2f1-47ca-a4f9-db5b25979cea"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00014.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZSLFIKFYU5Y2KM5EJKQNYHWRUBDQ4GJ/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMFHBC5OQXDPV2SDYA2JUQGVCPYASTJB/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TYNK6SDCMOLQJOI3B4AOE66P2G2IH4ZM/"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/202208-32"}, {"source": "security@huntr.dev", "tags": null, "url": "https://security.gentoo.org/glsa/202305-16"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://support.apple.com/kb/HT213488"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, "type": "CWE-416"}
| 103
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"/* vi:set ts=8 sts=4 sw=4 noet:\n *\n * VIM - Vi IMproved\t\tby Bram Moolenaar\n *\n * Do \":help uganda\" in Vim to read copying and usage conditions.\n * Do \":help credits\" in Vim to see a list of people who contributed.\n * See README.txt for an overview of the Vim source code.\n */",
"#include \"vim.h\"",
"/*\n * Vim originated from Stevie version 3.6 (Fish disk 217) by GRWalter (Fred)\n * It has been changed beyond recognition since then.\n *\n * Differences between version 7.4 and 8.x can be found with \":help version8\".\n * Differences between version 6.4 and 7.x can be found with \":help version7\".\n * Differences between version 5.8 and 6.x can be found with \":help version6\".\n * Differences between version 4.x and 5.x can be found with \":help version5\".\n * Differences between version 3.0 and 4.x can be found with \":help version4\".\n * All the remarks about older versions have been removed, they are not very\n * interesting.\n */",
"#include \"version.h\"",
"char\t\t*Version = VIM_VERSION_SHORT;\nstatic char\t*mediumVersion = VIM_VERSION_MEDIUM;",
"#if defined(HAVE_DATE_TIME) || defined(PROTO)\n# if (defined(VMS) && defined(VAXC)) || defined(PROTO)\nchar\tlongVersion[sizeof(VIM_VERSION_LONG_DATE) + sizeof(__DATE__)\n\t\t\t\t\t\t + sizeof(__TIME__) + 3];",
" void\ninit_longVersion(void)\n{\n /*\n * Construct the long version string. Necessary because\n * VAX C can't concatenate strings in the preprocessor.\n */\n strcpy(longVersion, VIM_VERSION_LONG_DATE);\n#ifdef BUILD_DATE\n strcat(longVersion, BUILD_DATE);\n#else\n strcat(longVersion, __DATE__);\n strcat(longVersion, \" \");\n strcat(longVersion, __TIME__);\n#endif\n strcat(longVersion, \")\");\n}",
"# else\nchar\t*longVersion = NULL;",
" void\ninit_longVersion(void)\n{\n if (longVersion == NULL)\n {\n#ifdef BUILD_DATE\n\tchar *date_time = BUILD_DATE;\n#else\n\tchar *date_time = __DATE__ \" \" __TIME__;\n#endif\n\tchar *msg = _(\"%s (%s, compiled %s)\");\n\tsize_t len = strlen(msg)\n\t\t + strlen(VIM_VERSION_LONG_ONLY)\n\t\t + strlen(VIM_VERSION_DATE_ONLY)\n\t\t + strlen(date_time);",
"\tlongVersion = alloc(len);\n\tif (longVersion == NULL)\n\t longVersion = VIM_VERSION_LONG;\n\telse\n\t vim_snprintf(longVersion, len, msg,\n\t\t VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);\n }\n}\n# endif\n#else\nchar\t*longVersion = VIM_VERSION_LONG;",
" void\ninit_longVersion(void)\n{\n // nothing to do\n}\n#endif",
"static char *(features[]) =\n{\n#ifdef HAVE_ACL\n\t\"+acl\",\n#else\n\t\"-acl\",\n#endif\n#ifdef AMIGA\t\t// only for Amiga systems\n# ifdef FEAT_ARP\n\t\"+ARP\",\n# else\n\t\"-ARP\",\n# endif\n#endif\n#ifdef FEAT_ARABIC\n\t\"+arabic\",\n#else\n\t\"-arabic\",\n#endif\n\t\"+autocmd\",\n#ifdef FEAT_AUTOCHDIR\n \"+autochdir\",\n#else\n \"-autochdir\",\n#endif\n#ifdef FEAT_AUTOSERVERNAME\n\t\"+autoservername\",\n#else\n\t\"-autoservername\",\n#endif\n#ifdef FEAT_BEVAL_GUI\n\t\"+balloon_eval\",\n#else\n\t\"-balloon_eval\",\n#endif\n#ifdef FEAT_BEVAL_TERM\n\t\"+balloon_eval_term\",\n#else\n\t\"-balloon_eval_term\",\n#endif\n#ifdef FEAT_BROWSE\n\t\"+browse\",\n#else\n\t\"-browse\",\n#endif\n#ifdef NO_BUILTIN_TCAPS\n\t\"-builtin_terms\",\n#endif\n#ifdef SOME_BUILTIN_TCAPS\n\t\"+builtin_terms\",\n#endif\n#ifdef ALL_BUILTIN_TCAPS\n\t\"++builtin_terms\",\n#endif\n#ifdef FEAT_BYTEOFF\n\t\"+byte_offset\",\n#else\n\t\"-byte_offset\",\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t\"+channel\",\n#else\n\t\"-channel\",\n#endif\n\t\"+cindent\",\n#ifdef FEAT_CLIENTSERVER\n\t\"+clientserver\",\n#else\n\t\"-clientserver\",\n#endif\n#ifdef FEAT_CLIPBOARD\n\t\"+clipboard\",\n#else\n\t\"-clipboard\",\n#endif\n\t\"+cmdline_compl\",\n\t\"+cmdline_hist\",\n#ifdef FEAT_CMDL_INFO\n\t\"+cmdline_info\",\n#else\n\t\"-cmdline_info\",\n#endif\n\t\"+comments\",\n#ifdef FEAT_CONCEAL\n\t\"+conceal\",\n#else\n\t\"-conceal\",\n#endif\n#ifdef FEAT_CRYPT\n\t\"+cryptv\",\n#else\n\t\"-cryptv\",\n#endif\n#ifdef FEAT_CSCOPE\n\t\"+cscope\",\n#else\n\t\"-cscope\",\n#endif\n\t\"+cursorbind\",\n#ifdef CURSOR_SHAPE\n\t\"+cursorshape\",\n#else\n\t\"-cursorshape\",\n#endif\n#if defined(FEAT_CON_DIALOG) && defined(FEAT_GUI_DIALOG)\n\t\"+dialog_con_gui\",\n#else\n# if defined(FEAT_CON_DIALOG)\n\t\"+dialog_con\",\n# else\n# if defined(FEAT_GUI_DIALOG)\n\t\"+dialog_gui\",\n# else\n\t\"-dialog\",\n# endif\n# endif\n#endif\n#ifdef FEAT_DIFF\n\t\"+diff\",\n#else\n\t\"-diff\",\n#endif\n#ifdef FEAT_DIGRAPHS\n\t\"+digraphs\",\n#else\n\t\"-digraphs\",\n#endif\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_DIRECTX\n\t\"+directx\",\n# else\n\t\"-directx\",\n# endif\n#endif\n#ifdef FEAT_DND\n\t\"+dnd\",\n#else\n\t\"-dnd\",\n#endif\n\t\"-ebcdic\",\n#ifdef FEAT_EMACS_TAGS\n\t\"+emacs_tags\",\n#else\n\t\"-emacs_tags\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+eval\",\n#else\n\t\"-eval\",\n#endif\n\t\"+ex_extra\",\n#ifdef FEAT_SEARCH_EXTRA\n\t\"+extra_search\",\n#else\n\t\"-extra_search\",\n#endif\n\t\"-farsi\",\n#ifdef FEAT_SEARCHPATH\n\t\"+file_in_path\",\n#else\n\t\"-file_in_path\",\n#endif\n#ifdef FEAT_FIND_ID\n\t\"+find_in_path\",\n#else\n\t\"-find_in_path\",\n#endif\n#ifdef FEAT_FLOAT\n\t\"+float\",\n#else\n\t\"-float\",\n#endif\n#ifdef FEAT_FOLDING\n\t\"+folding\",\n#else\n\t\"-folding\",\n#endif\n#ifdef FEAT_FOOTER\n\t\"+footer\",\n#else\n\t\"-footer\",\n#endif\n\t // only interesting on Unix systems\n#if !defined(USE_SYSTEM) && defined(UNIX)\n\t\"+fork()\",\n#endif\n#ifdef FEAT_GETTEXT\n# ifdef DYNAMIC_GETTEXT\n\t\"+gettext/dyn\",\n# else\n\t\"+gettext\",\n# endif\n#else\n\t\"-gettext\",\n#endif\n\t\"-hangul_input\",\n#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)\n# ifdef DYNAMIC_ICONV\n\t\"+iconv/dyn\",\n# else\n\t\"+iconv\",\n# endif\n#else\n\t\"-iconv\",\n#endif\n\t\"+insert_expand\",\n#ifdef FEAT_IPV6\n\t\"+ipv6\",\n#else\n\t\"-ipv6\",\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\t\"+job\",\n#else\n\t\"-job\",\n#endif\n\t\"+jumplist\",\n#ifdef FEAT_KEYMAP\n\t\"+keymap\",\n#else\n\t\"-keymap\",\n#endif\n#ifdef FEAT_EVAL\n\t\"+lambda\",\n#else\n\t\"-lambda\",\n#endif\n#ifdef FEAT_LANGMAP\n\t\"+langmap\",\n#else\n\t\"-langmap\",\n#endif\n#ifdef FEAT_LIBCALL\n\t\"+libcall\",\n#else\n\t\"-libcall\",\n#endif\n#ifdef FEAT_LINEBREAK\n\t\"+linebreak\",\n#else\n\t\"-linebreak\",\n#endif\n\t\"+lispindent\",\n\t\"+listcmds\",\n\t\"+localmap\",\n#ifdef FEAT_LUA\n# ifdef DYNAMIC_LUA\n\t\"+lua/dyn\",\n# else\n\t\"+lua\",\n# endif\n#else\n\t\"-lua\",\n#endif\n#ifdef FEAT_MENU\n\t\"+menu\",\n#else\n\t\"-menu\",\n#endif\n#ifdef FEAT_SESSION\n\t\"+mksession\",\n#else\n\t\"-mksession\",\n#endif\n\t\"+modify_fname\",\n\t\"+mouse\",\n#ifdef FEAT_MOUSESHAPE\n\t\"+mouseshape\",\n#else\n\t\"-mouseshape\",\n#endif",
"#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_MOUSE_DEC\n\t\"+mouse_dec\",\n# else\n\t\"-mouse_dec\",\n# endif\n# ifdef FEAT_MOUSE_GPM\n# ifdef DYNAMIC_GPM\n\t\"+mouse_gpm/dyn\",\n# else\n\t\"+mouse_gpm\",\n# endif\n# else\n\t\"-mouse_gpm\",\n# endif\n# ifdef FEAT_MOUSE_JSB\n\t\"+mouse_jsbterm\",\n# else\n\t\"-mouse_jsbterm\",\n# endif\n# ifdef FEAT_MOUSE_NET\n\t\"+mouse_netterm\",\n# else\n\t\"-mouse_netterm\",\n# endif\n#endif",
"#ifdef __QNX__\n# ifdef FEAT_MOUSE_PTERM\n\t\"+mouse_pterm\",\n# else\n\t\"-mouse_pterm\",\n# endif\n#endif",
"#if defined(UNIX) || defined(VMS)\n\t\"+mouse_sgr\",\n# ifdef FEAT_SYSMOUSE\n\t\"+mouse_sysmouse\",\n# else\n\t\"-mouse_sysmouse\",\n# endif\n# ifdef FEAT_MOUSE_URXVT\n\t\"+mouse_urxvt\",\n# else\n\t\"-mouse_urxvt\",\n# endif\n\t\"+mouse_xterm\",\n#endif",
"#ifdef FEAT_MBYTE_IME\n# ifdef DYNAMIC_IME\n\t\"+multi_byte_ime/dyn\",\n# else\n\t\"+multi_byte_ime\",\n# endif\n#else\n\t\"+multi_byte\",\n#endif\n#ifdef FEAT_MULTI_LANG\n\t\"+multi_lang\",\n#else\n\t\"-multi_lang\",\n#endif\n#ifdef FEAT_MZSCHEME\n# ifdef DYNAMIC_MZSCHEME\n\t\"+mzscheme/dyn\",\n# else\n\t\"+mzscheme\",\n# endif\n#else\n\t\"-mzscheme\",\n#endif\n#ifdef FEAT_NETBEANS_INTG\n\t\"+netbeans_intg\",\n#else\n\t\"-netbeans_intg\",\n#endif\n\t\"+num64\",\n#ifdef FEAT_GUI_MSWIN\n# ifdef FEAT_OLE\n\t\"+ole\",\n# else\n\t\"-ole\",\n# endif\n#endif\n#ifdef FEAT_EVAL\n\t\"+packages\",\n#else\n\t\"-packages\",\n#endif\n#ifdef FEAT_PATH_EXTRA\n\t\"+path_extra\",\n#else\n\t\"-path_extra\",\n#endif\n#ifdef FEAT_PERL\n# ifdef DYNAMIC_PERL\n\t\"+perl/dyn\",\n# else\n\t\"+perl\",\n# endif\n#else\n\t\"-perl\",\n#endif\n#ifdef FEAT_PERSISTENT_UNDO\n\t\"+persistent_undo\",\n#else\n\t\"-persistent_undo\",\n#endif\n#ifdef FEAT_PROP_POPUP\n\t\"+popupwin\",\n#else\n\t\"-popupwin\",\n#endif\n#ifdef FEAT_PRINTER\n# ifdef FEAT_POSTSCRIPT\n\t\"+postscript\",\n# else\n\t\"-postscript\",\n# endif\n\t\"+printer\",\n#else\n\t\"-printer\",\n#endif\n#ifdef FEAT_PROFILE\n\t\"+profile\",\n#else\n\t\"-profile\",\n#endif\n#ifdef FEAT_PYTHON\n# ifdef DYNAMIC_PYTHON\n\t\"+python/dyn\",\n# else\n\t\"+python\",\n# endif\n#else\n\t\"-python\",\n#endif\n#ifdef FEAT_PYTHON3\n# ifdef DYNAMIC_PYTHON3\n\t\"+python3/dyn\",\n# else\n\t\"+python3\",\n# endif\n#else\n\t\"-python3\",\n#endif\n#ifdef FEAT_QUICKFIX\n\t\"+quickfix\",\n#else\n\t\"-quickfix\",\n#endif\n#ifdef FEAT_RELTIME\n\t\"+reltime\",\n#else\n\t\"-reltime\",\n#endif\n#ifdef FEAT_RIGHTLEFT\n\t\"+rightleft\",\n#else\n\t\"-rightleft\",\n#endif\n#ifdef FEAT_RUBY\n# ifdef DYNAMIC_RUBY\n\t\"+ruby/dyn\",\n# else\n\t\"+ruby\",\n# endif\n#else\n\t\"-ruby\",\n#endif\n\t\"+scrollbind\",\n#ifdef FEAT_SIGNS\n\t\"+signs\",\n#else\n\t\"-signs\",\n#endif\n\t\"+smartindent\",\n#ifdef FEAT_SODIUM\n# ifdef DYNAMIC_SODIUM\n\t\"+sodium/dyn\",\n# else\n\t\"+sodium\",\n# endif\n#else\n\t\"-sodium\",\n#endif\n#ifdef FEAT_SOUND\n\t\"+sound\",\n#else\n\t\"-sound\",\n#endif\n#ifdef FEAT_SPELL\n\t\"+spell\",\n#else\n\t\"-spell\",\n#endif\n#ifdef STARTUPTIME\n\t\"+startuptime\",\n#else\n\t\"-startuptime\",\n#endif\n#ifdef FEAT_STL_OPT\n\t\"+statusline\",\n#else\n\t\"-statusline\",\n#endif\n\t\"-sun_workshop\",\n#ifdef FEAT_SYN_HL\n\t\"+syntax\",\n#else\n\t\"-syntax\",\n#endif\n\t // only interesting on Unix systems\n#if defined(USE_SYSTEM) && defined(UNIX)\n\t\"+system()\",\n#endif\n\t\"+tag_binary\",\n\t\"-tag_old_static\",\n\t\"-tag_any_white\",\n#ifdef FEAT_TCL\n# ifdef DYNAMIC_TCL\n\t\"+tcl/dyn\",\n# else\n\t\"+tcl\",\n# endif\n#else\n\t\"-tcl\",\n#endif\n#ifdef FEAT_TERMGUICOLORS\n\t\"+termguicolors\",\n#else\n\t\"-termguicolors\",\n#endif\n#ifdef FEAT_TERMINAL\n\t\"+terminal\",\n#else\n\t\"-terminal\",\n#endif\n#if defined(UNIX)\n// only Unix can have terminfo instead of termcap\n# ifdef TERMINFO\n\t\"+terminfo\",\n# else\n\t\"-terminfo\",\n# endif\n#endif\n#ifdef FEAT_TERMRESPONSE\n\t\"+termresponse\",\n#else\n\t\"-termresponse\",\n#endif\n#ifdef FEAT_TEXTOBJ\n\t\"+textobjects\",\n#else\n\t\"-textobjects\",\n#endif\n#ifdef FEAT_PROP_POPUP\n\t\"+textprop\",\n#else\n\t\"-textprop\",\n#endif\n#if !defined(UNIX)\n// unix always includes termcap support\n# ifdef HAVE_TGETENT\n\t\"+tgetent\",\n# else\n\t\"-tgetent\",\n# endif\n#endif\n#ifdef FEAT_TIMERS\n\t\"+timers\",\n#else\n\t\"-timers\",\n#endif\n\t\"+title\",\n#ifdef FEAT_TOOLBAR\n\t\"+toolbar\",\n#else\n\t\"-toolbar\",\n#endif\n\t\"+user_commands\",\n#ifdef FEAT_VARTABS\n\t\"+vartabs\",\n#else\n\t\"-vartabs\",\n#endif\n\t\"+vertsplit\",\n\t\"+vim9script\",\n#ifdef FEAT_VIMINFO\n\t\"+viminfo\",\n#else\n\t\"-viminfo\",\n#endif\n\t\"+virtualedit\",\n\t\"+visual\",\n\t\"+visualextra\",\n\t\"+vreplace\",\n#ifdef MSWIN\n# ifdef FEAT_VTP\n\t\"+vtp\",\n# else\n\t\"-vtp\",\n# endif\n#endif\n#ifdef FEAT_WILDIGN\n\t\"+wildignore\",\n#else\n\t\"-wildignore\",\n#endif\n#ifdef FEAT_WILDMENU\n\t\"+wildmenu\",\n#else\n\t\"-wildmenu\",\n#endif\n\t\"+windows\",\n#ifdef FEAT_WRITEBACKUP\n\t\"+writebackup\",\n#else\n\t\"-writebackup\",\n#endif\n#if defined(UNIX) || defined(VMS)\n# ifdef FEAT_X11\n\t\"+X11\",\n# else\n\t\"-X11\",\n# endif\n#endif\n#ifdef FEAT_XFONTSET\n\t\"+xfontset\",\n#else\n\t\"-xfontset\",\n#endif\n#ifdef FEAT_XIM\n\t\"+xim\",\n#else\n\t\"-xim\",\n#endif\n#if defined(MSWIN)\n# ifdef FEAT_XPM_W32\n\t\"+xpm_w32\",\n# else\n\t\"-xpm_w32\",\n# endif\n#elif defined(HAVE_XPM)\n\t\"+xpm\",\n#else\n\t\"-xpm\",\n#endif\n#if defined(UNIX) || defined(VMS)\n# if defined(USE_XSMP_INTERACT)\n\t\"+xsmp_interact\",\n# elif defined(USE_XSMP)\n\t\"+xsmp\",\n# else\n\t\"-xsmp\",\n# endif\n# ifdef FEAT_XCLIPBOARD\n\t\"+xterm_clipboard\",\n# else\n\t\"-xterm_clipboard\",\n# endif\n#endif\n#ifdef FEAT_XTERM_SAVE\n\t\"+xterm_save\",\n#else\n\t\"-xterm_save\",\n#endif\n\tNULL\n};",
"static int included_patches[] =\n{ /* Add new patch number below this line */",
"/**/\n 5024,",
"/**/\n 5023,\n/**/\n 5022,\n/**/\n 5021,\n/**/\n 5020,\n/**/\n 5019,\n/**/\n 5018,\n/**/\n 5017,\n/**/\n 5016,\n/**/\n 5015,\n/**/\n 5014,\n/**/\n 5013,\n/**/\n 5012,\n/**/\n 5011,\n/**/\n 5010,\n/**/\n 5009,\n/**/\n 5008,\n/**/\n 5007,\n/**/\n 5006,\n/**/\n 5005,\n/**/\n 5004,\n/**/\n 5003,\n/**/\n 5002,\n/**/\n 5001,\n/**/\n 5000,\n/**/\n 4999,\n/**/\n 4998,\n/**/\n 4997,\n/**/\n 4996,\n/**/\n 4995,\n/**/\n 4994,\n/**/\n 4993,\n/**/\n 4992,\n/**/\n 4991,\n/**/\n 4990,\n/**/\n 4989,\n/**/\n 4988,\n/**/\n 4987,\n/**/\n 4986,\n/**/\n 4985,\n/**/\n 4984,\n/**/\n 4983,\n/**/\n 4982,\n/**/\n 4981,\n/**/\n 4980,\n/**/\n 4979,\n/**/\n 4978,\n/**/\n 4977,\n/**/\n 4976,\n/**/\n 4975,\n/**/\n 4974,\n/**/\n 4973,\n/**/\n 4972,\n/**/\n 4971,\n/**/\n 4970,\n/**/\n 4969,\n/**/\n 4968,\n/**/\n 4967,\n/**/\n 4966,\n/**/\n 4965,\n/**/\n 4964,\n/**/\n 4963,\n/**/\n 4962,\n/**/\n 4961,\n/**/\n 4960,\n/**/\n 4959,\n/**/\n 4958,\n/**/\n 4957,\n/**/\n 4956,\n/**/\n 4955,\n/**/\n 4954,\n/**/\n 4953,\n/**/\n 4952,\n/**/\n 4951,\n/**/\n 4950,\n/**/\n 4949,\n/**/\n 4948,\n/**/\n 4947,\n/**/\n 4946,\n/**/\n 4945,\n/**/\n 4944,\n/**/\n 4943,\n/**/\n 4942,\n/**/\n 4941,\n/**/\n 4940,\n/**/\n 4939,\n/**/\n 4938,\n/**/\n 4937,\n/**/\n 4936,\n/**/\n 4935,\n/**/\n 4934,\n/**/\n 4933,\n/**/\n 4932,\n/**/\n 4931,\n/**/\n 4930,\n/**/\n 4929,\n/**/\n 4928,\n/**/\n 4927,\n/**/\n 4926,\n/**/\n 4925,\n/**/\n 4924,\n/**/\n 4923,\n/**/\n 4922,\n/**/\n 4921,\n/**/\n 4920,\n/**/\n 4919,\n/**/\n 4918,\n/**/\n 4917,\n/**/\n 4916,\n/**/\n 4915,\n/**/\n 4914,\n/**/\n 4913,\n/**/\n 4912,\n/**/\n 4911,\n/**/\n 4910,\n/**/\n 4909,\n/**/\n 4908,\n/**/\n 4907,\n/**/\n 4906,\n/**/\n 4905,\n/**/\n 4904,\n/**/\n 4903,\n/**/\n 4902,\n/**/\n 4901,\n/**/\n 4900,\n/**/\n 4899,\n/**/\n 4898,\n/**/\n 4897,\n/**/\n 4896,\n/**/\n 4895,\n/**/\n 4894,\n/**/\n 4893,\n/**/\n 4892,\n/**/\n 4891,\n/**/\n 4890,\n/**/\n 4889,\n/**/\n 4888,\n/**/\n 4887,\n/**/\n 4886,\n/**/\n 4885,\n/**/\n 4884,\n/**/\n 4883,\n/**/\n 4882,\n/**/\n 4881,\n/**/\n 4880,\n/**/\n 4879,\n/**/\n 4878,\n/**/\n 4877,\n/**/\n 4876,\n/**/\n 4875,\n/**/\n 4874,\n/**/\n 4873,\n/**/\n 4872,\n/**/\n 4871,\n/**/\n 4870,\n/**/\n 4869,\n/**/\n 4868,\n/**/\n 4867,\n/**/\n 4866,\n/**/\n 4865,\n/**/\n 4864,\n/**/\n 4863,\n/**/\n 4862,\n/**/\n 4861,\n/**/\n 4860,\n/**/\n 4859,\n/**/\n 4858,\n/**/\n 4857,\n/**/\n 4856,\n/**/\n 4855,\n/**/\n 4854,\n/**/\n 4853,\n/**/\n 4852,\n/**/\n 4851,\n/**/\n 4850,\n/**/\n 4849,\n/**/\n 4848,\n/**/\n 4847,\n/**/\n 4846,\n/**/\n 4845,\n/**/\n 4844,\n/**/\n 4843,\n/**/\n 4842,\n/**/\n 4841,\n/**/\n 4840,\n/**/\n 4839,\n/**/\n 4838,\n/**/\n 4837,\n/**/\n 4836,\n/**/\n 4835,\n/**/\n 4834,\n/**/\n 4833,\n/**/\n 4832,\n/**/\n 4831,\n/**/\n 4830,\n/**/\n 4829,\n/**/\n 4828,\n/**/\n 4827,\n/**/\n 4826,\n/**/\n 4825,\n/**/\n 4824,\n/**/\n 4823,\n/**/\n 4822,\n/**/\n 4821,\n/**/\n 4820,\n/**/\n 4819,\n/**/\n 4818,\n/**/\n 4817,\n/**/\n 4816,\n/**/\n 4815,\n/**/\n 4814,\n/**/\n 4813,\n/**/\n 4812,\n/**/\n 4811,\n/**/\n 4810,\n/**/\n 4809,\n/**/\n 4808,\n/**/\n 4807,\n/**/\n 4806,\n/**/\n 4805,\n/**/\n 4804,\n/**/\n 4803,\n/**/\n 4802,\n/**/\n 4801,\n/**/\n 4800,\n/**/\n 4799,\n/**/\n 4798,\n/**/\n 4797,\n/**/\n 4796,\n/**/\n 4795,\n/**/\n 4794,\n/**/\n 4793,\n/**/\n 4792,\n/**/\n 4791,\n/**/\n 4790,\n/**/\n 4789,\n/**/\n 4788,\n/**/\n 4787,\n/**/\n 4786,\n/**/\n 4785,\n/**/\n 4784,\n/**/\n 4783,\n/**/\n 4782,\n/**/\n 4781,\n/**/\n 4780,\n/**/\n 4779,\n/**/\n 4778,\n/**/\n 4777,\n/**/\n 4776,\n/**/\n 4775,\n/**/\n 4774,\n/**/\n 4773,\n/**/\n 4772,\n/**/\n 4771,\n/**/\n 4770,\n/**/\n 4769,\n/**/\n 4768,\n/**/\n 4767,\n/**/\n 4766,\n/**/\n 4765,\n/**/\n 4764,\n/**/\n 4763,\n/**/\n 4762,\n/**/\n 4761,\n/**/\n 4760,\n/**/\n 4759,\n/**/\n 4758,\n/**/\n 4757,\n/**/\n 4756,\n/**/\n 4755,\n/**/\n 4754,\n/**/\n 4753,\n/**/\n 4752,\n/**/\n 4751,\n/**/\n 4750,\n/**/\n 4749,\n/**/\n 4748,\n/**/\n 4747,\n/**/\n 4746,\n/**/\n 4745,\n/**/\n 4744,\n/**/\n 4743,\n/**/\n 4742,\n/**/\n 4741,\n/**/\n 4740,\n/**/\n 4739,\n/**/\n 4738,\n/**/\n 4737,\n/**/\n 4736,\n/**/\n 4735,\n/**/\n 4734,\n/**/\n 4733,\n/**/\n 4732,\n/**/\n 4731,\n/**/\n 4730,\n/**/\n 4729,\n/**/\n 4728,\n/**/\n 4727,\n/**/\n 4726,\n/**/\n 4725,\n/**/\n 4724,\n/**/\n 4723,\n/**/\n 4722,\n/**/\n 4721,\n/**/\n 4720,\n/**/\n 4719,\n/**/\n 4718,\n/**/\n 4717,\n/**/\n 4716,\n/**/\n 4715,\n/**/\n 4714,\n/**/\n 4713,\n/**/\n 4712,\n/**/\n 4711,\n/**/\n 4710,\n/**/\n 4709,\n/**/\n 4708,\n/**/\n 4707,\n/**/\n 4706,\n/**/\n 4705,\n/**/\n 4704,\n/**/\n 4703,\n/**/\n 4702,\n/**/\n 4701,\n/**/\n 4700,\n/**/\n 4699,\n/**/\n 4698,\n/**/\n 4697,\n/**/\n 4696,\n/**/\n 4695,\n/**/\n 4694,\n/**/\n 4693,\n/**/\n 4692,\n/**/\n 4691,\n/**/\n 4690,\n/**/\n 4689,\n/**/\n 4688,\n/**/\n 4687,\n/**/\n 4686,\n/**/\n 4685,\n/**/\n 4684,\n/**/\n 4683,\n/**/\n 4682,\n/**/\n 4681,\n/**/\n 4680,\n/**/\n 4679,\n/**/\n 4678,\n/**/\n 4677,\n/**/\n 4676,\n/**/\n 4675,\n/**/\n 4674,\n/**/\n 4673,\n/**/\n 4672,\n/**/\n 4671,\n/**/\n 4670,\n/**/\n 4669,\n/**/\n 4668,\n/**/\n 4667,\n/**/\n 4666,\n/**/\n 4665,\n/**/\n 4664,\n/**/\n 4663,\n/**/\n 4662,\n/**/\n 4661,\n/**/\n 4660,\n/**/\n 4659,\n/**/\n 4658,\n/**/\n 4657,\n/**/\n 4656,\n/**/\n 4655,\n/**/\n 4654,\n/**/\n 4653,\n/**/\n 4652,\n/**/\n 4651,\n/**/\n 4650,\n/**/\n 4649,\n/**/\n 4648,\n/**/\n 4647,\n/**/\n 4646,\n/**/\n 4645,\n/**/\n 4644,\n/**/\n 4643,\n/**/\n 4642,\n/**/\n 4641,\n/**/\n 4640,\n/**/\n 4639,\n/**/\n 4638,\n/**/\n 4637,\n/**/\n 4636,\n/**/\n 4635,\n/**/\n 4634,\n/**/\n 4633,\n/**/\n 4632,\n/**/\n 4631,\n/**/\n 4630,\n/**/\n 4629,\n/**/\n 4628,\n/**/\n 4627,\n/**/\n 4626,\n/**/\n 4625,\n/**/\n 4624,\n/**/\n 4623,\n/**/\n 4622,\n/**/\n 4621,\n/**/\n 4620,\n/**/\n 4619,\n/**/\n 4618,\n/**/\n 4617,\n/**/\n 4616,\n/**/\n 4615,\n/**/\n 4614,\n/**/\n 4613,\n/**/\n 4612,\n/**/\n 4611,\n/**/\n 4610,\n/**/\n 4609,\n/**/\n 4608,\n/**/\n 4607,\n/**/\n 4606,\n/**/\n 4605,\n/**/\n 4604,\n/**/\n 4603,\n/**/\n 4602,\n/**/\n 4601,\n/**/\n 4600,\n/**/\n 4599,\n/**/\n 4598,\n/**/\n 4597,\n/**/\n 4596,\n/**/\n 4595,\n/**/\n 4594,\n/**/\n 4593,\n/**/\n 4592,\n/**/\n 4591,\n/**/\n 4590,\n/**/\n 4589,\n/**/\n 4588,\n/**/\n 4587,\n/**/\n 4586,\n/**/\n 4585,\n/**/\n 4584,\n/**/\n 4583,\n/**/\n 4582,\n/**/\n 4581,\n/**/\n 4580,\n/**/\n 4579,\n/**/\n 4578,\n/**/\n 4577,\n/**/\n 4576,\n/**/\n 4575,\n/**/\n 4574,\n/**/\n 4573,\n/**/\n 4572,\n/**/\n 4571,\n/**/\n 4570,\n/**/\n 4569,\n/**/\n 4568,\n/**/\n 4567,\n/**/\n 4566,\n/**/\n 4565,\n/**/\n 4564,\n/**/\n 4563,\n/**/\n 4562,\n/**/\n 4561,\n/**/\n 4560,\n/**/\n 4559,\n/**/\n 4558,\n/**/\n 4557,\n/**/\n 4556,\n/**/\n 4555,\n/**/\n 4554,\n/**/\n 4553,\n/**/\n 4552,\n/**/\n 4551,\n/**/\n 4550,\n/**/\n 4549,\n/**/\n 4548,\n/**/\n 4547,\n/**/\n 4546,\n/**/\n 4545,\n/**/\n 4544,\n/**/\n 4543,\n/**/\n 4542,\n/**/\n 4541,\n/**/\n 4540,\n/**/\n 4539,\n/**/\n 4538,\n/**/\n 4537,\n/**/\n 4536,\n/**/\n 4535,\n/**/\n 4534,\n/**/\n 4533,\n/**/\n 4532,\n/**/\n 4531,\n/**/\n 4530,\n/**/\n 4529,\n/**/\n 4528,\n/**/\n 4527,\n/**/\n 4526,\n/**/\n 4525,\n/**/\n 4524,\n/**/\n 4523,\n/**/\n 4522,\n/**/\n 4521,\n/**/\n 4520,\n/**/\n 4519,\n/**/\n 4518,\n/**/\n 4517,\n/**/\n 4516,\n/**/\n 4515,\n/**/\n 4514,\n/**/\n 4513,\n/**/\n 4512,\n/**/\n 4511,\n/**/\n 4510,\n/**/\n 4509,\n/**/\n 4508,\n/**/\n 4507,\n/**/\n 4506,\n/**/\n 4505,\n/**/\n 4504,\n/**/\n 4503,\n/**/\n 4502,\n/**/\n 4501,\n/**/\n 4500,\n/**/\n 4499,\n/**/\n 4498,\n/**/\n 4497,\n/**/\n 4496,\n/**/\n 4495,\n/**/\n 4494,\n/**/\n 4493,\n/**/\n 4492,\n/**/\n 4491,\n/**/\n 4490,\n/**/\n 4489,\n/**/\n 4488,\n/**/\n 4487,\n/**/\n 4486,\n/**/\n 4485,\n/**/\n 4484,\n/**/\n 4483,\n/**/\n 4482,\n/**/\n 4481,\n/**/\n 4480,\n/**/\n 4479,\n/**/\n 4478,\n/**/\n 4477,\n/**/\n 4476,\n/**/\n 4475,\n/**/\n 4474,\n/**/\n 4473,\n/**/\n 4472,\n/**/\n 4471,\n/**/\n 4470,\n/**/\n 4469,\n/**/\n 4468,\n/**/\n 4467,\n/**/\n 4466,\n/**/\n 4465,\n/**/\n 4464,\n/**/\n 4463,\n/**/\n 4462,\n/**/\n 4461,\n/**/\n 4460,\n/**/\n 4459,\n/**/\n 4458,\n/**/\n 4457,\n/**/\n 4456,\n/**/\n 4455,\n/**/\n 4454,\n/**/\n 4453,\n/**/\n 4452,\n/**/\n 4451,\n/**/\n 4450,\n/**/\n 4449,\n/**/\n 4448,\n/**/\n 4447,\n/**/\n 4446,\n/**/\n 4445,\n/**/\n 4444,\n/**/\n 4443,\n/**/\n 4442,\n/**/\n 4441,\n/**/\n 4440,\n/**/\n 4439,\n/**/\n 4438,\n/**/\n 4437,\n/**/\n 4436,\n/**/\n 4435,\n/**/\n 4434,\n/**/\n 4433,\n/**/\n 4432,\n/**/\n 4431,\n/**/\n 4430,\n/**/\n 4429,\n/**/\n 4428,\n/**/\n 4427,\n/**/\n 4426,\n/**/\n 4425,\n/**/\n 4424,\n/**/\n 4423,\n/**/\n 4422,\n/**/\n 4421,\n/**/\n 4420,\n/**/\n 4419,\n/**/\n 4418,\n/**/\n 4417,\n/**/\n 4416,\n/**/\n 4415,\n/**/\n 4414,\n/**/\n 4413,\n/**/\n 4412,\n/**/\n 4411,\n/**/\n 4410,\n/**/\n 4409,\n/**/\n 4408,\n/**/\n 4407,\n/**/\n 4406,\n/**/\n 4405,\n/**/\n 4404,\n/**/\n 4403,\n/**/\n 4402,\n/**/\n 4401,\n/**/\n 4400,\n/**/\n 4399,\n/**/\n 4398,\n/**/\n 4397,\n/**/\n 4396,\n/**/\n 4395,\n/**/\n 4394,\n/**/\n 4393,\n/**/\n 4392,\n/**/\n 4391,\n/**/\n 4390,\n/**/\n 4389,\n/**/\n 4388,\n/**/\n 4387,\n/**/\n 4386,\n/**/\n 4385,\n/**/\n 4384,\n/**/\n 4383,\n/**/\n 4382,\n/**/\n 4381,\n/**/\n 4380,\n/**/\n 4379,\n/**/\n 4378,\n/**/\n 4377,\n/**/\n 4376,\n/**/\n 4375,\n/**/\n 4374,\n/**/\n 4373,\n/**/\n 4372,\n/**/\n 4371,\n/**/\n 4370,\n/**/\n 4369,\n/**/\n 4368,\n/**/\n 4367,\n/**/\n 4366,\n/**/\n 4365,\n/**/\n 4364,\n/**/\n 4363,\n/**/\n 4362,\n/**/\n 4361,\n/**/\n 4360,\n/**/\n 4359,\n/**/\n 4358,\n/**/\n 4357,\n/**/\n 4356,\n/**/\n 4355,\n/**/\n 4354,\n/**/\n 4353,\n/**/\n 4352,\n/**/\n 4351,\n/**/\n 4350,\n/**/\n 4349,\n/**/\n 4348,\n/**/\n 4347,\n/**/\n 4346,\n/**/\n 4345,\n/**/\n 4344,\n/**/\n 4343,\n/**/\n 4342,\n/**/\n 4341,\n/**/\n 4340,\n/**/\n 4339,\n/**/\n 4338,\n/**/\n 4337,\n/**/\n 4336,\n/**/\n 4335,\n/**/\n 4334,\n/**/\n 4333,\n/**/\n 4332,\n/**/\n 4331,\n/**/\n 4330,\n/**/\n 4329,\n/**/\n 4328,\n/**/\n 4327,\n/**/\n 4326,\n/**/\n 4325,\n/**/\n 4324,\n/**/\n 4323,\n/**/\n 4322,\n/**/\n 4321,\n/**/\n 4320,\n/**/\n 4319,\n/**/\n 4318,\n/**/\n 4317,\n/**/\n 4316,\n/**/\n 4315,\n/**/\n 4314,\n/**/\n 4313,\n/**/\n 4312,\n/**/\n 4311,\n/**/\n 4310,\n/**/\n 4309,\n/**/\n 4308,\n/**/\n 4307,\n/**/\n 4306,\n/**/\n 4305,\n/**/\n 4304,\n/**/\n 4303,\n/**/\n 4302,\n/**/\n 4301,\n/**/\n 4300,\n/**/\n 4299,\n/**/\n 4298,\n/**/\n 4297,\n/**/\n 4296,\n/**/\n 4295,\n/**/\n 4294,\n/**/\n 4293,\n/**/\n 4292,\n/**/\n 4291,\n/**/\n 4290,\n/**/\n 4289,\n/**/\n 4288,\n/**/\n 4287,\n/**/\n 4286,\n/**/\n 4285,\n/**/\n 4284,\n/**/\n 4283,\n/**/\n 4282,\n/**/\n 4281,\n/**/\n 4280,\n/**/\n 4279,\n/**/\n 4278,\n/**/\n 4277,\n/**/\n 4276,\n/**/\n 4275,\n/**/\n 4274,\n/**/\n 4273,\n/**/\n 4272,\n/**/\n 4271,\n/**/\n 4270,\n/**/\n 4269,\n/**/\n 4268,\n/**/\n 4267,\n/**/\n 4266,\n/**/\n 4265,\n/**/\n 4264,\n/**/\n 4263,\n/**/\n 4262,\n/**/\n 4261,\n/**/\n 4260,\n/**/\n 4259,\n/**/\n 4258,\n/**/\n 4257,\n/**/\n 4256,\n/**/\n 4255,\n/**/\n 4254,\n/**/\n 4253,\n/**/\n 4252,\n/**/\n 4251,\n/**/\n 4250,\n/**/\n 4249,\n/**/\n 4248,\n/**/\n 4247,\n/**/\n 4246,\n/**/\n 4245,\n/**/\n 4244,\n/**/\n 4243,\n/**/\n 4242,\n/**/\n 4241,\n/**/\n 4240,\n/**/\n 4239,\n/**/\n 4238,\n/**/\n 4237,\n/**/\n 4236,\n/**/\n 4235,\n/**/\n 4234,\n/**/\n 4233,\n/**/\n 4232,\n/**/\n 4231,\n/**/\n 4230,\n/**/\n 4229,\n/**/\n 4228,\n/**/\n 4227,\n/**/\n 4226,\n/**/\n 4225,\n/**/\n 4224,\n/**/\n 4223,\n/**/\n 4222,\n/**/\n 4221,\n/**/\n 4220,\n/**/\n 4219,\n/**/\n 4218,\n/**/\n 4217,\n/**/\n 4216,\n/**/\n 4215,\n/**/\n 4214,\n/**/\n 4213,\n/**/\n 4212,\n/**/\n 4211,\n/**/\n 4210,\n/**/\n 4209,\n/**/\n 4208,\n/**/\n 4207,\n/**/\n 4206,\n/**/\n 4205,\n/**/\n 4204,\n/**/\n 4203,\n/**/\n 4202,\n/**/\n 4201,\n/**/\n 4200,\n/**/\n 4199,\n/**/\n 4198,\n/**/\n 4197,\n/**/\n 4196,\n/**/\n 4195,\n/**/\n 4194,\n/**/\n 4193,\n/**/\n 4192,\n/**/\n 4191,\n/**/\n 4190,\n/**/\n 4189,\n/**/\n 4188,\n/**/\n 4187,\n/**/\n 4186,\n/**/\n 4185,\n/**/\n 4184,\n/**/\n 4183,\n/**/\n 4182,\n/**/\n 4181,\n/**/\n 4180,\n/**/\n 4179,\n/**/\n 4178,\n/**/\n 4177,\n/**/\n 4176,\n/**/\n 4175,\n/**/\n 4174,\n/**/\n 4173,\n/**/\n 4172,\n/**/\n 4171,\n/**/\n 4170,\n/**/\n 4169,\n/**/\n 4168,\n/**/\n 4167,\n/**/\n 4166,\n/**/\n 4165,\n/**/\n 4164,\n/**/\n 4163,\n/**/\n 4162,\n/**/\n 4161,\n/**/\n 4160,\n/**/\n 4159,\n/**/\n 4158,\n/**/\n 4157,\n/**/\n 4156,\n/**/\n 4155,\n/**/\n 4154,\n/**/\n 4153,\n/**/\n 4152,\n/**/\n 4151,\n/**/\n 4150,\n/**/\n 4149,\n/**/\n 4148,\n/**/\n 4147,\n/**/\n 4146,\n/**/\n 4145,\n/**/\n 4144,\n/**/\n 4143,\n/**/\n 4142,\n/**/\n 4141,\n/**/\n 4140,\n/**/\n 4139,\n/**/\n 4138,\n/**/\n 4137,\n/**/\n 4136,\n/**/\n 4135,\n/**/\n 4134,\n/**/\n 4133,\n/**/\n 4132,\n/**/\n 4131,\n/**/\n 4130,\n/**/\n 4129,\n/**/\n 4128,\n/**/\n 4127,\n/**/\n 4126,\n/**/\n 4125,\n/**/\n 4124,\n/**/\n 4123,\n/**/\n 4122,\n/**/\n 4121,\n/**/\n 4120,\n/**/\n 4119,\n/**/\n 4118,\n/**/\n 4117,\n/**/\n 4116,\n/**/\n 4115,\n/**/\n 4114,\n/**/\n 4113,\n/**/\n 4112,\n/**/\n 4111,\n/**/\n 4110,\n/**/\n 4109,\n/**/\n 4108,\n/**/\n 4107,\n/**/\n 4106,\n/**/\n 4105,\n/**/\n 4104,\n/**/\n 4103,\n/**/\n 4102,\n/**/\n 4101,\n/**/\n 4100,\n/**/\n 4099,\n/**/\n 4098,\n/**/\n 4097,\n/**/\n 4096,\n/**/\n 4095,\n/**/\n 4094,\n/**/\n 4093,\n/**/\n 4092,\n/**/\n 4091,\n/**/\n 4090,\n/**/\n 4089,\n/**/\n 4088,\n/**/\n 4087,\n/**/\n 4086,\n/**/\n 4085,\n/**/\n 4084,\n/**/\n 4083,\n/**/\n 4082,\n/**/\n 4081,\n/**/\n 4080,\n/**/\n 4079,\n/**/\n 4078,\n/**/\n 4077,\n/**/\n 4076,\n/**/\n 4075,\n/**/\n 4074,\n/**/\n 4073,\n/**/\n 4072,\n/**/\n 4071,\n/**/\n 4070,\n/**/\n 4069,\n/**/\n 4068,\n/**/\n 4067,\n/**/\n 4066,\n/**/\n 4065,\n/**/\n 4064,\n/**/\n 4063,\n/**/\n 4062,\n/**/\n 4061,\n/**/\n 4060,\n/**/\n 4059,\n/**/\n 4058,\n/**/\n 4057,\n/**/\n 4056,\n/**/\n 4055,\n/**/\n 4054,\n/**/\n 4053,\n/**/\n 4052,\n/**/\n 4051,\n/**/\n 4050,\n/**/\n 4049,\n/**/\n 4048,\n/**/\n 4047,\n/**/\n 4046,\n/**/\n 4045,\n/**/\n 4044,\n/**/\n 4043,\n/**/\n 4042,\n/**/\n 4041,\n/**/\n 4040,\n/**/\n 4039,\n/**/\n 4038,\n/**/\n 4037,\n/**/\n 4036,\n/**/\n 4035,\n/**/\n 4034,\n/**/\n 4033,\n/**/\n 4032,\n/**/\n 4031,\n/**/\n 4030,\n/**/\n 4029,\n/**/\n 4028,\n/**/\n 4027,\n/**/\n 4026,\n/**/\n 4025,\n/**/\n 4024,\n/**/\n 4023,\n/**/\n 4022,\n/**/\n 4021,\n/**/\n 4020,\n/**/\n 4019,\n/**/\n 4018,\n/**/\n 4017,\n/**/\n 4016,\n/**/\n 4015,\n/**/\n 4014,\n/**/\n 4013,\n/**/\n 4012,\n/**/\n 4011,\n/**/\n 4010,\n/**/\n 4009,\n/**/\n 4008,\n/**/\n 4007,\n/**/\n 4006,\n/**/\n 4005,\n/**/\n 4004,\n/**/\n 4003,\n/**/\n 4002,\n/**/\n 4001,\n/**/\n 4000,\n/**/\n 3999,\n/**/\n 3998,\n/**/\n 3997,\n/**/\n 3996,\n/**/\n 3995,\n/**/\n 3994,\n/**/\n 3993,\n/**/\n 3992,\n/**/\n 3991,\n/**/\n 3990,\n/**/\n 3989,\n/**/\n 3988,\n/**/\n 3987,\n/**/\n 3986,\n/**/\n 3985,\n/**/\n 3984,\n/**/\n 3983,\n/**/\n 3982,\n/**/\n 3981,\n/**/\n 3980,\n/**/\n 3979,\n/**/\n 3978,\n/**/\n 3977,\n/**/\n 3976,\n/**/\n 3975,\n/**/\n 3974,\n/**/\n 3973,\n/**/\n 3972,\n/**/\n 3971,\n/**/\n 3970,\n/**/\n 3969,\n/**/\n 3968,\n/**/\n 3967,\n/**/\n 3966,\n/**/\n 3965,\n/**/\n 3964,\n/**/\n 3963,\n/**/\n 3962,\n/**/\n 3961,\n/**/\n 3960,\n/**/\n 3959,\n/**/\n 3958,\n/**/\n 3957,\n/**/\n 3956,\n/**/\n 3955,\n/**/\n 3954,\n/**/\n 3953,\n/**/\n 3952,\n/**/\n 3951,\n/**/\n 3950,\n/**/\n 3949,\n/**/\n 3948,\n/**/\n 3947,\n/**/\n 3946,\n/**/\n 3945,\n/**/\n 3944,\n/**/\n 3943,\n/**/\n 3942,\n/**/\n 3941,\n/**/\n 3940,\n/**/\n 3939,\n/**/\n 3938,\n/**/\n 3937,\n/**/\n 3936,\n/**/\n 3935,\n/**/\n 3934,\n/**/\n 3933,\n/**/\n 3932,\n/**/\n 3931,\n/**/\n 3930,\n/**/\n 3929,\n/**/\n 3928,\n/**/\n 3927,\n/**/\n 3926,\n/**/\n 3925,\n/**/\n 3924,\n/**/\n 3923,\n/**/\n 3922,\n/**/\n 3921,\n/**/\n 3920,\n/**/\n 3919,\n/**/\n 3918,\n/**/\n 3917,\n/**/\n 3916,\n/**/\n 3915,\n/**/\n 3914,\n/**/\n 3913,\n/**/\n 3912,\n/**/\n 3911,\n/**/\n 3910,\n/**/\n 3909,\n/**/\n 3908,\n/**/\n 3907,\n/**/\n 3906,\n/**/\n 3905,\n/**/\n 3904,\n/**/\n 3903,\n/**/\n 3902,\n/**/\n 3901,\n/**/\n 3900,\n/**/\n 3899,\n/**/\n 3898,\n/**/\n 3897,\n/**/\n 3896,\n/**/\n 3895,\n/**/\n 3894,\n/**/\n 3893,\n/**/\n 3892,\n/**/\n 3891,\n/**/\n 3890,\n/**/\n 3889,\n/**/\n 3888,\n/**/\n 3887,\n/**/\n 3886,\n/**/\n 3885,\n/**/\n 3884,\n/**/\n 3883,\n/**/\n 3882,\n/**/\n 3881,\n/**/\n 3880,\n/**/\n 3879,\n/**/\n 3878,\n/**/\n 3877,\n/**/\n 3876,\n/**/\n 3875,\n/**/\n 3874,\n/**/\n 3873,\n/**/\n 3872,\n/**/\n 3871,\n/**/\n 3870,\n/**/\n 3869,\n/**/\n 3868,\n/**/\n 3867,\n/**/\n 3866,\n/**/\n 3865,\n/**/\n 3864,\n/**/\n 3863,\n/**/\n 3862,\n/**/\n 3861,\n/**/\n 3860,\n/**/\n 3859,\n/**/\n 3858,\n/**/\n 3857,\n/**/\n 3856,\n/**/\n 3855,\n/**/\n 3854,\n/**/\n 3853,\n/**/\n 3852,\n/**/\n 3851,\n/**/\n 3850,\n/**/\n 3849,\n/**/\n 3848,\n/**/\n 3847,\n/**/\n 3846,\n/**/\n 3845,\n/**/\n 3844,\n/**/\n 3843,\n/**/\n 3842,\n/**/\n 3841,\n/**/\n 3840,\n/**/\n 3839,\n/**/\n 3838,\n/**/\n 3837,\n/**/\n 3836,\n/**/\n 3835,\n/**/\n 3834,\n/**/\n 3833,\n/**/\n 3832,\n/**/\n 3831,\n/**/\n 3830,\n/**/\n 3829,\n/**/\n 3828,\n/**/\n 3827,\n/**/\n 3826,\n/**/\n 3825,\n/**/\n 3824,\n/**/\n 3823,\n/**/\n 3822,\n/**/\n 3821,\n/**/\n 3820,\n/**/\n 3819,\n/**/\n 3818,\n/**/\n 3817,\n/**/\n 3816,\n/**/\n 3815,\n/**/\n 3814,\n/**/\n 3813,\n/**/\n 3812,\n/**/\n 3811,\n/**/\n 3810,\n/**/\n 3809,\n/**/\n 3808,\n/**/\n 3807,\n/**/\n 3806,\n/**/\n 3805,\n/**/\n 3804,\n/**/\n 3803,\n/**/\n 3802,\n/**/\n 3801,\n/**/\n 3800,\n/**/\n 3799,\n/**/\n 3798,\n/**/\n 3797,\n/**/\n 3796,\n/**/\n 3795,\n/**/\n 3794,\n/**/\n 3793,\n/**/\n 3792,\n/**/\n 3791,\n/**/\n 3790,\n/**/\n 3789,\n/**/\n 3788,\n/**/\n 3787,\n/**/\n 3786,\n/**/\n 3785,\n/**/\n 3784,\n/**/\n 3783,\n/**/\n 3782,\n/**/\n 3781,\n/**/\n 3780,\n/**/\n 3779,\n/**/\n 3778,\n/**/\n 3777,\n/**/\n 3776,\n/**/\n 3775,\n/**/\n 3774,\n/**/\n 3773,\n/**/\n 3772,\n/**/\n 3771,\n/**/\n 3770,\n/**/\n 3769,\n/**/\n 3768,\n/**/\n 3767,\n/**/\n 3766,\n/**/\n 3765,\n/**/\n 3764,\n/**/\n 3763,\n/**/\n 3762,\n/**/\n 3761,\n/**/\n 3760,\n/**/\n 3759,\n/**/\n 3758,\n/**/\n 3757,\n/**/\n 3756,\n/**/\n 3755,\n/**/\n 3754,\n/**/\n 3753,\n/**/\n 3752,\n/**/\n 3751,\n/**/\n 3750,\n/**/\n 3749,\n/**/\n 3748,\n/**/\n 3747,\n/**/\n 3746,\n/**/\n 3745,\n/**/\n 3744,\n/**/\n 3743,\n/**/\n 3742,\n/**/\n 3741,\n/**/\n 3740,\n/**/\n 3739,\n/**/\n 3738,\n/**/\n 3737,\n/**/\n 3736,\n/**/\n 3735,\n/**/\n 3734,\n/**/\n 3733,\n/**/\n 3732,\n/**/\n 3731,\n/**/\n 3730,\n/**/\n 3729,\n/**/\n 3728,\n/**/\n 3727,\n/**/\n 3726,\n/**/\n 3725,\n/**/\n 3724,\n/**/\n 3723,\n/**/\n 3722,\n/**/\n 3721,\n/**/\n 3720,\n/**/\n 3719,\n/**/\n 3718,\n/**/\n 3717,\n/**/\n 3716,\n/**/\n 3715,\n/**/\n 3714,\n/**/\n 3713,\n/**/\n 3712,\n/**/\n 3711,\n/**/\n 3710,\n/**/\n 3709,\n/**/\n 3708,\n/**/\n 3707,\n/**/\n 3706,\n/**/\n 3705,\n/**/\n 3704,\n/**/\n 3703,\n/**/\n 3702,\n/**/\n 3701,\n/**/\n 3700,\n/**/\n 3699,\n/**/\n 3698,\n/**/\n 3697,\n/**/\n 3696,\n/**/\n 3695,\n/**/\n 3694,\n/**/\n 3693,\n/**/\n 3692,\n/**/\n 3691,\n/**/\n 3690,\n/**/\n 3689,\n/**/\n 3688,\n/**/\n 3687,\n/**/\n 3686,\n/**/\n 3685,\n/**/\n 3684,\n/**/\n 3683,\n/**/\n 3682,\n/**/\n 3681,\n/**/\n 3680,\n/**/\n 3679,\n/**/\n 3678,\n/**/\n 3677,\n/**/\n 3676,\n/**/\n 3675,\n/**/\n 3674,\n/**/\n 3673,\n/**/\n 3672,\n/**/\n 3671,\n/**/\n 3670,\n/**/\n 3669,\n/**/\n 3668,\n/**/\n 3667,\n/**/\n 3666,\n/**/\n 3665,\n/**/\n 3664,\n/**/\n 3663,\n/**/\n 3662,\n/**/\n 3661,\n/**/\n 3660,\n/**/\n 3659,\n/**/\n 3658,\n/**/\n 3657,\n/**/\n 3656,\n/**/\n 3655,\n/**/\n 3654,\n/**/\n 3653,\n/**/\n 3652,\n/**/\n 3651,\n/**/\n 3650,\n/**/\n 3649,\n/**/\n 3648,\n/**/\n 3647,\n/**/\n 3646,\n/**/\n 3645,\n/**/\n 3644,\n/**/\n 3643,\n/**/\n 3642,\n/**/\n 3641,\n/**/\n 3640,\n/**/\n 3639,\n/**/\n 3638,\n/**/\n 3637,\n/**/\n 3636,\n/**/\n 3635,\n/**/\n 3634,\n/**/\n 3633,\n/**/\n 3632,\n/**/\n 3631,\n/**/\n 3630,\n/**/\n 3629,\n/**/\n 3628,\n/**/\n 3627,\n/**/\n 3626,\n/**/\n 3625,\n/**/\n 3624,\n/**/\n 3623,\n/**/\n 3622,\n/**/\n 3621,\n/**/\n 3620,\n/**/\n 3619,\n/**/\n 3618,\n/**/\n 3617,\n/**/\n 3616,\n/**/\n 3615,\n/**/\n 3614,\n/**/\n 3613,\n/**/\n 3612,\n/**/\n 3611,\n/**/\n 3610,\n/**/\n 3609,\n/**/\n 3608,\n/**/\n 3607,\n/**/\n 3606,\n/**/\n 3605,\n/**/\n 3604,\n/**/\n 3603,\n/**/\n 3602,\n/**/\n 3601,\n/**/\n 3600,\n/**/\n 3599,\n/**/\n 3598,\n/**/\n 3597,\n/**/\n 3596,\n/**/\n 3595,\n/**/\n 3594,\n/**/\n 3593,\n/**/\n 3592,\n/**/\n 3591,\n/**/\n 3590,\n/**/\n 3589,\n/**/\n 3588,\n/**/\n 3587,\n/**/\n 3586,\n/**/\n 3585,\n/**/\n 3584,\n/**/\n 3583,\n/**/\n 3582,\n/**/\n 3581,\n/**/\n 3580,\n/**/\n 3579,\n/**/\n 3578,\n/**/\n 3577,\n/**/\n 3576,\n/**/\n 3575,\n/**/\n 3574,\n/**/\n 3573,\n/**/\n 3572,\n/**/\n 3571,\n/**/\n 3570,\n/**/\n 3569,\n/**/\n 3568,\n/**/\n 3567,\n/**/\n 3566,\n/**/\n 3565,\n/**/\n 3564,\n/**/\n 3563,\n/**/\n 3562,\n/**/\n 3561,\n/**/\n 3560,\n/**/\n 3559,\n/**/\n 3558,\n/**/\n 3557,\n/**/\n 3556,\n/**/\n 3555,\n/**/\n 3554,\n/**/\n 3553,\n/**/\n 3552,\n/**/\n 3551,\n/**/\n 3550,\n/**/\n 3549,\n/**/\n 3548,\n/**/\n 3547,\n/**/\n 3546,\n/**/\n 3545,\n/**/\n 3544,\n/**/\n 3543,\n/**/\n 3542,\n/**/\n 3541,\n/**/\n 3540,\n/**/\n 3539,\n/**/\n 3538,\n/**/\n 3537,\n/**/\n 3536,\n/**/\n 3535,\n/**/\n 3534,\n/**/\n 3533,\n/**/\n 3532,\n/**/\n 3531,\n/**/\n 3530,\n/**/\n 3529,\n/**/\n 3528,\n/**/\n 3527,\n/**/\n 3526,\n/**/\n 3525,\n/**/\n 3524,\n/**/\n 3523,\n/**/\n 3522,\n/**/\n 3521,\n/**/\n 3520,\n/**/\n 3519,\n/**/\n 3518,\n/**/\n 3517,\n/**/\n 3516,\n/**/\n 3515,\n/**/\n 3514,\n/**/\n 3513,\n/**/\n 3512,\n/**/\n 3511,\n/**/\n 3510,\n/**/\n 3509,\n/**/\n 3508,\n/**/\n 3507,\n/**/\n 3506,\n/**/\n 3505,\n/**/\n 3504,\n/**/\n 3503,\n/**/\n 3502,\n/**/\n 3501,\n/**/\n 3500,\n/**/\n 3499,\n/**/\n 3498,\n/**/\n 3497,\n/**/\n 3496,\n/**/\n 3495,\n/**/\n 3494,\n/**/\n 3493,\n/**/\n 3492,\n/**/\n 3491,\n/**/\n 3490,\n/**/\n 3489,\n/**/\n 3488,\n/**/\n 3487,\n/**/\n 3486,\n/**/\n 3485,\n/**/\n 3484,\n/**/\n 3483,\n/**/\n 3482,\n/**/\n 3481,\n/**/\n 3480,\n/**/\n 3479,\n/**/\n 3478,\n/**/\n 3477,\n/**/\n 3476,\n/**/\n 3475,\n/**/\n 3474,\n/**/\n 3473,\n/**/\n 3472,\n/**/\n 3471,\n/**/\n 3470,\n/**/\n 3469,\n/**/\n 3468,\n/**/\n 3467,\n/**/\n 3466,\n/**/\n 3465,\n/**/\n 3464,\n/**/\n 3463,\n/**/\n 3462,\n/**/\n 3461,\n/**/\n 3460,\n/**/\n 3459,\n/**/\n 3458,\n/**/\n 3457,\n/**/\n 3456,\n/**/\n 3455,\n/**/\n 3454,\n/**/\n 3453,\n/**/\n 3452,\n/**/\n 3451,\n/**/\n 3450,\n/**/\n 3449,\n/**/\n 3448,\n/**/\n 3447,\n/**/\n 3446,\n/**/\n 3445,\n/**/\n 3444,\n/**/\n 3443,\n/**/\n 3442,\n/**/\n 3441,\n/**/\n 3440,\n/**/\n 3439,\n/**/\n 3438,\n/**/\n 3437,\n/**/\n 3436,\n/**/\n 3435,\n/**/\n 3434,\n/**/\n 3433,\n/**/\n 3432,\n/**/\n 3431,\n/**/\n 3430,\n/**/\n 3429,\n/**/\n 3428,\n/**/\n 3427,\n/**/\n 3426,\n/**/\n 3425,\n/**/\n 3424,\n/**/\n 3423,\n/**/\n 3422,\n/**/\n 3421,\n/**/\n 3420,\n/**/\n 3419,\n/**/\n 3418,\n/**/\n 3417,\n/**/\n 3416,\n/**/\n 3415,\n/**/\n 3414,\n/**/\n 3413,\n/**/\n 3412,\n/**/\n 3411,\n/**/\n 3410,\n/**/\n 3409,\n/**/\n 3408,\n/**/\n 3407,\n/**/\n 3406,\n/**/\n 3405,\n/**/\n 3404,\n/**/\n 3403,\n/**/\n 3402,\n/**/\n 3401,\n/**/\n 3400,\n/**/\n 3399,\n/**/\n 3398,\n/**/\n 3397,\n/**/\n 3396,\n/**/\n 3395,\n/**/\n 3394,\n/**/\n 3393,\n/**/\n 3392,\n/**/\n 3391,\n/**/\n 3390,\n/**/\n 3389,\n/**/\n 3388,\n/**/\n 3387,\n/**/\n 3386,\n/**/\n 3385,\n/**/\n 3384,\n/**/\n 3383,\n/**/\n 3382,\n/**/\n 3381,\n/**/\n 3380,\n/**/\n 3379,\n/**/\n 3378,\n/**/\n 3377,\n/**/\n 3376,\n/**/\n 3375,\n/**/\n 3374,\n/**/\n 3373,\n/**/\n 3372,\n/**/\n 3371,\n/**/\n 3370,\n/**/\n 3369,\n/**/\n 3368,\n/**/\n 3367,\n/**/\n 3366,\n/**/\n 3365,\n/**/\n 3364,\n/**/\n 3363,\n/**/\n 3362,\n/**/\n 3361,\n/**/\n 3360,\n/**/\n 3359,\n/**/\n 3358,\n/**/\n 3357,\n/**/\n 3356,\n/**/\n 3355,\n/**/\n 3354,\n/**/\n 3353,\n/**/\n 3352,\n/**/\n 3351,\n/**/\n 3350,\n/**/\n 3349,\n/**/\n 3348,\n/**/\n 3347,\n/**/\n 3346,\n/**/\n 3345,\n/**/\n 3344,\n/**/\n 3343,\n/**/\n 3342,\n/**/\n 3341,\n/**/\n 3340,\n/**/\n 3339,\n/**/\n 3338,\n/**/\n 3337,\n/**/\n 3336,\n/**/\n 3335,\n/**/\n 3334,\n/**/\n 3333,\n/**/\n 3332,\n/**/\n 3331,\n/**/\n 3330,\n/**/\n 3329,\n/**/\n 3328,\n/**/\n 3327,\n/**/\n 3326,\n/**/\n 3325,\n/**/\n 3324,\n/**/\n 3323,\n/**/\n 3322,\n/**/\n 3321,\n/**/\n 3320,\n/**/\n 3319,\n/**/\n 3318,\n/**/\n 3317,\n/**/\n 3316,\n/**/\n 3315,\n/**/\n 3314,\n/**/\n 3313,\n/**/\n 3312,\n/**/\n 3311,\n/**/\n 3310,\n/**/\n 3309,\n/**/\n 3308,\n/**/\n 3307,\n/**/\n 3306,\n/**/\n 3305,\n/**/\n 3304,\n/**/\n 3303,\n/**/\n 3302,\n/**/\n 3301,\n/**/\n 3300,\n/**/\n 3299,\n/**/\n 3298,\n/**/\n 3297,\n/**/\n 3296,\n/**/\n 3295,\n/**/\n 3294,\n/**/\n 3293,\n/**/\n 3292,\n/**/\n 3291,\n/**/\n 3290,\n/**/\n 3289,\n/**/\n 3288,\n/**/\n 3287,\n/**/\n 3286,\n/**/\n 3285,\n/**/\n 3284,\n/**/\n 3283,\n/**/\n 3282,\n/**/\n 3281,\n/**/\n 3280,\n/**/\n 3279,\n/**/\n 3278,\n/**/\n 3277,\n/**/\n 3276,\n/**/\n 3275,\n/**/\n 3274,\n/**/\n 3273,\n/**/\n 3272,\n/**/\n 3271,\n/**/\n 3270,\n/**/\n 3269,\n/**/\n 3268,\n/**/\n 3267,\n/**/\n 3266,\n/**/\n 3265,\n/**/\n 3264,\n/**/\n 3263,\n/**/\n 3262,\n/**/\n 3261,\n/**/\n 3260,\n/**/\n 3259,\n/**/\n 3258,\n/**/\n 3257,\n/**/\n 3256,\n/**/\n 3255,\n/**/\n 3254,\n/**/\n 3253,\n/**/\n 3252,\n/**/\n 3251,\n/**/\n 3250,\n/**/\n 3249,\n/**/\n 3248,\n/**/\n 3247,\n/**/\n 3246,\n/**/\n 3245,\n/**/\n 3244,\n/**/\n 3243,\n/**/\n 3242,\n/**/\n 3241,\n/**/\n 3240,\n/**/\n 3239,\n/**/\n 3238,\n/**/\n 3237,\n/**/\n 3236,\n/**/\n 3235,\n/**/\n 3234,\n/**/\n 3233,\n/**/\n 3232,\n/**/\n 3231,\n/**/\n 3230,\n/**/\n 3229,\n/**/\n 3228,\n/**/\n 3227,\n/**/\n 3226,\n/**/\n 3225,\n/**/\n 3224,\n/**/\n 3223,\n/**/\n 3222,\n/**/\n 3221,\n/**/\n 3220,\n/**/\n 3219,\n/**/\n 3218,\n/**/\n 3217,\n/**/\n 3216,\n/**/\n 3215,\n/**/\n 3214,\n/**/\n 3213,\n/**/\n 3212,\n/**/\n 3211,\n/**/\n 3210,\n/**/\n 3209,\n/**/\n 3208,\n/**/\n 3207,\n/**/\n 3206,\n/**/\n 3205,\n/**/\n 3204,\n/**/\n 3203,\n/**/\n 3202,\n/**/\n 3201,\n/**/\n 3200,\n/**/\n 3199,\n/**/\n 3198,\n/**/\n 3197,\n/**/\n 3196,\n/**/\n 3195,\n/**/\n 3194,\n/**/\n 3193,\n/**/\n 3192,\n/**/\n 3191,\n/**/\n 3190,\n/**/\n 3189,\n/**/\n 3188,\n/**/\n 3187,\n/**/\n 3186,\n/**/\n 3185,\n/**/\n 3184,\n/**/\n 3183,\n/**/\n 3182,\n/**/\n 3181,\n/**/\n 3180,\n/**/\n 3179,\n/**/\n 3178,\n/**/\n 3177,\n/**/\n 3176,\n/**/\n 3175,\n/**/\n 3174,\n/**/\n 3173,\n/**/\n 3172,\n/**/\n 3171,\n/**/\n 3170,\n/**/\n 3169,\n/**/\n 3168,\n/**/\n 3167,\n/**/\n 3166,\n/**/\n 3165,\n/**/\n 3164,\n/**/\n 3163,\n/**/\n 3162,\n/**/\n 3161,\n/**/\n 3160,\n/**/\n 3159,\n/**/\n 3158,\n/**/\n 3157,\n/**/\n 3156,\n/**/\n 3155,\n/**/\n 3154,\n/**/\n 3153,\n/**/\n 3152,\n/**/\n 3151,\n/**/\n 3150,\n/**/\n 3149,\n/**/\n 3148,\n/**/\n 3147,\n/**/\n 3146,\n/**/\n 3145,\n/**/\n 3144,\n/**/\n 3143,\n/**/\n 3142,\n/**/\n 3141,\n/**/\n 3140,\n/**/\n 3139,\n/**/\n 3138,\n/**/\n 3137,\n/**/\n 3136,\n/**/\n 3135,\n/**/\n 3134,\n/**/\n 3133,\n/**/\n 3132,\n/**/\n 3131,\n/**/\n 3130,\n/**/\n 3129,\n/**/\n 3128,\n/**/\n 3127,\n/**/\n 3126,\n/**/\n 3125,\n/**/\n 3124,\n/**/\n 3123,\n/**/\n 3122,\n/**/\n 3121,\n/**/\n 3120,\n/**/\n 3119,\n/**/\n 3118,\n/**/\n 3117,\n/**/\n 3116,\n/**/\n 3115,\n/**/\n 3114,\n/**/\n 3113,\n/**/\n 3112,\n/**/\n 3111,\n/**/\n 3110,\n/**/\n 3109,\n/**/\n 3108,\n/**/\n 3107,\n/**/\n 3106,\n/**/\n 3105,\n/**/\n 3104,\n/**/\n 3103,\n/**/\n 3102,\n/**/\n 3101,\n/**/\n 3100,\n/**/\n 3099,\n/**/\n 3098,\n/**/\n 3097,\n/**/\n 3096,\n/**/\n 3095,\n/**/\n 3094,\n/**/\n 3093,\n/**/\n 3092,\n/**/\n 3091,\n/**/\n 3090,\n/**/\n 3089,\n/**/\n 3088,\n/**/\n 3087,\n/**/\n 3086,\n/**/\n 3085,\n/**/\n 3084,\n/**/\n 3083,\n/**/\n 3082,\n/**/\n 3081,\n/**/\n 3080,\n/**/\n 3079,\n/**/\n 3078,\n/**/\n 3077,\n/**/\n 3076,\n/**/\n 3075,\n/**/\n 3074,\n/**/\n 3073,\n/**/\n 3072,\n/**/\n 3071,\n/**/\n 3070,\n/**/\n 3069,\n/**/\n 3068,\n/**/\n 3067,\n/**/\n 3066,\n/**/\n 3065,\n/**/\n 3064,\n/**/\n 3063,\n/**/\n 3062,\n/**/\n 3061,\n/**/\n 3060,\n/**/\n 3059,\n/**/\n 3058,\n/**/\n 3057,\n/**/\n 3056,\n/**/\n 3055,\n/**/\n 3054,\n/**/\n 3053,\n/**/\n 3052,\n/**/\n 3051,\n/**/\n 3050,\n/**/\n 3049,\n/**/\n 3048,\n/**/\n 3047,\n/**/\n 3046,\n/**/\n 3045,\n/**/\n 3044,\n/**/\n 3043,\n/**/\n 3042,\n/**/\n 3041,\n/**/\n 3040,\n/**/\n 3039,\n/**/\n 3038,\n/**/\n 3037,\n/**/\n 3036,\n/**/\n 3035,\n/**/\n 3034,\n/**/\n 3033,\n/**/\n 3032,\n/**/\n 3031,\n/**/\n 3030,\n/**/\n 3029,\n/**/\n 3028,\n/**/\n 3027,\n/**/\n 3026,\n/**/\n 3025,\n/**/\n 3024,\n/**/\n 3023,\n/**/\n 3022,\n/**/\n 3021,\n/**/\n 3020,\n/**/\n 3019,\n/**/\n 3018,\n/**/\n 3017,\n/**/\n 3016,\n/**/\n 3015,\n/**/\n 3014,\n/**/\n 3013,\n/**/\n 3012,\n/**/\n 3011,\n/**/\n 3010,\n/**/\n 3009,\n/**/\n 3008,\n/**/\n 3007,\n/**/\n 3006,\n/**/\n 3005,\n/**/\n 3004,\n/**/\n 3003,\n/**/\n 3002,\n/**/\n 3001,\n/**/\n 3000,\n/**/\n 2999,\n/**/\n 2998,\n/**/\n 2997,\n/**/\n 2996,\n/**/\n 2995,\n/**/\n 2994,\n/**/\n 2993,\n/**/\n 2992,\n/**/\n 2991,\n/**/\n 2990,\n/**/\n 2989,\n/**/\n 2988,\n/**/\n 2987,\n/**/\n 2986,\n/**/\n 2985,\n/**/\n 2984,\n/**/\n 2983,\n/**/\n 2982,\n/**/\n 2981,\n/**/\n 2980,\n/**/\n 2979,\n/**/\n 2978,\n/**/\n 2977,\n/**/\n 2976,\n/**/\n 2975,\n/**/\n 2974,\n/**/\n 2973,\n/**/\n 2972,\n/**/\n 2971,\n/**/\n 2970,\n/**/\n 2969,\n/**/\n 2968,\n/**/\n 2967,\n/**/\n 2966,\n/**/\n 2965,\n/**/\n 2964,\n/**/\n 2963,\n/**/\n 2962,\n/**/\n 2961,\n/**/\n 2960,\n/**/\n 2959,\n/**/\n 2958,\n/**/\n 2957,\n/**/\n 2956,\n/**/\n 2955,\n/**/\n 2954,\n/**/\n 2953,\n/**/\n 2952,\n/**/\n 2951,\n/**/\n 2950,\n/**/\n 2949,\n/**/\n 2948,\n/**/\n 2947,\n/**/\n 2946,\n/**/\n 2945,\n/**/\n 2944,\n/**/\n 2943,\n/**/\n 2942,\n/**/\n 2941,\n/**/\n 2940,\n/**/\n 2939,\n/**/\n 2938,\n/**/\n 2937,\n/**/\n 2936,\n/**/\n 2935,\n/**/\n 2934,\n/**/\n 2933,\n/**/\n 2932,\n/**/\n 2931,\n/**/\n 2930,\n/**/\n 2929,\n/**/\n 2928,\n/**/\n 2927,\n/**/\n 2926,\n/**/\n 2925,\n/**/\n 2924,\n/**/\n 2923,\n/**/\n 2922,\n/**/\n 2921,\n/**/\n 2920,\n/**/\n 2919,\n/**/\n 2918,\n/**/\n 2917,\n/**/\n 2916,\n/**/\n 2915,\n/**/\n 2914,\n/**/\n 2913,\n/**/\n 2912,\n/**/\n 2911,\n/**/\n 2910,\n/**/\n 2909,\n/**/\n 2908,\n/**/\n 2907,\n/**/\n 2906,\n/**/\n 2905,\n/**/\n 2904,\n/**/\n 2903,\n/**/\n 2902,\n/**/\n 2901,\n/**/\n 2900,\n/**/\n 2899,\n/**/\n 2898,\n/**/\n 2897,\n/**/\n 2896,\n/**/\n 2895,\n/**/\n 2894,\n/**/\n 2893,\n/**/\n 2892,\n/**/\n 2891,\n/**/\n 2890,\n/**/\n 2889,\n/**/\n 2888,\n/**/\n 2887,\n/**/\n 2886,\n/**/\n 2885,\n/**/\n 2884,\n/**/\n 2883,\n/**/\n 2882,\n/**/\n 2881,\n/**/\n 2880,\n/**/\n 2879,\n/**/\n 2878,\n/**/\n 2877,\n/**/\n 2876,\n/**/\n 2875,\n/**/\n 2874,\n/**/\n 2873,\n/**/\n 2872,\n/**/\n 2871,\n/**/\n 2870,\n/**/\n 2869,\n/**/\n 2868,\n/**/\n 2867,\n/**/\n 2866,\n/**/\n 2865,\n/**/\n 2864,\n/**/\n 2863,\n/**/\n 2862,\n/**/\n 2861,\n/**/\n 2860,\n/**/\n 2859,\n/**/\n 2858,\n/**/\n 2857,\n/**/\n 2856,\n/**/\n 2855,\n/**/\n 2854,\n/**/\n 2853,\n/**/\n 2852,\n/**/\n 2851,\n/**/\n 2850,\n/**/\n 2849,\n/**/\n 2848,\n/**/\n 2847,\n/**/\n 2846,\n/**/\n 2845,\n/**/\n 2844,\n/**/\n 2843,\n/**/\n 2842,\n/**/\n 2841,\n/**/\n 2840,\n/**/\n 2839,\n/**/\n 2838,\n/**/\n 2837,\n/**/\n 2836,\n/**/\n 2835,\n/**/\n 2834,\n/**/\n 2833,\n/**/\n 2832,\n/**/\n 2831,\n/**/\n 2830,\n/**/\n 2829,\n/**/\n 2828,\n/**/\n 2827,\n/**/\n 2826,\n/**/\n 2825,\n/**/\n 2824,\n/**/\n 2823,\n/**/\n 2822,\n/**/\n 2821,\n/**/\n 2820,\n/**/\n 2819,\n/**/\n 2818,\n/**/\n 2817,\n/**/\n 2816,\n/**/\n 2815,\n/**/\n 2814,\n/**/\n 2813,\n/**/\n 2812,\n/**/\n 2811,\n/**/\n 2810,\n/**/\n 2809,\n/**/\n 2808,\n/**/\n 2807,\n/**/\n 2806,\n/**/\n 2805,\n/**/\n 2804,\n/**/\n 2803,\n/**/\n 2802,\n/**/\n 2801,\n/**/\n 2800,\n/**/\n 2799,\n/**/\n 2798,\n/**/\n 2797,\n/**/\n 2796,\n/**/\n 2795,\n/**/\n 2794,\n/**/\n 2793,\n/**/\n 2792,\n/**/\n 2791,\n/**/\n 2790,\n/**/\n 2789,\n/**/\n 2788,\n/**/\n 2787,\n/**/\n 2786,\n/**/\n 2785,\n/**/\n 2784,\n/**/\n 2783,\n/**/\n 2782,\n/**/\n 2781,\n/**/\n 2780,\n/**/\n 2779,\n/**/\n 2778,\n/**/\n 2777,\n/**/\n 2776,\n/**/\n 2775,\n/**/\n 2774,\n/**/\n 2773,\n/**/\n 2772,\n/**/\n 2771,\n/**/\n 2770,\n/**/\n 2769,\n/**/\n 2768,\n/**/\n 2767,\n/**/\n 2766,\n/**/\n 2765,\n/**/\n 2764,\n/**/\n 2763,\n/**/\n 2762,\n/**/\n 2761,\n/**/\n 2760,\n/**/\n 2759,\n/**/\n 2758,\n/**/\n 2757,\n/**/\n 2756,\n/**/\n 2755,\n/**/\n 2754,\n/**/\n 2753,\n/**/\n 2752,\n/**/\n 2751,\n/**/\n 2750,\n/**/\n 2749,\n/**/\n 2748,\n/**/\n 2747,\n/**/\n 2746,\n/**/\n 2745,\n/**/\n 2744,\n/**/\n 2743,\n/**/\n 2742,\n/**/\n 2741,\n/**/\n 2740,\n/**/\n 2739,\n/**/\n 2738,\n/**/\n 2737,\n/**/\n 2736,\n/**/\n 2735,\n/**/\n 2734,\n/**/\n 2733,\n/**/\n 2732,\n/**/\n 2731,\n/**/\n 2730,\n/**/\n 2729,\n/**/\n 2728,\n/**/\n 2727,\n/**/\n 2726,\n/**/\n 2725,\n/**/\n 2724,\n/**/\n 2723,\n/**/\n 2722,\n/**/\n 2721,\n/**/\n 2720,\n/**/\n 2719,\n/**/\n 2718,\n/**/\n 2717,\n/**/\n 2716,\n/**/\n 2715,\n/**/\n 2714,\n/**/\n 2713,\n/**/\n 2712,\n/**/\n 2711,\n/**/\n 2710,\n/**/\n 2709,\n/**/\n 2708,\n/**/\n 2707,\n/**/\n 2706,\n/**/\n 2705,\n/**/\n 2704,\n/**/\n 2703,\n/**/\n 2702,\n/**/\n 2701,\n/**/\n 2700,\n/**/\n 2699,\n/**/\n 2698,\n/**/\n 2697,\n/**/\n 2696,\n/**/\n 2695,\n/**/\n 2694,\n/**/\n 2693,\n/**/\n 2692,\n/**/\n 2691,\n/**/\n 2690,\n/**/\n 2689,\n/**/\n 2688,\n/**/\n 2687,\n/**/\n 2686,\n/**/\n 2685,\n/**/\n 2684,\n/**/\n 2683,\n/**/\n 2682,\n/**/\n 2681,\n/**/\n 2680,\n/**/\n 2679,\n/**/\n 2678,\n/**/\n 2677,\n/**/\n 2676,\n/**/\n 2675,\n/**/\n 2674,\n/**/\n 2673,\n/**/\n 2672,\n/**/\n 2671,\n/**/\n 2670,\n/**/\n 2669,\n/**/\n 2668,\n/**/\n 2667,\n/**/\n 2666,\n/**/\n 2665,\n/**/\n 2664,\n/**/\n 2663,\n/**/\n 2662,\n/**/\n 2661,\n/**/\n 2660,\n/**/\n 2659,\n/**/\n 2658,\n/**/\n 2657,\n/**/\n 2656,\n/**/\n 2655,\n/**/\n 2654,\n/**/\n 2653,\n/**/\n 2652,\n/**/\n 2651,\n/**/\n 2650,\n/**/\n 2649,\n/**/\n 2648,\n/**/\n 2647,\n/**/\n 2646,\n/**/\n 2645,\n/**/\n 2644,\n/**/\n 2643,\n/**/\n 2642,\n/**/\n 2641,\n/**/\n 2640,\n/**/\n 2639,\n/**/\n 2638,\n/**/\n 2637,\n/**/\n 2636,\n/**/\n 2635,\n/**/\n 2634,\n/**/\n 2633,\n/**/\n 2632,\n/**/\n 2631,\n/**/\n 2630,\n/**/\n 2629,\n/**/\n 2628,\n/**/\n 2627,\n/**/\n 2626,\n/**/\n 2625,\n/**/\n 2624,\n/**/\n 2623,\n/**/\n 2622,\n/**/\n 2621,\n/**/\n 2620,\n/**/\n 2619,\n/**/\n 2618,\n/**/\n 2617,\n/**/\n 2616,\n/**/\n 2615,\n/**/\n 2614,\n/**/\n 2613,\n/**/\n 2612,\n/**/\n 2611,\n/**/\n 2610,\n/**/\n 2609,\n/**/\n 2608,\n/**/\n 2607,\n/**/\n 2606,\n/**/\n 2605,\n/**/\n 2604,\n/**/\n 2603,\n/**/\n 2602,\n/**/\n 2601,\n/**/\n 2600,\n/**/\n 2599,\n/**/\n 2598,\n/**/\n 2597,\n/**/\n 2596,\n/**/\n 2595,\n/**/\n 2594,\n/**/\n 2593,\n/**/\n 2592,\n/**/\n 2591,\n/**/\n 2590,\n/**/\n 2589,\n/**/\n 2588,\n/**/\n 2587,\n/**/\n 2586,\n/**/\n 2585,\n/**/\n 2584,\n/**/\n 2583,\n/**/\n 2582,\n/**/\n 2581,\n/**/\n 2580,\n/**/\n 2579,\n/**/\n 2578,\n/**/\n 2577,\n/**/\n 2576,\n/**/\n 2575,\n/**/\n 2574,\n/**/\n 2573,\n/**/\n 2572,\n/**/\n 2571,\n/**/\n 2570,\n/**/\n 2569,\n/**/\n 2568,\n/**/\n 2567,\n/**/\n 2566,\n/**/\n 2565,\n/**/\n 2564,\n/**/\n 2563,\n/**/\n 2562,\n/**/\n 2561,\n/**/\n 2560,\n/**/\n 2559,\n/**/\n 2558,\n/**/\n 2557,\n/**/\n 2556,\n/**/\n 2555,\n/**/\n 2554,\n/**/\n 2553,\n/**/\n 2552,\n/**/\n 2551,\n/**/\n 2550,\n/**/\n 2549,\n/**/\n 2548,\n/**/\n 2547,\n/**/\n 2546,\n/**/\n 2545,\n/**/\n 2544,\n/**/\n 2543,\n/**/\n 2542,\n/**/\n 2541,\n/**/\n 2540,\n/**/\n 2539,\n/**/\n 2538,\n/**/\n 2537,\n/**/\n 2536,\n/**/\n 2535,\n/**/\n 2534,\n/**/\n 2533,\n/**/\n 2532,\n/**/\n 2531,\n/**/\n 2530,\n/**/\n 2529,\n/**/\n 2528,\n/**/\n 2527,\n/**/\n 2526,\n/**/\n 2525,\n/**/\n 2524,\n/**/\n 2523,\n/**/\n 2522,\n/**/\n 2521,\n/**/\n 2520,\n/**/\n 2519,\n/**/\n 2518,\n/**/\n 2517,\n/**/\n 2516,\n/**/\n 2515,\n/**/\n 2514,\n/**/\n 2513,\n/**/\n 2512,\n/**/\n 2511,\n/**/\n 2510,\n/**/\n 2509,\n/**/\n 2508,\n/**/\n 2507,\n/**/\n 2506,\n/**/\n 2505,\n/**/\n 2504,\n/**/\n 2503,\n/**/\n 2502,\n/**/\n 2501,\n/**/\n 2500,\n/**/\n 2499,\n/**/\n 2498,\n/**/\n 2497,\n/**/\n 2496,\n/**/\n 2495,\n/**/\n 2494,\n/**/\n 2493,\n/**/\n 2492,\n/**/\n 2491,\n/**/\n 2490,\n/**/\n 2489,\n/**/\n 2488,\n/**/\n 2487,\n/**/\n 2486,\n/**/\n 2485,\n/**/\n 2484,\n/**/\n 2483,\n/**/\n 2482,\n/**/\n 2481,\n/**/\n 2480,\n/**/\n 2479,\n/**/\n 2478,\n/**/\n 2477,\n/**/\n 2476,\n/**/\n 2475,\n/**/\n 2474,\n/**/\n 2473,\n/**/\n 2472,\n/**/\n 2471,\n/**/\n 2470,\n/**/\n 2469,\n/**/\n 2468,\n/**/\n 2467,\n/**/\n 2466,\n/**/\n 2465,\n/**/\n 2464,\n/**/\n 2463,\n/**/\n 2462,\n/**/\n 2461,\n/**/\n 2460,\n/**/\n 2459,\n/**/\n 2458,\n/**/\n 2457,\n/**/\n 2456,\n/**/\n 2455,\n/**/\n 2454,\n/**/\n 2453,\n/**/\n 2452,\n/**/\n 2451,\n/**/\n 2450,\n/**/\n 2449,\n/**/\n 2448,\n/**/\n 2447,\n/**/\n 2446,\n/**/\n 2445,\n/**/\n 2444,\n/**/\n 2443,\n/**/\n 2442,\n/**/\n 2441,\n/**/\n 2440,\n/**/\n 2439,\n/**/\n 2438,\n/**/\n 2437,\n/**/\n 2436,\n/**/\n 2435,\n/**/\n 2434,\n/**/\n 2433,\n/**/\n 2432,\n/**/\n 2431,\n/**/\n 2430,\n/**/\n 2429,\n/**/\n 2428,\n/**/\n 2427,\n/**/\n 2426,\n/**/\n 2425,\n/**/\n 2424,\n/**/\n 2423,\n/**/\n 2422,\n/**/\n 2421,\n/**/\n 2420,\n/**/\n 2419,\n/**/\n 2418,\n/**/\n 2417,\n/**/\n 2416,\n/**/\n 2415,\n/**/\n 2414,\n/**/\n 2413,\n/**/\n 2412,\n/**/\n 2411,\n/**/\n 2410,\n/**/\n 2409,\n/**/\n 2408,\n/**/\n 2407,\n/**/\n 2406,\n/**/\n 2405,\n/**/\n 2404,\n/**/\n 2403,\n/**/\n 2402,\n/**/\n 2401,\n/**/\n 2400,\n/**/\n 2399,\n/**/\n 2398,\n/**/\n 2397,\n/**/\n 2396,\n/**/\n 2395,\n/**/\n 2394,\n/**/\n 2393,\n/**/\n 2392,\n/**/\n 2391,\n/**/\n 2390,\n/**/\n 2389,\n/**/\n 2388,\n/**/\n 2387,\n/**/\n 2386,\n/**/\n 2385,\n/**/\n 2384,\n/**/\n 2383,\n/**/\n 2382,\n/**/\n 2381,\n/**/\n 2380,\n/**/\n 2379,\n/**/\n 2378,\n/**/\n 2377,\n/**/\n 2376,\n/**/\n 2375,\n/**/\n 2374,\n/**/\n 2373,\n/**/\n 2372,\n/**/\n 2371,\n/**/\n 2370,\n/**/\n 2369,\n/**/\n 2368,\n/**/\n 2367,\n/**/\n 2366,\n/**/\n 2365,\n/**/\n 2364,\n/**/\n 2363,\n/**/\n 2362,\n/**/\n 2361,\n/**/\n 2360,\n/**/\n 2359,\n/**/\n 2358,\n/**/\n 2357,\n/**/\n 2356,\n/**/\n 2355,\n/**/\n 2354,\n/**/\n 2353,\n/**/\n 2352,\n/**/\n 2351,\n/**/\n 2350,\n/**/\n 2349,\n/**/\n 2348,\n/**/\n 2347,\n/**/\n 2346,\n/**/\n 2345,\n/**/\n 2344,\n/**/\n 2343,\n/**/\n 2342,\n/**/\n 2341,\n/**/\n 2340,\n/**/\n 2339,\n/**/\n 2338,\n/**/\n 2337,\n/**/\n 2336,\n/**/\n 2335,\n/**/\n 2334,\n/**/\n 2333,\n/**/\n 2332,\n/**/\n 2331,\n/**/\n 2330,\n/**/\n 2329,\n/**/\n 2328,\n/**/\n 2327,\n/**/\n 2326,\n/**/\n 2325,\n/**/\n 2324,\n/**/\n 2323,\n/**/\n 2322,\n/**/\n 2321,\n/**/\n 2320,\n/**/\n 2319,\n/**/\n 2318,\n/**/\n 2317,\n/**/\n 2316,\n/**/\n 2315,\n/**/\n 2314,\n/**/\n 2313,\n/**/\n 2312,\n/**/\n 2311,\n/**/\n 2310,\n/**/\n 2309,\n/**/\n 2308,\n/**/\n 2307,\n/**/\n 2306,\n/**/\n 2305,\n/**/\n 2304,\n/**/\n 2303,\n/**/\n 2302,\n/**/\n 2301,\n/**/\n 2300,\n/**/\n 2299,\n/**/\n 2298,\n/**/\n 2297,\n/**/\n 2296,\n/**/\n 2295,\n/**/\n 2294,\n/**/\n 2293,\n/**/\n 2292,\n/**/\n 2291,\n/**/\n 2290,\n/**/\n 2289,\n/**/\n 2288,\n/**/\n 2287,\n/**/\n 2286,\n/**/\n 2285,\n/**/\n 2284,\n/**/\n 2283,\n/**/\n 2282,\n/**/\n 2281,\n/**/\n 2280,\n/**/\n 2279,\n/**/\n 2278,\n/**/\n 2277,\n/**/\n 2276,\n/**/\n 2275,\n/**/\n 2274,\n/**/\n 2273,\n/**/\n 2272,\n/**/\n 2271,\n/**/\n 2270,\n/**/\n 2269,\n/**/\n 2268,\n/**/\n 2267,\n/**/\n 2266,\n/**/\n 2265,\n/**/\n 2264,\n/**/\n 2263,\n/**/\n 2262,\n/**/\n 2261,\n/**/\n 2260,\n/**/\n 2259,\n/**/\n 2258,\n/**/\n 2257,\n/**/\n 2256,\n/**/\n 2255,\n/**/\n 2254,\n/**/\n 2253,\n/**/\n 2252,\n/**/\n 2251,\n/**/\n 2250,\n/**/\n 2249,\n/**/\n 2248,\n/**/\n 2247,\n/**/\n 2246,\n/**/\n 2245,\n/**/\n 2244,\n/**/\n 2243,\n/**/\n 2242,\n/**/\n 2241,\n/**/\n 2240,\n/**/\n 2239,\n/**/\n 2238,\n/**/\n 2237,\n/**/\n 2236,\n/**/\n 2235,\n/**/\n 2234,\n/**/\n 2233,\n/**/\n 2232,\n/**/\n 2231,\n/**/\n 2230,\n/**/\n 2229,\n/**/\n 2228,\n/**/\n 2227,\n/**/\n 2226,\n/**/\n 2225,\n/**/\n 2224,\n/**/\n 2223,\n/**/\n 2222,\n/**/\n 2221,\n/**/\n 2220,\n/**/\n 2219,\n/**/\n 2218,\n/**/\n 2217,\n/**/\n 2216,\n/**/\n 2215,\n/**/\n 2214,\n/**/\n 2213,\n/**/\n 2212,\n/**/\n 2211,\n/**/\n 2210,\n/**/\n 2209,\n/**/\n 2208,\n/**/\n 2207,\n/**/\n 2206,\n/**/\n 2205,\n/**/\n 2204,\n/**/\n 2203,\n/**/\n 2202,\n/**/\n 2201,\n/**/\n 2200,\n/**/\n 2199,\n/**/\n 2198,\n/**/\n 2197,\n/**/\n 2196,\n/**/\n 2195,\n/**/\n 2194,\n/**/\n 2193,\n/**/\n 2192,\n/**/\n 2191,\n/**/\n 2190,\n/**/\n 2189,\n/**/\n 2188,\n/**/\n 2187,\n/**/\n 2186,\n/**/\n 2185,\n/**/\n 2184,\n/**/\n 2183,\n/**/\n 2182,\n/**/\n 2181,\n/**/\n 2180,\n/**/\n 2179,\n/**/\n 2178,\n/**/\n 2177,\n/**/\n 2176,\n/**/\n 2175,\n/**/\n 2174,\n/**/\n 2173,\n/**/\n 2172,\n/**/\n 2171,\n/**/\n 2170,\n/**/\n 2169,\n/**/\n 2168,\n/**/\n 2167,\n/**/\n 2166,\n/**/\n 2165,\n/**/\n 2164,\n/**/\n 2163,\n/**/\n 2162,\n/**/\n 2161,\n/**/\n 2160,\n/**/\n 2159,\n/**/\n 2158,\n/**/\n 2157,\n/**/\n 2156,\n/**/\n 2155,\n/**/\n 2154,\n/**/\n 2153,\n/**/\n 2152,\n/**/\n 2151,\n/**/\n 2150,\n/**/\n 2149,\n/**/\n 2148,\n/**/\n 2147,\n/**/\n 2146,\n/**/\n 2145,\n/**/\n 2144,\n/**/\n 2143,\n/**/\n 2142,\n/**/\n 2141,\n/**/\n 2140,\n/**/\n 2139,\n/**/\n 2138,\n/**/\n 2137,\n/**/\n 2136,\n/**/\n 2135,\n/**/\n 2134,\n/**/\n 2133,\n/**/\n 2132,\n/**/\n 2131,\n/**/\n 2130,\n/**/\n 2129,\n/**/\n 2128,\n/**/\n 2127,\n/**/\n 2126,\n/**/\n 2125,\n/**/\n 2124,\n/**/\n 2123,\n/**/\n 2122,\n/**/\n 2121,\n/**/\n 2120,\n/**/\n 2119,\n/**/\n 2118,\n/**/\n 2117,\n/**/\n 2116,\n/**/\n 2115,\n/**/\n 2114,\n/**/\n 2113,\n/**/\n 2112,\n/**/\n 2111,\n/**/\n 2110,\n/**/\n 2109,\n/**/\n 2108,\n/**/\n 2107,\n/**/\n 2106,\n/**/\n 2105,\n/**/\n 2104,\n/**/\n 2103,\n/**/\n 2102,\n/**/\n 2101,\n/**/\n 2100,\n/**/\n 2099,\n/**/\n 2098,\n/**/\n 2097,\n/**/\n 2096,\n/**/\n 2095,\n/**/\n 2094,\n/**/\n 2093,\n/**/\n 2092,\n/**/\n 2091,\n/**/\n 2090,\n/**/\n 2089,\n/**/\n 2088,\n/**/\n 2087,\n/**/\n 2086,\n/**/\n 2085,\n/**/\n 2084,\n/**/\n 2083,\n/**/\n 2082,\n/**/\n 2081,\n/**/\n 2080,\n/**/\n 2079,\n/**/\n 2078,\n/**/\n 2077,\n/**/\n 2076,\n/**/\n 2075,\n/**/\n 2074,\n/**/\n 2073,\n/**/\n 2072,\n/**/\n 2071,\n/**/\n 2070,\n/**/\n 2069,\n/**/\n 2068,\n/**/\n 2067,\n/**/\n 2066,\n/**/\n 2065,\n/**/\n 2064,\n/**/\n 2063,\n/**/\n 2062,\n/**/\n 2061,\n/**/\n 2060,\n/**/\n 2059,\n/**/\n 2058,\n/**/\n 2057,\n/**/\n 2056,\n/**/\n 2055,\n/**/\n 2054,\n/**/\n 2053,\n/**/\n 2052,\n/**/\n 2051,\n/**/\n 2050,\n/**/\n 2049,\n/**/\n 2048,\n/**/\n 2047,\n/**/\n 2046,\n/**/\n 2045,\n/**/\n 2044,\n/**/\n 2043,\n/**/\n 2042,\n/**/\n 2041,\n/**/\n 2040,\n/**/\n 2039,\n/**/\n 2038,\n/**/\n 2037,\n/**/\n 2036,\n/**/\n 2035,\n/**/\n 2034,\n/**/\n 2033,\n/**/\n 2032,\n/**/\n 2031,\n/**/\n 2030,\n/**/\n 2029,\n/**/\n 2028,\n/**/\n 2027,\n/**/\n 2026,\n/**/\n 2025,\n/**/\n 2024,\n/**/\n 2023,\n/**/\n 2022,\n/**/\n 2021,\n/**/\n 2020,\n/**/\n 2019,\n/**/\n 2018,\n/**/\n 2017,\n/**/\n 2016,\n/**/\n 2015,\n/**/\n 2014,\n/**/\n 2013,\n/**/\n 2012,\n/**/\n 2011,\n/**/\n 2010,\n/**/\n 2009,\n/**/\n 2008,\n/**/\n 2007,\n/**/\n 2006,\n/**/\n 2005,\n/**/\n 2004,\n/**/\n 2003,\n/**/\n 2002,\n/**/\n 2001,\n/**/\n 2000,\n/**/\n 1999,\n/**/\n 1998,\n/**/\n 1997,\n/**/\n 1996,\n/**/\n 1995,\n/**/\n 1994,\n/**/\n 1993,\n/**/\n 1992,\n/**/\n 1991,\n/**/\n 1990,\n/**/\n 1989,\n/**/\n 1988,\n/**/\n 1987,\n/**/\n 1986,\n/**/\n 1985,\n/**/\n 1984,\n/**/\n 1983,\n/**/\n 1982,\n/**/\n 1981,\n/**/\n 1980,\n/**/\n 1979,\n/**/\n 1978,\n/**/\n 1977,\n/**/\n 1976,\n/**/\n 1975,\n/**/\n 1974,\n/**/\n 1973,\n/**/\n 1972,\n/**/\n 1971,\n/**/\n 1970,\n/**/\n 1969,\n/**/\n 1968,\n/**/\n 1967,\n/**/\n 1966,\n/**/\n 1965,\n/**/\n 1964,\n/**/\n 1963,\n/**/\n 1962,\n/**/\n 1961,\n/**/\n 1960,\n/**/\n 1959,\n/**/\n 1958,\n/**/\n 1957,\n/**/\n 1956,\n/**/\n 1955,\n/**/\n 1954,\n/**/\n 1953,\n/**/\n 1952,\n/**/\n 1951,\n/**/\n 1950,\n/**/\n 1949,\n/**/\n 1948,\n/**/\n 1947,\n/**/\n 1946,\n/**/\n 1945,\n/**/\n 1944,\n/**/\n 1943,\n/**/\n 1942,\n/**/\n 1941,\n/**/\n 1940,\n/**/\n 1939,\n/**/\n 1938,\n/**/\n 1937,\n/**/\n 1936,\n/**/\n 1935,\n/**/\n 1934,\n/**/\n 1933,\n/**/\n 1932,\n/**/\n 1931,\n/**/\n 1930,\n/**/\n 1929,\n/**/\n 1928,\n/**/\n 1927,\n/**/\n 1926,\n/**/\n 1925,\n/**/\n 1924,\n/**/\n 1923,\n/**/\n 1922,\n/**/\n 1921,\n/**/\n 1920,\n/**/\n 1919,\n/**/\n 1918,\n/**/\n 1917,\n/**/\n 1916,\n/**/\n 1915,\n/**/\n 1914,\n/**/\n 1913,\n/**/\n 1912,\n/**/\n 1911,\n/**/\n 1910,\n/**/\n 1909,\n/**/\n 1908,\n/**/\n 1907,\n/**/\n 1906,\n/**/\n 1905,\n/**/\n 1904,\n/**/\n 1903,\n/**/\n 1902,\n/**/\n 1901,\n/**/\n 1900,\n/**/\n 1899,\n/**/\n 1898,\n/**/\n 1897,\n/**/\n 1896,\n/**/\n 1895,\n/**/\n 1894,\n/**/\n 1893,\n/**/\n 1892,\n/**/\n 1891,\n/**/\n 1890,\n/**/\n 1889,\n/**/\n 1888,\n/**/\n 1887,\n/**/\n 1886,\n/**/\n 1885,\n/**/\n 1884,\n/**/\n 1883,\n/**/\n 1882,\n/**/\n 1881,\n/**/\n 1880,\n/**/\n 1879,\n/**/\n 1878,\n/**/\n 1877,\n/**/\n 1876,\n/**/\n 1875,\n/**/\n 1874,\n/**/\n 1873,\n/**/\n 1872,\n/**/\n 1871,\n/**/\n 1870,\n/**/\n 1869,\n/**/\n 1868,\n/**/\n 1867,\n/**/\n 1866,\n/**/\n 1865,\n/**/\n 1864,\n/**/\n 1863,\n/**/\n 1862,\n/**/\n 1861,\n/**/\n 1860,\n/**/\n 1859,\n/**/\n 1858,\n/**/\n 1857,\n/**/\n 1856,\n/**/\n 1855,\n/**/\n 1854,\n/**/\n 1853,\n/**/\n 1852,\n/**/\n 1851,\n/**/\n 1850,\n/**/\n 1849,\n/**/\n 1848,\n/**/\n 1847,\n/**/\n 1846,\n/**/\n 1845,\n/**/\n 1844,\n/**/\n 1843,\n/**/\n 1842,\n/**/\n 1841,\n/**/\n 1840,\n/**/\n 1839,\n/**/\n 1838,\n/**/\n 1837,\n/**/\n 1836,\n/**/\n 1835,\n/**/\n 1834,\n/**/\n 1833,\n/**/\n 1832,\n/**/\n 1831,\n/**/\n 1830,\n/**/\n 1829,\n/**/\n 1828,\n/**/\n 1827,\n/**/\n 1826,\n/**/\n 1825,\n/**/\n 1824,\n/**/\n 1823,\n/**/\n 1822,\n/**/\n 1821,\n/**/\n 1820,\n/**/\n 1819,\n/**/\n 1818,\n/**/\n 1817,\n/**/\n 1816,\n/**/\n 1815,\n/**/\n 1814,\n/**/\n 1813,\n/**/\n 1812,\n/**/\n 1811,\n/**/\n 1810,\n/**/\n 1809,\n/**/\n 1808,\n/**/\n 1807,\n/**/\n 1806,\n/**/\n 1805,\n/**/\n 1804,\n/**/\n 1803,\n/**/\n 1802,\n/**/\n 1801,\n/**/\n 1800,\n/**/\n 1799,\n/**/\n 1798,\n/**/\n 1797,\n/**/\n 1796,\n/**/\n 1795,\n/**/\n 1794,\n/**/\n 1793,\n/**/\n 1792,\n/**/\n 1791,\n/**/\n 1790,\n/**/\n 1789,\n/**/\n 1788,\n/**/\n 1787,\n/**/\n 1786,\n/**/\n 1785,\n/**/\n 1784,\n/**/\n 1783,\n/**/\n 1782,\n/**/\n 1781,\n/**/\n 1780,\n/**/\n 1779,\n/**/\n 1778,\n/**/\n 1777,\n/**/\n 1776,\n/**/\n 1775,\n/**/\n 1774,\n/**/\n 1773,\n/**/\n 1772,\n/**/\n 1771,\n/**/\n 1770,\n/**/\n 1769,\n/**/\n 1768,\n/**/\n 1767,\n/**/\n 1766,\n/**/\n 1765,\n/**/\n 1764,\n/**/\n 1763,\n/**/\n 1762,\n/**/\n 1761,\n/**/\n 1760,\n/**/\n 1759,\n/**/\n 1758,\n/**/\n 1757,\n/**/\n 1756,\n/**/\n 1755,\n/**/\n 1754,\n/**/\n 1753,\n/**/\n 1752,\n/**/\n 1751,\n/**/\n 1750,\n/**/\n 1749,\n/**/\n 1748,\n/**/\n 1747,\n/**/\n 1746,\n/**/\n 1745,\n/**/\n 1744,\n/**/\n 1743,\n/**/\n 1742,\n/**/\n 1741,\n/**/\n 1740,\n/**/\n 1739,\n/**/\n 1738,\n/**/\n 1737,\n/**/\n 1736,\n/**/\n 1735,\n/**/\n 1734,\n/**/\n 1733,\n/**/\n 1732,\n/**/\n 1731,\n/**/\n 1730,\n/**/\n 1729,\n/**/\n 1728,\n/**/\n 1727,\n/**/\n 1726,\n/**/\n 1725,\n/**/\n 1724,\n/**/\n 1723,\n/**/\n 1722,\n/**/\n 1721,\n/**/\n 1720,\n/**/\n 1719,\n/**/\n 1718,\n/**/\n 1717,\n/**/\n 1716,\n/**/\n 1715,\n/**/\n 1714,\n/**/\n 1713,\n/**/\n 1712,\n/**/\n 1711,\n/**/\n 1710,\n/**/\n 1709,\n/**/\n 1708,\n/**/\n 1707,\n/**/\n 1706,\n/**/\n 1705,\n/**/\n 1704,\n/**/\n 1703,\n/**/\n 1702,\n/**/\n 1701,\n/**/\n 1700,\n/**/\n 1699,\n/**/\n 1698,\n/**/\n 1697,\n/**/\n 1696,\n/**/\n 1695,\n/**/\n 1694,\n/**/\n 1693,\n/**/\n 1692,\n/**/\n 1691,\n/**/\n 1690,\n/**/\n 1689,\n/**/\n 1688,\n/**/\n 1687,\n/**/\n 1686,\n/**/\n 1685,\n/**/\n 1684,\n/**/\n 1683,\n/**/\n 1682,\n/**/\n 1681,\n/**/\n 1680,\n/**/\n 1679,\n/**/\n 1678,\n/**/\n 1677,\n/**/\n 1676,\n/**/\n 1675,\n/**/\n 1674,\n/**/\n 1673,\n/**/\n 1672,\n/**/\n 1671,\n/**/\n 1670,\n/**/\n 1669,\n/**/\n 1668,\n/**/\n 1667,\n/**/\n 1666,\n/**/\n 1665,\n/**/\n 1664,\n/**/\n 1663,\n/**/\n 1662,\n/**/\n 1661,\n/**/\n 1660,\n/**/\n 1659,\n/**/\n 1658,\n/**/\n 1657,\n/**/\n 1656,\n/**/\n 1655,\n/**/\n 1654,\n/**/\n 1653,\n/**/\n 1652,\n/**/\n 1651,\n/**/\n 1650,\n/**/\n 1649,\n/**/\n 1648,\n/**/\n 1647,\n/**/\n 1646,\n/**/\n 1645,\n/**/\n 1644,\n/**/\n 1643,\n/**/\n 1642,\n/**/\n 1641,\n/**/\n 1640,\n/**/\n 1639,\n/**/\n 1638,\n/**/\n 1637,\n/**/\n 1636,\n/**/\n 1635,\n/**/\n 1634,\n/**/\n 1633,\n/**/\n 1632,\n/**/\n 1631,\n/**/\n 1630,\n/**/\n 1629,\n/**/\n 1628,\n/**/\n 1627,\n/**/\n 1626,\n/**/\n 1625,\n/**/\n 1624,\n/**/\n 1623,\n/**/\n 1622,\n/**/\n 1621,\n/**/\n 1620,\n/**/\n 1619,\n/**/\n 1618,\n/**/\n 1617,\n/**/\n 1616,\n/**/\n 1615,\n/**/\n 1614,\n/**/\n 1613,\n/**/\n 1612,\n/**/\n 1611,\n/**/\n 1610,\n/**/\n 1609,\n/**/\n 1608,\n/**/\n 1607,\n/**/\n 1606,\n/**/\n 1605,\n/**/\n 1604,\n/**/\n 1603,\n/**/\n 1602,\n/**/\n 1601,\n/**/\n 1600,\n/**/\n 1599,\n/**/\n 1598,\n/**/\n 1597,\n/**/\n 1596,\n/**/\n 1595,\n/**/\n 1594,\n/**/\n 1593,\n/**/\n 1592,\n/**/\n 1591,\n/**/\n 1590,\n/**/\n 1589,\n/**/\n 1588,\n/**/\n 1587,\n/**/\n 1586,\n/**/\n 1585,\n/**/\n 1584,\n/**/\n 1583,\n/**/\n 1582,\n/**/\n 1581,\n/**/\n 1580,\n/**/\n 1579,\n/**/\n 1578,\n/**/\n 1577,\n/**/\n 1576,\n/**/\n 1575,\n/**/\n 1574,\n/**/\n 1573,\n/**/\n 1572,\n/**/\n 1571,\n/**/\n 1570,\n/**/\n 1569,\n/**/\n 1568,\n/**/\n 1567,\n/**/\n 1566,\n/**/\n 1565,\n/**/\n 1564,\n/**/\n 1563,\n/**/\n 1562,\n/**/\n 1561,\n/**/\n 1560,\n/**/\n 1559,\n/**/\n 1558,\n/**/\n 1557,\n/**/\n 1556,\n/**/\n 1555,\n/**/\n 1554,\n/**/\n 1553,\n/**/\n 1552,\n/**/\n 1551,\n/**/\n 1550,\n/**/\n 1549,\n/**/\n 1548,\n/**/\n 1547,\n/**/\n 1546,\n/**/\n 1545,\n/**/\n 1544,\n/**/\n 1543,\n/**/\n 1542,\n/**/\n 1541,\n/**/\n 1540,\n/**/\n 1539,\n/**/\n 1538,\n/**/\n 1537,\n/**/\n 1536,\n/**/\n 1535,\n/**/\n 1534,\n/**/\n 1533,\n/**/\n 1532,\n/**/\n 1531,\n/**/\n 1530,\n/**/\n 1529,\n/**/\n 1528,\n/**/\n 1527,\n/**/\n 1526,\n/**/\n 1525,\n/**/\n 1524,\n/**/\n 1523,\n/**/\n 1522,\n/**/\n 1521,\n/**/\n 1520,\n/**/\n 1519,\n/**/\n 1518,\n/**/\n 1517,\n/**/\n 1516,\n/**/\n 1515,\n/**/\n 1514,\n/**/\n 1513,\n/**/\n 1512,\n/**/\n 1511,\n/**/\n 1510,\n/**/\n 1509,\n/**/\n 1508,\n/**/\n 1507,\n/**/\n 1506,\n/**/\n 1505,\n/**/\n 1504,\n/**/\n 1503,\n/**/\n 1502,\n/**/\n 1501,\n/**/\n 1500,\n/**/\n 1499,\n/**/\n 1498,\n/**/\n 1497,\n/**/\n 1496,\n/**/\n 1495,\n/**/\n 1494,\n/**/\n 1493,\n/**/\n 1492,\n/**/\n 1491,\n/**/\n 1490,\n/**/\n 1489,\n/**/\n 1488,\n/**/\n 1487,\n/**/\n 1486,\n/**/\n 1485,\n/**/\n 1484,\n/**/\n 1483,\n/**/\n 1482,\n/**/\n 1481,\n/**/\n 1480,\n/**/\n 1479,\n/**/\n 1478,\n/**/\n 1477,\n/**/\n 1476,\n/**/\n 1475,\n/**/\n 1474,\n/**/\n 1473,\n/**/\n 1472,\n/**/\n 1471,\n/**/\n 1470,\n/**/\n 1469,\n/**/\n 1468,\n/**/\n 1467,\n/**/\n 1466,\n/**/\n 1465,\n/**/\n 1464,\n/**/\n 1463,\n/**/\n 1462,\n/**/\n 1461,\n/**/\n 1460,\n/**/\n 1459,\n/**/\n 1458,\n/**/\n 1457,\n/**/\n 1456,\n/**/\n 1455,\n/**/\n 1454,\n/**/\n 1453,\n/**/\n 1452,\n/**/\n 1451,\n/**/\n 1450,\n/**/\n 1449,\n/**/\n 1448,\n/**/\n 1447,\n/**/\n 1446,\n/**/\n 1445,\n/**/\n 1444,\n/**/\n 1443,\n/**/\n 1442,\n/**/\n 1441,\n/**/\n 1440,\n/**/\n 1439,\n/**/\n 1438,\n/**/\n 1437,\n/**/\n 1436,\n/**/\n 1435,\n/**/\n 1434,\n/**/\n 1433,\n/**/\n 1432,\n/**/\n 1431,\n/**/\n 1430,\n/**/\n 1429,\n/**/\n 1428,\n/**/\n 1427,\n/**/\n 1426,\n/**/\n 1425,\n/**/\n 1424,\n/**/\n 1423,\n/**/\n 1422,\n/**/\n 1421,\n/**/\n 1420,\n/**/\n 1419,\n/**/\n 1418,\n/**/\n 1417,\n/**/\n 1416,\n/**/\n 1415,\n/**/\n 1414,\n/**/\n 1413,\n/**/\n 1412,\n/**/\n 1411,\n/**/\n 1410,\n/**/\n 1409,\n/**/\n 1408,\n/**/\n 1407,\n/**/\n 1406,\n/**/\n 1405,\n/**/\n 1404,\n/**/\n 1403,\n/**/\n 1402,\n/**/\n 1401,\n/**/\n 1400,\n/**/\n 1399,\n/**/\n 1398,\n/**/\n 1397,\n/**/\n 1396,\n/**/\n 1395,\n/**/\n 1394,\n/**/\n 1393,\n/**/\n 1392,\n/**/\n 1391,\n/**/\n 1390,\n/**/\n 1389,\n/**/\n 1388,\n/**/\n 1387,\n/**/\n 1386,\n/**/\n 1385,\n/**/\n 1384,\n/**/\n 1383,\n/**/\n 1382,\n/**/\n 1381,\n/**/\n 1380,\n/**/\n 1379,\n/**/\n 1378,\n/**/\n 1377,\n/**/\n 1376,\n/**/\n 1375,\n/**/\n 1374,\n/**/\n 1373,\n/**/\n 1372,\n/**/\n 1371,\n/**/\n 1370,\n/**/\n 1369,\n/**/\n 1368,\n/**/\n 1367,\n/**/\n 1366,\n/**/\n 1365,\n/**/\n 1364,\n/**/\n 1363,\n/**/\n 1362,\n/**/\n 1361,\n/**/\n 1360,\n/**/\n 1359,\n/**/\n 1358,\n/**/\n 1357,\n/**/\n 1356,\n/**/\n 1355,\n/**/\n 1354,\n/**/\n 1353,\n/**/\n 1352,\n/**/\n 1351,\n/**/\n 1350,\n/**/\n 1349,\n/**/\n 1348,\n/**/\n 1347,\n/**/\n 1346,\n/**/\n 1345,\n/**/\n 1344,\n/**/\n 1343,\n/**/\n 1342,\n/**/\n 1341,\n/**/\n 1340,\n/**/\n 1339,\n/**/\n 1338,\n/**/\n 1337,\n/**/\n 1336,\n/**/\n 1335,\n/**/\n 1334,\n/**/\n 1333,\n/**/\n 1332,\n/**/\n 1331,\n/**/\n 1330,\n/**/\n 1329,\n/**/\n 1328,\n/**/\n 1327,\n/**/\n 1326,\n/**/\n 1325,\n/**/\n 1324,\n/**/\n 1323,\n/**/\n 1322,\n/**/\n 1321,\n/**/\n 1320,\n/**/\n 1319,\n/**/\n 1318,\n/**/\n 1317,\n/**/\n 1316,\n/**/\n 1315,\n/**/\n 1314,\n/**/\n 1313,\n/**/\n 1312,\n/**/\n 1311,\n/**/\n 1310,\n/**/\n 1309,\n/**/\n 1308,\n/**/\n 1307,\n/**/\n 1306,\n/**/\n 1305,\n/**/\n 1304,\n/**/\n 1303,\n/**/\n 1302,\n/**/\n 1301,\n/**/\n 1300,\n/**/\n 1299,\n/**/\n 1298,\n/**/\n 1297,\n/**/\n 1296,\n/**/\n 1295,\n/**/\n 1294,\n/**/\n 1293,\n/**/\n 1292,\n/**/\n 1291,\n/**/\n 1290,\n/**/\n 1289,\n/**/\n 1288,\n/**/\n 1287,\n/**/\n 1286,\n/**/\n 1285,\n/**/\n 1284,\n/**/\n 1283,\n/**/\n 1282,\n/**/\n 1281,\n/**/\n 1280,\n/**/\n 1279,\n/**/\n 1278,\n/**/\n 1277,\n/**/\n 1276,\n/**/\n 1275,\n/**/\n 1274,\n/**/\n 1273,\n/**/\n 1272,\n/**/\n 1271,\n/**/\n 1270,\n/**/\n 1269,\n/**/\n 1268,\n/**/\n 1267,\n/**/\n 1266,\n/**/\n 1265,\n/**/\n 1264,\n/**/\n 1263,\n/**/\n 1262,\n/**/\n 1261,\n/**/\n 1260,\n/**/\n 1259,\n/**/\n 1258,\n/**/\n 1257,\n/**/\n 1256,\n/**/\n 1255,\n/**/\n 1254,\n/**/\n 1253,\n/**/\n 1252,\n/**/\n 1251,\n/**/\n 1250,\n/**/\n 1249,\n/**/\n 1248,\n/**/\n 1247,\n/**/\n 1246,\n/**/\n 1245,\n/**/\n 1244,\n/**/\n 1243,\n/**/\n 1242,\n/**/\n 1241,\n/**/\n 1240,\n/**/\n 1239,\n/**/\n 1238,\n/**/\n 1237,\n/**/\n 1236,\n/**/\n 1235,\n/**/\n 1234,\n/**/\n 1233,\n/**/\n 1232,\n/**/\n 1231,\n/**/\n 1230,\n/**/\n 1229,\n/**/\n 1228,\n/**/\n 1227,\n/**/\n 1226,\n/**/\n 1225,\n/**/\n 1224,\n/**/\n 1223,\n/**/\n 1222,\n/**/\n 1221,\n/**/\n 1220,\n/**/\n 1219,\n/**/\n 1218,\n/**/\n 1217,\n/**/\n 1216,\n/**/\n 1215,\n/**/\n 1214,\n/**/\n 1213,\n/**/\n 1212,\n/**/\n 1211,\n/**/\n 1210,\n/**/\n 1209,\n/**/\n 1208,\n/**/\n 1207,\n/**/\n 1206,\n/**/\n 1205,\n/**/\n 1204,\n/**/\n 1203,\n/**/\n 1202,\n/**/\n 1201,\n/**/\n 1200,\n/**/\n 1199,\n/**/\n 1198,\n/**/\n 1197,\n/**/\n 1196,\n/**/\n 1195,\n/**/\n 1194,\n/**/\n 1193,\n/**/\n 1192,\n/**/\n 1191,\n/**/\n 1190,\n/**/\n 1189,\n/**/\n 1188,\n/**/\n 1187,\n/**/\n 1186,\n/**/\n 1185,\n/**/\n 1184,\n/**/\n 1183,\n/**/\n 1182,\n/**/\n 1181,\n/**/\n 1180,\n/**/\n 1179,\n/**/\n 1178,\n/**/\n 1177,\n/**/\n 1176,\n/**/\n 1175,\n/**/\n 1174,\n/**/\n 1173,\n/**/\n 1172,\n/**/\n 1171,\n/**/\n 1170,\n/**/\n 1169,\n/**/\n 1168,\n/**/\n 1167,\n/**/\n 1166,\n/**/\n 1165,\n/**/\n 1164,\n/**/\n 1163,\n/**/\n 1162,\n/**/\n 1161,\n/**/\n 1160,\n/**/\n 1159,\n/**/\n 1158,\n/**/\n 1157,\n/**/\n 1156,\n/**/\n 1155,\n/**/\n 1154,\n/**/\n 1153,\n/**/\n 1152,\n/**/\n 1151,\n/**/\n 1150,\n/**/\n 1149,\n/**/\n 1148,\n/**/\n 1147,\n/**/\n 1146,\n/**/\n 1145,\n/**/\n 1144,\n/**/\n 1143,\n/**/\n 1142,\n/**/\n 1141,\n/**/\n 1140,\n/**/\n 1139,\n/**/\n 1138,\n/**/\n 1137,\n/**/\n 1136,\n/**/\n 1135,\n/**/\n 1134,\n/**/\n 1133,\n/**/\n 1132,\n/**/\n 1131,\n/**/\n 1130,\n/**/\n 1129,\n/**/\n 1128,\n/**/\n 1127,\n/**/\n 1126,\n/**/\n 1125,\n/**/\n 1124,\n/**/\n 1123,\n/**/\n 1122,\n/**/\n 1121,\n/**/\n 1120,\n/**/\n 1119,\n/**/\n 1118,\n/**/\n 1117,\n/**/\n 1116,\n/**/\n 1115,\n/**/\n 1114,\n/**/\n 1113,\n/**/\n 1112,\n/**/\n 1111,\n/**/\n 1110,\n/**/\n 1109,\n/**/\n 1108,\n/**/\n 1107,\n/**/\n 1106,\n/**/\n 1105,\n/**/\n 1104,\n/**/\n 1103,\n/**/\n 1102,\n/**/\n 1101,\n/**/\n 1100,\n/**/\n 1099,\n/**/\n 1098,\n/**/\n 1097,\n/**/\n 1096,\n/**/\n 1095,\n/**/\n 1094,\n/**/\n 1093,\n/**/\n 1092,\n/**/\n 1091,\n/**/\n 1090,\n/**/\n 1089,\n/**/\n 1088,\n/**/\n 1087,\n/**/\n 1086,\n/**/\n 1085,\n/**/\n 1084,\n/**/\n 1083,\n/**/\n 1082,\n/**/\n 1081,\n/**/\n 1080,\n/**/\n 1079,\n/**/\n 1078,\n/**/\n 1077,\n/**/\n 1076,\n/**/\n 1075,\n/**/\n 1074,\n/**/\n 1073,\n/**/\n 1072,\n/**/\n 1071,\n/**/\n 1070,\n/**/\n 1069,\n/**/\n 1068,\n/**/\n 1067,\n/**/\n 1066,\n/**/\n 1065,\n/**/\n 1064,\n/**/\n 1063,\n/**/\n 1062,\n/**/\n 1061,\n/**/\n 1060,\n/**/\n 1059,\n/**/\n 1058,\n/**/\n 1057,\n/**/\n 1056,\n/**/\n 1055,\n/**/\n 1054,\n/**/\n 1053,\n/**/\n 1052,\n/**/\n 1051,\n/**/\n 1050,\n/**/\n 1049,\n/**/\n 1048,\n/**/\n 1047,\n/**/\n 1046,\n/**/\n 1045,\n/**/\n 1044,\n/**/\n 1043,\n/**/\n 1042,\n/**/\n 1041,\n/**/\n 1040,\n/**/\n 1039,\n/**/\n 1038,\n/**/\n 1037,\n/**/\n 1036,\n/**/\n 1035,\n/**/\n 1034,\n/**/\n 1033,\n/**/\n 1032,\n/**/\n 1031,\n/**/\n 1030,\n/**/\n 1029,\n/**/\n 1028,\n/**/\n 1027,\n/**/\n 1026,\n/**/\n 1025,\n/**/\n 1024,\n/**/\n 1023,\n/**/\n 1022,\n/**/\n 1021,\n/**/\n 1020,\n/**/\n 1019,\n/**/\n 1018,\n/**/\n 1017,\n/**/\n 1016,\n/**/\n 1015,\n/**/\n 1014,\n/**/\n 1013,\n/**/\n 1012,\n/**/\n 1011,\n/**/\n 1010,\n/**/\n 1009,\n/**/\n 1008,\n/**/\n 1007,\n/**/\n 1006,\n/**/\n 1005,\n/**/\n 1004,\n/**/\n 1003,\n/**/\n 1002,\n/**/\n 1001,\n/**/\n 1000,\n/**/\n 999,\n/**/\n 998,\n/**/\n 997,\n/**/\n 996,\n/**/\n 995,\n/**/\n 994,\n/**/\n 993,\n/**/\n 992,\n/**/\n 991,\n/**/\n 990,\n/**/\n 989,\n/**/\n 988,\n/**/\n 987,\n/**/\n 986,\n/**/\n 985,\n/**/\n 984,\n/**/\n 983,\n/**/\n 982,\n/**/\n 981,\n/**/\n 980,\n/**/\n 979,\n/**/\n 978,\n/**/\n 977,\n/**/\n 976,\n/**/\n 975,\n/**/\n 974,\n/**/\n 973,\n/**/\n 972,\n/**/\n 971,\n/**/\n 970,\n/**/\n 969,\n/**/\n 968,\n/**/\n 967,\n/**/\n 966,\n/**/\n 965,\n/**/\n 964,\n/**/\n 963,\n/**/\n 962,\n/**/\n 961,\n/**/\n 960,\n/**/\n 959,\n/**/\n 958,\n/**/\n 957,\n/**/\n 956,\n/**/\n 955,\n/**/\n 954,\n/**/\n 953,\n/**/\n 952,\n/**/\n 951,\n/**/\n 950,\n/**/\n 949,\n/**/\n 948,\n/**/\n 947,\n/**/\n 946,\n/**/\n 945,\n/**/\n 944,\n/**/\n 943,\n/**/\n 942,\n/**/\n 941,\n/**/\n 940,\n/**/\n 939,\n/**/\n 938,\n/**/\n 937,\n/**/\n 936,\n/**/\n 935,\n/**/\n 934,\n/**/\n 933,\n/**/\n 932,\n/**/\n 931,\n/**/\n 930,\n/**/\n 929,\n/**/\n 928,\n/**/\n 927,\n/**/\n 926,\n/**/\n 925,\n/**/\n 924,\n/**/\n 923,\n/**/\n 922,\n/**/\n 921,\n/**/\n 920,\n/**/\n 919,\n/**/\n 918,\n/**/\n 917,\n/**/\n 916,\n/**/\n 915,\n/**/\n 914,\n/**/\n 913,\n/**/\n 912,\n/**/\n 911,\n/**/\n 910,\n/**/\n 909,\n/**/\n 908,\n/**/\n 907,\n/**/\n 906,\n/**/\n 905,\n/**/\n 904,\n/**/\n 903,\n/**/\n 902,\n/**/\n 901,\n/**/\n 900,\n/**/\n 899,\n/**/\n 898,\n/**/\n 897,\n/**/\n 896,\n/**/\n 895,\n/**/\n 894,\n/**/\n 893,\n/**/\n 892,\n/**/\n 891,\n/**/\n 890,\n/**/\n 889,\n/**/\n 888,\n/**/\n 887,\n/**/\n 886,\n/**/\n 885,\n/**/\n 884,\n/**/\n 883,\n/**/\n 882,\n/**/\n 881,\n/**/\n 880,\n/**/\n 879,\n/**/\n 878,\n/**/\n 877,\n/**/\n 876,\n/**/\n 875,\n/**/\n 874,\n/**/\n 873,\n/**/\n 872,\n/**/\n 871,\n/**/\n 870,\n/**/\n 869,\n/**/\n 868,\n/**/\n 867,\n/**/\n 866,\n/**/\n 865,\n/**/\n 864,\n/**/\n 863,\n/**/\n 862,\n/**/\n 861,\n/**/\n 860,\n/**/\n 859,\n/**/\n 858,\n/**/\n 857,\n/**/\n 856,\n/**/\n 855,\n/**/\n 854,\n/**/\n 853,\n/**/\n 852,\n/**/\n 851,\n/**/\n 850,\n/**/\n 849,\n/**/\n 848,\n/**/\n 847,\n/**/\n 846,\n/**/\n 845,\n/**/\n 844,\n/**/\n 843,\n/**/\n 842,\n/**/\n 841,\n/**/\n 840,\n/**/\n 839,\n/**/\n 838,\n/**/\n 837,\n/**/\n 836,\n/**/\n 835,\n/**/\n 834,\n/**/\n 833,\n/**/\n 832,\n/**/\n 831,\n/**/\n 830,\n/**/\n 829,\n/**/\n 828,\n/**/\n 827,\n/**/\n 826,\n/**/\n 825,\n/**/\n 824,\n/**/\n 823,\n/**/\n 822,\n/**/\n 821,\n/**/\n 820,\n/**/\n 819,\n/**/\n 818,\n/**/\n 817,\n/**/\n 816,\n/**/\n 815,\n/**/\n 814,\n/**/\n 813,\n/**/\n 812,\n/**/\n 811,\n/**/\n 810,\n/**/\n 809,\n/**/\n 808,\n/**/\n 807,\n/**/\n 806,\n/**/\n 805,\n/**/\n 804,\n/**/\n 803,\n/**/\n 802,\n/**/\n 801,\n/**/\n 800,\n/**/\n 799,\n/**/\n 798,\n/**/\n 797,\n/**/\n 796,\n/**/\n 795,\n/**/\n 794,\n/**/\n 793,\n/**/\n 792,\n/**/\n 791,\n/**/\n 790,\n/**/\n 789,\n/**/\n 788,\n/**/\n 787,\n/**/\n 786,\n/**/\n 785,\n/**/\n 784,\n/**/\n 783,\n/**/\n 782,\n/**/\n 781,\n/**/\n 780,\n/**/\n 779,\n/**/\n 778,\n/**/\n 777,\n/**/\n 776,\n/**/\n 775,\n/**/\n 774,\n/**/\n 773,\n/**/\n 772,\n/**/\n 771,\n/**/\n 770,\n/**/\n 769,\n/**/\n 768,\n/**/\n 767,\n/**/\n 766,\n/**/\n 765,\n/**/\n 764,\n/**/\n 763,\n/**/\n 762,\n/**/\n 761,\n/**/\n 760,\n/**/\n 759,\n/**/\n 758,\n/**/\n 757,\n/**/\n 756,\n/**/\n 755,\n/**/\n 754,\n/**/\n 753,\n/**/\n 752,\n/**/\n 751,\n/**/\n 750,\n/**/\n 749,\n/**/\n 748,\n/**/\n 747,\n/**/\n 746,\n/**/\n 745,\n/**/\n 744,\n/**/\n 743,\n/**/\n 742,\n/**/\n 741,\n/**/\n 740,\n/**/\n 739,\n/**/\n 738,\n/**/\n 737,\n/**/\n 736,\n/**/\n 735,\n/**/\n 734,\n/**/\n 733,\n/**/\n 732,\n/**/\n 731,\n/**/\n 730,\n/**/\n 729,\n/**/\n 728,\n/**/\n 727,\n/**/\n 726,\n/**/\n 725,\n/**/\n 724,\n/**/\n 723,\n/**/\n 722,\n/**/\n 721,\n/**/\n 720,\n/**/\n 719,\n/**/\n 718,\n/**/\n 717,\n/**/\n 716,\n/**/\n 715,\n/**/\n 714,\n/**/\n 713,\n/**/\n 712,\n/**/\n 711,\n/**/\n 710,\n/**/\n 709,\n/**/\n 708,\n/**/\n 707,\n/**/\n 706,\n/**/\n 705,\n/**/\n 704,\n/**/\n 703,\n/**/\n 702,\n/**/\n 701,\n/**/\n 700,\n/**/\n 699,\n/**/\n 698,\n/**/\n 697,\n/**/\n 696,\n/**/\n 695,\n/**/\n 694,\n/**/\n 693,\n/**/\n 692,\n/**/\n 691,\n/**/\n 690,\n/**/\n 689,\n/**/\n 688,\n/**/\n 687,\n/**/\n 686,\n/**/\n 685,\n/**/\n 684,\n/**/\n 683,\n/**/\n 682,\n/**/\n 681,\n/**/\n 680,\n/**/\n 679,\n/**/\n 678,\n/**/\n 677,\n/**/\n 676,\n/**/\n 675,\n/**/\n 674,\n/**/\n 673,\n/**/\n 672,\n/**/\n 671,\n/**/\n 670,\n/**/\n 669,\n/**/\n 668,\n/**/\n 667,\n/**/\n 666,\n/**/\n 665,\n/**/\n 664,\n/**/\n 663,\n/**/\n 662,\n/**/\n 661,\n/**/\n 660,\n/**/\n 659,\n/**/\n 658,\n/**/\n 657,\n/**/\n 656,\n/**/\n 655,\n/**/\n 654,\n/**/\n 653,\n/**/\n 652,\n/**/\n 651,\n/**/\n 650,\n/**/\n 649,\n/**/\n 648,\n/**/\n 647,\n/**/\n 646,\n/**/\n 645,\n/**/\n 644,\n/**/\n 643,\n/**/\n 642,\n/**/\n 641,\n/**/\n 640,\n/**/\n 639,\n/**/\n 638,\n/**/\n 637,\n/**/\n 636,\n/**/\n 635,\n/**/\n 634,\n/**/\n 633,\n/**/\n 632,\n/**/\n 631,\n/**/\n 630,\n/**/\n 629,\n/**/\n 628,\n/**/\n 627,\n/**/\n 626,\n/**/\n 625,\n/**/\n 624,\n/**/\n 623,\n/**/\n 622,\n/**/\n 621,\n/**/\n 620,\n/**/\n 619,\n/**/\n 618,\n/**/\n 617,\n/**/\n 616,\n/**/\n 615,\n/**/\n 614,\n/**/\n 613,\n/**/\n 612,\n/**/\n 611,\n/**/\n 610,\n/**/\n 609,\n/**/\n 608,\n/**/\n 607,\n/**/\n 606,\n/**/\n 605,\n/**/\n 604,\n/**/\n 603,\n/**/\n 602,\n/**/\n 601,\n/**/\n 600,\n/**/\n 599,\n/**/\n 598,\n/**/\n 597,\n/**/\n 596,\n/**/\n 595,\n/**/\n 594,\n/**/\n 593,\n/**/\n 592,\n/**/\n 591,\n/**/\n 590,\n/**/\n 589,\n/**/\n 588,\n/**/\n 587,\n/**/\n 586,\n/**/\n 585,\n/**/\n 584,\n/**/\n 583,\n/**/\n 582,\n/**/\n 581,\n/**/\n 580,\n/**/\n 579,\n/**/\n 578,\n/**/\n 577,\n/**/\n 576,\n/**/\n 575,\n/**/\n 574,\n/**/\n 573,\n/**/\n 572,\n/**/\n 571,\n/**/\n 570,\n/**/\n 569,\n/**/\n 568,\n/**/\n 567,\n/**/\n 566,\n/**/\n 565,\n/**/\n 564,\n/**/\n 563,\n/**/\n 562,\n/**/\n 561,\n/**/\n 560,\n/**/\n 559,\n/**/\n 558,\n/**/\n 557,\n/**/\n 556,\n/**/\n 555,\n/**/\n 554,\n/**/\n 553,\n/**/\n 552,\n/**/\n 551,\n/**/\n 550,\n/**/\n 549,\n/**/\n 548,\n/**/\n 547,\n/**/\n 546,\n/**/\n 545,\n/**/\n 544,\n/**/\n 543,\n/**/\n 542,\n/**/\n 541,\n/**/\n 540,\n/**/\n 539,\n/**/\n 538,\n/**/\n 537,\n/**/\n 536,\n/**/\n 535,\n/**/\n 534,\n/**/\n 533,\n/**/\n 532,\n/**/\n 531,\n/**/\n 530,\n/**/\n 529,\n/**/\n 528,\n/**/\n 527,\n/**/\n 526,\n/**/\n 525,\n/**/\n 524,\n/**/\n 523,\n/**/\n 522,\n/**/\n 521,\n/**/\n 520,\n/**/\n 519,\n/**/\n 518,\n/**/\n 517,\n/**/\n 516,\n/**/\n 515,\n/**/\n 514,\n/**/\n 513,\n/**/\n 512,\n/**/\n 511,\n/**/\n 510,\n/**/\n 509,\n/**/\n 508,\n/**/\n 507,\n/**/\n 506,\n/**/\n 505,\n/**/\n 504,\n/**/\n 503,\n/**/\n 502,\n/**/\n 501,\n/**/\n 500,\n/**/\n 499,\n/**/\n 498,\n/**/\n 497,\n/**/\n 496,\n/**/\n 495,\n/**/\n 494,\n/**/\n 493,\n/**/\n 492,\n/**/\n 491,\n/**/\n 490,\n/**/\n 489,\n/**/\n 488,\n/**/\n 487,\n/**/\n 486,\n/**/\n 485,\n/**/\n 484,\n/**/\n 483,\n/**/\n 482,\n/**/\n 481,\n/**/\n 480,\n/**/\n 479,\n/**/\n 478,\n/**/\n 477,\n/**/\n 476,\n/**/\n 475,\n/**/\n 474,\n/**/\n 473,\n/**/\n 472,\n/**/\n 471,\n/**/\n 470,\n/**/\n 469,\n/**/\n 468,\n/**/\n 467,\n/**/\n 466,\n/**/\n 465,\n/**/\n 464,\n/**/\n 463,\n/**/\n 462,\n/**/\n 461,\n/**/\n 460,\n/**/\n 459,\n/**/\n 458,\n/**/\n 457,\n/**/\n 456,\n/**/\n 455,\n/**/\n 454,\n/**/\n 453,\n/**/\n 452,\n/**/\n 451,\n/**/\n 450,\n/**/\n 449,\n/**/\n 448,\n/**/\n 447,\n/**/\n 446,\n/**/\n 445,\n/**/\n 444,\n/**/\n 443,\n/**/\n 442,\n/**/\n 441,\n/**/\n 440,\n/**/\n 439,\n/**/\n 438,\n/**/\n 437,\n/**/\n 436,\n/**/\n 435,\n/**/\n 434,\n/**/\n 433,\n/**/\n 432,\n/**/\n 431,\n/**/\n 430,\n/**/\n 429,\n/**/\n 428,\n/**/\n 427,\n/**/\n 426,\n/**/\n 425,\n/**/\n 424,\n/**/\n 423,\n/**/\n 422,\n/**/\n 421,\n/**/\n 420,\n/**/\n 419,\n/**/\n 418,\n/**/\n 417,\n/**/\n 416,\n/**/\n 415,\n/**/\n 414,\n/**/\n 413,\n/**/\n 412,\n/**/\n 411,\n/**/\n 410,\n/**/\n 409,\n/**/\n 408,\n/**/\n 407,\n/**/\n 406,\n/**/\n 405,\n/**/\n 404,\n/**/\n 403,\n/**/\n 402,\n/**/\n 401,\n/**/\n 400,\n/**/\n 399,\n/**/\n 398,\n/**/\n 397,\n/**/\n 396,\n/**/\n 395,\n/**/\n 394,\n/**/\n 393,\n/**/\n 392,\n/**/\n 391,\n/**/\n 390,\n/**/\n 389,\n/**/\n 388,\n/**/\n 387,\n/**/\n 386,\n/**/\n 385,\n/**/\n 384,\n/**/\n 383,\n/**/\n 382,\n/**/\n 381,\n/**/\n 380,\n/**/\n 379,\n/**/\n 378,\n/**/\n 377,\n/**/\n 376,\n/**/\n 375,\n/**/\n 374,\n/**/\n 373,\n/**/\n 372,\n/**/\n 371,\n/**/\n 370,\n/**/\n 369,\n/**/\n 368,\n/**/\n 367,\n/**/\n 366,\n/**/\n 365,\n/**/\n 364,\n/**/\n 363,\n/**/\n 362,\n/**/\n 361,\n/**/\n 360,\n/**/\n 359,\n/**/\n 358,\n/**/\n 357,\n/**/\n 356,\n/**/\n 355,\n/**/\n 354,\n/**/\n 353,\n/**/\n 352,\n/**/\n 351,\n/**/\n 350,\n/**/\n 349,\n/**/\n 348,\n/**/\n 347,\n/**/\n 346,\n/**/\n 345,\n/**/\n 344,\n/**/\n 343,\n/**/\n 342,\n/**/\n 341,\n/**/\n 340,\n/**/\n 339,\n/**/\n 338,\n/**/\n 337,\n/**/\n 336,\n/**/\n 335,\n/**/\n 334,\n/**/\n 333,\n/**/\n 332,\n/**/\n 331,\n/**/\n 330,\n/**/\n 329,\n/**/\n 328,\n/**/\n 327,\n/**/\n 326,\n/**/\n 325,\n/**/\n 324,\n/**/\n 323,\n/**/\n 322,\n/**/\n 321,\n/**/\n 320,\n/**/\n 319,\n/**/\n 318,\n/**/\n 317,\n/**/\n 316,\n/**/\n 315,\n/**/\n 314,\n/**/\n 313,\n/**/\n 312,\n/**/\n 311,\n/**/\n 310,\n/**/\n 309,\n/**/\n 308,\n/**/\n 307,\n/**/\n 306,\n/**/\n 305,\n/**/\n 304,\n/**/\n 303,\n/**/\n 302,\n/**/\n 301,\n/**/\n 300,\n/**/\n 299,\n/**/\n 298,\n/**/\n 297,\n/**/\n 296,\n/**/\n 295,\n/**/\n 294,\n/**/\n 293,\n/**/\n 292,\n/**/\n 291,\n/**/\n 290,\n/**/\n 289,\n/**/\n 288,\n/**/\n 287,\n/**/\n 286,\n/**/\n 285,\n/**/\n 284,\n/**/\n 283,\n/**/\n 282,\n/**/\n 281,\n/**/\n 280,\n/**/\n 279,\n/**/\n 278,\n/**/\n 277,\n/**/\n 276,\n/**/\n 275,\n/**/\n 274,\n/**/\n 273,\n/**/\n 272,\n/**/\n 271,\n/**/\n 270,\n/**/\n 269,\n/**/\n 268,\n/**/\n 267,\n/**/\n 266,\n/**/\n 265,\n/**/\n 264,\n/**/\n 263,\n/**/\n 262,\n/**/\n 261,\n/**/\n 260,\n/**/\n 259,\n/**/\n 258,\n/**/\n 257,\n/**/\n 256,\n/**/\n 255,\n/**/\n 254,\n/**/\n 253,\n/**/\n 252,\n/**/\n 251,\n/**/\n 250,\n/**/\n 249,\n/**/\n 248,\n/**/\n 247,\n/**/\n 246,\n/**/\n 245,\n/**/\n 244,\n/**/\n 243,\n/**/\n 242,\n/**/\n 241,\n/**/\n 240,\n/**/\n 239,\n/**/\n 238,\n/**/\n 237,\n/**/\n 236,\n/**/\n 235,\n/**/\n 234,\n/**/\n 233,\n/**/\n 232,\n/**/\n 231,\n/**/\n 230,\n/**/\n 229,\n/**/\n 228,\n/**/\n 227,\n/**/\n 226,\n/**/\n 225,\n/**/\n 224,\n/**/\n 223,\n/**/\n 222,\n/**/\n 221,\n/**/\n 220,\n/**/\n 219,\n/**/\n 218,\n/**/\n 217,\n/**/\n 216,\n/**/\n 215,\n/**/\n 214,\n/**/\n 213,\n/**/\n 212,\n/**/\n 211,\n/**/\n 210,\n/**/\n 209,\n/**/\n 208,\n/**/\n 207,\n/**/\n 206,\n/**/\n 205,\n/**/\n 204,\n/**/\n 203,\n/**/\n 202,\n/**/\n 201,\n/**/\n 200,\n/**/\n 199,\n/**/\n 198,\n/**/\n 197,\n/**/\n 196,\n/**/\n 195,\n/**/\n 194,\n/**/\n 193,\n/**/\n 192,\n/**/\n 191,\n/**/\n 190,\n/**/\n 189,\n/**/\n 188,\n/**/\n 187,\n/**/\n 186,\n/**/\n 185,\n/**/\n 184,\n/**/\n 183,\n/**/\n 182,\n/**/\n 181,\n/**/\n 180,\n/**/\n 179,\n/**/\n 178,\n/**/\n 177,\n/**/\n 176,\n/**/\n 175,\n/**/\n 174,\n/**/\n 173,\n/**/\n 172,\n/**/\n 171,\n/**/\n 170,\n/**/\n 169,\n/**/\n 168,\n/**/\n 167,\n/**/\n 166,\n/**/\n 165,\n/**/\n 164,\n/**/\n 163,\n/**/\n 162,\n/**/\n 161,\n/**/\n 160,\n/**/\n 159,\n/**/\n 158,\n/**/\n 157,\n/**/\n 156,\n/**/\n 155,\n/**/\n 154,\n/**/\n 153,\n/**/\n 152,\n/**/\n 151,\n/**/\n 150,\n/**/\n 149,\n/**/\n 148,\n/**/\n 147,\n/**/\n 146,\n/**/\n 145,\n/**/\n 144,\n/**/\n 143,\n/**/\n 142,\n/**/\n 141,\n/**/\n 140,\n/**/\n 139,\n/**/\n 138,\n/**/\n 137,\n/**/\n 136,\n/**/\n 135,\n/**/\n 134,\n/**/\n 133,\n/**/\n 132,\n/**/\n 131,\n/**/\n 130,\n/**/\n 129,\n/**/\n 128,\n/**/\n 127,\n/**/\n 126,\n/**/\n 125,\n/**/\n 124,\n/**/\n 123,\n/**/\n 122,\n/**/\n 121,\n/**/\n 120,\n/**/\n 119,\n/**/\n 118,\n/**/\n 117,\n/**/\n 116,\n/**/\n 115,\n/**/\n 114,\n/**/\n 113,\n/**/\n 112,\n/**/\n 111,\n/**/\n 110,\n/**/\n 109,\n/**/\n 108,\n/**/\n 107,\n/**/\n 106,\n/**/\n 105,\n/**/\n 104,\n/**/\n 103,\n/**/\n 102,\n/**/\n 101,\n/**/\n 100,\n/**/\n 99,\n/**/\n 98,\n/**/\n 97,\n/**/\n 96,\n/**/\n 95,\n/**/\n 94,\n/**/\n 93,\n/**/\n 92,\n/**/\n 91,\n/**/\n 90,\n/**/\n 89,\n/**/\n 88,\n/**/\n 87,\n/**/\n 86,\n/**/\n 85,\n/**/\n 84,\n/**/\n 83,\n/**/\n 82,\n/**/\n 81,\n/**/\n 80,\n/**/\n 79,\n/**/\n 78,\n/**/\n 77,\n/**/\n 76,\n/**/\n 75,\n/**/\n 74,\n/**/\n 73,\n/**/\n 72,\n/**/\n 71,\n/**/\n 70,\n/**/\n 69,\n/**/\n 68,\n/**/\n 67,\n/**/\n 66,\n/**/\n 65,\n/**/\n 64,\n/**/\n 63,\n/**/\n 62,\n/**/\n 61,\n/**/\n 60,\n/**/\n 59,\n/**/\n 58,\n/**/\n 57,\n/**/\n 56,\n/**/\n 55,\n/**/\n 54,\n/**/\n 53,\n/**/\n 52,\n/**/\n 51,\n/**/\n 50,\n/**/\n 49,\n/**/\n 48,\n/**/\n 47,\n/**/\n 46,\n/**/\n 45,\n/**/\n 44,\n/**/\n 43,\n/**/\n 42,\n/**/\n 41,\n/**/\n 40,\n/**/\n 39,\n/**/\n 38,\n/**/\n 37,\n/**/\n 36,\n/**/\n 35,\n/**/\n 34,\n/**/\n 33,\n/**/\n 32,\n/**/\n 31,\n/**/\n 30,\n/**/\n 29,\n/**/\n 28,\n/**/\n 27,\n/**/\n 26,\n/**/\n 25,\n/**/\n 24,\n/**/\n 23,\n/**/\n 22,\n/**/\n 21,\n/**/\n 20,\n/**/\n 19,\n/**/\n 18,\n/**/\n 17,\n/**/\n 16,\n/**/\n 15,\n/**/\n 14,\n/**/\n 13,\n/**/\n 12,\n/**/\n 11,\n/**/\n 10,\n/**/\n 9,\n/**/\n 8,\n/**/\n 7,\n/**/\n 6,\n/**/\n 5,\n/**/\n 4,\n/**/\n 3,\n/**/\n 2,\n/**/\n 1,\n/**/\n 0\n};",
"/*\n * Place to put a short description when adding a feature with a patch.\n * Keep it short, e.g.,: \"relative numbers\", \"persistent undo\".\n * Also add a comment marker to separate the lines.\n * See the official Vim patches for the diff format: It must use a context of\n * one line only. Create it by hand or use \"diff -C2\" and edit the patch.\n */\nstatic char *(extra_patches[]) =\n{ /* Add your patch description below this line */\n/**/\n NULL\n};",
" int\nhighest_patch(void)\n{\n // this relies on the highest patch number to be the first entry\n return included_patches[0];\n}",
"#if defined(FEAT_EVAL) || defined(PROTO)\n/*\n * Return TRUE if patch \"n\" has been included.\n */\n int\nhas_patch(int n)\n{\n int\t\th, m, l;",
" // Perform a binary search.\n l = 0;\n h = (int)ARRAY_LENGTH(included_patches) - 1;\n while (l < h)\n {\n\tm = (l + h) / 2;\n\tif (included_patches[m] == n)\n\t return TRUE;\n\tif (included_patches[m] < n)\n\t h = m;\n\telse\n\t l = m + 1;\n }\n return FALSE;\n}\n#endif",
" void\nex_version(exarg_T *eap)\n{\n /*\n * Ignore a \":version 9.99\" command.\n */\n if (*eap->arg == NUL)\n {\n\tmsg_putchar('\\n');\n\tlist_version();\n }\n}",
"/*\n * Output a string for the version message. If it's going to wrap, output a\n * newline, unless the message is too long to fit on the screen anyway.\n * When \"wrap\" is TRUE wrap the string in [].\n */\n static void\nversion_msg_wrap(char_u *s, int wrap)\n{\n int\t\tlen = vim_strsize(s) + (wrap ? 2 : 0);",
" if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns\n\t\t\t\t\t\t\t\t&& *s != '\\n')\n\tmsg_putchar('\\n');\n if (!got_int)\n {\n\tif (wrap)\n\t msg_puts(\"[\");\n\tmsg_puts((char *)s);\n\tif (wrap)\n\t msg_puts(\"]\");\n }\n}",
" static void\nversion_msg(char *s)\n{\n version_msg_wrap((char_u *)s, FALSE);\n}",
"/*\n * List all features aligned in columns, dictionary style.\n */\n static void\nlist_features(void)\n{\n list_in_columns((char_u **)features, -1, -1);\n}",
"/*\n * List string items nicely aligned in columns.\n * When \"size\" is < 0 then the last entry is marked with NULL.\n * The entry with index \"current\" is inclosed in [].\n */\n void\nlist_in_columns(char_u **items, int size, int current)\n{\n int\t\ti;\n int\t\tncol;\n int\t\tnrow;\n int\t\tcur_row = 1;\n int\t\titem_count = 0;\n int\t\twidth = 0;\n#ifdef FEAT_SYN_HL\n int\t\tuse_highlight = (items == (char_u **)features);\n#endif",
" // Find the length of the longest item, use that + 1 as the column\n // width.\n for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)\n {\n\tint l = vim_strsize(items[i]) + (i == current ? 2 : 0);",
"\tif (l > width)\n\t width = l;\n\t++item_count;\n }\n width += 1;",
" if (Columns < width)\n {\n\t// Not enough screen columns - show one per line\n\tfor (i = 0; i < item_count; ++i)\n\t{\n\t version_msg_wrap(items[i], i == current);\n\t if (msg_col > 0 && i < item_count - 1)\n\t\tmsg_putchar('\\n');\n\t}\n\treturn;\n }",
" // The rightmost column doesn't need a separator.\n // Sacrifice it to fit in one more column if possible.\n ncol = (int) (Columns + 1) / width;\n nrow = item_count / ncol + ((item_count % ncol) ? 1 : 0);",
" // \"i\" counts columns then rows. \"idx\" counts rows then columns.\n for (i = 0; !got_int && i < nrow * ncol; ++i)\n {\n\tint idx = (i / ncol) + (i % ncol) * nrow;",
"\tif (idx < item_count)\n\t{\n\t int last_col = (i + 1) % ncol == 0;",
"\t if (idx == current)\n\t\tmsg_putchar('[');\n#ifdef FEAT_SYN_HL\n\t if (use_highlight && items[idx][0] == '-')\n\t\tmsg_puts_attr((char *)items[idx], HL_ATTR(HLF_W));\n\t else\n#endif\n\t\tmsg_puts((char *)items[idx]);\n\t if (idx == current)\n\t\tmsg_putchar(']');\n\t if (last_col)\n\t {\n\t\tif (msg_col > 0 && cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t else\n\t {\n\t\twhile (msg_col % width)\n\t\t msg_putchar(' ');\n\t }\n\t}\n\telse\n\t{\n\t // this row is out of items, thus at the end of the row\n\t if (msg_col > 0)\n\t {\n\t\tif (cur_row < nrow)\n\t\t msg_putchar('\\n');\n\t\t++cur_row;\n\t }\n\t}\n }\n}",
" void\nlist_version(void)\n{\n int\t\ti;\n int\t\tfirst;\n char\t*s = \"\";",
" /*\n * When adding features here, don't forget to update the list of\n * internal variables in eval.c!\n */\n init_longVersion();\n msg(longVersion);\n#ifdef MSWIN\n# ifdef FEAT_GUI_MSWIN\n# ifdef VIMDLL\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI/console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI/console version\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit GUI version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit GUI version\"));\n# endif\n# endif\n# ifdef FEAT_OLE\n msg_puts(_(\" with OLE support\"));\n# endif\n# else\n# ifdef _WIN64\n msg_puts(_(\"\\nMS-Windows 64-bit console version\"));\n# else\n msg_puts(_(\"\\nMS-Windows 32-bit console version\"));\n# endif\n# endif\n#endif\n#if defined(MACOS_X)\n# if defined(MACOS_X_DARWIN)\n msg_puts(_(\"\\nmacOS version\"));\n# else\n msg_puts(_(\"\\nmacOS version w/o darwin feat.\"));\n# endif\n# if defined(__arm64__)\n msg_puts(\" - arm64\");\n# elif defined(__x86_64__)\n msg_puts(\" - x86_64\");\n# endif\n#endif",
"#ifdef VMS\n msg_puts(_(\"\\nOpenVMS version\"));\n# ifdef HAVE_PATHDEF\n if (*compiled_arch != NUL)\n {\n\tmsg_puts(\" - \");\n\tmsg_puts((char *)compiled_arch);\n }\n# endif",
"#endif",
" // Print the list of patch numbers if there is at least one.\n // Print a range when patches are consecutive: \"1-10, 12, 15-40, 42-45\"\n if (included_patches[0] != 0)\n {\n\tmsg_puts(_(\"\\nIncluded patches: \"));\n\tfirst = -1;\n\ti = (int)ARRAY_LENGTH(included_patches) - 1;\n\twhile (--i >= 0)\n\t{\n\t if (first < 0)\n\t\tfirst = included_patches[i];\n\t if (i == 0 || included_patches[i - 1] != included_patches[i] + 1)\n\t {\n\t\tmsg_puts(s);\n\t\ts = \", \";\n\t\tmsg_outnum((long)first);\n\t\tif (first != included_patches[i])\n\t\t{\n\t\t msg_puts(\"-\");\n\t\t msg_outnum((long)included_patches[i]);\n\t\t}\n\t\tfirst = -1;\n\t }\n\t}\n }",
" // Print the list of extra patch descriptions if there is at least one.\n if (extra_patches[0] != NULL)\n {\n\tmsg_puts(_(\"\\nExtra patches: \"));\n\ts = \"\";\n\tfor (i = 0; extra_patches[i] != NULL; ++i)\n\t{\n\t msg_puts(s);\n\t s = \", \";\n\t msg_puts(extra_patches[i]);\n\t}\n }",
"#ifdef MODIFIED_BY\n msg_puts(\"\\n\");\n msg_puts(_(\"Modified by \"));\n msg_puts(MODIFIED_BY);\n#endif",
"#ifdef HAVE_PATHDEF\n if (*compiled_user != NUL || *compiled_sys != NUL)\n {\n\tmsg_puts(_(\"\\nCompiled \"));\n\tif (*compiled_user != NUL)\n\t{\n\t msg_puts(_(\"by \"));\n\t msg_puts((char *)compiled_user);\n\t}\n\tif (*compiled_sys != NUL)\n\t{\n\t msg_puts(\"@\");\n\t msg_puts((char *)compiled_sys);\n\t}\n }\n#endif",
"#if defined(FEAT_HUGE)\n msg_puts(_(\"\\nHuge version \"));\n#elif defined(FEAT_BIG)\n msg_puts(_(\"\\nBig version \"));\n#elif defined(FEAT_NORMAL)\n msg_puts(_(\"\\nNormal version \"));\n#elif defined(FEAT_SMALL)\n msg_puts(_(\"\\nSmall version \"));\n#else\n msg_puts(_(\"\\nTiny version \"));\n#endif\n#if !defined(FEAT_GUI)\n msg_puts(_(\"without GUI.\"));\n#elif defined(FEAT_GUI_GTK)\n# if defined(USE_GTK3)\n msg_puts(_(\"with GTK3 GUI.\"));\n# elif defined(FEAT_GUI_GNOME)\n msg_puts(_(\"with GTK2-GNOME GUI.\"));\n# else\n msg_puts(_(\"with GTK2 GUI.\"));\n# endif\n#elif defined(FEAT_GUI_MOTIF)\n msg_puts(_(\"with X11-Motif GUI.\"));\n#elif defined(FEAT_GUI_HAIKU)\n msg_puts(_(\"with Haiku GUI.\"));\n#elif defined(FEAT_GUI_PHOTON)\n msg_puts(_(\"with Photon GUI.\"));\n#elif defined(MSWIN)\n msg_puts(_(\"with GUI.\"));\n#endif\n version_msg(_(\" Features included (+) or not (-):\\n\"));",
" list_features();\n if (msg_col > 0)\n\tmsg_putchar('\\n');",
"#ifdef SYS_VIMRC_FILE\n version_msg(_(\" system vimrc file: \\\"\"));\n version_msg(SYS_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE\n version_msg(_(\" user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE2\n version_msg(_(\" 2nd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_VIMRC_FILE3\n version_msg(_(\" 3rd user vimrc file: \\\"\"));\n version_msg(USR_VIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE\n version_msg(_(\" user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef USR_EXRC_FILE2\n version_msg(_(\" 2nd user exrc file: \\\"\"));\n version_msg(USR_EXRC_FILE2);\n version_msg(\"\\\"\\n\");\n#endif\n#ifdef FEAT_GUI\n# ifdef SYS_GVIMRC_FILE\n version_msg(_(\" system gvimrc file: \\\"\"));\n version_msg(SYS_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n version_msg(_(\" user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE);\n version_msg(\"\\\"\\n\");\n# ifdef USR_GVIMRC_FILE2\n version_msg(_(\"2nd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE2);\n version_msg(\"\\\"\\n\");\n# endif\n# ifdef USR_GVIMRC_FILE3\n version_msg(_(\"3rd user gvimrc file: \\\"\"));\n version_msg(USR_GVIMRC_FILE3);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n version_msg(_(\" defaults file: \\\"\"));\n version_msg(VIM_DEFAULTS_FILE);\n version_msg(\"\\\"\\n\");\n#ifdef FEAT_GUI\n# ifdef SYS_MENU_FILE\n version_msg(_(\" system menu file: \\\"\"));\n version_msg(SYS_MENU_FILE);\n version_msg(\"\\\"\\n\");\n# endif\n#endif\n#ifdef HAVE_PATHDEF\n if (*default_vim_dir != NUL)\n {\n\tversion_msg(_(\" fall-back for $VIM: \\\"\"));\n\tversion_msg((char *)default_vim_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n if (*default_vimruntime_dir != NUL)\n {\n\tversion_msg(_(\" f-b for $VIMRUNTIME: \\\"\"));\n\tversion_msg((char *)default_vimruntime_dir);\n\tversion_msg(\"\\\"\\n\");\n }\n version_msg(_(\"Compilation: \"));\n version_msg((char *)all_cflags);\n version_msg(\"\\n\");\n#ifdef VMS\n if (*compiler_version != NUL)\n {\n\tversion_msg(_(\"Compiler: \"));\n\tversion_msg((char *)compiler_version);\n\tversion_msg(\"\\n\");\n }\n#endif\n version_msg(_(\"Linking: \"));\n version_msg((char *)all_lflags);\n#endif\n#ifdef DEBUG\n version_msg(\"\\n\");\n version_msg(_(\" DEBUG BUILD\"));\n#endif\n}",
"static void do_intro_line(int row, char_u *mesg, int add_version, int attr);\nstatic void intro_message(int colon);",
"/*\n * Show the intro message when not editing a file.\n */\n void\nmaybe_intro_message(void)\n{\n if (BUFEMPTY()\n\t && curbuf->b_fname == NULL\n\t && firstwin->w_next == NULL\n\t && vim_strchr(p_shm, SHM_INTRO) == NULL)\n\tintro_message(FALSE);\n}",
"/*\n * Give an introductory message about Vim.\n * Only used when starting Vim on an empty file, without a file name.\n * Or with the \":intro\" command (for Sven :-).\n */\n static void\nintro_message(\n int\t\tcolon)\t\t// TRUE for \":intro\"\n{\n int\t\ti;\n int\t\trow;\n int\t\tblanklines;\n int\t\tsponsor;\n char\t*p;\n static char\t*(lines[]) =\n {\n\tN_(\"VIM - Vi IMproved\"),\n\t\"\",\n\tN_(\"version \"),\n\tN_(\"by Bram Moolenaar et al.\"),\n#ifdef MODIFIED_BY\n\t\" \",\n#endif\n\tN_(\"Vim is open source and freely distributable\"),\n\t\"\",\n\tN_(\"Help poor children in Uganda!\"),\n\tN_(\"type :help iccf<Enter> for information \"),\n\t\"\",\n\tN_(\"type :q<Enter> to exit \"),\n\tN_(\"type :help<Enter> or <F1> for on-line help\"),\n\tN_(\"type :help version8<Enter> for version info\"),\n\tNULL,\n\t\"\",\n\tN_(\"Running in Vi compatible mode\"),\n\tN_(\"type :set nocp<Enter> for Vim defaults\"),\n\tN_(\"type :help cp-default<Enter> for info on this\"),\n };\n#ifdef FEAT_GUI\n static char\t*(gui_lines[]) =\n {\n\tNULL,\n\tNULL,\n\tNULL,\n\tNULL,\n#ifdef MODIFIED_BY\n\tNULL,\n#endif\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Help->Orphans for information \"),\n\tNULL,\n\tN_(\"Running modeless, typed text is inserted\"),\n\tN_(\"menu Edit->Global Settings->Toggle Insert Mode \"),\n\tN_(\" for two modes \"),\n\tNULL,\n\tNULL,\n\tNULL,\n\tN_(\"menu Edit->Global Settings->Toggle Vi Compatible\"),\n\tN_(\" for Vim defaults \"),\n };\n#endif",
" // blanklines = screen height - # message lines\n blanklines = (int)Rows - (ARRAY_LENGTH(lines) - 1);\n if (!p_cp)\n\tblanklines += 4; // add 4 for not showing \"Vi compatible\" message",
" // Don't overwrite a statusline. Depends on 'cmdheight'.\n if (p_ls > 1)\n\tblanklines -= Rows - topframe->fr_height;\n if (blanklines < 0)\n\tblanklines = 0;",
" // Show the sponsor and register message one out of four times, the Uganda\n // message two out of four times.\n sponsor = (int)time(NULL);\n sponsor = ((sponsor & 2) == 0) - ((sponsor & 4) == 0);",
" // start displaying the message lines after half of the blank lines\n row = blanklines / 2;\n if ((row >= 2 && Columns >= 50) || colon)\n {\n\tfor (i = 0; i < (int)ARRAY_LENGTH(lines); ++i)\n\t{\n\t p = lines[i];\n#ifdef FEAT_GUI\n\t if (p_im && gui.in_use && gui_lines[i] != NULL)\n\t\tp = gui_lines[i];\n#endif\n\t if (p == NULL)\n\t {\n\t\tif (!p_cp)\n\t\t break;\n\t\tcontinue;\n\t }\n\t if (sponsor != 0)\n\t {\n\t\tif (strstr(p, \"children\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"Sponsor Vim development!\")\n\t\t\t: N_(\"Become a registered Vim user!\");\n\t\telse if (strstr(p, \"iccf\") != NULL)\n\t\t p = sponsor < 0\n\t\t\t? N_(\"type :help sponsor<Enter> for information \")\n\t\t\t: N_(\"type :help register<Enter> for information \");\n\t\telse if (strstr(p, \"Orphans\") != NULL)\n\t\t p = N_(\"menu Help->Sponsor/Register for information \");\n\t }\n\t if (*p != NUL)\n\t\tdo_intro_line(row, (char_u *)_(p), i == 2, 0);\n\t ++row;\n\t}\n }",
" // Make the wait-return message appear just below the text.\n if (colon)\n\tmsg_row = row;\n}",
" static void\ndo_intro_line(\n int\t\trow,\n char_u\t*mesg,\n int\t\tadd_version,\n int\t\tattr)\n{\n char_u\tvers[20];\n int\t\tcol;\n char_u\t*p;\n int\t\tl;\n int\t\tclen;\n#ifdef MODIFIED_BY\n# define MODBY_LEN 150\n char_u\tmodby[MODBY_LEN];",
" if (*mesg == ' ')\n {\n\tvim_strncpy(modby, (char_u *)_(\"Modified by \"), MODBY_LEN - 1);\n\tl = (int)STRLEN(modby);\n\tvim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);\n\tmesg = modby;\n }\n#endif",
" // Center the message horizontally.\n col = vim_strsize(mesg);\n if (add_version)\n {\n\tSTRCPY(vers, mediumVersion);\n\tif (highest_patch())\n\t{\n\t // Check for 9.9x or 9.9xx, alpha/beta version\n\t if (isalpha((int)vers[3]))\n\t {\n\t\tint len = (isalpha((int)vers[4])) ? 5 : 4;\n\t\tsprintf((char *)vers + len, \".%d%s\", highest_patch(),\n\t\t\t\t\t\t\t mediumVersion + len);\n\t }\n\t else\n\t\tsprintf((char *)vers + 3, \".%d\", highest_patch());\n\t}\n\tcol += (int)STRLEN(vers);\n }\n col = (Columns - col) / 2;\n if (col < 0)\n\tcol = 0;",
" // Split up in parts to highlight <> items differently.\n for (p = mesg; *p != NUL; p += l)\n {\n\tclen = 0;\n\tfor (l = 0; p[l] != NUL\n\t\t\t && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)\n\t{\n\t if (has_mbyte)\n\t {\n\t\tclen += ptr2cells(p + l);\n\t\tl += (*mb_ptr2len)(p + l) - 1;\n\t }\n\t else\n\t\tclen += byte2cells(p[l]);\n\t}\n\tscreen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);\n\tcol += clen;\n }",
" // Add the version number to the version line.\n if (add_version)\n\tscreen_puts(vers, row, col, 0);\n}",
"/*\n * \":intro\": clear screen, display intro screen and wait for return.\n */\n void\nex_intro(exarg_T *eap UNUSED)\n{\n screenclear();\n intro_message(TRUE);\n wait_return(TRUE);\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [4474, 1400, 736], "buggy_code_start_loc": [4466, 1400, 736], "filenames": ["src/normal.c", "src/testdir/test_tagjump.vim", "src/version.c"], "fixing_code_end_loc": [4481, 1407, 739], "fixing_code_start_loc": [4467, 1401, 737], "message": "Use After Free in GitHub repository vim/vim prior to 8.2.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*", "matchCriteriaId": "C9328925-FDFF-4283-A085-666EB6616272", "versionEndExcluding": "8.2.5024", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:fedoraproject:fedora:34:*:*:*:*:*:*:*", "matchCriteriaId": "A930E247-0B43-43CB-98FF-6CE7B8189835", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:*", "matchCriteriaId": "80E516C0-98A4-4ADE-B69F-66A772E2BAAA", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*", "matchCriteriaId": "5C675112-476C-4D7C-BCB9-A2FB2D0BC9FD", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*", "matchCriteriaId": "DEECE5FC-CACF-4496-A3E7-164736409252", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}, {"criteria": "cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*", "matchCriteriaId": "07B237A9-69A3-4A9C-9DA0-4E06BD37AE73", "versionEndExcluding": null, "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}, {"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:o:apple:macos:*:*:*:*:*:*:*:*", "matchCriteriaId": "71E032AD-F827-4944-9699-BB1E6D4233FC", "versionEndExcluding": "13.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Use After Free in GitHub repository vim/vim prior to 8.2."}, {"lang": "es", "value": "Un Uso de Memoria Previamente Liberada en el repositorio de GitHub vim/vim versiones anteriores a 8.2"}], "evaluatorComment": null, "id": "CVE-2022-1898", "lastModified": "2023-05-03T12:15:36.347", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "PARTIAL", "baseScore": 6.8, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:M/Au:N/C:P/I:P/A:P", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 6.4, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": true}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "LOCAL", "availabilityImpact": "HIGH", "baseScore": 7.8, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "version": "3.1"}, "exploitabilityScore": 1.8, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2022-05-27T09:15:08.030", "references": [{"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/28"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "http://seclists.org/fulldisclosure/2022/Oct/41"}, {"source": "security@huntr.dev", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Issue Tracking", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/45aad635-c2f1-47ca-a4f9-db5b25979cea"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/06/msg00014.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.debian.org/debian-lts-announce/2022/11/msg00009.html"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/OZSLFIKFYU5Y2KM5EJKQNYHWRUBDQ4GJ/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMFHBC5OQXDPV2SDYA2JUQGVCPYASTJB/"}, {"source": "security@huntr.dev", "tags": ["Mailing List", "Third Party Advisory"], "url": "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TYNK6SDCMOLQJOI3B4AOE66P2G2IH4ZM/"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://security.gentoo.org/glsa/202208-32"}, {"source": "security@huntr.dev", "tags": null, "url": "https://security.gentoo.org/glsa/202305-16"}, {"source": "security@huntr.dev", "tags": ["Third Party Advisory"], "url": "https://support.apple.com/kb/HT213488"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-416"}], "source": "security@huntr.dev", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-416"}], "source": "nvd@nist.gov", "type": "Secondary"}]}, "github_commit_url": "https://github.com/vim/vim/commit/e2fa213cf571041dbd04ab0329303ffdc980678a"}, "type": "CWE-416"}
| 103
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"class admin_config extends AdminPanel {",
"\tvar $panelname = 'config';",
"}",
"class admin_config_default extends AdminPanelActionValidated {",
"\tvar $validators = array(\n\t\t// not needed anymore !\n\t\t// array('blog_root', 'blog_root', 'notEmpty', false, false, 'trim'),\n\t\tarray(\n\t\t\t'www',\n\t\t\t'www',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\t// ...\n\t\tarray(\n\t\t\t'title',\n\t\t\t'title',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\t// array('subtitle', 'subtitle', 'notEmpty', false, false, 'trim'),\n\t\t// array('blogfooter', 'blogfooter', 'notEmpty', false, false, 'trim'),\n\t\tarray(\n\t\t\t'email',\n\t\t\t'email',\n\t\t\t'isEmail',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'maxentries',\n\t\t\t'maxentries',\n\t\t\t'isInt',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),",
"\t\tarray(\n\t\t\t'timeoffset',\n\t\t\t'timeoffset',\n\t\t\t'isNumber',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'timeformat',\n\t\t\t'timeformat',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'dateformat',\n\t\t\t'dateformat',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'dateformatshort',\n\t\t\t'dateformatshort',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),",
"\t\tarray(\n\t\t\t'lang',\n\t\t\t'lang',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'charset',\n\t\t\t'charset',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t)\n\t);",
"\tvar $events = array(\n\t\t'save'\n\t);",
"\tfunction setup() {\n\t\t$this->smarty->assign('themes', theme_list());\n\t\t$this->smarty->assign('lang_list', lang_list());",
"\t\t$static_list = array();",
"\t\tforeach (static_getlist() as $id) {\n\t\t\t$static_list [$id] = static_parse($id);\n\t\t}",
"\t\t$this->smarty->assign('static_list', $static_list);\n\t}",
"\tfunction onsave() {\n\t\tglobal $fp_config;\n\t\t$l = explode(',', $_POST ['lang']);\n\t\t$fp_config ['general'] = array(\n\t\t\t// 'BLOG_ROOT' => $_POST['blog_root'],\n\t\t\t'www' => $_POST ['www'],\n\t\t\t'title' => wp_specialchars(stripslashes($_POST ['title'])),\n\t\t\t'subtitle' => wp_specialchars(stripslashes($_POST ['subtitle'])),\n\t\t\t'footer' => wp_specialchars(stripslashes($_POST ['blogfooter'])),",
"\t\t\t'author' => $_POST ['author'],\n\t\t\t'email' => $_POST ['email'],",
"\t\t\t'startpage' => ($_POST ['startpage'] == ':NULL:') ? null : $_POST ['startpage'],\n\t\t\t'maxentries' => $_POST ['maxentries'],\n\t\t\t// 'voting' => $_POST['voting'],\n\t\t\t'notify' => isset($_POST ['notify']),",
"\t\t\t\t/* preserve the following */\n\t\t\t\t'theme' => $fp_config ['general'] ['theme'],",
"\t\t\t'style' => @$fp_config ['general'] ['style'],\n\t\t\t'blogid' => $fp_config ['general'] ['blogid'],\n\t\t\t'charset' => 'utf-8'\n\t\t);",
"\t\t$fp_config ['locale'] = array(\n\t\t\t'timeoffset' => $_POST ['timeoffset'],\n\t\t\t'timeformat' => $_POST ['timeformat'],\n\t\t\t'dateformat' => $_POST ['dateformat'],\n\t\t\t'dateformatshort' => $_POST ['dateformatshort'],\n\t\t\t'charset' => $_POST ['charset'],\n\t\t\t'lang' => $_POST ['lang']\n\t\t);",
"\t\t// 'LANG' => $l[0],\n\t\t// 'CHARSET'=> $l[1],",
"\t\t$success = config_save() ? 1 : -1;",
"\t\t$this->smarty->assign('success', $success);",
"\t\treturn 1;\n\t}",
"\tfunction onerror() {\n\t\t$this->main();\n\t\treturn 0;\n\t}",
"\tfunction cleartplcache() {\n\t\t// if theme was switched, clear tpl cache\n\t\t$tpl = new tpl_deleter();",
"\t\t$tpl->getList();\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [135], "buggy_code_start_loc": [127], "filenames": ["admin/panels/config/admin.config.php"], "fixing_code_end_loc": [135], "fixing_code_start_loc": [127], "message": "Cross-site Scripting (XSS) - Generic in GitHub repository flatpressblog/flatpress prior to 1.3.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:flatpress:flatpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "2C1FD291-99DD-40F3-96DB-D79CA8279692", "versionEndExcluding": "1.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Generic in GitHub repository flatpressblog/flatpress prior to 1.3."}], "evaluatorComment": null, "id": "CVE-2023-1146", "lastModified": "2023-03-03T18:57:12.490", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 2.5, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-03-02T03:15:08.977", "references": [{"source": "security@huntr.dev", "tags": ["Patch"], "url": "https://github.com/flatpressblog/flatpress/commit/0ee4f2e8a7b9276880b56858e408cc9c6643cc3b"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/d6d1e1e2-2f67-4d28-aa84-b30fb1d2e737"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Primary"}]}, "github_commit_url": "https://github.com/flatpressblog/flatpress/commit/0ee4f2e8a7b9276880b56858e408cc9c6643cc3b"}, "type": "CWE-79"}
| 104
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"<?php",
"class admin_config extends AdminPanel {",
"\tvar $panelname = 'config';",
"}",
"class admin_config_default extends AdminPanelActionValidated {",
"\tvar $validators = array(\n\t\t// not needed anymore !\n\t\t// array('blog_root', 'blog_root', 'notEmpty', false, false, 'trim'),\n\t\tarray(\n\t\t\t'www',\n\t\t\t'www',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\t// ...\n\t\tarray(\n\t\t\t'title',\n\t\t\t'title',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\t// array('subtitle', 'subtitle', 'notEmpty', false, false, 'trim'),\n\t\t// array('blogfooter', 'blogfooter', 'notEmpty', false, false, 'trim'),\n\t\tarray(\n\t\t\t'email',\n\t\t\t'email',\n\t\t\t'isEmail',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'maxentries',\n\t\t\t'maxentries',\n\t\t\t'isInt',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),",
"\t\tarray(\n\t\t\t'timeoffset',\n\t\t\t'timeoffset',\n\t\t\t'isNumber',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'timeformat',\n\t\t\t'timeformat',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'dateformat',\n\t\t\t'dateformat',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'dateformatshort',\n\t\t\t'dateformatshort',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),",
"\t\tarray(\n\t\t\t'lang',\n\t\t\t'lang',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t),\n\t\tarray(\n\t\t\t'charset',\n\t\t\t'charset',\n\t\t\t'notEmpty',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t'trim'\n\t\t)\n\t);",
"\tvar $events = array(\n\t\t'save'\n\t);",
"\tfunction setup() {\n\t\t$this->smarty->assign('themes', theme_list());\n\t\t$this->smarty->assign('lang_list', lang_list());",
"\t\t$static_list = array();",
"\t\tforeach (static_getlist() as $id) {\n\t\t\t$static_list [$id] = static_parse($id);\n\t\t}",
"\t\t$this->smarty->assign('static_list', $static_list);\n\t}",
"\tfunction onsave() {\n\t\tglobal $fp_config;\n\t\t$l = explode(',', $_POST ['lang']);\n\t\t$fp_config ['general'] = array(\n\t\t\t// 'BLOG_ROOT' => $_POST['blog_root'],\n\t\t\t'www' => $_POST ['www'],\n\t\t\t'title' => wp_specialchars(stripslashes($_POST ['title'])),\n\t\t\t'subtitle' => wp_specialchars(stripslashes($_POST ['subtitle'])),\n\t\t\t'footer' => wp_specialchars(stripslashes($_POST ['blogfooter'])),",
"\t\t\t'author' => wp_specialchars($_POST ['author']),\n\t\t\t'email' => wp_specialchars($_POST ['email']),",
"\t\t\t'startpage' => ($_POST ['startpage'] == ':NULL:') ? null : $_POST ['startpage'],\n\t\t\t'maxentries' => $_POST ['maxentries'],\n\t\t\t// 'voting' => $_POST['voting'],\n\t\t\t'notify' => isset($_POST ['notify']),",
"\t\t\t// preserve the following\n\t\t\t'theme' => $fp_config ['general'] ['theme'],",
"\t\t\t'style' => @$fp_config ['general'] ['style'],\n\t\t\t'blogid' => $fp_config ['general'] ['blogid'],\n\t\t\t'charset' => 'utf-8'\n\t\t);",
"\t\t$fp_config ['locale'] = array(\n\t\t\t'timeoffset' => $_POST ['timeoffset'],\n\t\t\t'timeformat' => $_POST ['timeformat'],\n\t\t\t'dateformat' => $_POST ['dateformat'],\n\t\t\t'dateformatshort' => $_POST ['dateformatshort'],\n\t\t\t'charset' => $_POST ['charset'],\n\t\t\t'lang' => $_POST ['lang']\n\t\t);",
"\t\t// 'LANG' => $l[0],\n\t\t// 'CHARSET'=> $l[1],",
"\t\t$success = config_save() ? 1 : -1;",
"\t\t$this->smarty->assign('success', $success);",
"\t\treturn 1;\n\t}",
"\tfunction onerror() {\n\t\t$this->main();\n\t\treturn 0;\n\t}",
"\tfunction cleartplcache() {\n\t\t// if theme was switched, clear tpl cache\n\t\t$tpl = new tpl_deleter();",
"\t\t$tpl->getList();\n\t}",
"}",
"?>"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [135], "buggy_code_start_loc": [127], "filenames": ["admin/panels/config/admin.config.php"], "fixing_code_end_loc": [135], "fixing_code_start_loc": [127], "message": "Cross-site Scripting (XSS) - Generic in GitHub repository flatpressblog/flatpress prior to 1.3.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:flatpress:flatpress:*:*:*:*:*:*:*:*", "matchCriteriaId": "2C1FD291-99DD-40F3-96DB-D79CA8279692", "versionEndExcluding": "1.3", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "Cross-site Scripting (XSS) - Generic in GitHub repository flatpressblog/flatpress prior to 1.3."}], "evaluatorComment": null, "id": "CVE-2023-1146", "lastModified": "2023-03-03T18:57:12.490", "metrics": {"cvssMetricV2": null, "cvssMetricV30": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N", "version": "3.0"}, "exploitabilityScore": 2.8, "impactScore": 2.5, "source": "security@huntr.dev", "type": "Secondary"}], "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 5.4, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "LOW", "scope": "CHANGED", "userInteraction": "REQUIRED", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.3, "impactScore": 2.7, "source": "nvd@nist.gov", "type": "Primary"}]}, "published": "2023-03-02T03:15:08.977", "references": [{"source": "security@huntr.dev", "tags": ["Patch"], "url": "https://github.com/flatpressblog/flatpress/commit/0ee4f2e8a7b9276880b56858e408cc9c6643cc3b"}, {"source": "security@huntr.dev", "tags": ["Exploit", "Patch", "Third Party Advisory"], "url": "https://huntr.dev/bounties/d6d1e1e2-2f67-4d28-aa84-b30fb1d2e737"}], "sourceIdentifier": "security@huntr.dev", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-79"}], "source": "security@huntr.dev", "type": "Primary"}]}, "github_commit_url": "https://github.com/flatpressblog/flatpress/commit/0ee4f2e8a7b9276880b56858e408cc9c6643cc3b"}, "type": "CWE-79"}
| 104
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"var pythonMirror = process.env.npm_config_python_mirror || process.env.PYTHON_MIRROR || 'https://www.python.org/ftp/python/'",
"var buildTools = {\n installerName: 'BuildTools_Full.exe',",
" installerUrl: 'http://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe',",
" logName: 'build-tools-log.txt'\n}",
"var python = {\n installerName: 'python-2.7.11.msi',\n installerUrl: pythonMirror.replace(/\\/*$/, '/2.7.11/python-2.7.11.msi'),\n targetName: 'python27',\n logName: 'python-log.txt'\n}",
"module.exports = {\n buildTools,\n python\n}"
] |
[
1,
1,
0,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [6], "buggy_code_start_loc": [5], "filenames": ["src/constants.js"], "fixing_code_end_loc": [6], "fixing_code_start_loc": [5], "message": "windows-build-tools is a module for installing C++ Build Tools for Windows using npm. windows-build-tools versions below 1.0.0 download resources over HTTP, which leaves it vulnerable to MITM attacks. It may be possible to cause remote code execution (RCE) by swapping out the requested resources with an attacker controlled copy if the attacker is on the network or positioned in between the user and the remote server.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:windows-build-tools_project:windows-build-tools:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "6A463AD3-7F9E-4EF4-B9C5-852FC9782EEE", "versionEndExcluding": "1.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "windows-build-tools is a module for installing C++ Build Tools for Windows using npm. windows-build-tools versions below 1.0.0 download resources over HTTP, which leaves it vulnerable to MITM attacks. It may be possible to cause remote code execution (RCE) by swapping out the requested resources with an attacker controlled copy if the attacker is on the network or positioned in between the user and the remote server."}, {"lang": "es", "value": "windows-build-tools es un m\u00f3dulo para instalar C++ Build Tools para Windows mediante npm. windows-build-tools en versiones anteriores a la 1.0.0 descarga recursos por HTTP, lo que lo deja vulnerable a ataques MITM. Podr\u00eda ser posible provocar la ejecuci\u00f3n remota de c\u00f3digo (RCE) cambiando los recursos solicitados por otros controlados por el atacante si \u00e9ste est\u00e1 en la red o posicionado entre el usuario y el servidor remoto."}], "evaluatorComment": null, "id": "CVE-2017-16003", "lastModified": "2019-10-09T23:24:35.407", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 9.3, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:M/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2018-05-29T20:29:02.143", "references": [{"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/felixrieseberg/windows-build-tools/commit/9835d33e68f2cb5e4d148e954bb3ed0221d98e90"}, {"source": "support@hackerone.com", "tags": ["Third Party Advisory"], "url": "https://nodesecurity.io/advisories/304"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-311"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-311"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/felixrieseberg/windows-build-tools/commit/9835d33e68f2cb5e4d148e954bb3ed0221d98e90"}, "type": "CWE-311"}
| 105
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"var pythonMirror = process.env.npm_config_python_mirror || process.env.PYTHON_MIRROR || 'https://www.python.org/ftp/python/'",
"var buildTools = {\n installerName: 'BuildTools_Full.exe',",
" installerUrl: 'https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe',",
" logName: 'build-tools-log.txt'\n}",
"var python = {\n installerName: 'python-2.7.11.msi',\n installerUrl: pythonMirror.replace(/\\/*$/, '/2.7.11/python-2.7.11.msi'),\n targetName: 'python27',\n logName: 'python-log.txt'\n}",
"module.exports = {\n buildTools,\n python\n}"
] |
[
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [6], "buggy_code_start_loc": [5], "filenames": ["src/constants.js"], "fixing_code_end_loc": [6], "fixing_code_start_loc": [5], "message": "windows-build-tools is a module for installing C++ Build Tools for Windows using npm. windows-build-tools versions below 1.0.0 download resources over HTTP, which leaves it vulnerable to MITM attacks. It may be possible to cause remote code execution (RCE) by swapping out the requested resources with an attacker controlled copy if the attacker is on the network or positioned in between the user and the remote server.", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:windows-build-tools_project:windows-build-tools:*:*:*:*:*:node.js:*:*", "matchCriteriaId": "6A463AD3-7F9E-4EF4-B9C5-852FC9782EEE", "versionEndExcluding": "1.0.0", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "windows-build-tools is a module for installing C++ Build Tools for Windows using npm. windows-build-tools versions below 1.0.0 download resources over HTTP, which leaves it vulnerable to MITM attacks. It may be possible to cause remote code execution (RCE) by swapping out the requested resources with an attacker controlled copy if the attacker is on the network or positioned in between the user and the remote server."}, {"lang": "es", "value": "windows-build-tools es un m\u00f3dulo para instalar C++ Build Tools para Windows mediante npm. windows-build-tools en versiones anteriores a la 1.0.0 descarga recursos por HTTP, lo que lo deja vulnerable a ataques MITM. Podr\u00eda ser posible provocar la ejecuci\u00f3n remota de c\u00f3digo (RCE) cambiando los recursos solicitados por otros controlados por el atacante si \u00e9ste est\u00e1 en la red o posicionado entre el usuario y el servidor remoto."}], "evaluatorComment": null, "id": "CVE-2017-16003", "lastModified": "2019-10-09T23:24:35.407", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "HIGH", "cvssData": {"accessComplexity": "MEDIUM", "accessVector": "NETWORK", "authentication": "NONE", "availabilityImpact": "COMPLETE", "baseScore": 9.3, "confidentialityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "vectorString": "AV:N/AC:M/Au:N/C:C/I:C/A:C", "version": "2.0"}, "exploitabilityScore": 8.6, "impactScore": 10.0, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": [{"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "HIGH", "baseScore": 8.1, "baseSeverity": "HIGH", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H", "version": "3.0"}, "exploitabilityScore": 2.2, "impactScore": 5.9, "source": "nvd@nist.gov", "type": "Primary"}], "cvssMetricV31": null}, "published": "2018-05-29T20:29:02.143", "references": [{"source": "support@hackerone.com", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/felixrieseberg/windows-build-tools/commit/9835d33e68f2cb5e4d148e954bb3ed0221d98e90"}, {"source": "support@hackerone.com", "tags": ["Third Party Advisory"], "url": "https://nodesecurity.io/advisories/304"}], "sourceIdentifier": "support@hackerone.com", "vendorComments": null, "vulnStatus": "Modified", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-311"}], "source": "nvd@nist.gov", "type": "Primary"}, {"description": [{"lang": "en", "value": "CWE-311"}], "source": "support@hackerone.com", "type": "Secondary"}]}, "github_commit_url": "https://github.com/felixrieseberg/windows-build-tools/commit/9835d33e68f2cb5e4d148e954bb3ed0221d98e90"}, "type": "CWE-311"}
| 105
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"module github.com/TykTechnologies/tyk-identity-broker",
"go 1.13",
"require (\n\tgithub.com/Jeffail/gabs v1.4.0",
"\tgithub.com/TykTechnologies/tyk/certs v0.0.1",
"\tgithub.com/crewjam/saml v0.4.5\n\tgithub.com/go-ldap/ldap/v3 v3.2.3\n\tgithub.com/go-redis/redis/v8 v8.3.1\n\tgithub.com/gorilla/mux v1.7.4\n\tgithub.com/gorilla/sessions v1.2.0\n\tgithub.com/jonboulle/clockwork v0.2.2 // indirect\n\tgithub.com/kelseyhightower/envconfig v1.4.0\n\tgithub.com/markbates/goth v1.64.2\n\tgithub.com/matryer/is v1.4.0\n\tgithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201219040909-8fd2afad43d1 // indirect\n\tgithub.com/mattn/go-colorable v0.1.7 // indirect\n\tgithub.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect\n\tgithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect",
"",
"\tgithub.com/satori/go.uuid v1.2.0\n\tgithub.com/sirupsen/logrus v1.4.3-0.20191026113918-67a7fdcf741f\n\tgithub.com/x-cray/logrus-prefixed-formatter v0.5.2\n\tgolang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect",
"\tgolang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d",
"\tgolang.org/x/text v0.3.3\n\tgopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect\n\tgopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22\n)\n",
"replace github.com/jensneuse/graphql-go-tools => github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20200731074614-80c67fc17e8e"
] |
[
1,
1,
1,
0,
1,
0,
1,
0,
1,
0
] |
PreciseBugs
|
{"buggy_code_end_loc": [32, 195, 32], "buggy_code_start_loc": [7, 0, 31], "filenames": ["go.mod", "go.sum", "providers/saml.go"], "fixing_code_end_loc": [38, 885, 32], "fixing_code_start_loc": [7, 1, 31], "message": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:tyk:tyk-identity-broker:*:*:*:*:*:*:*:*", "matchCriteriaId": "509C7956-E3F8-4F26-A047-DDEC86CA5EBD", "versionEndExcluding": "1.1.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data)."}, {"lang": "es", "value": "El paquete github.com/tyktechnologies/tyk-identity-broker versiones anteriores a 1.1.1, es vulnerable a una omisi\u00f3n de autenticaci\u00f3n por medio del analizador Go XML, lo que puede causar una omisi\u00f3n de autenticaci\u00f3n SAML. Esto es debido a que el analizador XML no garantiza la integridad en el viaje de ida y vuelta XML (datos XML encoding/decoding)"}], "evaluatorComment": null, "id": "CVE-2021-23365", "lastModified": "2021-05-19T13:00:45.973", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 5.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 2.5, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2021-04-26T10:15:12.597", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/46f70420e0911e4e8b638575e29d394c227c75d0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/pull/147"}, {"source": "report@snyk.io", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.1.1"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMTYKTECHNOLOGIESTYKIDENTITYBROKER-1089720"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, "type": "CWE-287"}
| 106
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"module github.com/TykTechnologies/tyk-identity-broker",
"go 1.13",
"require (\n\tgithub.com/Jeffail/gabs v1.4.0",
"\tgithub.com/TykTechnologies/tyk v1.9.2-0.20210112201019-11dba25d812b",
"\tgithub.com/crewjam/saml v0.4.5\n\tgithub.com/go-ldap/ldap/v3 v3.2.3\n\tgithub.com/go-redis/redis/v8 v8.3.1\n\tgithub.com/gorilla/mux v1.7.4\n\tgithub.com/gorilla/sessions v1.2.0\n\tgithub.com/jonboulle/clockwork v0.2.2 // indirect\n\tgithub.com/kelseyhightower/envconfig v1.4.0\n\tgithub.com/markbates/goth v1.64.2\n\tgithub.com/matryer/is v1.4.0\n\tgithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201219040909-8fd2afad43d1 // indirect\n\tgithub.com/mattn/go-colorable v0.1.7 // indirect\n\tgithub.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect\n\tgithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect",
"\tgithub.com/pkg/errors v0.9.1 // indirect",
"\tgithub.com/satori/go.uuid v1.2.0\n\tgithub.com/sirupsen/logrus v1.4.3-0.20191026113918-67a7fdcf741f\n\tgithub.com/x-cray/logrus-prefixed-formatter v0.5.2\n\tgolang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect",
"\tgolang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect\n\tgolang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43",
"\tgolang.org/x/text v0.3.3\n\tgopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect\n\tgopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22\n)\n",
"replace github.com/jeffail/tunny => github.com/Jeffail/tunny v0.0.0-20171107125207-452a8e97d6a3",
"replace github.com/jensneuse/graphql-go-tools => github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20201012125356-562407e88c4f",
"exclude github.com/TykTechnologies/tyk/certs v0.0.1"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [32, 195, 32], "buggy_code_start_loc": [7, 0, 31], "filenames": ["go.mod", "go.sum", "providers/saml.go"], "fixing_code_end_loc": [38, 885, 32], "fixing_code_start_loc": [7, 1, 31], "message": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:tyk:tyk-identity-broker:*:*:*:*:*:*:*:*", "matchCriteriaId": "509C7956-E3F8-4F26-A047-DDEC86CA5EBD", "versionEndExcluding": "1.1.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data)."}, {"lang": "es", "value": "El paquete github.com/tyktechnologies/tyk-identity-broker versiones anteriores a 1.1.1, es vulnerable a una omisi\u00f3n de autenticaci\u00f3n por medio del analizador Go XML, lo que puede causar una omisi\u00f3n de autenticaci\u00f3n SAML. Esto es debido a que el analizador XML no garantiza la integridad en el viaje de ida y vuelta XML (datos XML encoding/decoding)"}], "evaluatorComment": null, "id": "CVE-2021-23365", "lastModified": "2021-05-19T13:00:45.973", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 5.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 2.5, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2021-04-26T10:15:12.597", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/46f70420e0911e4e8b638575e29d394c227c75d0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/pull/147"}, {"source": "report@snyk.io", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.1.1"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMTYKTECHNOLOGIESTYKIDENTITYBROKER-1089720"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, "type": "CWE-287"}
| 106
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"",
"cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=",
"",
"github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28=\ngithub.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=",
"",
"github.com/Jeffail/gabs v1.4.0 h1://5fYRRTq1edjfIrQGvdkcd22pkYUrHZ5YC/H2GJVAo=\ngithub.com/Jeffail/gabs v1.4.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=",
"github.com/TykTechnologies/tyk/certs v0.0.1 h1:dhRT7HeKS5zHMbmNHuulBdC0pN90kdUxmQ6UB4RpmOk=\ngithub.com/TykTechnologies/tyk/certs v0.0.1/go.mod h1:Xq3wD9z699ZujmiGvndoOPi3ElE46pmiiHrHSUjpqb0=",
"github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=\ngithub.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=",
"",
"github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=\ngithub.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=",
"",
"github.com/crewjam/httperr v0.0.0-20190612203328-a946449404da h1:WXnT88cFG2davqSFqvaFfzkSMC0lqh/8/rKZ+z7tYvI=\ngithub.com/crewjam/httperr v0.0.0-20190612203328-a946449404da/go.mod h1:+rmNIXRvYMqLQeR4DHyTvs6y0MEMymTz4vyFpFkKTPs=\ngithub.com/crewjam/saml v0.4.5 h1:H9u+6CZAESUKHxMyxUbVn0IawYvKZn4nt3d4ccV4O/M=\ngithub.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S68bk=",
"",
"github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=\ngithub.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=\ngithub.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=\ngithub.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=",
"",
"github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=\ngithub.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=\ngithub.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=",
"",
"github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8=\ngithub.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=",
"",
"github.com/go-ldap/ldap/v3 v3.2.3 h1:FBt+5w3q/vPVPb4eYMQSn+pOiz4zewPamYhlGMmc7yM=\ngithub.com/go-ldap/ldap/v3 v3.2.3/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg=\ngithub.com/go-redis/redis/v8 v8.3.1 h1:jEPCgHQopfNaABun3NVN9pv2K7RjstY/7UJD6UEKFEY=\ngithub.com/go-redis/redis/v8 v8.3.1/go.mod h1:a2xkpBM7NJUN5V5kiF46X5Ltx4WeXJ9757X/ScKUBdE=",
"",
"github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=\ngithub.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=",
"",
"github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=\ngithub.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=\ngithub.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=\ngithub.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=\ngithub.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=",
"",
"github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=\ngithub.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=",
"",
"github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=\ngithub.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=",
"",
"github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=\ngithub.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=",
"",
"github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=\ngithub.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=\ngithub.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=",
"",
"github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=\ngithub.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=\ngithub.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1 h1:LqbZZ9sNMWVjeXS4NN5oVvhMjDyLhmA1LG86oSo+IqY=\ngithub.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY=\ngithub.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=\ngithub.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=\ngithub.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w=\ngithub.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ=\ngithub.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=",
"",
"github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=",
"",
"github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4=",
"",
"github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=\ngithub.com/jonboulle/clockwork v0.2.1 h1:S/EaQvW6FpWMYAvYvY+OBDvpaM+izu0oiwo5y0MH7U0=\ngithub.com/jonboulle/clockwork v0.2.1/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=\ngithub.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=\ngithub.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=",
"",
"github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=\ngithub.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=",
"",
"github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=",
"",
"github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=\ngithub.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=\ngithub.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=\ngithub.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=\ngithub.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=\ngithub.com/lestrrat-go/jwx v0.9.0/go.mod h1:iEoxlYfZjvoGpuWwxUz+eR5e6KTJGsaRcy/YNA/UnBk=",
"",
"github.com/markbates/going v1.0.0/go.mod h1:I6mnB4BPnEeqo85ynXIx1ZFLLbtiLHNXVgWeFO9OGOA=\ngithub.com/markbates/goth v1.64.2 h1:HDFwyuB6/ATU1USTvd/Rb3C9XE0VAxeuciSz+aUZHHA=\ngithub.com/markbates/goth v1.64.2/go.mod h1:hSFJFfH56BfFCX4+hBIxyd3o5VzuH5rNwKVRsFr/JPk=\ngithub.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=\ngithub.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201213122252-bcd7e1b9601e h1:qqXczln0qwkVGcpQ+sQuPOVntt2FytYarXXxYSNJkgw=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201213122252-bcd7e1b9601e/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201219040909-8fd2afad43d1 h1:x37Q11fexMtlhecRnkdzLL6dgnS1NF1nzAJ1vic22BY=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201219040909-8fd2afad43d1/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=",
"",
"github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=\ngithub.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=",
"",
"github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=\ngithub.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=",
"",
"github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=\ngithub.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=",
"",
"github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c h1:3wkDRdxK92dF+c1ke2dtj7ZzemFWBHB9plnJOtlwdFA=\ngithub.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM=",
"",
"github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=\ngithub.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=\ngithub.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=",
"",
"github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=",
"",
"github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=\ngithub.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4=\ngithub.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=",
"",
"github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=\ngithub.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=\ngithub.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=\ngithub.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=\ngithub.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=",
"",
"github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=\ngithub.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=",
"",
"github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=\ngithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=\ngithub.com/pmylund/go-cache v2.1.0+incompatible h1:n+7K51jLz6a3sCvff3BppuCAkixuDHuJ/C57Vw/XjTE=\ngithub.com/pmylund/go-cache v2.1.0+incompatible/go.mod h1:hmz95dGvINpbRZGsqPcd7B5xXY5+EKb5PpGhQY3NTHk=",
"",
"github.com/russellhaering/goxmldsig v1.1.0 h1:lK/zeJie2sqG52ZAlPNn1oBBqsIsEKypUUBGpYYF6lk=\ngithub.com/russellhaering/goxmldsig v1.1.0/go.mod h1:QK8GhXPB3+AfuCrfo0oRISa9NfzeCpWmxeGnqEpDF9o=",
"",
"github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=\ngithub.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=",
"",
"github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=\ngithub.com/sirupsen/logrus v1.4.3-0.20191026113918-67a7fdcf741f h1:xnyywEh1HIH7+ehsJqLMhxBPm1J98jOR3/onr/HaI5s=\ngithub.com/sirupsen/logrus v1.4.3-0.20191026113918-67a7fdcf741f/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=",
"",
"github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=\ngithub.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=",
"",
"github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=\ngithub.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=",
"",
"github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=\ngithub.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=",
"",
"github.com/zenazn/goji v0.9.1-0.20160507202103-64eb34159fe5/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=",
"",
"go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA=\ngo.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY=",
"",
"golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=",
"",
"golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=",
"",
"golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=",
"",
"golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=\ngolang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=",
"",
"golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"",
"golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"",
"golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"",
"golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=\ngolang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=",
"",
"golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0=\ngolang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=",
"",
"golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=",
"",
"golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=\ngolang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=",
"",
"golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=",
"",
"golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=\ngolang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=",
"",
"golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=",
"",
"golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=",
"",
"golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=\ngolang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4=\ngolang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"",
"golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=\ngolang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=",
"",
"golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=",
"",
"golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=\ngolang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=\ngolang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=",
"",
"golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=",
"",
"golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=",
"",
"google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=\ngoogle.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=",
"",
"google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=\ngoogle.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=\ngoogle.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=\ngoogle.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=\ngoogle.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=",
"",
"google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=\ngoogle.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=",
"",
"gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=",
"",
"gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=\ngopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=",
"",
"gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=\ngopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=\ngopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=",
"",
"gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=\ngopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=",
"",
"gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=",
"",
"gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=\ngopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=\ngopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=",
""
] |
[
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0
] |
PreciseBugs
|
{"buggy_code_end_loc": [32, 195, 32], "buggy_code_start_loc": [7, 0, 31], "filenames": ["go.mod", "go.sum", "providers/saml.go"], "fixing_code_end_loc": [38, 885, 32], "fixing_code_start_loc": [7, 1, 31], "message": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:tyk:tyk-identity-broker:*:*:*:*:*:*:*:*", "matchCriteriaId": "509C7956-E3F8-4F26-A047-DDEC86CA5EBD", "versionEndExcluding": "1.1.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data)."}, {"lang": "es", "value": "El paquete github.com/tyktechnologies/tyk-identity-broker versiones anteriores a 1.1.1, es vulnerable a una omisi\u00f3n de autenticaci\u00f3n por medio del analizador Go XML, lo que puede causar una omisi\u00f3n de autenticaci\u00f3n SAML. Esto es debido a que el analizador XML no garantiza la integridad en el viaje de ida y vuelta XML (datos XML encoding/decoding)"}], "evaluatorComment": null, "id": "CVE-2021-23365", "lastModified": "2021-05-19T13:00:45.973", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 5.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 2.5, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2021-04-26T10:15:12.597", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/46f70420e0911e4e8b638575e29d394c227c75d0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/pull/147"}, {"source": "report@snyk.io", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.1.1"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMTYKTECHNOLOGIESTYKIDENTITYBROKER-1089720"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, "type": "CWE-287"}
| 106
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=",
"cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=",
"cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=\ncloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=\ncloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=\ncloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=\ncloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=\ncloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=\ncloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=\ncloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=\ncloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=\ncloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=\ncloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=\ncloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=\ncloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=\ncloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=\ncloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=\ncloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=\ncloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=\ncloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=\ncloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=\ncloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=\ncloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=\ncloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=\ncloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=\ncloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=\ncloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=\ncloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=\ncloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=\ncloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=\ncloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=\ncloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=\ndmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=",
"github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28=\ngithub.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=",
"github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=\ngithub.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=\ngithub.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=",
"github.com/Jeffail/gabs v1.4.0 h1://5fYRRTq1edjfIrQGvdkcd22pkYUrHZ5YC/H2GJVAo=\ngithub.com/Jeffail/gabs v1.4.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=",
"github.com/Jeffail/tunny v0.0.0-20171107125207-452a8e97d6a3 h1:FALdZx01H5t7P6YcNsAOwKh6rme30R7h8cjgtEhcd4s=\ngithub.com/Jeffail/tunny v0.0.0-20171107125207-452a8e97d6a3/go.mod h1:BX3q3G70XX0UmIkDWfDHoDRquDS1xFJA5VTbMf+14wM=\ngithub.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=\ngithub.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=\ngithub.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=\ngithub.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=\ngithub.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=\ngithub.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=\ngithub.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=\ngithub.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=\ngithub.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=\ngithub.com/TykTechnologies/again v0.0.0-20190805133618-6ad301e7eaed h1:/h52kySW055ZF4boJc9tcuQhR909ubCiMN64EMBEu8Q=\ngithub.com/TykTechnologies/again v0.0.0-20190805133618-6ad301e7eaed/go.mod h1:OUrgdjjCoYX2GZY9Vathb4ExCO9WuPtU1piuOpNw19Q=\ngithub.com/TykTechnologies/circuitbreaker v2.2.2+incompatible h1:UgJdsV/fBL5Ctx43EGKFxkX0W3MqqeRruadDQ1Kzhn4=\ngithub.com/TykTechnologies/circuitbreaker v2.2.2+incompatible/go.mod h1:f2+J36wN08/zLudMnO+QaqaBhTdQuIqemtaeEQbhMEM=\ngithub.com/TykTechnologies/drl v0.0.0-20190905191955-cc541aa8e3e1 h1:LimXJxKH+ovz0NrcU3Ue/cYhzN4xu5sJsID0RwjSd1k=\ngithub.com/TykTechnologies/drl v0.0.0-20190905191955-cc541aa8e3e1/go.mod h1:dLW6S3KuurRuyluxy33i57uYuTB1s/u+L8mCT0fqb98=\ngithub.com/TykTechnologies/goautosocket v0.0.0-20190430121222-97bfa5e7e481 h1:fPcSnu5/IBgyqf73GHA99QuwMDbfWH+L4BEX9EZ5kUo=\ngithub.com/TykTechnologies/goautosocket v0.0.0-20190430121222-97bfa5e7e481/go.mod h1:CtF8OunV123VfKa8Z9kKcIPHgcd67hSAwFMLlS7FvS4=\ngithub.com/TykTechnologies/gojsonschema v0.0.0-20170222154038-dcb3e4bb7990 h1:CJRTgg13M3vJG9S7k7kpnvDRMGMywm5OsN6eUE8VwJE=\ngithub.com/TykTechnologies/gojsonschema v0.0.0-20170222154038-dcb3e4bb7990/go.mod h1:SQT0NBrY4/pMikBgwFIrWCjcHBxg015Y8is0kAnMtug=\ngithub.com/TykTechnologies/gorpc v0.0.0-20190515174534-b9c10befc5f4 h1:hTjM5Uubg3w9VjNc8WjrDrLiGX14Ih8/ItyXEn2tNUs=\ngithub.com/TykTechnologies/gorpc v0.0.0-20190515174534-b9c10befc5f4/go.mod h1:vqhQRhIHefD4jdFo55j+m0vD5NMjx2liq/ubnshQpaY=\ngithub.com/TykTechnologies/goverify v0.0.0-20160822133757-7ccc57452ade h1:tFUV86NDnfMY4Au+EJHGJx0Rton8xdOLEh1aT+j6XBk=\ngithub.com/TykTechnologies/goverify v0.0.0-20160822133757-7ccc57452ade/go.mod h1:mkS8jKcz8otdfEXhJs1QQ/DKoIY1NFFsRPKS0RwQENI=\ngithub.com/TykTechnologies/graphql-go-tools v1.6.2-0.20201012125356-562407e88c4f h1:VB1RMo/6Ex6Q8Ig3fikE9/+H7N0m+EgUTtap/9hQsns=\ngithub.com/TykTechnologies/graphql-go-tools v1.6.2-0.20201012125356-562407e88c4f/go.mod h1:T6j+5gC7NkmZOMLcxR4qk+nK81LMWW7FTsj/hP3X/Ds=\ngithub.com/TykTechnologies/leakybucket v0.0.0-20170301023702-71692c943e3c h1:j6fd0Fz1R4oSWOmcooGjrdahqrML+btQ+PfEJw8SzbA=\ngithub.com/TykTechnologies/leakybucket v0.0.0-20170301023702-71692c943e3c/go.mod h1:GnHUbsQx+ysI10osPhUdTmsxcE7ef64cVp38Fdyd7e0=\ngithub.com/TykTechnologies/murmur3 v0.0.0-20180602122059-1915e687e465 h1:A2gBjoX8aF0G3GHEpHyj2f0ixuPkCgcGqmPdKHSkW+0=\ngithub.com/TykTechnologies/murmur3 v0.0.0-20180602122059-1915e687e465/go.mod h1:sqH/SPFr11m9cahie7ulBuBX9TOhfBX1sp+qf9jh3Vg=\ngithub.com/TykTechnologies/openid2go v0.0.0-20200312160651-00c254a52b19 h1:mgi8xtMR6Pxj/5Rncalb67ArL8TCJbHSQmMfJg9lE4s=\ngithub.com/TykTechnologies/openid2go v0.0.0-20200312160651-00c254a52b19/go.mod h1:rGlqNE4CvxZIeiHp0mgrw+/jdGSjJzkZ0n78hhHMdfM=\ngithub.com/TykTechnologies/tyk v1.9.2-0.20210112201019-11dba25d812b h1:Rg5hRIoQOC+2Mp8Q+UILm6Z9dZJKM0wjtL7ljvHQKJ8=\ngithub.com/TykTechnologies/tyk v1.9.2-0.20210112201019-11dba25d812b/go.mod h1:zChgSqkmgul4Nl+pciXea4kaQbEtq5kGEiaKRVIhhto=\ngithub.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=\ngithub.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=\ngithub.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=\ngithub.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=\ngithub.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=\ngithub.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=\ngithub.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=\ngithub.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=\ngithub.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=\ngithub.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=",
"github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=\ngithub.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=",
"github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=\ngithub.com/bshuster-repo/logrus-logstash-hook v0.4.1 h1:pgAtgj+A31JBVtEHu2uHuEx0n+2ukqUJnS2vVe5pQNA=\ngithub.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk=\ngithub.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23 h1:D21IyuvjDCshj1/qq+pCNd3VZOAEI9jy6Bi131YlXgI=\ngithub.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=\ngithub.com/cenk/backoff v2.2.1+incompatible h1:djdFT7f4gF2ttuzRKPbMOWgZajgesItGLwG5FTQKmmE=\ngithub.com/cenk/backoff v2.2.1+incompatible/go.mod h1:7FtoeaSnHoZnmZzz47cM35Y9nSW7tNyaidugnHTaFDE=\ngithub.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs=\ngithub.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=\ngithub.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=\ngithub.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 h1:8k9FLYBLKT+9v2HQJ/a95ZemmTx+/ltJcAiRhVushG8=\ngithub.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4=\ngithub.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=\ngithub.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=",
"github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=\ngithub.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=",
"github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=\ngithub.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=\ngithub.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=\ngithub.com/clbanning/mxj v1.8.4 h1:HuhwZtbyvyOw+3Z1AowPkU87JkJUSv751ELWaiTpj8I=\ngithub.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng=\ngithub.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=\ngithub.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=\ngithub.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=\ngithub.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=\ngithub.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=\ngithub.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=\ngithub.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=",
"github.com/crewjam/httperr v0.0.0-20190612203328-a946449404da h1:WXnT88cFG2davqSFqvaFfzkSMC0lqh/8/rKZ+z7tYvI=\ngithub.com/crewjam/httperr v0.0.0-20190612203328-a946449404da/go.mod h1:+rmNIXRvYMqLQeR4DHyTvs6y0MEMymTz4vyFpFkKTPs=\ngithub.com/crewjam/saml v0.4.5 h1:H9u+6CZAESUKHxMyxUbVn0IawYvKZn4nt3d4ccV4O/M=\ngithub.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S68bk=",
"github.com/dave/jennifer v1.4.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg=",
"github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=\ngithub.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=\ngithub.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=\ngithub.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=",
"github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=\ngithub.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=\ngithub.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=\ngithub.com/eclipse/paho.mqtt.golang v1.2.0 h1:1F8mhG9+aO5/xpdtFkW4SxOJB67ukuDC3t2y2qayIX0=\ngithub.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts=\ngithub.com/emanoelxavier/openid2go v0.0.0-20190718021401-6345b638bfc9/go.mod h1:hahZBazACLtwLVO5XoLT8pPXTGfRt5bK6XddHEy/XUk=\ngithub.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=\ngithub.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=\ngithub.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=\ngithub.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=\ngithub.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=\ngithub.com/evalphobia/logrus_sentry v0.8.2 h1:dotxHq+YLZsT1Bb45bB5UQbfCh3gM/nFFetyN46VoDQ=\ngithub.com/evalphobia/logrus_sentry v0.8.2/go.mod h1:pKcp+vriitUqu9KiWj/VRFbRfFNUwz95/UkgG8a6MNc=\ngithub.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw=\ngithub.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA=\ngithub.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=\ngithub.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=\ngithub.com/franela/goblin v0.0.0-20181003173013-ead4ad1d2727/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=\ngithub.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8 h1:a9ENSRDFBUPkJ5lCgVZh26+ZbGyoVJG7yb5SSzF5H54=\ngithub.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=",
"github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=\ngithub.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=\ngithub.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=",
"github.com/gemnasium/logrus-graylog-hook v2.0.7+incompatible h1:lgnKqRfXdYPljf5yj0SOYSH+i29U8E3KKzdOIWsHZno=\ngithub.com/gemnasium/logrus-graylog-hook v2.0.7+incompatible/go.mod h1:85jwR23cg8rapnMQj96B9pX4XzmkXMNAPVfnnUNP8Dk=\ngithub.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=\ngithub.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=",
"github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us009o8=\ngithub.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=",
"github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=\ngithub.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=\ngithub.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=\ngithub.com/go-ldap/ldap v3.0.2+incompatible h1:kD5HQcAzlQ7yrhfn+h+MSABeAy/jAJhvIJ/QDllP44g=\ngithub.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=",
"github.com/go-ldap/ldap/v3 v3.2.3 h1:FBt+5w3q/vPVPb4eYMQSn+pOiz4zewPamYhlGMmc7yM=\ngithub.com/go-ldap/ldap/v3 v3.2.3/go.mod h1:iYS1MdmrmceOJ1QOTnRXrIs7i3kloqtmGQjRvjKpyMg=\ngithub.com/go-redis/redis/v8 v8.3.1 h1:jEPCgHQopfNaABun3NVN9pv2K7RjstY/7UJD6UEKFEY=\ngithub.com/go-redis/redis/v8 v8.3.1/go.mod h1:a2xkpBM7NJUN5V5kiF46X5Ltx4WeXJ9757X/ScKUBdE=",
"github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=\ngithub.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=\ngithub.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU=\ngithub.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=\ngithub.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs=\ngithub.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4=\ngithub.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q=\ngithub.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg=\ngithub.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk=\ngithub.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw=\ngithub.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=\ngithub.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=\ngithub.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=\ngithub.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=\ngithub.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=\ngithub.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=\ngithub.com/gocraft/health v0.0.0-20170925182251-8675af27fef0 h1:pKjeDsx7HGGbjr7VGI1HksxDJqSjaGED3cSw9GeSI98=\ngithub.com/gocraft/health v0.0.0-20170925182251-8675af27fef0/go.mod h1:rWibcVfwbUxi/QXW84U7vNTcIcZFd6miwbt8ritxh/Y=\ngithub.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=\ngithub.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=\ngithub.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=\ngithub.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=\ngithub.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=\ngithub.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=\ngithub.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=",
"github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=\ngithub.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=",
"github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=",
"github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=\ngithub.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=\ngithub.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=\ngithub.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=\ngithub.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=",
"github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=",
"github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=\ngithub.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=",
"github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=\ngithub.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=\ngithub.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=\ngithub.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=",
"github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=\ngithub.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=",
"github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=",
"github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=\ngithub.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=",
"github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=\ngithub.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=\ngithub.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=\ngithub.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=\ngithub.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=\ngithub.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=\ngithub.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=\ngithub.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=",
"github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=\ngithub.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=\ngithub.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=",
"github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=",
"github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=\ngithub.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=\ngithub.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1 h1:LqbZZ9sNMWVjeXS4NN5oVvhMjDyLhmA1LG86oSo+IqY=\ngithub.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY=\ngithub.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=\ngithub.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=\ngithub.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w=\ngithub.com/gorilla/sessions v1.2.0 h1:S7P+1Hm5V/AT9cjEcUD5uDaQSX0OE577aCXgoaKpYbQ=\ngithub.com/gorilla/sessions v1.2.0/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=",
"github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=\ngithub.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=\ngithub.com/hashicorp/consul/api v1.3.0 h1:HXNYlRkkM/t+Y/Yhxtwcy02dlYwIaoxzvxPnS+cqy78=\ngithub.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=\ngithub.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=\ngithub.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=\ngithub.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=\ngithub.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=\ngithub.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=\ngithub.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=\ngithub.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=\ngithub.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=\ngithub.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=\ngithub.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=\ngithub.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=\ngithub.com/hashicorp/go-msgpack v0.5.4/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=\ngithub.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=\ngithub.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=\ngithub.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=\ngithub.com/hashicorp/go-retryablehttp v0.5.4 h1:1BZvpawXoJCWX6pNtow9+rpEj+3itIlutiqnntI6jOE=\ngithub.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=\ngithub.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=\ngithub.com/hashicorp/go-rootcerts v1.0.1 h1:DMo4fmknnz0E0evoNYnV48RjWndOsmd6OW+09R3cEP8=\ngithub.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=\ngithub.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=\ngithub.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=\ngithub.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=\ngithub.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=\ngithub.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=\ngithub.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=\ngithub.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=\ngithub.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=\ngithub.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=\ngithub.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=\ngithub.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=\ngithub.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=\ngithub.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=\ngithub.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=\ngithub.com/hashicorp/serf v0.8.2 h1:YZ7UKsJv+hKjqGVUUbtE3HNj79Eln2oQ75tniF6iPt0=\ngithub.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=\ngithub.com/hashicorp/vault/api v1.0.4 h1:j08Or/wryXT4AcHj1oCbMd7IijXcKzYUGw59LGu9onU=\ngithub.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q=\ngithub.com/hashicorp/vault/sdk v0.1.13 h1:mOEPeOhT7jl0J4AMl1E705+BcmeRs1VmKNb9F0sMLy8=\ngithub.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M=\ngithub.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=\ngithub.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=",
"github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=",
"github.com/huandu/xstrings v1.2.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=\ngithub.com/huandu/xstrings v1.3.0 h1:gvV6jG9dTgFEncxo+AF7PH6MZXi/vZl25owA/8Dg8Wo=\ngithub.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=\ngithub.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=\ngithub.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=\ngithub.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=\ngithub.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=\ngithub.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=\ngithub.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=",
"github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4=",
"github.com/jensneuse/abstractlogger v0.0.4 h1:sa4EH8fhWk3zlTDbSncaWKfwxYM8tYSlQ054ETLyyQY=\ngithub.com/jensneuse/abstractlogger v0.0.4/go.mod h1:6WuamOHuykJk8zED/R0LNiLhWR6C7FIAo43ocUEB3mo=\ngithub.com/jensneuse/byte-template v0.0.0-20200214152254-4f3cf06e5c68 h1:E80wOd3IFQcoBxLkAUpUQ3BoGrZ4DxhQdP21+HH1s6A=\ngithub.com/jensneuse/byte-template v0.0.0-20200214152254-4f3cf06e5c68/go.mod h1:0D5r/VSW6D/o65rKLL9xk7sZxL2+oku2HvFPYeIMFr4=\ngithub.com/jensneuse/diffview v1.0.0/go.mod h1:i6IacuD8LnEaPuiyzMHA+Wfz5mAuycMOf3R/orUY9y4=\ngithub.com/jensneuse/pipeline v0.0.0-20200117120358-9fb4de085cd6 h1:y8hvuqbuVGFNpEos+vB5I5X+QxWm0uyTk+5oeOinMjY=\ngithub.com/jensneuse/pipeline v0.0.0-20200117120358-9fb4de085cd6/go.mod h1:UsfzaMt+keVOxa007GcCJMFeTHr6voRfBGMQEW7DkdM=\ngithub.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=\ngithub.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=",
"github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=\ngithub.com/jonboulle/clockwork v0.2.1 h1:S/EaQvW6FpWMYAvYvY+OBDvpaM+izu0oiwo5y0MH7U0=\ngithub.com/jonboulle/clockwork v0.2.1/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=\ngithub.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=\ngithub.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=",
"github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=\ngithub.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=\ngithub.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da h1:5y58+OCjoHCYB8182mpf/dEsq0vwTKPOo4zGfH0xW9A=\ngithub.com/justinas/alice v0.0.0-20171023064455-03f45bd4b7da/go.mod h1:oLH0CmIaxCGXD67VKGR5AacGXZSMznlmeqM8RzPrcY8=\ngithub.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=",
"github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=\ngithub.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=",
"github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=\ngithub.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=",
"github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=",
"github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=\ngithub.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=",
"github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=\ngithub.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=\ngithub.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=\ngithub.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=\ngithub.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=\ngithub.com/lestrrat-go/jwx v0.9.0/go.mod h1:iEoxlYfZjvoGpuWwxUz+eR5e6KTJGsaRcy/YNA/UnBk=",
"github.com/lonelycode/go-uuid v0.0.0-20141202165402-ed3ca8a15a93 h1:WcaWCUFwpiRpIjcM7u27kuy2p5zPLC1KRxB3/bJ7XsI=\ngithub.com/lonelycode/go-uuid v0.0.0-20141202165402-ed3ca8a15a93/go.mod h1:ZjpSGzPgHSthaPv5L+rBEMIwrr5Uto0pKPwHmCHRkUM=\ngithub.com/lonelycode/osin v0.0.0-20160423095202-da239c9dacb6 h1:G2UYdR7/shMh7NMp2ETozj6zlqU5M8b0VqRbdxTXciU=\ngithub.com/lonelycode/osin v0.0.0-20160423095202-da239c9dacb6/go.mod h1:x4kc0i0iLfRkNWchVMcLjy+Txcz3XqNbr8iRUGFduLQ=\ngithub.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=\ngithub.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=",
"github.com/markbates/going v1.0.0/go.mod h1:I6mnB4BPnEeqo85ynXIx1ZFLLbtiLHNXVgWeFO9OGOA=\ngithub.com/markbates/goth v1.64.2 h1:HDFwyuB6/ATU1USTvd/Rb3C9XE0VAxeuciSz+aUZHHA=\ngithub.com/markbates/goth v1.64.2/go.mod h1:hSFJFfH56BfFCX4+hBIxyd3o5VzuH5rNwKVRsFr/JPk=\ngithub.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=\ngithub.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201213122252-bcd7e1b9601e h1:qqXczln0qwkVGcpQ+sQuPOVntt2FytYarXXxYSNJkgw=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201213122252-bcd7e1b9601e/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201219040909-8fd2afad43d1 h1:x37Q11fexMtlhecRnkdzLL6dgnS1NF1nzAJ1vic22BY=\ngithub.com/mattermost/xml-roundtrip-validator v0.0.0-20201219040909-8fd2afad43d1/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=",
"github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=\ngithub.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=",
"github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=\ngithub.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=",
"github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=\ngithub.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=",
"github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=\ngithub.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=",
"github.com/mavricknz/asn1-ber v0.0.0-20151103223136-b9df1c2f4213 h1:3DongGRjJZvIFDq063tg76LKlGhA7O0TVqoPql0Zfbk=\ngithub.com/mavricknz/asn1-ber v0.0.0-20151103223136-b9df1c2f4213/go.mod h1:v/ZufymxjcI3pnNmQIUQQKxnHLTblrjZ4MNLs5DrZ1o=\ngithub.com/mavricknz/ldap v0.0.0-20160227184754-f5a958005e43 h1:x4SDcUPDTMzuFEdWe5lTznj1echpsd0ApTkZOdwtm7g=\ngithub.com/mavricknz/ldap v0.0.0-20160227184754-f5a958005e43/go.mod h1:z76yvVwVulPd8FyifHe8UEHeud6XXaSan0ibi2sDy6w=\ngithub.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=",
"github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=\ngithub.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=",
"github.com/miekg/dns v1.0.14 h1:9jZdLNd/P4+SfEJ0TNyxYpsK8N4GtfylBLqtbYN1sbA=\ngithub.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=\ngithub.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=\ngithub.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=\ngithub.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=\ngithub.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=\ngithub.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=\ngithub.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=\ngithub.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=\ngithub.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=\ngithub.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=\ngithub.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=\ngithub.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=\ngithub.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=\ngithub.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=\ngithub.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=\ngithub.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=\ngithub.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=",
"github.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c h1:3wkDRdxK92dF+c1ke2dtj7ZzemFWBHB9plnJOtlwdFA=\ngithub.com/mrjones/oauth v0.0.0-20180629183705-f4e24b6d100c/go.mod h1:skjdDftzkFALcuGzYSklqYd8gvat6F1gZJ4YPVbkZpM=",
"github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=\ngithub.com/nats-io/jwt v0.3.2 h1:+RB5hMpXUUA2dfxuhBTEkMOrYmM+gKIZYS1KjSostMI=\ngithub.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=\ngithub.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=\ngithub.com/nats-io/nats.go v1.9.1 h1:ik3HbLhZ0YABLto7iX80pZLPw/6dx3T+++MZJwLnMrQ=\ngithub.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=\ngithub.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=\ngithub.com/nats-io/nkeys v0.1.3 h1:6JrEfig+HzTH85yxzhSVbjHRJv9cn0p6n3IngIcM5/k=\ngithub.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=\ngithub.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=\ngithub.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=\ngithub.com/newrelic/go-agent v2.13.0+incompatible h1:Dl6m75MHAzfB0kicv9GiLxzQatRjTLUAdrnYyoT8s4M=\ngithub.com/newrelic/go-agent v2.13.0+incompatible/go.mod h1:a8Fv1b/fYhFSReoTU6HDkTYIMZeSVNffmoS726Y0LzQ=",
"github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=\ngithub.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=\ngithub.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=",
"github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=",
"github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=",
"github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=",
"github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=\ngithub.com/onsi/ginkgo v1.14.1 h1:jMU0WaQrP0a/YAEq8eJmJKjBoMs+pClEr1vDMlM/Do4=\ngithub.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=",
"github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=",
"github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=\ngithub.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=\ngithub.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=\ngithub.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=\ngithub.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=",
"github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=\ngithub.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=\ngithub.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb9NAWI=\ngithub.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=\ngithub.com/oschwald/maxminddb-golang v1.5.0 h1:rmyoIV6z2/s9TCJedUuDiKht2RN12LWJ1L7iRGtWY64=\ngithub.com/oschwald/maxminddb-golang v1.5.0/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY=\ngithub.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=\ngithub.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=\ngithub.com/paulbellamy/ratecounter v0.2.0 h1:2L/RhJq+HA8gBQImDXtLPrDXK5qAj6ozWVK/zFXVJGs=\ngithub.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE=\ngithub.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=\ngithub.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea/go.mod h1:1VcHEd3ro4QMoHfiNl/j7Jkln9+KQuorp0PItHMJYNg=\ngithub.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=\ngithub.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=\ngithub.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=\ngithub.com/pires/go-proxyproto v0.0.0-20190615163442-2c19fd512994 h1:3ssKn22MN6oLH+l2iimsBdCliSgELXTBWWR+yooB2lQ=\ngithub.com/pires/go-proxyproto v0.0.0-20190615163442-2c19fd512994/go.mod h1:6/gX3+E/IYGa0wMORlSMla999awQFdbaeQCHjSMKIzY=",
"github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=\ngithub.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=",
"github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=\ngithub.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=",
"github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=\ngithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=\ngithub.com/pmylund/go-cache v2.1.0+incompatible h1:n+7K51jLz6a3sCvff3BppuCAkixuDHuJ/C57Vw/XjTE=\ngithub.com/pmylund/go-cache v2.1.0+incompatible/go.mod h1:hmz95dGvINpbRZGsqPcd7B5xXY5+EKb5PpGhQY3NTHk=",
"github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=\ngithub.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=\ngithub.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d h1:1VUlQbCfkoSGv7qP7Y+ro3ap1P1pPZxgdGVqiTVy5C4=\ngithub.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY=\ngithub.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=\ngithub.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=\ngithub.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=\ngithub.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=\ngithub.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=",
"github.com/russellhaering/goxmldsig v1.1.0 h1:lK/zeJie2sqG52ZAlPNn1oBBqsIsEKypUUBGpYYF6lk=\ngithub.com/russellhaering/goxmldsig v1.1.0/go.mod h1:QK8GhXPB3+AfuCrfo0oRISa9NfzeCpWmxeGnqEpDF9o=",
"github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=\ngithub.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=\ngithub.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=\ngithub.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=\ngithub.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=",
"github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=\ngithub.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=",
"github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=\ngithub.com/sebdah/goldie v0.0.0-20180424091453-8784dd1ab561/go.mod h1:lvjGftC8oe7XPtyrOidaMi0rp5B9+XY/ZRUynGnuaxQ=",
"github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=\ngithub.com/sirupsen/logrus v1.4.3-0.20191026113918-67a7fdcf741f h1:xnyywEh1HIH7+ehsJqLMhxBPm1J98jOR3/onr/HaI5s=\ngithub.com/sirupsen/logrus v1.4.3-0.20191026113918-67a7fdcf741f/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=",
"github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=\ngithub.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=\ngithub.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=\ngithub.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=\ngithub.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=\ngithub.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=\ngithub.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=\ngithub.com/square/go-jose v2.4.1+incompatible h1:KFYc54wTtgnd3x4B/Y7Zr1s/QaEx2BNzRsB3Hae5LHo=\ngithub.com/square/go-jose v2.4.1+incompatible/go.mod h1:7MxpAF/1WTVUu8Am+T5kNy+t0902CaLWM4Z745MkOa8=\ngithub.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=",
"github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=\ngithub.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=",
"github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=\ngithub.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=\ngithub.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=",
"github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=\ngithub.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=",
"github.com/tidwall/gjson v1.3.5 h1:2oW9FBNu8qt9jy5URgrzsVx/T/KSn3qn/smJQ0crlDQ=\ngithub.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=\ngithub.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=\ngithub.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=\ngithub.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=\ngithub.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=\ngithub.com/tidwall/sjson v1.0.4 h1:UcdIRXff12Lpnu3OLtZvnc03g4vH2suXDXhBwBqmzYg=\ngithub.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y=\ngithub.com/uber-go/atomic v1.4.0/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g=\ngithub.com/uber/jaeger-client-go v2.19.0+incompatible h1:pbwbYfHUoaase0oPQOdZ1GcaUjImYGimUXSQ/+8+Z8Q=\ngithub.com/uber/jaeger-client-go v2.19.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=\ngithub.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw=\ngithub.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=\ngithub.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=\ngithub.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=\ngithub.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA=\ngithub.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=",
"github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=\ngithub.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=",
"github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=\ngithub.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=\ngithub.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=\ngithub.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=\ngithub.com/xeipuuv/gojsonschema v0.0.0-20171025060643-212d8a0df7ac h1:4VBKAdTNqxLs00+bB+9Lnosfg6keGxPEXZ28e7hZV3A=\ngithub.com/xeipuuv/gojsonschema v0.0.0-20171025060643-212d8a0df7ac/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs=\ngithub.com/xenolf/lego v0.3.2-0.20170618175828-28ead50ff1ca h1:HmO0j2gywlGvJEtnSRqupP2pNb2Uoue+Et3efiOLWN8=\ngithub.com/xenolf/lego v0.3.2-0.20170618175828-28ead50ff1ca/go.mod h1:fwiGnfsIjG7OHPfOvgK7Y/Qo6+2Ox0iozjNTkZICKbY=\ngithub.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=\ngithub.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=",
"github.com/zenazn/goji v0.9.1-0.20160507202103-64eb34159fe5/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=",
"go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=\ngo.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=\ngo.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=",
"go.opentelemetry.io/otel v0.13.0 h1:2isEnyzjjJZq6r2EKMsFj4TxiQiexsM04AVhwbR/oBA=\ngo.opentelemetry.io/otel v0.13.0/go.mod h1:dlSNewoRYikTkotEnxdmuBHgzT+k/idJSfDv/FxEnOY=",
"go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=\ngo.uber.org/atomic v1.5.1 h1:rsqfU5vBkVknbhUGbAUwQKR2H4ItV8tjJ+6kJX4cxHM=\ngo.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=\ngo.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=\ngo.uber.org/multierr v1.4.0 h1:f3WCSC2KzAcBXGATIxAB1E2XuCpNU255wNKZ505qi3E=\ngo.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=\ngo.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=\ngo.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=\ngo.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU=\ngo.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=\ngolang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=",
"golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=",
"golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=",
"golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=",
"golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=",
"golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=",
"golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=",
"golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=\ngolang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=",
"golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=\ngolang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=\ngolang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=\ngolang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=\ngolang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=\ngolang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=\ngolang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=\ngolang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=\ngolang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=\ngolang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=\ngolang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=\ngolang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=\ngolang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=\ngolang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=\ngolang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=\ngolang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=\ngolang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=\ngolang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=\ngolang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=\ngolang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=",
"golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=",
"golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=",
"golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=\ngolang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=",
"golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=\ngolang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=",
"golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dDLfdtbT/IVn4keq83P0=\ngolang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=",
"golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=\ngolang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=",
"golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=",
"golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=\ngolang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=",
"golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=\ngolang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=",
"golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc=\ngolang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=",
"golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=",
"golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=",
"golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=\ngolang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=",
"golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=\ngolang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=",
"golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=",
"golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=",
"golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=",
"golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=\ngolang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4=\ngolang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=\ngolang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=",
"golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=\ngolang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=",
"golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=",
"golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=",
"golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=",
"golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=\ngolang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=\ngolang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=",
"golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=\ngolang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=",
"golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=",
"golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=\ngolang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200115044656-831fdb1e1868/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=\ngolang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=\ngolang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=\ngolang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200825202427-b303f430e36d h1:W07d4xkoAUSNOkOzdzXCdFGxT7o2rW4q8M34tB2i//k=\ngolang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=",
"golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=",
"golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=\ngolang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngoogle.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=\ngoogle.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=\ngoogle.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=\ngoogle.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=\ngoogle.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=\ngoogle.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=\ngoogle.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=\ngoogle.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=\ngoogle.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=",
"google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=\ngoogle.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=",
"google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=\ngoogle.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=\ngoogle.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=\ngoogle.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=\ngoogle.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=\ngoogle.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=\ngoogle.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=\ngoogle.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=\ngoogle.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=\ngoogle.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=\ngoogle.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=\ngoogle.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8=\ngoogle.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=\ngoogle.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=\ngoogle.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=\ngoogle.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=\ngoogle.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=\ngoogle.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=\ngoogle.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=\ngoogle.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=\ngoogle.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=\ngoogle.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=\ngoogle.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.31.0 h1:T7P4R73V3SSDPhH7WW7ATbfViLtmamH0DKrP3f9AuDI=\ngoogle.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=",
"google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=\ngoogle.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=\ngoogle.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=\ngoogle.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=\ngoogle.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=",
"google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=",
"google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=\ngoogle.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=",
"google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=\ngoogle.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=\ngoogle.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=\ngopkg.in/Masterminds/sprig.v2 v2.21.0 h1:a+iB4gaPLrBrwxlmW/bI8UXDnsTGV1HZbkhNG936dE4=\ngopkg.in/Masterminds/sprig.v2 v2.21.0/go.mod h1:DtHmW+kdrJpYMY6Mk6OHFNi/8EBAnNYVRUffwRCNHgA=\ngopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=\ngopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=\ngopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=",
"gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=",
"gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=",
"gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=\ngopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=",
"gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=",
"gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=\ngopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=\ngopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=",
"gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI=\ngopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=\ngopkg.in/square/go-jose.v1 v1.1.2 h1:/5jmADZB+RiKtZGr4HxsEFOEfbfsjTKsVnqpThUpE30=\ngopkg.in/square/go-jose.v1 v1.1.2/go.mod h1:QpYS+a4WhS+DTlyQIi6Ka7MS3SuR9a055rgXNEe6EiA=\ngopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4=\ngopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=",
"gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=\ngopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=",
"gopkg.in/vmihailenco/msgpack.v2 v2.9.1 h1:kb0VV7NuIojvRfzwslQeP3yArBqJHW9tOl4t38VS1jM=\ngopkg.in/vmihailenco/msgpack.v2 v2.9.1/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8=\ngopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc h1:LMEBgNcZUqXaP7evD1PZcL6EcDVa2QOFuI+cqM3+AJM=\ngopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc/go.mod h1:N8UOSI6/c2yOpa/XDz3KVUiegocTziPiqNkeNTMiG1k=\ngopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=",
"gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=",
"gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=",
"gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=\ngopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=\ngopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=",
"honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=\nhonnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=\nhonnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=\nhonnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=\nrsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=\nrsc.io/letsencrypt v0.0.2 h1:CWRvaqcmyyWMhhhGes73TvuIjf7O3Crq6F+Xid/cWNI=\nrsc.io/letsencrypt v0.0.2/go.mod h1:buyQKZ6IXrRnB7TdkHP0RyEybLx18HHyOSoTyoOLqNY=\nrsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=\nrsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA="
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [32, 195, 32], "buggy_code_start_loc": [7, 0, 31], "filenames": ["go.mod", "go.sum", "providers/saml.go"], "fixing_code_end_loc": [38, 885, 32], "fixing_code_start_loc": [7, 1, 31], "message": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:tyk:tyk-identity-broker:*:*:*:*:*:*:*:*", "matchCriteriaId": "509C7956-E3F8-4F26-A047-DDEC86CA5EBD", "versionEndExcluding": "1.1.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data)."}, {"lang": "es", "value": "El paquete github.com/tyktechnologies/tyk-identity-broker versiones anteriores a 1.1.1, es vulnerable a una omisi\u00f3n de autenticaci\u00f3n por medio del analizador Go XML, lo que puede causar una omisi\u00f3n de autenticaci\u00f3n SAML. Esto es debido a que el analizador XML no garantiza la integridad en el viaje de ida y vuelta XML (datos XML encoding/decoding)"}], "evaluatorComment": null, "id": "CVE-2021-23365", "lastModified": "2021-05-19T13:00:45.973", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 5.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 2.5, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2021-04-26T10:15:12.597", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/46f70420e0911e4e8b638575e29d394c227c75d0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/pull/147"}, {"source": "report@snyk.io", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.1.1"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMTYKTECHNOLOGIESTYKIDENTITYBROKER-1089720"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, "type": "CWE-287"}
| 106
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"package providers",
"import (\n\t\"context\"\n\t\"crypto/rsa\"\n\t\"encoding/json\"\n\t\"encoding/xml\"\n\t\"github.com/TykTechnologies/tyk/certs\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n\t\"sync\"",
"\t\"github.com/markbates/goth\"",
"\t\"github.com/crewjam/saml\"",
"\t\"github.com/crewjam/saml/samlsp\"",
"\tlogger \"github.com/TykTechnologies/tyk-identity-broker/log\"\n\t\"github.com/sirupsen/logrus\"",
"\t\"github.com/TykTechnologies/tyk-identity-broker/tap\"\n)",
"var onceReloadSAMLLogger sync.Once\nvar SAMLLogTag = \"SAML AUTH\"\nvar SAMLLogger = log.WithField(\"prefix\", SAMLLogTag)",
"// certManager will fallback as files as default",
"var CertManager = certs.NewCertificateManager(nil, \"\", nil)",
"\ntype SAMLProvider struct {\n\thandler tap.IdentityHandler\n\tconfig SAMLConfig\n\tprofile tap.Profile\n\tm *samlsp.Middleware\n}",
"var middleware *samlsp.Middleware",
"type SAMLConfig struct {\n\tIDPMetadataURL string\n\tCertLocation string\n\tSAMLBaseURL string\n\tForceAuthentication bool\n\tSAMLBinding string\n\tSAMLEmailClaim string\n\tSAMLForenameClaim string\n\tSAMLSurnameClaim string\n\tFailureRedirect string\n}",
"func (s *SAMLProvider) Init(handler tap.IdentityHandler, profile tap.Profile, config []byte) error {\n\t//if an external logger was set, then lets reload it to inherit those configs\n\tonceReloadSAMLLogger.Do(func() {\n\t\tlog = logger.Get()\n\t\tSAMLLogger = &logrus.Entry{Logger: log}\n\t\tSAMLLogger = SAMLLogger.Logger.WithField(\"prefix\", SAMLLogTag)\n\t})",
"\ts.handler = handler\n\ts.profile = profile\n\tunmarshalErr := json.Unmarshal(config, &s.config)",
"\tif unmarshalErr != nil {\n\t\treturn unmarshalErr\n\t}\n\ts.initialiseSAMLMiddleware()",
"\treturn nil\n}",
"func (s *SAMLProvider) Name() string {\n\treturn \"SAMLProvider\"\n}",
"func (s *SAMLProvider) ProviderType() tap.ProviderType {\n\treturn tap.REDIRECT_PROVIDER\n}",
"func (s *SAMLProvider) UseCallback() bool {\n\treturn true\n}",
"func (s *SAMLProvider) initialiseSAMLMiddleware() {\n\tif middleware == nil {",
"\t\tSAMLLogger.Debug(\"Initialising middleware SAML\")\n\t\t//needs to match the signing cert if IDP\n\t\tcerts := CertManager.List([]string{s.config.CertLocation}, certs.CertificateAny)",
"\t\tif len(certs) == 0 {\n\t\t\tSAMLLogger.Error(\"certificate was not loaded\")\n\t\t}",
"\t\tkeyPair := certs[0]\n\t\tidpMetadataURL, err := url.Parse(s.config.IDPMetadataURL)\n\t\tif err != nil {\n\t\t\tSAMLLogger.Errorf(\"Error parsing IDP metadata URL: %v\", err)\n\t\t}",
"\t\tSAMLLogger.Debugf(\"IDPmetadataURL is: %v\", idpMetadataURL.String())\n\t\trootURL, err := url.Parse(s.config.SAMLBaseURL)\n\t\tif err != nil {\n\t\t\tSAMLLogger.Errorf(\"Error parsing SAMLBaseURL: %v\", err)\n\t\t}",
"\t\thttpClient := http.DefaultClient",
"\t\tmetadata, err := samlsp.FetchMetadata(context.TODO(), httpClient, *idpMetadataURL)\n\t\tif err != nil {\n\t\t\tSAMLLogger.Errorf(\"Error retrieving IDP Metadata: %v\", err)\n\t\t}",
"\t\tSAMLLogger.Debugf(\"Root URL: %v\", rootURL.String())\n\t\tif keyPair == nil {\n\t\t\tSAMLLogger.Error(\"profile certificate was not loaded\")\n\t\t\treturn\n\t\t}\n\t\tvar key *rsa.PrivateKey\n\t\tif keyPair.PrivateKey == nil {\n\t\t\tSAMLLogger.Error(\"Private Key is nil not rsa.PrivateKey\")\n\t\t} else {\n\t\t\tkey = keyPair.PrivateKey.(*rsa.PrivateKey)\n\t\t}",
"\t\topts := samlsp.Options{\n\t\t\tURL: *rootURL,\n\t\t\tKey: key,\n\t\t}",
"\t\tmetadataURL := rootURL.ResolveReference(&url.URL{Path: \"auth/\" + s.profile.ID + \"/saml/metadata\"})\n\t\tacsURL := rootURL.ResolveReference(&url.URL{Path: \"auth/\" + s.profile.ID + \"/saml/callback\"})\n\t\tsloURL := rootURL.ResolveReference(&url.URL{Path: \"auth/\" + s.profile.ID + \"/saml/slo\"})",
"\t\tSAMLLogger.Debugf(\"SP metadata URL: %v\", metadataURL.String())\n\t\tSAMLLogger.Debugf(\"SP acs URL: %v\", acsURL.String())",
"\t\tvar forceAuthn = s.config.ForceAuthentication",
"\t\tsp := saml.ServiceProvider{\n\t\t\tEntityID: metadataURL.String(),\n\t\t\tKey: key,\n\t\t\tCertificate: keyPair.Leaf,\n\t\t\tMetadataURL: *metadataURL,\n\t\t\tAcsURL: *acsURL,\n\t\t\tSloURL: *sloURL,\n\t\t\tIDPMetadata: metadata,\n\t\t\tForceAuthn: &forceAuthn,\n\t\t\tAllowIDPInitiated: true,\n\t\t}",
"\t\tmiddleware = &samlsp.Middleware{\n\t\t\tServiceProvider: sp,\n\t\t\tBinding: s.config.SAMLBinding,\n\t\t\tOnError: samlsp.DefaultOnError,\n\t\t\tSession: samlsp.DefaultSessionProvider(opts),\n\t\t}\n\t\tmiddleware.RequestTracker = samlsp.DefaultRequestTracker(opts, &middleware.ServiceProvider)\n\t}",
"}",
"func (s *SAMLProvider) Handle(w http.ResponseWriter, r *http.Request, pathParams map[string]string, profile tap.Profile) {\n\tif middleware == nil {\n\t\tSAMLLogger.Error(\"cannot process request, middleware not loaded\")\n\t\treturn\n\t}",
"\ts.m = middleware\n\t// If we try to redirect when the original request is the ACS URL we'll\n\t// end up in a loop so just fail and error instead\n\tif r.URL.Path == s.m.ServiceProvider.AcsURL.Path {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}",
"\tvar binding, bindingLocation string\n\tif s.m.Binding != \"\" {\n\t\tbinding = s.m.Binding\n\t\tbindingLocation = s.m.ServiceProvider.GetSSOBindingLocation(binding)\n\t} else {\n\t\tbinding = saml.HTTPRedirectBinding\n\t\tbindingLocation = s.m.ServiceProvider.GetSSOBindingLocation(binding)\n\t\tif bindingLocation == \"\" {\n\t\t\tbinding = saml.HTTPPostBinding\n\t\t\tbindingLocation = s.m.ServiceProvider.GetSSOBindingLocation(binding)\n\t\t}\n\t}\n\tSAMLLogger.Debugf(\"Binding: %v\", binding)\n\tSAMLLogger.Debugf(\"BindingLocation: %v\", bindingLocation)",
"\tauthReq, err := s.m.ServiceProvider.MakeAuthenticationRequest(bindingLocation)\n\tif err != nil {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}",
"\t// relayState is limited to 80 bytes but also must be integrity protected.\n\t// this means that we cannot use a JWT because it is way to long. Instead\n\t// we set a signed cookie that encodes the original URL which we'll check\n\t// against the SAML response when we get it.\n\trelayState, err := s.m.RequestTracker.TrackRequest(w, r, authReq.ID)\n\tif err != nil {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}",
"\tif binding == saml.HTTPRedirectBinding {\n\t\tredirectURL := authReq.Redirect(relayState)\n\t\tw.Header().Add(\"Location\", redirectURL.String())\n\t\tw.WriteHeader(http.StatusFound)\n\t\treturn\n\t}\n\tif binding == saml.HTTPPostBinding {\n\t\tw.Header().Add(\"Content-Security-Policy\", \"\"+\n\t\t\t\"default-src; \"+\n\t\t\t\"script-src 'sha256-AjPdJSbZmeWHnEc5ykvJFay8FTWeTeRbs9dutfZ0HqE='; \"+\n\t\t\t\"reflected-xss block; referrer no-referrer;\")\n\t\tw.Header().Add(\"Content-type\", \"text/html\")\n\t\tw.Write([]byte(`<!DOCTYPE html><html><body>`))\n\t\tw.Write(authReq.Post(relayState))\n\t\tw.Write([]byte(`</body></html>`))\n\t\treturn\n\t}\n}",
"func (s *SAMLProvider) HandleCallback(w http.ResponseWriter, r *http.Request, onError func(tag string, errorMsg string, rawErr error, code int, w http.ResponseWriter, r *http.Request), profile tap.Profile) {\n\ts.m = middleware",
"\terr := r.ParseForm()\n\tif err != nil {\n\t\tSAMLLogger.Errorf(\"Error parsing form: %v\", err)\n\t}",
"\tvar possibleRequestIDs = make([]string, 0)\n\tif s.m.ServiceProvider.AllowIDPInitiated {\n\t\tSAMLLogger.Debug(\"allowing IDP initiated ID\")\n\t\tpossibleRequestIDs = append(possibleRequestIDs, \"\")\n\t}",
"\ttrackedRequests := s.m.RequestTracker.GetTrackedRequests(r)\n\tfor _, tr := range trackedRequests {\n\t\tpossibleRequestIDs = append(possibleRequestIDs, tr.SAMLRequestID)\n\t}\n\tassertion, err := s.m.ServiceProvider.ParseResponse(r, possibleRequestIDs)\n\tif err != nil {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}\n\trawData := make(map[string]interface{}, 0)\n\tvar str strings.Builder\n\tfor _, v := range assertion.AttributeStatements {\n\t\tfor _, att := range v.Attributes {\n\t\t\tSAMLLogger.Debugf(\"attribute name: %v\\n\", att.Name)\n\t\t\trawData[att.Name] = \"\"\n\t\t\tfor _, vals := range att.Values {\n\t\t\t\tstr.WriteString(vals.Value + \" \")\n\t\t\t\tSAMLLogger.Debugf(\"vals.value: %v\\n \", vals.Value)\n\t\t\t}\n\t\t\trawData[att.Name] = strings.TrimSuffix(str.String(), \" \")\n\t\t\tstr.Reset()\n\t\t}\n\t}",
"\t//this is going to be a nightmare of slight differences between IDPs\n\t// so lets make it configurable with a sensible backup\n\tvar email string\n\temailClaim := s.config.SAMLEmailClaim\n\tif emailClaim == \"\" {\n\t\temailClaim = \"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress\"\n\t}",
"\tif _, ok := rawData[emailClaim]; ok {\n\t\temail = rawData[emailClaim].(string)\n\t} else if _, ok := rawData[\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/\"]; ok {\n\t\temail = rawData[\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name\"].(string)\n\t}",
"\tgivenNameClaim := s.config.SAMLForenameClaim\n\tsurnameClaim := s.config.SAMLSurnameClaim",
"\tif givenNameClaim == \"\" {\n\t\tgivenNameClaim = \"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname\"\n\t}",
"\tif surnameClaim == \"\" {\n\t\tsurnameClaim = \"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname\"\n\t}\n\tname := rawData[givenNameClaim].(string) + \" \" +\n\t\trawData[surnameClaim].(string)",
"\tthisUser := goth.User{\n\t\tUserID: name,\n\t\tEmail: email,\n\t\tProvider: \"SAMLProvider\",\n\t\tRawData: rawData,\n\t}\n\ts.handler.CompleteIdentityAction(w, r, thisUser, s.profile)\n}",
"func (s *SAMLProvider) HandleMetadata(w http.ResponseWriter, r *http.Request) {\n\ts.m = middleware",
"\tbuf, _ := xml.MarshalIndent(s.m.ServiceProvider.Metadata(), \"\", \" \")\n\tw.Header().Set(\"Content-Type\", \"application/samlmetadata+xml\")\n\tw.Write(buf)\n\treturn\n}",
"func (s *SAMLProvider) provideErrorRedirect(w http.ResponseWriter, r *http.Request) {\n\thttp.Redirect(w, r, s.config.FailureRedirect, 301)\n\treturn\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [32, 195, 32], "buggy_code_start_loc": [7, 0, 31], "filenames": ["go.mod", "go.sum", "providers/saml.go"], "fixing_code_end_loc": [38, 885, 32], "fixing_code_start_loc": [7, 1, 31], "message": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:tyk:tyk-identity-broker:*:*:*:*:*:*:*:*", "matchCriteriaId": "509C7956-E3F8-4F26-A047-DDEC86CA5EBD", "versionEndExcluding": "1.1.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data)."}, {"lang": "es", "value": "El paquete github.com/tyktechnologies/tyk-identity-broker versiones anteriores a 1.1.1, es vulnerable a una omisi\u00f3n de autenticaci\u00f3n por medio del analizador Go XML, lo que puede causar una omisi\u00f3n de autenticaci\u00f3n SAML. Esto es debido a que el analizador XML no garantiza la integridad en el viaje de ida y vuelta XML (datos XML encoding/decoding)"}], "evaluatorComment": null, "id": "CVE-2021-23365", "lastModified": "2021-05-19T13:00:45.973", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 5.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 2.5, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2021-04-26T10:15:12.597", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/46f70420e0911e4e8b638575e29d394c227c75d0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/pull/147"}, {"source": "report@snyk.io", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.1.1"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMTYKTECHNOLOGIESTYKIDENTITYBROKER-1089720"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, "type": "CWE-287"}
| 106
|
Determine whether the {function_name} code is vulnerable or not.
|
[
"package providers",
"import (\n\t\"context\"\n\t\"crypto/rsa\"\n\t\"encoding/json\"\n\t\"encoding/xml\"\n\t\"github.com/TykTechnologies/tyk/certs\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"strings\"\n\t\"sync\"",
"\t\"github.com/markbates/goth\"",
"\t\"github.com/crewjam/saml\"",
"\t\"github.com/crewjam/saml/samlsp\"",
"\tlogger \"github.com/TykTechnologies/tyk-identity-broker/log\"\n\t\"github.com/sirupsen/logrus\"",
"\t\"github.com/TykTechnologies/tyk-identity-broker/tap\"\n)",
"var onceReloadSAMLLogger sync.Once\nvar SAMLLogTag = \"SAML AUTH\"\nvar SAMLLogger = log.WithField(\"prefix\", SAMLLogTag)",
"// certManager will fallback as files as default",
"var CertManager = certs.NewCertificateManager(nil, \"\", nil, false)",
"\ntype SAMLProvider struct {\n\thandler tap.IdentityHandler\n\tconfig SAMLConfig\n\tprofile tap.Profile\n\tm *samlsp.Middleware\n}",
"var middleware *samlsp.Middleware",
"type SAMLConfig struct {\n\tIDPMetadataURL string\n\tCertLocation string\n\tSAMLBaseURL string\n\tForceAuthentication bool\n\tSAMLBinding string\n\tSAMLEmailClaim string\n\tSAMLForenameClaim string\n\tSAMLSurnameClaim string\n\tFailureRedirect string\n}",
"func (s *SAMLProvider) Init(handler tap.IdentityHandler, profile tap.Profile, config []byte) error {\n\t//if an external logger was set, then lets reload it to inherit those configs\n\tonceReloadSAMLLogger.Do(func() {\n\t\tlog = logger.Get()\n\t\tSAMLLogger = &logrus.Entry{Logger: log}\n\t\tSAMLLogger = SAMLLogger.Logger.WithField(\"prefix\", SAMLLogTag)\n\t})",
"\ts.handler = handler\n\ts.profile = profile\n\tunmarshalErr := json.Unmarshal(config, &s.config)",
"\tif unmarshalErr != nil {\n\t\treturn unmarshalErr\n\t}\n\ts.initialiseSAMLMiddleware()",
"\treturn nil\n}",
"func (s *SAMLProvider) Name() string {\n\treturn \"SAMLProvider\"\n}",
"func (s *SAMLProvider) ProviderType() tap.ProviderType {\n\treturn tap.REDIRECT_PROVIDER\n}",
"func (s *SAMLProvider) UseCallback() bool {\n\treturn true\n}",
"func (s *SAMLProvider) initialiseSAMLMiddleware() {\n\tif middleware == nil {",
"\t\tSAMLLogger.Debug(\"Initialising middleware SAML\")\n\t\t//needs to match the signing cert if IDP\n\t\tcerts := CertManager.List([]string{s.config.CertLocation}, certs.CertificateAny)",
"\t\tif len(certs) == 0 {\n\t\t\tSAMLLogger.Error(\"certificate was not loaded\")\n\t\t}",
"\t\tkeyPair := certs[0]\n\t\tidpMetadataURL, err := url.Parse(s.config.IDPMetadataURL)\n\t\tif err != nil {\n\t\t\tSAMLLogger.Errorf(\"Error parsing IDP metadata URL: %v\", err)\n\t\t}",
"\t\tSAMLLogger.Debugf(\"IDPmetadataURL is: %v\", idpMetadataURL.String())\n\t\trootURL, err := url.Parse(s.config.SAMLBaseURL)\n\t\tif err != nil {\n\t\t\tSAMLLogger.Errorf(\"Error parsing SAMLBaseURL: %v\", err)\n\t\t}",
"\t\thttpClient := http.DefaultClient",
"\t\tmetadata, err := samlsp.FetchMetadata(context.TODO(), httpClient, *idpMetadataURL)\n\t\tif err != nil {\n\t\t\tSAMLLogger.Errorf(\"Error retrieving IDP Metadata: %v\", err)\n\t\t}",
"\t\tSAMLLogger.Debugf(\"Root URL: %v\", rootURL.String())\n\t\tif keyPair == nil {\n\t\t\tSAMLLogger.Error(\"profile certificate was not loaded\")\n\t\t\treturn\n\t\t}\n\t\tvar key *rsa.PrivateKey\n\t\tif keyPair.PrivateKey == nil {\n\t\t\tSAMLLogger.Error(\"Private Key is nil not rsa.PrivateKey\")\n\t\t} else {\n\t\t\tkey = keyPair.PrivateKey.(*rsa.PrivateKey)\n\t\t}",
"\t\topts := samlsp.Options{\n\t\t\tURL: *rootURL,\n\t\t\tKey: key,\n\t\t}",
"\t\tmetadataURL := rootURL.ResolveReference(&url.URL{Path: \"auth/\" + s.profile.ID + \"/saml/metadata\"})\n\t\tacsURL := rootURL.ResolveReference(&url.URL{Path: \"auth/\" + s.profile.ID + \"/saml/callback\"})\n\t\tsloURL := rootURL.ResolveReference(&url.URL{Path: \"auth/\" + s.profile.ID + \"/saml/slo\"})",
"\t\tSAMLLogger.Debugf(\"SP metadata URL: %v\", metadataURL.String())\n\t\tSAMLLogger.Debugf(\"SP acs URL: %v\", acsURL.String())",
"\t\tvar forceAuthn = s.config.ForceAuthentication",
"\t\tsp := saml.ServiceProvider{\n\t\t\tEntityID: metadataURL.String(),\n\t\t\tKey: key,\n\t\t\tCertificate: keyPair.Leaf,\n\t\t\tMetadataURL: *metadataURL,\n\t\t\tAcsURL: *acsURL,\n\t\t\tSloURL: *sloURL,\n\t\t\tIDPMetadata: metadata,\n\t\t\tForceAuthn: &forceAuthn,\n\t\t\tAllowIDPInitiated: true,\n\t\t}",
"\t\tmiddleware = &samlsp.Middleware{\n\t\t\tServiceProvider: sp,\n\t\t\tBinding: s.config.SAMLBinding,\n\t\t\tOnError: samlsp.DefaultOnError,\n\t\t\tSession: samlsp.DefaultSessionProvider(opts),\n\t\t}\n\t\tmiddleware.RequestTracker = samlsp.DefaultRequestTracker(opts, &middleware.ServiceProvider)\n\t}",
"}",
"func (s *SAMLProvider) Handle(w http.ResponseWriter, r *http.Request, pathParams map[string]string, profile tap.Profile) {\n\tif middleware == nil {\n\t\tSAMLLogger.Error(\"cannot process request, middleware not loaded\")\n\t\treturn\n\t}",
"\ts.m = middleware\n\t// If we try to redirect when the original request is the ACS URL we'll\n\t// end up in a loop so just fail and error instead\n\tif r.URL.Path == s.m.ServiceProvider.AcsURL.Path {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}",
"\tvar binding, bindingLocation string\n\tif s.m.Binding != \"\" {\n\t\tbinding = s.m.Binding\n\t\tbindingLocation = s.m.ServiceProvider.GetSSOBindingLocation(binding)\n\t} else {\n\t\tbinding = saml.HTTPRedirectBinding\n\t\tbindingLocation = s.m.ServiceProvider.GetSSOBindingLocation(binding)\n\t\tif bindingLocation == \"\" {\n\t\t\tbinding = saml.HTTPPostBinding\n\t\t\tbindingLocation = s.m.ServiceProvider.GetSSOBindingLocation(binding)\n\t\t}\n\t}\n\tSAMLLogger.Debugf(\"Binding: %v\", binding)\n\tSAMLLogger.Debugf(\"BindingLocation: %v\", bindingLocation)",
"\tauthReq, err := s.m.ServiceProvider.MakeAuthenticationRequest(bindingLocation)\n\tif err != nil {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}",
"\t// relayState is limited to 80 bytes but also must be integrity protected.\n\t// this means that we cannot use a JWT because it is way to long. Instead\n\t// we set a signed cookie that encodes the original URL which we'll check\n\t// against the SAML response when we get it.\n\trelayState, err := s.m.RequestTracker.TrackRequest(w, r, authReq.ID)\n\tif err != nil {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}",
"\tif binding == saml.HTTPRedirectBinding {\n\t\tredirectURL := authReq.Redirect(relayState)\n\t\tw.Header().Add(\"Location\", redirectURL.String())\n\t\tw.WriteHeader(http.StatusFound)\n\t\treturn\n\t}\n\tif binding == saml.HTTPPostBinding {\n\t\tw.Header().Add(\"Content-Security-Policy\", \"\"+\n\t\t\t\"default-src; \"+\n\t\t\t\"script-src 'sha256-AjPdJSbZmeWHnEc5ykvJFay8FTWeTeRbs9dutfZ0HqE='; \"+\n\t\t\t\"reflected-xss block; referrer no-referrer;\")\n\t\tw.Header().Add(\"Content-type\", \"text/html\")\n\t\tw.Write([]byte(`<!DOCTYPE html><html><body>`))\n\t\tw.Write(authReq.Post(relayState))\n\t\tw.Write([]byte(`</body></html>`))\n\t\treturn\n\t}\n}",
"func (s *SAMLProvider) HandleCallback(w http.ResponseWriter, r *http.Request, onError func(tag string, errorMsg string, rawErr error, code int, w http.ResponseWriter, r *http.Request), profile tap.Profile) {\n\ts.m = middleware",
"\terr := r.ParseForm()\n\tif err != nil {\n\t\tSAMLLogger.Errorf(\"Error parsing form: %v\", err)\n\t}",
"\tvar possibleRequestIDs = make([]string, 0)\n\tif s.m.ServiceProvider.AllowIDPInitiated {\n\t\tSAMLLogger.Debug(\"allowing IDP initiated ID\")\n\t\tpossibleRequestIDs = append(possibleRequestIDs, \"\")\n\t}",
"\ttrackedRequests := s.m.RequestTracker.GetTrackedRequests(r)\n\tfor _, tr := range trackedRequests {\n\t\tpossibleRequestIDs = append(possibleRequestIDs, tr.SAMLRequestID)\n\t}\n\tassertion, err := s.m.ServiceProvider.ParseResponse(r, possibleRequestIDs)\n\tif err != nil {\n\t\ts.provideErrorRedirect(w, r)\n\t\treturn\n\t}\n\trawData := make(map[string]interface{}, 0)\n\tvar str strings.Builder\n\tfor _, v := range assertion.AttributeStatements {\n\t\tfor _, att := range v.Attributes {\n\t\t\tSAMLLogger.Debugf(\"attribute name: %v\\n\", att.Name)\n\t\t\trawData[att.Name] = \"\"\n\t\t\tfor _, vals := range att.Values {\n\t\t\t\tstr.WriteString(vals.Value + \" \")\n\t\t\t\tSAMLLogger.Debugf(\"vals.value: %v\\n \", vals.Value)\n\t\t\t}\n\t\t\trawData[att.Name] = strings.TrimSuffix(str.String(), \" \")\n\t\t\tstr.Reset()\n\t\t}\n\t}",
"\t//this is going to be a nightmare of slight differences between IDPs\n\t// so lets make it configurable with a sensible backup\n\tvar email string\n\temailClaim := s.config.SAMLEmailClaim\n\tif emailClaim == \"\" {\n\t\temailClaim = \"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress\"\n\t}",
"\tif _, ok := rawData[emailClaim]; ok {\n\t\temail = rawData[emailClaim].(string)\n\t} else if _, ok := rawData[\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/\"]; ok {\n\t\temail = rawData[\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name\"].(string)\n\t}",
"\tgivenNameClaim := s.config.SAMLForenameClaim\n\tsurnameClaim := s.config.SAMLSurnameClaim",
"\tif givenNameClaim == \"\" {\n\t\tgivenNameClaim = \"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname\"\n\t}",
"\tif surnameClaim == \"\" {\n\t\tsurnameClaim = \"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname\"\n\t}\n\tname := rawData[givenNameClaim].(string) + \" \" +\n\t\trawData[surnameClaim].(string)",
"\tthisUser := goth.User{\n\t\tUserID: name,\n\t\tEmail: email,\n\t\tProvider: \"SAMLProvider\",\n\t\tRawData: rawData,\n\t}\n\ts.handler.CompleteIdentityAction(w, r, thisUser, s.profile)\n}",
"func (s *SAMLProvider) HandleMetadata(w http.ResponseWriter, r *http.Request) {\n\ts.m = middleware",
"\tbuf, _ := xml.MarshalIndent(s.m.ServiceProvider.Metadata(), \"\", \" \")\n\tw.Header().Set(\"Content-Type\", \"application/samlmetadata+xml\")\n\tw.Write(buf)\n\treturn\n}",
"func (s *SAMLProvider) provideErrorRedirect(w http.ResponseWriter, r *http.Request) {\n\thttp.Redirect(w, r, s.config.FailureRedirect, 301)\n\treturn\n}"
] |
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
PreciseBugs
|
{"buggy_code_end_loc": [32, 195, 32], "buggy_code_start_loc": [7, 0, 31], "filenames": ["go.mod", "go.sum", "providers/saml.go"], "fixing_code_end_loc": [38, 885, 32], "fixing_code_start_loc": [7, 1, 31], "message": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data).", "other": {"cve": {"cisaActionDue": null, "cisaExploitAdd": null, "cisaRequiredAction": null, "cisaVulnerabilityName": null, "configurations": [{"nodes": [{"cpeMatch": [{"criteria": "cpe:2.3:a:tyk:tyk-identity-broker:*:*:*:*:*:*:*:*", "matchCriteriaId": "509C7956-E3F8-4F26-A047-DDEC86CA5EBD", "versionEndExcluding": "1.1.1", "versionEndIncluding": null, "versionStartExcluding": null, "versionStartIncluding": null, "vulnerable": true}], "negate": false, "operator": "OR"}], "operator": null}], "descriptions": [{"lang": "en", "value": "The package github.com/tyktechnologies/tyk-identity-broker before 1.1.1 are vulnerable to Authentication Bypass via the Go XML parser which can cause SAML authentication bypass. This is because the XML parser doesn\u2019t guarantee integrity in the XML round-trip (encoding/decoding XML data)."}, {"lang": "es", "value": "El paquete github.com/tyktechnologies/tyk-identity-broker versiones anteriores a 1.1.1, es vulnerable a una omisi\u00f3n de autenticaci\u00f3n por medio del analizador Go XML, lo que puede causar una omisi\u00f3n de autenticaci\u00f3n SAML. Esto es debido a que el analizador XML no garantiza la integridad en el viaje de ida y vuelta XML (datos XML encoding/decoding)"}], "evaluatorComment": null, "id": "CVE-2021-23365", "lastModified": "2021-05-19T13:00:45.973", "metrics": {"cvssMetricV2": [{"acInsufInfo": false, "baseSeverity": "MEDIUM", "cvssData": {"accessComplexity": "LOW", "accessVector": "NETWORK", "authentication": "SINGLE", "availabilityImpact": "NONE", "baseScore": 5.5, "confidentialityImpact": "PARTIAL", "integrityImpact": "PARTIAL", "vectorString": "AV:N/AC:L/Au:S/C:P/I:P/A:N", "version": "2.0"}, "exploitabilityScore": 8.0, "impactScore": 4.9, "obtainAllPrivilege": false, "obtainOtherPrivilege": false, "obtainUserPrivilege": false, "source": "nvd@nist.gov", "type": "Primary", "userInteractionRequired": false}], "cvssMetricV30": null, "cvssMetricV31": [{"cvssData": {"attackComplexity": "LOW", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 9.1, "baseSeverity": "CRITICAL", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N", "version": "3.1"}, "exploitabilityScore": 3.9, "impactScore": 5.2, "source": "nvd@nist.gov", "type": "Primary"}, {"cvssData": {"attackComplexity": "HIGH", "attackVector": "NETWORK", "availabilityImpact": "NONE", "baseScore": 4.8, "baseSeverity": "MEDIUM", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "privilegesRequired": "NONE", "scope": "UNCHANGED", "userInteraction": "NONE", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N", "version": "3.1"}, "exploitabilityScore": 2.2, "impactScore": 2.5, "source": "report@snyk.io", "type": "Secondary"}]}, "published": "2021-04-26T10:15:12.597", "references": [{"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/46f70420e0911e4e8b638575e29d394c227c75d0"}, {"source": "report@snyk.io", "tags": ["Patch", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/pull/147"}, {"source": "report@snyk.io", "tags": ["Release Notes", "Third Party Advisory"], "url": "https://github.com/TykTechnologies/tyk-identity-broker/releases/tag/v1.1.1"}, {"source": "report@snyk.io", "tags": ["Third Party Advisory"], "url": "https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMTYKTECHNOLOGIESTYKIDENTITYBROKER-1089720"}], "sourceIdentifier": "report@snyk.io", "vendorComments": null, "vulnStatus": "Analyzed", "weaknesses": [{"description": [{"lang": "en", "value": "CWE-287"}], "source": "nvd@nist.gov", "type": "Primary"}]}, "github_commit_url": "https://github.com/TykTechnologies/tyk-identity-broker/commit/243092965b0f93a95a14cb882b5b9a3df61dd5c0"}, "type": "CWE-287"}
| 106
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.